From 1a02c0e705ebce68dd2f0c78c1b56716fff220fd Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 15 Dec 2022 18:40:33 +0000 Subject: [PATCH] CodeGen from PR 21878 in Azure/azure-rest-api-specs Merge c7647c4f469312075ec9243d64dff58382cd5fb8 into 038922fd638b28f04ad706a916b486f8392c7cef --- eng/versioning/version_client.txt | 1 + pom.xml | 1 + .../CHANGELOG.md | 5 + .../README.md | 105 + .../SAMPLE.md | 17010 ++++++++++++++++ .../pom.xml | 55 + .../sql/generated/SqlManager.java | 2730 +++ ...ackupShortTermRetentionPoliciesClient.java | 278 + .../generated/fluent/CapabilitiesClient.java | 42 + .../fluent/DataMaskingPoliciesClient.java | 85 + .../fluent/DataMaskingRulesClient.java | 94 + ...rehouseUserActivitiesOperationsClient.java | 95 + ...dvancedThreatProtectionSettingsClient.java | 140 + .../fluent/DatabaseAdvisorsClient.java | 124 + .../DatabaseAutomaticTuningsClient.java | 85 + .../DatabaseBlobAuditingPoliciesClient.java | 119 + .../fluent/DatabaseColumnsClient.java | 155 + .../DatabaseExtensionsOperationsClient.java | 178 + .../fluent/DatabaseOperationsClient.java | 82 + .../DatabaseRecommendedActionsClient.java | 146 + .../fluent/DatabaseSchemasClient.java | 82 + .../DatabaseSecurityAlertPoliciesClient.java | 137 + ...ulnerabilityAssessmentBaselinesClient.java | 161 + ...erabilityAssessmentExecuteScansClient.java | 100 + ...rabilityAssessmentRuleBaselinesClient.java | 222 + ...nerabilityAssessmentScanResultsClient.java | 115 + ...SqlVulnerabilityAssessmentScansClient.java | 107 + ...ulnerabilityAssessmentsSettingsClient.java | 94 + .../fluent/DatabaseTablesClient.java | 98 + .../fluent/DatabaseUsagesClient.java | 46 + ...rabilityAssessmentRuleBaselinesClient.java | 178 + ...aseVulnerabilityAssessmentScansClient.java | 246 + ...atabaseVulnerabilityAssessmentsClient.java | 180 + .../sql/generated/fluent/DatabasesClient.java | 866 + .../fluent/DeletedServersClient.java | 147 + .../DistributedAvailabilityGroupsClient.java | 316 + .../fluent/ElasticPoolActivitiesClient.java | 49 + .../ElasticPoolDatabaseActivitiesClient.java | 49 + .../fluent/ElasticPoolOperationsClient.java | 82 + .../generated/fluent/ElasticPoolsClient.java | 432 + .../fluent/EncryptionProtectorsClient.java | 227 + .../fluent/EndpointCertificatesClient.java | 77 + ...dedDatabaseBlobAuditingPoliciesClient.java | 125 + ...endedServerBlobAuditingPoliciesClient.java | 150 + .../fluent/FailoverGroupsClient.java | 427 + .../generated/fluent/FirewallRulesClient.java | 179 + .../fluent/GeoBackupPoliciesClient.java | 134 + .../fluent/IPv6FirewallRulesClient.java | 146 + .../fluent/InstanceFailoverGroupsClient.java | 354 + .../generated/fluent/InstancePoolsClient.java | 283 + .../sql/generated/fluent/JobAgentsClient.java | 279 + .../fluent/JobCredentialsClient.java | 160 + .../generated/fluent/JobExecutionsClient.java | 356 + .../fluent/JobStepExecutionsClient.java | 123 + .../sql/generated/fluent/JobStepsClient.java | 273 + .../fluent/JobTargetExecutionsClient.java | 191 + .../fluent/JobTargetGroupsClient.java | 160 + .../generated/fluent/JobVersionsClient.java | 92 + .../sql/generated/fluent/JobsClient.java | 156 + .../LedgerDigestUploadsOperationsClient.java | 260 + .../LongTermRetentionBackupsClient.java | 882 + ...RetentionManagedInstanceBackupsClient.java | 486 + .../LongTermRetentionPoliciesClient.java | 182 + ...ntenanceWindowOptionsOperationsClient.java | 55 + .../MaintenanceWindowsOperationsClient.java | 98 + ...ackupShortTermRetentionPoliciesClient.java | 284 + ...dvancedThreatProtectionSettingsClient.java | 142 + .../fluent/ManagedDatabaseColumnsClient.java | 156 + .../ManagedDatabaseMoveOperationsClient.java | 82 + .../fluent/ManagedDatabaseQueriesClient.java | 97 + ...aseRecommendedSensitivityLabelsClient.java | 58 + .../ManagedDatabaseRestoreDetailsClient.java | 57 + .../fluent/ManagedDatabaseSchemasClient.java | 84 + ...edDatabaseSecurityAlertPoliciesClient.java | 140 + .../ManagedDatabaseSecurityEventsClient.java | 58 + ...anagedDatabaseSensitivityLabelsClient.java | 399 + .../fluent/ManagedDatabaseTablesClient.java | 98 + ...abaseTransparentDataEncryptionsClient.java | 142 + ...rabilityAssessmentRuleBaselinesClient.java | 178 + ...aseVulnerabilityAssessmentScansClient.java | 246 + ...atabaseVulnerabilityAssessmentsClient.java | 181 + .../fluent/ManagedDatabasesClient.java | 662 + .../ManagedInstanceAdministratorsClient.java | 229 + ...dvancedThreatProtectionSettingsClient.java | 178 + ...tanceAzureADOnlyAuthenticationsClient.java | 244 + .../fluent/ManagedInstanceDtcsClient.java | 158 + ...gedInstanceEncryptionProtectorsClient.java | 243 + .../fluent/ManagedInstanceKeysClient.java | 220 + ...stanceLongTermRetentionPoliciesClient.java | 190 + .../ManagedInstanceOperationsClient.java | 110 + ...tancePrivateEndpointConnectionsClient.java | 233 + ...gedInstancePrivateLinkResourcesClient.java | 80 + .../ManagedInstanceTdeCertificatesClient.java | 77 + ...nstanceVulnerabilityAssessmentsClient.java | 169 + .../fluent/ManagedInstancesClient.java | 430 + ...ackupShortTermRetentionPoliciesClient.java | 284 + .../fluent/ManagedServerDnsAliasesClient.java | 314 + ...agedServerSecurityAlertPoliciesClient.java | 173 + .../generated/fluent/OperationsClient.java | 36 + .../fluent/OutboundFirewallRulesClient.java | 218 + .../PrivateEndpointConnectionsClient.java | 226 + .../fluent/PrivateLinkResourcesClient.java | 76 + .../RecommendedSensitivityLabelsClient.java | 55 + .../fluent/RecoverableDatabasesClient.java | 77 + .../RecoverableManagedDatabasesClient.java | 78 + .../fluent/ReplicationLinksClient.java | 318 + .../RestorableDroppedDatabasesClient.java | 77 + ...storableDroppedManagedDatabasesClient.java | 81 + .../generated/fluent/RestorePointsClient.java | 201 + .../fluent/SensitivityLabelsClient.java | 394 + ...dvancedThreatProtectionSettingsClient.java | 175 + .../fluent/ServerAdvisorsClient.java | 112 + .../fluent/ServerAutomaticTuningsClient.java | 76 + .../ServerAzureADAdministratorsClient.java | 229 + ...erverAzureADOnlyAuthenticationsClient.java | 241 + .../ServerBlobAuditingPoliciesClient.java | 143 + .../ServerCommunicationLinksClient.java | 194 + .../ServerConnectionPoliciesClient.java | 165 + .../ServerDevOpsAuditSettingsClient.java | 168 + .../fluent/ServerDnsAliasesClient.java | 283 + .../generated/fluent/ServerKeysClient.java | 221 + .../fluent/ServerOperationsClient.java | 43 + .../ServerSecurityAlertPoliciesClient.java | 165 + .../fluent/ServerTrustCertificatesClient.java | 230 + .../fluent/ServerTrustGroupsClient.java | 248 + .../generated/fluent/ServerUsagesClient.java | 45 + .../ServerVulnerabilityAssessmentsClient.java | 162 + .../sql/generated/fluent/ServersClient.java | 380 + .../fluent/ServiceObjectivesClient.java | 78 + .../sql/generated/fluent/SqlAgentsClient.java | 77 + .../generated/fluent/SqlManagementClient.java | 1055 + ...ulnerabilityAssessmentBaselinesClient.java | 99 + ...tyAssessmentBaselinesOperationsClient.java | 66 + ...erabilityAssessmentExecuteScansClient.java | 87 + ...rabilityAssessmentRuleBaselinesClient.java | 161 + ...sessmentRuleBaselinesOperationsClient.java | 63 + ...yAssessmentScanResultOperationsClient.java | 107 + ...SqlVulnerabilityAssessmentScansClient.java | 94 + .../SqlVulnerabilityAssessmentsClient.java | 48 + ...ulnerabilityAssessmentsSettingsClient.java | 129 + .../fluent/SubscriptionUsagesClient.java | 67 + .../fluent/SynapseLinkWorkspacesClient.java | 47 + .../generated/fluent/SyncAgentsClient.java | 276 + .../generated/fluent/SyncGroupsClient.java | 587 + .../generated/fluent/SyncMembersClient.java | 501 + .../fluent/TdeCertificatesClient.java | 77 + .../sql/generated/fluent/TimeZonesClient.java | 67 + .../TransparentDataEncryptionsClient.java | 136 + .../sql/generated/fluent/UsagesClient.java | 45 + .../fluent/VirtualClustersClient.java | 281 + .../fluent/VirtualNetworkRulesClient.java | 218 + .../fluent/WorkloadClassifiersClient.java | 288 + .../fluent/WorkloadGroupsClient.java | 242 + .../models/AdministratorProperties.java | 164 + .../AdvancedThreatProtectionProperties.java | 79 + .../generated/fluent/models/AdvisorInner.java | 155 + .../fluent/models/AdvisorProperties.java | 157 + .../AutomaticTuningServerProperties.java | 106 + .../models/AzureADOnlyAuthProperties.java | 50 + .../BackupShortTermRetentionPolicyInner.java | 97 + ...kupShortTermRetentionPolicyProperties.java | 85 + ...BaseLongTermRetentionPolicyProperties.java | 128 + .../CheckNameAvailabilityResponseInner.java | 87 + ...rmRetentionBackupParametersProperties.java | 183 + .../fluent/models/DataMaskingPolicyInner.java | 143 + .../models/DataMaskingPolicyProperties.java | 123 + .../fluent/models/DataMaskingRuleInner.java | 353 + .../models/DataMaskingRuleProperties.java | 377 + .../DataWarehouseUserActivitiesInner.java | 52 + ...DataWarehouseUserActivitiesProperties.java | 42 + ...DatabaseAdvancedThreatProtectionInner.java | 95 + .../models/DatabaseAutomaticTuningInner.java | 101 + .../DatabaseAutomaticTuningProperties.java | 106 + .../DatabaseBlobAuditingPolicyInner.java | 417 + .../DatabaseBlobAuditingPolicyProperties.java | 516 + .../fluent/models/DatabaseColumnInner.java | 137 + .../models/DatabaseColumnProperties.java | 130 + .../models/DatabaseExtensionsProperties.java | 157 + .../fluent/models/DatabaseInner.java | 1041 + .../fluent/models/DatabaseOperationInner.java | 171 + .../models/DatabaseOperationProperties.java | 236 + .../fluent/models/DatabaseProperties.java | 1109 + .../fluent/models/DatabaseSchemaInner.java | 24 + .../DatabaseSecurityAlertPolicyInner.java | 240 + ...lnerabilityAssessmentBaselineSetInner.java | 84 + ...bilityAssessmentBaselineSetProperties.java | 66 + ...nerabilityAssessmentRuleBaselineInner.java | 83 + ...AssessmentRuleBaselineInputProperties.java | 88 + ...ssmentRuleBaselineListInputProperties.java | 92 + ...ilityAssessmentRuleBaselineProperties.java | 62 + .../fluent/models/DatabaseTableInner.java | 90 + .../models/DatabaseTableProperties.java | 77 + .../models/DatabaseUpdateProperties.java | 1024 + .../fluent/models/DatabaseUsageInner.java | 79 + .../models/DatabaseUsageProperties.java | 84 + .../DatabaseVulnerabilityAssessmentInner.java | 147 + ...baseVulnerabilityAssessmentProperties.java | 147 + ...nerabilityAssessmentRuleBaselineInner.java | 69 + ...ilityAssessmentRuleBaselineProperties.java | 66 + ...abilityAssessmentScanExportProperties.java | 41 + ...lnerabilityAssessmentScansExportInner.java | 53 + .../fluent/models/DeletedServerInner.java | 80 + .../models/DeletedServerProperties.java | 85 + .../DistributedAvailabilityGroupInner.java | 207 + ...istributedAvailabilityGroupProperties.java | 235 + .../models/ElasticPoolActivityInner.java | 251 + .../models/ElasticPoolActivityProperties.java | 326 + .../ElasticPoolDatabaseActivityInner.java | 207 + ...ElasticPoolDatabaseActivityProperties.java | 252 + .../fluent/models/ElasticPoolInner.java | 290 + .../models/ElasticPoolOperationInner.java | 170 + .../ElasticPoolOperationProperties.java | 235 + .../fluent/models/ElasticPoolProperties.java | 225 + .../models/ElasticPoolUpdateProperties.java | 194 + .../models/EncryptionProtectorInner.java | 170 + .../models/EncryptionProtectorProperties.java | 157 + .../models/EndpointCertificateInner.java | 66 + .../models/EndpointCertificateProperties.java | 50 + ...tendedDatabaseBlobAuditingPolicyInner.java | 426 + ...dDatabaseBlobAuditingPolicyProperties.java | 545 + ...ExtendedServerBlobAuditingPolicyInner.java | 470 + ...dedServerBlobAuditingPolicyProperties.java | 606 + .../fluent/models/FailoverGroupInner.java | 202 + .../models/FailoverGroupProperties.java | 185 + .../models/FailoverGroupUpdateProperties.java | 111 + .../fluent/models/FirewallRuleInner.java | 102 + .../fluent/models/GeoBackupPolicyInner.java | 114 + .../models/GeoBackupPolicyProperties.java | 74 + .../fluent/models/IPv6FirewallRuleInner.java | 100 + .../IPv6ServerFirewallRuleProperties.java | 78 + ...tExportExtensionsOperationResultInner.java | 107 + ...rtExtensionsOperationResultProperties.java | 130 + .../ImportExportOperationResultInner.java | 136 + ...ImportExportOperationResultProperties.java | 180 + .../models/InstanceFailoverGroupInner.java | 159 + .../InstanceFailoverGroupProperties.java | 197 + .../fluent/models/InstancePoolInner.java | 160 + .../fluent/models/InstancePoolProperties.java | 120 + .../fluent/models/JobAgentInner.java | 121 + .../fluent/models/JobAgentProperties.java | 74 + .../fluent/models/JobCredentialInner.java | 89 + .../models/JobCredentialProperties.java | 91 + .../fluent/models/JobExecutionInner.java | 179 + .../fluent/models/JobExecutionProperties.java | 238 + .../sql/generated/fluent/models/JobInner.java | 99 + .../fluent/models/JobProperties.java | 95 + .../generated/fluent/models/JobStepInner.java | 186 + .../fluent/models/JobStepProperties.java | 212 + .../fluent/models/JobTargetGroupInner.java | 68 + .../models/JobTargetGroupProperties.java | 63 + .../fluent/models/JobVersionInner.java | 24 + .../models/LedgerDigestUploadsInner.java | 78 + .../models/LedgerDigestUploadsProperties.java | 69 + .../models/LocationCapabilitiesInner.java | 120 + ...atabaseTransparentDataEncryptionInner.java | 67 + .../models/LongTermRetentionBackupInner.java | 132 + ...rmRetentionBackupOperationResultInner.java | 108 + .../LongTermRetentionBackupProperties.java | 158 + ...ermRetentionOperationResultProperties.java | 131 + .../models/LongTermRetentionPolicyInner.java | 135 + .../models/MaintenanceWindowOptionsInner.java | 212 + .../MaintenanceWindowOptionsProperties.java | 217 + .../models/MaintenanceWindowsInner.java | 68 + .../models/MaintenanceWindowsProperties.java | 55 + ...edBackupShortTermRetentionPolicyInner.java | 68 + ...kupShortTermRetentionPolicyProperties.java | 52 + ...DatabaseAdvancedThreatProtectionInner.java | 95 + .../fluent/models/ManagedDatabaseInner.java | 441 + ...nagedDatabaseMoveOperationResultInner.java | 190 + ...DatabaseMoveOperationResultProperties.java | 267 + .../models/ManagedDatabaseProperties.java | 487 + ...nagedDatabaseRestoreDetailsProperties.java | 370 + ...agedDatabaseRestoreDetailsResultInner.java | 245 + ...nagedDatabaseSecurityAlertPolicyInner.java | 224 + .../ManagedInstanceAdministratorInner.java | 137 + ...anagedInstanceAdministratorProperties.java | 152 + ...InstanceAdvancedThreatProtectionInner.java | 95 + ...agedInstanceAzureADOnlyAuthProperties.java | 50 + ...nstanceAzureADOnlyAuthenticationInner.java | 67 + .../models/ManagedInstanceDtcInner.java | 133 + .../models/ManagedInstanceDtcProperties.java | 138 + ...nagedInstanceEncryptionProtectorInner.java | 146 + ...InstanceEncryptionProtectorProperties.java | 143 + .../fluent/models/ManagedInstanceInner.java | 756 + .../models/ManagedInstanceKeyInner.java | 133 + .../models/ManagedInstanceKeyProperties.java | 132 + ...dInstanceLongTermRetentionBackupInner.java | 108 + ...anceLongTermRetentionBackupProperties.java | 131 + ...dInstanceLongTermRetentionPolicyInner.java | 135 + .../models/ManagedInstanceOperationInner.java | 182 + .../ManagedInstanceOperationProperties.java | 259 + ...nstancePrivateEndpointConnectionInner.java | 102 + ...cePrivateEndpointConnectionProperties.java | 101 + .../ManagedInstancePrivateLinkInner.java | 44 + .../models/ManagedInstanceProperties.java | 793 + .../models/ManagedInstanceQueryInner.java | 66 + ...dInstanceVulnerabilityAssessmentInner.java | 147 + ...anceVulnerabilityAssessmentProperties.java | 158 + .../models/ManagedServerDnsAliasInner.java | 61 + .../ManagedServerDnsAliasProperties.java | 54 + ...ManagedServerSecurityAlertPolicyInner.java | 240 + ...ManagedTransparentDataEncryptionInner.java | 67 + ...edTransparentDataEncryptionProperties.java | 60 + .../fluent/models/MetricDefinitionInner.java | 110 + .../generated/fluent/models/MetricInner.java | 125 + .../fluent/models/OperationInner.java | 92 + .../models/OutboundFirewallRuleInner.java | 52 + .../OutboundFirewallRuleProperties.java | 39 + .../PrivateEndpointConnectionInner.java | 102 + .../PrivateEndpointConnectionProperties.java | 101 + .../models/PrivateLinkResourceInner.java | 44 + .../fluent/models/QueryProperties.java | 50 + .../fluent/models/QueryStatisticsInner.java | 104 + .../models/QueryStatisticsProperties.java | 115 + .../fluent/models/RecommendedActionInner.java | 316 + .../models/RecommendedActionProperties.java | 435 + ...endedSensitivityLabelUpdateProperties.java | 156 + .../models/RecoverableDatabaseInner.java | 80 + .../models/RecoverableDatabaseProperties.java | 85 + .../RecoverableManagedDatabaseInner.java | 52 + .../RecoverableManagedDatabaseProperties.java | 39 + .../fluent/models/ReplicationLinkInner.java | 146 + .../models/ReplicationLinkProperties.java | 193 + .../RestorableDroppedDatabaseInner.java | 184 + .../RestorableDroppedDatabaseProperties.java | 116 + ...RestorableDroppedManagedDatabaseInner.java | 95 + ...rableDroppedManagedDatabaseProperties.java | 85 + .../fluent/models/RestorePointInner.java | 96 + .../fluent/models/RestorePointProperties.java | 86 + .../models/SecurityAlertPolicyProperties.java | 244 + .../SecurityAlertsPolicyProperties.java | 244 + .../fluent/models/SecurityEventInner.java | 130 + .../models/SecurityEventProperties.java | 166 + .../fluent/models/SensitivityLabelInner.java | 211 + .../models/SensitivityLabelProperties.java | 217 + .../models/SensitivityLabelUpdateInner.java | 159 + ...SensitivityLabelUpdatePropertiesInner.java | 185 + .../ServerAdvancedThreatProtectionInner.java | 95 + .../models/ServerAutomaticTuningInner.java | 101 + .../ServerAzureADAdministratorInner.java | 146 + .../ServerAzureADOnlyAuthenticationInner.java | 66 + .../models/ServerBlobAuditingPolicyInner.java | 447 + .../ServerBlobAuditingPolicyProperties.java | 577 + .../models/ServerCommunicationLinkInner.java | 105 + .../ServerCommunicationLinkProperties.java | 74 + .../models/ServerConnectionPolicyInner.java | 97 + .../ServerConnectionPolicyProperties.java | 60 + .../ServerDevOpsAuditSettingsProperties.java | 254 + .../ServerDevOpsAuditingSettingsInner.java | 239 + .../fluent/models/ServerDnsAliasInner.java | 52 + .../models/ServerDnsAliasProperties.java | 39 + .../models/ServerFirewallRuleProperties.java | 82 + .../generated/fluent/models/ServerInner.java | 382 + .../fluent/models/ServerKeyInner.java | 157 + .../fluent/models/ServerKeyProperties.java | 147 + .../fluent/models/ServerOperationInner.java | 162 + .../models/ServerOperationProperties.java | 221 + .../fluent/models/ServerProperties.java | 365 + .../ServerSecurityAlertPolicyInner.java | 240 + .../models/ServerTrustCertificateInner.java | 84 + .../ServerTrustCertificateProperties.java | 80 + .../fluent/models/ServerTrustGroupInner.java | 92 + .../models/ServerTrustGroupProperties.java | 96 + .../fluent/models/ServerUsageInner.java | 130 + .../ServerVulnerabilityAssessmentInner.java | 147 + ...rverVulnerabilityAssessmentProperties.java | 157 + .../fluent/models/ServiceObjectiveInner.java | 88 + .../models/ServiceObjectiveProperties.java | 99 + .../models/SqlAgentConfigurationInner.java | 67 + .../SqlAgentConfigurationProperties.java | 51 + .../SqlVulnerabilityAssessmentInner.java | 85 + ...lnerabilityAssessmentPolicyProperties.java | 54 + ...ulnerabilityAssessmentScanRecordInner.java | 208 + ...abilityAssessmentScanRecordProperties.java | 272 + ...abilityAssessmentScanResultProperties.java | 158 + ...lnerabilityAssessmentScanResultsInner.java | 136 + .../fluent/models/SubscriptionUsageInner.java | 79 + .../models/SubscriptionUsageProperties.java | 84 + .../models/SynapseLinkWorkspaceInner.java | 68 + .../SynapseLinkWorkspaceProperties.java | 55 + .../fluent/models/SyncAgentInner.java | 122 + .../models/SyncAgentKeyPropertiesInner.java | 39 + .../models/SyncAgentLinkedDatabaseInner.java | 98 + .../SyncAgentLinkedDatabaseProperties.java | 115 + .../fluent/models/SyncAgentProperties.java | 142 + .../models/SyncDatabaseIdPropertiesInner.java | 39 + .../models/SyncFullSchemaPropertiesInner.java | 60 + .../fluent/models/SyncGroupInner.java | 312 + .../models/SyncGroupLogPropertiesInner.java | 117 + .../fluent/models/SyncGroupProperties.java | 311 + .../fluent/models/SyncMemberInner.java | 298 + .../fluent/models/SyncMemberProperties.java | 321 + .../models/TdeCertificateProperties.java | 85 + .../fluent/models/TimeZoneInner.java | 61 + .../fluent/models/TimeZoneProperties.java | 54 + .../fluent/models/TopQueriesInner.java | 145 + .../TransparentDataEncryptionProperties.java | 60 + ...rmRetentionBackupParametersProperties.java | 52 + ...irtualClusterDnsServersOperationInner.java | 53 + .../generated/fluent/models/UsageInner.java | 133 + .../VirtualClusterDnsServersProperties.java | 40 + .../fluent/models/VirtualClusterInner.java | 100 + .../models/VirtualClusterProperties.java | 81 + .../models/VirtualNetworkRuleInner.java | 101 + .../models/VirtualNetworkRuleProperties.java | 103 + ...ulnerabilityAssessmentScanRecordInner.java | 120 + ...abilityAssessmentScanRecordProperties.java | 152 + .../models/WorkloadClassifierInner.java | 181 + .../models/WorkloadClassifierProperties.java | 189 + .../fluent/models/WorkloadGroupInner.java | 181 + .../models/WorkloadGroupProperties.java | 180 + .../generated/fluent/models/package-info.java | 10 + .../sql/generated/fluent/package-info.java | 10 + .../generated/implementation/AdvisorImpl.java | 90 + ...pShortTermRetentionPoliciesClientImpl.java | 1362 ++ .../BackupShortTermRetentionPoliciesImpl.java | 163 + .../BackupShortTermRetentionPolicyImpl.java | 160 + .../CapabilitiesClientImpl.java | 206 + .../implementation/CapabilitiesImpl.java | 61 + .../CheckNameAvailabilityResponseImpl.java | 46 + .../DataMaskingPoliciesClientImpl.java | 454 + .../DataMaskingPoliciesImpl.java | 116 + .../implementation/DataMaskingPolicyImpl.java | 178 + .../implementation/DataMaskingRuleImpl.java | 240 + .../DataMaskingRulesClientImpl.java | 524 + .../implementation/DataMaskingRulesImpl.java | 53 + .../DataWarehouseUserActivitiesImpl.java | 45 + ...useUserActivitiesOperationsClientImpl.java | 599 + ...WarehouseUserActivitiesOperationsImpl.java | 88 + .../DatabaseAdvancedThreatProtectionImpl.java | 188 + ...cedThreatProtectionSettingsClientImpl.java | 849 + ...eAdvancedThreatProtectionSettingsImpl.java | 172 + .../DatabaseAdvisorsClientImpl.java | 663 + .../implementation/DatabaseAdvisorsImpl.java | 128 + .../DatabaseAutomaticTuningImpl.java | 61 + .../DatabaseAutomaticTuningsClientImpl.java | 442 + .../DatabaseAutomaticTuningsImpl.java | 90 + ...atabaseBlobAuditingPoliciesClientImpl.java | 768 + .../DatabaseBlobAuditingPoliciesImpl.java | 132 + .../DatabaseBlobAuditingPolicyImpl.java | 238 + .../implementation/DatabaseColumnImpl.java | 58 + .../DatabaseColumnsClientImpl.java | 1169 ++ .../implementation/DatabaseColumnsImpl.java | 125 + ...atabaseExtensionsOperationsClientImpl.java | 961 + .../DatabaseExtensionsOperationsImpl.java | 66 + .../implementation/DatabaseImpl.java | 647 + .../implementation/DatabaseOperationImpl.java | 98 + .../DatabaseOperationsClientImpl.java | 555 + .../DatabaseOperationsImpl.java | 62 + .../DatabaseRecommendedActionsClientImpl.java | 763 + .../DatabaseRecommendedActionsImpl.java | 163 + .../implementation/DatabaseSchemaImpl.java | 40 + .../DatabaseSchemasClientImpl.java | 587 + .../implementation/DatabaseSchemasImpl.java | 75 + ...tabaseSecurityAlertPoliciesClientImpl.java | 834 + .../DatabaseSecurityAlertPoliciesImpl.java | 170 + .../DatabaseSecurityAlertPolicyImpl.java | 240 + ...ulnerabilityAssessmentBaselineSetImpl.java | 234 + ...rabilityAssessmentBaselinesClientImpl.java | 964 + ...lVulnerabilityAssessmentBaselinesImpl.java | 213 + ...ilityAssessmentExecuteScansClientImpl.java | 408 + ...lnerabilityAssessmentExecuteScansImpl.java | 53 + ...lnerabilityAssessmentRuleBaselineImpl.java | 249 + ...lityAssessmentRuleBaselinesClientImpl.java | 1293 ++ ...nerabilityAssessmentRuleBaselinesImpl.java | 405 + ...bilityAssessmentScanResultsClientImpl.java | 716 + ...ulnerabilityAssessmentScanResultsImpl.java | 116 + ...ulnerabilityAssessmentScansClientImpl.java | 675 + ...seSqlVulnerabilityAssessmentScansImpl.java | 104 + ...rabilityAssessmentsSettingsClientImpl.java | 598 + ...lVulnerabilityAssessmentsSettingsImpl.java | 89 + .../implementation/DatabaseTableImpl.java | 49 + .../DatabaseTablesClientImpl.java | 644 + .../implementation/DatabaseTablesImpl.java | 89 + .../implementation/DatabaseUsageImpl.java | 56 + .../DatabaseUsagesClientImpl.java | 365 + .../implementation/DatabaseUsagesImpl.java | 49 + .../DatabaseVulnerabilityAssessmentImpl.java | 205 + ...lnerabilityAssessmentRuleBaselineImpl.java | 223 + ...lityAssessmentRuleBaselinesClientImpl.java | 917 + ...nerabilityAssessmentRuleBaselinesImpl.java | 373 + ...ulnerabilityAssessmentScansClientImpl.java | 1293 ++ ...ulnerabilityAssessmentScansExportImpl.java | 46 + ...abaseVulnerabilityAssessmentScansImpl.java | 167 + ...aseVulnerabilityAssessmentsClientImpl.java | 1057 + .../DatabaseVulnerabilityAssessmentsImpl.java | 266 + .../implementation/DatabasesClientImpl.java | 4577 +++++ .../implementation/DatabasesImpl.java | 376 + .../implementation/DeletedServerImpl.java | 57 + .../DeletedServersClientImpl.java | 958 + .../implementation/DeletedServersImpl.java | 98 + .../DistributedAvailabilityGroupImpl.java | 219 + ...stributedAvailabilityGroupsClientImpl.java | 1636 ++ .../DistributedAvailabilityGroupsImpl.java | 229 + .../ElasticPoolActivitiesClientImpl.java | 275 + .../ElasticPoolActivitiesImpl.java | 49 + .../ElasticPoolActivityImpl.java | 126 + ...asticPoolDatabaseActivitiesClientImpl.java | 278 + .../ElasticPoolDatabaseActivitiesImpl.java | 50 + .../ElasticPoolDatabaseActivityImpl.java | 107 + .../implementation/ElasticPoolImpl.java | 300 + .../ElasticPoolOperationImpl.java | 97 + .../ElasticPoolOperationsClientImpl.java | 561 + .../ElasticPoolOperationsImpl.java | 62 + .../ElasticPoolsClientImpl.java | 2239 ++ .../implementation/ElasticPoolsImpl.java | 229 + .../EncryptionProtectorImpl.java | 199 + .../EncryptionProtectorsClientImpl.java | 1187 ++ .../EncryptionProtectorsImpl.java | 151 + .../EndpointCertificateImpl.java | 44 + .../EndpointCertificatesClientImpl.java | 538 + .../EndpointCertificatesImpl.java | 74 + ...atabaseBlobAuditingPoliciesClientImpl.java | 789 + ...endedDatabaseBlobAuditingPoliciesImpl.java | 133 + ...xtendedDatabaseBlobAuditingPolicyImpl.java | 245 + ...dServerBlobAuditingPoliciesClientImpl.java | 861 + ...xtendedServerBlobAuditingPoliciesImpl.java | 117 + .../ExtendedServerBlobAuditingPolicyImpl.java | 243 + .../implementation/FailoverGroupImpl.java | 262 + .../FailoverGroupsClientImpl.java | 2073 ++ .../implementation/FailoverGroupsImpl.java | 234 + .../implementation/FirewallRuleImpl.java | 154 + .../FirewallRulesClientImpl.java | 1097 + .../implementation/FirewallRulesImpl.java | 214 + .../GeoBackupPoliciesClientImpl.java | 717 + .../implementation/GeoBackupPoliciesImpl.java | 162 + .../implementation/GeoBackupPolicyImpl.java | 171 + .../implementation/IPv6FirewallRuleImpl.java | 156 + .../IPv6FirewallRulesClientImpl.java | 915 + .../implementation/IPv6FirewallRulesImpl.java | 197 + ...rtExportExtensionsOperationResultImpl.java | 176 + .../ImportExportOperationResultImpl.java | 90 + .../InstanceFailoverGroupImpl.java | 210 + .../InstanceFailoverGroupsClientImpl.java | 1782 ++ .../InstanceFailoverGroupsImpl.java | 247 + .../implementation/InstancePoolImpl.java | 211 + .../InstancePoolsClientImpl.java | 1584 ++ .../implementation/InstancePoolsImpl.java | 169 + .../implementation/JobAgentImpl.java | 201 + .../implementation/JobAgentsClientImpl.java | 1436 ++ .../implementation/JobAgentsImpl.java | 187 + .../implementation/JobCredentialImpl.java | 156 + .../JobCredentialsClientImpl.java | 987 + .../implementation/JobCredentialsImpl.java | 224 + .../implementation/JobExecutionImpl.java | 96 + .../JobExecutionsClientImpl.java | 2190 ++ .../implementation/JobExecutionsImpl.java | 213 + .../sql/generated/implementation/JobImpl.java | 160 + .../JobStepExecutionsClientImpl.java | 866 + .../implementation/JobStepExecutionsImpl.java | 122 + .../generated/implementation/JobStepImpl.java | 199 + .../implementation/JobStepsClientImpl.java | 1665 ++ .../implementation/JobStepsImpl.java | 328 + .../JobTargetExecutionsClientImpl.java | 1474 ++ .../JobTargetExecutionsImpl.java | 176 + .../implementation/JobTargetGroupImpl.java | 155 + .../JobTargetGroupsClientImpl.java | 990 + .../implementation/JobTargetGroupsImpl.java | 225 + .../implementation/JobVersionImpl.java | 39 + .../implementation/JobVersionsClientImpl.java | 590 + .../implementation/JobVersionsImpl.java | 84 + .../implementation/JobsClientImpl.java | 966 + .../generated/implementation/JobsImpl.java | 217 + .../LedgerDigestUploadsImpl.java | 165 + ...dgerDigestUploadsOperationsClientImpl.java | 1321 ++ .../LedgerDigestUploadsOperationsImpl.java | 189 + .../LocationCapabilitiesImpl.java | 63 + ...DatabaseTransparentDataEncryptionImpl.java | 157 + .../LongTermRetentionBackupImpl.java | 74 + ...ermRetentionBackupOperationResultImpl.java | 71 + .../LongTermRetentionBackupsClientImpl.java | 5407 +++++ .../LongTermRetentionBackupsImpl.java | 514 + ...ntionManagedInstanceBackupsClientImpl.java | 3408 ++++ ...rmRetentionManagedInstanceBackupsImpl.java | 272 + .../LongTermRetentionPoliciesClientImpl.java | 967 + .../LongTermRetentionPoliciesImpl.java | 163 + .../LongTermRetentionPolicyImpl.java | 174 + .../MaintenanceWindowOptionsImpl.java | 76 + ...anceWindowOptionsOperationsClientImpl.java | 272 + ...aintenanceWindowOptionsOperationsImpl.java | 69 + .../MaintenanceWindowsImpl.java | 52 + ...aintenanceWindowsOperationsClientImpl.java | 500 + .../MaintenanceWindowsOperationsImpl.java | 93 + ...pShortTermRetentionPoliciesClientImpl.java | 1403 ++ ...dBackupShortTermRetentionPoliciesImpl.java | 176 + ...gedBackupShortTermRetentionPolicyImpl.java | 151 + ...dDatabaseAdvancedThreatProtectionImpl.java | 189 + ...cedThreatProtectionSettingsClientImpl.java | 866 + ...eAdvancedThreatProtectionSettingsImpl.java | 184 + .../ManagedDatabaseColumnsClientImpl.java | 1206 ++ .../ManagedDatabaseColumnsImpl.java | 142 + .../implementation/ManagedDatabaseImpl.java | 366 + ...anagedDatabaseMoveOperationResultImpl.java | 108 + ...nagedDatabaseMoveOperationsClientImpl.java | 584 + .../ManagedDatabaseMoveOperationsImpl.java | 80 + .../ManagedDatabaseQueriesClientImpl.java | 683 + .../ManagedDatabaseQueriesImpl.java | 99 + ...ecommendedSensitivityLabelsClientImpl.java | 274 + ...abaseRecommendedSensitivityLabelsImpl.java | 55 + ...nagedDatabaseRestoreDetailsClientImpl.java | 277 + .../ManagedDatabaseRestoreDetailsImpl.java | 73 + ...nagedDatabaseRestoreDetailsResultImpl.java | 154 + .../ManagedDatabaseSchemasClientImpl.java | 594 + .../ManagedDatabaseSchemasImpl.java | 79 + ...tabaseSecurityAlertPoliciesClientImpl.java | 853 + ...agedDatabaseSecurityAlertPoliciesImpl.java | 177 + ...anagedDatabaseSecurityAlertPolicyImpl.java | 248 + ...nagedDatabaseSecurityEventsClientImpl.java | 471 + .../ManagedDatabaseSecurityEventsImpl.java | 60 + ...edDatabaseSensitivityLabelsClientImpl.java | 2470 +++ .../ManagedDatabaseSensitivityLabelsImpl.java | 355 + .../ManagedDatabaseTablesClientImpl.java | 667 + .../ManagedDatabaseTablesImpl.java | 95 + ...eTransparentDataEncryptionsClientImpl.java | 843 + ...atabaseTransparentDataEncryptionsImpl.java | 172 + ...lityAssessmentRuleBaselinesClientImpl.java | 936 + ...nerabilityAssessmentRuleBaselinesImpl.java | 191 + ...ulnerabilityAssessmentScansClientImpl.java | 1310 ++ ...abaseVulnerabilityAssessmentScansImpl.java | 172 + ...aseVulnerabilityAssessmentsClientImpl.java | 1079 + ...dDatabaseVulnerabilityAssessmentsImpl.java | 155 + .../ManagedDatabasesClientImpl.java | 3155 +++ .../implementation/ManagedDatabasesImpl.java | 283 + .../ManagedInstanceAdministratorImpl.java | 174 + ...nagedInstanceAdministratorsClientImpl.java | 1200 ++ .../ManagedInstanceAdministratorsImpl.java | 212 + ...dInstanceAdvancedThreatProtectionImpl.java | 167 + ...cedThreatProtectionSettingsClientImpl.java | 961 + ...eAdvancedThreatProtectionSettingsImpl.java | 162 + ...InstanceAzureADOnlyAuthenticationImpl.java | 146 + ...eAzureADOnlyAuthenticationsClientImpl.java | 1235 ++ ...nstanceAzureADOnlyAuthenticationsImpl.java | 222 + .../ManagedInstanceDtcImpl.java | 172 + .../ManagedInstanceDtcsClientImpl.java | 885 + .../ManagedInstanceDtcsImpl.java | 138 + ...anagedInstanceEncryptionProtectorImpl.java | 190 + ...nstanceEncryptionProtectorsClientImpl.java | 1238 ++ ...nagedInstanceEncryptionProtectorsImpl.java | 167 + .../implementation/ManagedInstanceImpl.java | 527 + .../ManagedInstanceKeyImpl.java | 163 + .../ManagedInstanceKeysClientImpl.java | 1190 ++ .../ManagedInstanceKeysImpl.java | 198 + ...edInstanceLongTermRetentionBackupImpl.java | 71 + ...ceLongTermRetentionPoliciesClientImpl.java | 1005 + ...InstanceLongTermRetentionPoliciesImpl.java | 176 + ...edInstanceLongTermRetentionPolicyImpl.java | 180 + .../ManagedInstanceOperationImpl.java | 104 + .../ManagedInstanceOperationsClientImpl.java | 717 + .../ManagedInstanceOperationsImpl.java | 87 + ...InstancePrivateEndpointConnectionImpl.java | 170 + ...ePrivateEndpointConnectionsClientImpl.java | 1229 ++ ...nstancePrivateEndpointConnectionsImpl.java | 219 + .../ManagedInstancePrivateLinkImpl.java | 46 + ...nstancePrivateLinkResourcesClientImpl.java | 545 + ...nagedInstancePrivateLinkResourcesImpl.java | 77 + .../ManagedInstanceQueryImpl.java | 44 + ...agedInstanceTdeCertificatesClientImpl.java | 346 + .../ManagedInstanceTdeCertificatesImpl.java | 43 + ...edInstanceVulnerabilityAssessmentImpl.java | 189 + ...nceVulnerabilityAssessmentsClientImpl.java | 996 + ...dInstanceVulnerabilityAssessmentsImpl.java | 237 + .../ManagedInstancesClientImpl.java | 2776 +++ .../implementation/ManagedInstancesImpl.java | 246 + ...pShortTermRetentionPoliciesClientImpl.java | 1453 ++ ...eBackupShortTermRetentionPoliciesImpl.java | 179 + .../ManagedServerDnsAliasImpl.java | 169 + .../ManagedServerDnsAliasesClientImpl.java | 1541 ++ .../ManagedServerDnsAliasesImpl.java | 230 + ...ServerSecurityAlertPoliciesClientImpl.java | 936 + ...anagedServerSecurityAlertPoliciesImpl.java | 156 + .../ManagedServerSecurityAlertPolicyImpl.java | 224 + .../ManagedTransparentDataEncryptionImpl.java | 157 + .../implementation/MetricDefinitionImpl.java | 59 + .../generated/implementation/MetricImpl.java | 62 + .../implementation/OperationImpl.java | 52 + .../implementation/OperationsClientImpl.java | 273 + .../implementation/OperationsImpl.java | 45 + .../OutboundFirewallRuleImpl.java | 131 + .../OutboundFirewallRulesClientImpl.java | 1159 ++ .../OutboundFirewallRulesImpl.java | 202 + .../PrivateEndpointConnectionImpl.java | 157 + .../PrivateEndpointConnectionsClientImpl.java | 1196 ++ .../PrivateEndpointConnectionsImpl.java | 208 + .../PrivateLinkResourceImpl.java | 45 + .../PrivateLinkResourcesClientImpl.java | 531 + .../PrivateLinkResourcesImpl.java | 74 + .../implementation/QueryStatisticsImpl.java | 68 + .../implementation/RecommendedActionImpl.java | 175 + ...ecommendedSensitivityLabelsClientImpl.java | 265 + .../RecommendedSensitivityLabelsImpl.java | 54 + .../RecoverableDatabaseImpl.java | 57 + .../RecoverableDatabasesClientImpl.java | 433 + .../RecoverableDatabasesImpl.java | 74 + .../RecoverableManagedDatabaseImpl.java | 45 + ...RecoverableManagedDatabasesClientImpl.java | 543 + .../RecoverableManagedDatabasesImpl.java | 80 + .../implementation/ReplicationLinkImpl.java | 88 + .../ReplicationLinksClientImpl.java | 1769 ++ .../implementation/ReplicationLinksImpl.java | 137 + .../RestorableDroppedDatabaseImpl.java | 86 + .../RestorableDroppedDatabasesClientImpl.java | 538 + .../RestorableDroppedDatabasesImpl.java | 77 + .../RestorableDroppedManagedDatabaseImpl.java | 73 + ...ableDroppedManagedDatabasesClientImpl.java | 553 + ...RestorableDroppedManagedDatabasesImpl.java | 80 + .../implementation/RestorePointImpl.java | 61 + .../RestorePointsClientImpl.java | 1109 + .../implementation/RestorePointsImpl.java | 118 + .../implementation/SecurityEventImpl.java | 79 + .../implementation/SensitivityLabelImpl.java | 256 + .../SensitivityLabelUpdateImpl.java | 68 + .../SensitivityLabelUpdatePropertiesImpl.java | 57 + .../SensitivityLabelsClientImpl.java | 2408 +++ .../implementation/SensitivityLabelsImpl.java | 292 + .../ServerAdvancedThreatProtectionImpl.java | 158 + ...cedThreatProtectionSettingsClientImpl.java | 933 + ...rAdvancedThreatProtectionSettingsImpl.java | 151 + .../ServerAdvisorsClientImpl.java | 607 + .../implementation/ServerAdvisorsImpl.java | 117 + .../ServerAutomaticTuningImpl.java | 61 + .../ServerAutomaticTuningsClientImpl.java | 404 + .../ServerAutomaticTuningsImpl.java | 85 + .../ServerAzureADAdministratorImpl.java | 173 + ...ServerAzureADAdministratorsClientImpl.java | 1186 ++ .../ServerAzureADAdministratorsImpl.java | 203 + .../ServerAzureADOnlyAuthenticationImpl.java | 142 + ...rAzureADOnlyAuthenticationsClientImpl.java | 1216 ++ .../ServerAzureADOnlyAuthenticationsImpl.java | 211 + .../ServerBlobAuditingPoliciesClientImpl.java | 833 + .../ServerBlobAuditingPoliciesImpl.java | 117 + .../ServerBlobAuditingPolicyImpl.java | 231 + .../ServerCommunicationLinkImpl.java | 157 + .../ServerCommunicationLinksClientImpl.java | 971 + .../ServerCommunicationLinksImpl.java | 200 + .../ServerConnectionPoliciesClientImpl.java | 898 + .../ServerConnectionPoliciesImpl.java | 139 + .../ServerConnectionPolicyImpl.java | 157 + .../ServerDevOpsAuditSettingsClientImpl.java | 920 + .../ServerDevOpsAuditSettingsImpl.java | 147 + .../ServerDevOpsAuditingSettingsImpl.java | 197 + .../implementation/ServerDnsAliasImpl.java | 44 + .../ServerDnsAliasesClientImpl.java | 1433 ++ .../implementation/ServerDnsAliasesImpl.java | 127 + .../generated/implementation/ServerImpl.java | 361 + .../implementation/ServerKeyImpl.java | 178 + .../implementation/ServerKeysClientImpl.java | 1146 ++ .../implementation/ServerKeysImpl.java | 187 + .../implementation/ServerOperationImpl.java | 94 + .../ServerOperationsClientImpl.java | 350 + .../implementation/ServerOperationsImpl.java | 46 + ...ServerSecurityAlertPoliciesClientImpl.java | 906 + .../ServerSecurityAlertPoliciesImpl.java | 144 + .../ServerSecurityAlertPolicyImpl.java | 218 + .../ServerTrustCertificateImpl.java | 147 + .../ServerTrustCertificatesClientImpl.java | 1204 ++ .../ServerTrustCertificatesImpl.java | 211 + .../implementation/ServerTrustGroupImpl.java | 159 + .../ServerTrustGroupsClientImpl.java | 1442 ++ .../implementation/ServerTrustGroupsImpl.java | 211 + .../implementation/ServerUsageImpl.java | 56 + .../ServerUsagesClientImpl.java | 251 + .../implementation/ServerUsagesImpl.java | 46 + .../ServerVulnerabilityAssessmentImpl.java | 180 + ...verVulnerabilityAssessmentsClientImpl.java | 974 + .../ServerVulnerabilityAssessmentsImpl.java | 226 + .../implementation/ServersClientImpl.java | 2068 ++ .../generated/implementation/ServersImpl.java | 221 + .../implementation/ServiceObjectiveImpl.java | 60 + .../ServiceObjectivesClientImpl.java | 435 + .../implementation/ServiceObjectivesImpl.java | 72 + .../SqlAgentConfigurationImpl.java | 45 + .../implementation/SqlAgentsClientImpl.java | 412 + .../implementation/SqlAgentsImpl.java | 88 + .../SqlManagementClientBuilder.java | 144 + .../SqlManagementClientImpl.java | 2314 +++ ...rabilityAssessmentBaselinesClientImpl.java | 637 + ...lVulnerabilityAssessmentBaselinesImpl.java | 98 + ...sessmentBaselinesOperationsClientImpl.java | 318 + ...lityAssessmentBaselinesOperationsImpl.java | 82 + ...ilityAssessmentExecuteScansClientImpl.java | 371 + ...lnerabilityAssessmentExecuteScansImpl.java | 47 + .../SqlVulnerabilityAssessmentImpl.java | 155 + ...lityAssessmentRuleBaselinesClientImpl.java | 964 + ...nerabilityAssessmentRuleBaselinesImpl.java | 155 + ...mentRuleBaselinesOperationsClientImpl.java | 301 + ...AssessmentRuleBaselinesOperationsImpl.java | 60 + ...VulnerabilityAssessmentScanRecordImpl.java | 121 + ...essmentScanResultOperationsClientImpl.java | 674 + ...ityAssessmentScanResultOperationsImpl.java | 102 + ...ulnerabilityAssessmentScanResultsImpl.java | 89 + ...ulnerabilityAssessmentScansClientImpl.java | 630 + .../SqlVulnerabilityAssessmentScansImpl.java | 95 + ...SqlVulnerabilityAssessmentsClientImpl.java | 241 + .../SqlVulnerabilityAssessmentsImpl.java | 50 + ...rabilityAssessmentsSettingsClientImpl.java | 784 + ...lVulnerabilityAssessmentsSettingsImpl.java | 154 + .../implementation/SubscriptionUsageImpl.java | 56 + .../SubscriptionUsagesClientImpl.java | 468 + .../SubscriptionUsagesImpl.java | 69 + .../SynapseLinkWorkspaceImpl.java | 52 + .../SynapseLinkWorkspacesClientImpl.java | 368 + .../SynapseLinkWorkspacesImpl.java | 49 + .../implementation/SyncAgentImpl.java | 172 + .../SyncAgentKeyPropertiesImpl.java | 32 + .../SyncAgentLinkedDatabaseImpl.java | 65 + .../implementation/SyncAgentsClientImpl.java | 1612 ++ .../implementation/SyncAgentsImpl.java | 230 + .../SyncDatabaseIdPropertiesImpl.java | 32 + .../SyncFullSchemaPropertiesImpl.java | 45 + .../implementation/SyncGroupImpl.java | 268 + .../SyncGroupLogPropertiesImpl.java | 55 + .../implementation/SyncGroupsClientImpl.java | 3386 +++ .../implementation/SyncGroupsImpl.java | 326 + .../implementation/SyncMemberImpl.java | 277 + .../implementation/SyncMembersClientImpl.java | 2503 +++ .../implementation/SyncMembersImpl.java | 312 + .../TdeCertificatesClientImpl.java | 338 + .../implementation/TdeCertificatesImpl.java | 41 + .../implementation/TimeZoneImpl.java | 47 + .../implementation/TimeZonesClientImpl.java | 464 + .../implementation/TimeZonesImpl.java | 69 + .../implementation/TopQueriesImpl.java | 64 + .../TransparentDataEncryptionsClientImpl.java | 821 + .../TransparentDataEncryptionsImpl.java | 161 + ...VirtualClusterDnsServersOperationImpl.java | 46 + .../generated/implementation/UsageImpl.java | 56 + .../implementation/UsagesClientImpl.java | 379 + .../generated/implementation/UsagesImpl.java | 46 + .../sql/generated/implementation/Utils.java | 204 + .../implementation/VirtualClusterImpl.java | 73 + .../VirtualClustersClientImpl.java | 1569 ++ .../implementation/VirtualClustersImpl.java | 134 + .../VirtualNetworkRuleImpl.java | 150 + .../VirtualNetworkRulesClientImpl.java | 1180 ++ .../VirtualNetworkRulesImpl.java | 197 + ...VulnerabilityAssessmentScanRecordImpl.java | 84 + .../WorkloadClassifierImpl.java | 225 + .../WorkloadClassifiersClientImpl.java | 1471 ++ .../WorkloadClassifiersImpl.java | 299 + .../implementation/WorkloadGroupImpl.java | 188 + .../WorkloadGroupsClientImpl.java | 1255 ++ .../implementation/WorkloadGroupsImpl.java | 230 + .../implementation/package-info.java | 10 + .../models/AdministratorListResult.java | 59 + .../generated/models/AdministratorName.java | 35 + .../generated/models/AdministratorType.java | 35 + .../models/AdvancedThreatProtectionName.java | 35 + .../models/AdvancedThreatProtectionState.java | 57 + .../sql/generated/models/Advisor.java | 104 + .../sql/generated/models/AdvisorStatus.java | 60 + .../models/AggregationFunctionType.java | 47 + .../models/AlwaysEncryptedEnclaveType.java | 38 + .../generated/models/AuthenticationName.java | 35 + .../generated/models/AutoExecuteStatus.java | 57 + .../AutoExecuteStatusInheritedFrom.java | 64 + .../models/AutoPauseDelayTimeRange.java | 114 + .../models/AutomaticTuningDisabledReason.java | 66 + .../generated/models/AutomaticTuningMode.java | 57 + .../AutomaticTuningOptionModeActual.java | 51 + .../AutomaticTuningOptionModeDesired.java | 54 + .../models/AutomaticTuningOptions.java | 95 + .../models/AutomaticTuningServerMode.java | 54 + .../models/AutomaticTuningServerOptions.java | 95 + .../models/AutomaticTuningServerReason.java | 54 + .../models/AzureADOnlyAuthListResult.java | 59 + .../BackupShortTermRetentionPolicies.java | 111 + .../BackupShortTermRetentionPolicy.java | 201 + ...kupShortTermRetentionPolicyListResult.java | 59 + .../models/BackupStorageRedundancy.java | 44 + .../sql/generated/models/Baseline.java | 56 + .../models/BaselineAdjustedResult.java | 88 + .../sql/generated/models/BaselineName.java | 35 + .../generated/models/BenchmarkReference.java | 54 + .../models/BlobAuditingPolicyState.java | 53 + .../sql/generated/models/Capabilities.java | 36 + .../sql/generated/models/CapabilityGroup.java | 49 + .../generated/models/CapabilityStatus.java | 57 + .../models/CatalogCollationType.java | 38 + .../models/CheckNameAvailabilityReason.java | 51 + .../models/CheckNameAvailabilityRequest.java | 86 + .../models/CheckNameAvailabilityResponse.java | 47 + .../sql/generated/models/ColumnDataType.java | 134 + .../CompleteDatabaseRestoreDefinition.java | 59 + .../models/ConnectionPolicyName.java | 35 + ...CopyLongTermRetentionBackupParameters.java | 183 + .../CreateDatabaseRestorePointDefinition.java | 59 + .../sql/generated/models/CreateMode.java | 89 + .../generated/models/DataMaskingFunction.java | 63 + .../generated/models/DataMaskingPolicies.java | 71 + .../generated/models/DataMaskingPolicy.java | 239 + .../sql/generated/models/DataMaskingRule.java | 512 + .../models/DataMaskingRuleListResult.java | 55 + .../models/DataMaskingRuleState.java | 55 + .../generated/models/DataMaskingRules.java | 49 + .../generated/models/DataMaskingState.java | 51 + .../models/DataWarehouseUserActivities.java | 45 + ...DataWarehouseUserActivitiesListResult.java | 59 + ...DataWarehouseUserActivitiesOperations.java | 84 + .../models/DataWarehouseUserActivityName.java | 35 + .../sql/generated/models/Database.java | 1362 ++ .../DatabaseAdvancedThreatProtection.java | 180 + ...aseAdvancedThreatProtectionListResult.java | 59 + ...abaseAdvancedThreatProtectionSettings.java | 114 + .../generated/models/DatabaseAdvisors.java | 116 + .../models/DatabaseAutomaticTuning.java | 60 + .../models/DatabaseAutomaticTunings.java | 79 + .../models/DatabaseBlobAuditingPolicies.java | 103 + .../models/DatabaseBlobAuditingPolicy.java | 741 + .../DatabaseBlobAuditingPolicyListResult.java | 59 + .../sql/generated/models/DatabaseColumn.java | 66 + .../models/DatabaseColumnListResult.java | 59 + .../sql/generated/models/DatabaseColumns.java | 146 + .../generated/models/DatabaseExtensions.java | 136 + .../models/DatabaseExtensionsOperations.java | 82 + .../generated/models/DatabaseIdentity.java | 105 + .../models/DatabaseIdentityType.java | 38 + .../generated/models/DatabaseLicenseType.java | 41 + .../generated/models/DatabaseListResult.java | 59 + .../generated/models/DatabaseOperation.java | 137 + .../models/DatabaseOperationListResult.java | 59 + .../generated/models/DatabaseOperations.java | 74 + .../generated/models/DatabaseReadScale.java | 42 + .../models/DatabaseRecommendedActions.java | 138 + .../sql/generated/models/DatabaseSchema.java | 38 + .../models/DatabaseSchemaListResult.java | 59 + .../sql/generated/models/DatabaseSchemas.java | 75 + .../DatabaseSecurityAlertListResult.java | 59 + .../models/DatabaseSecurityAlertPolicies.java | 114 + .../models/DatabaseSecurityAlertPolicy.java | 381 + ...SqlVulnerabilityAssessmentBaselineSet.java | 198 + ...bilityAssessmentBaselineSetListResult.java | 59 + ...seSqlVulnerabilityAssessmentBaselines.java | 129 + ...qlVulnerabilityAssessmentExecuteScans.java | 48 + ...qlVulnerabilityAssessmentRuleBaseline.java | 201 + ...nerabilityAssessmentRuleBaselineInput.java | 107 + ...bilityAssessmentRuleBaselineListInput.java | 109 + ...ilityAssessmentRuleBaselineListResult.java | 59 + ...lVulnerabilityAssessmentRuleBaselines.java | 206 + ...SqlVulnerabilityAssessmentScanResults.java | 104 + ...tabaseSqlVulnerabilityAssessmentScans.java | 96 + ...seSqlVulnerabilityAssessmentsSettings.java | 83 + .../sql/generated/models/DatabaseState.java | 41 + .../sql/generated/models/DatabaseStatus.java | 106 + .../sql/generated/models/DatabaseTable.java | 52 + .../models/DatabaseTableListResult.java | 59 + .../sql/generated/models/DatabaseTables.java | 91 + .../sql/generated/models/DatabaseUpdate.java | 922 + .../sql/generated/models/DatabaseUsage.java | 66 + .../models/DatabaseUsageListResult.java | 59 + .../sql/generated/models/DatabaseUsages.java | 41 + .../models/DatabaseUserIdentity.java | 55 + .../DatabaseVulnerabilityAssessment.java | 276 + ...baseVulnerabilityAssessmentListResult.java | 59 + ...seVulnerabilityAssessmentRuleBaseline.java | 173 + ...lnerabilityAssessmentRuleBaselineItem.java | 60 + ...eVulnerabilityAssessmentRuleBaselines.java | 164 + .../DatabaseVulnerabilityAssessmentScans.java | 182 + ...aseVulnerabilityAssessmentScansExport.java | 47 + .../DatabaseVulnerabilityAssessments.java | 175 + .../sql/generated/models/Databases.java | 495 + .../sql/generated/models/DayOfWeek.java | 53 + .../sql/generated/models/DeletedServer.java | 67 + .../models/DeletedServerListResult.java | 59 + .../sql/generated/models/DeletedServers.java | 105 + .../models/DevOpsAuditingSettingsName.java | 35 + .../models/DiffBackupIntervalInHours.java | 41 + .../models/DistributedAvailabilityGroup.java | 320 + .../models/DistributedAvailabilityGroups.java | 151 + ...stributedAvailabilityGroupsListResult.java | 59 + .../models/DnsRefreshOperationStatus.java | 41 + .../sql/generated/models/DtcName.java | 35 + .../generated/models/EditionCapability.java | 150 + .../sql/generated/models/ElasticPool.java | 477 + .../models/ElasticPoolActivities.java | 44 + .../generated/models/ElasticPoolActivity.java | 187 + .../models/ElasticPoolActivityListResult.java | 63 + .../models/ElasticPoolDatabaseActivities.java | 44 + .../models/ElasticPoolDatabaseActivity.java | 153 + ...ElasticPoolDatabaseActivityListResult.java | 63 + .../models/ElasticPoolEditionCapability.java | 115 + .../models/ElasticPoolLicenseType.java | 38 + .../models/ElasticPoolListResult.java | 59 + .../models/ElasticPoolOperation.java | 137 + .../ElasticPoolOperationListResult.java | 59 + .../models/ElasticPoolOperations.java | 75 + ...DatabaseMaxPerformanceLevelCapability.java | 114 + ...DatabaseMinPerformanceLevelCapability.java | 95 + .../ElasticPoolPerDatabaseSettings.java | 76 + ...ElasticPoolPerformanceLevelCapability.java | 241 + .../generated/models/ElasticPoolState.java | 41 + .../generated/models/ElasticPoolUpdate.java | 245 + .../sql/generated/models/ElasticPools.java | 242 + .../generated/models/EncryptionProtector.java | 285 + .../models/EncryptionProtectorListResult.java | 59 + .../models/EncryptionProtectorName.java | 35 + .../models/EncryptionProtectors.java | 129 + .../generated/models/EndpointCertificate.java | 45 + .../models/EndpointCertificateListResult.java | 59 + .../models/EndpointCertificates.java | 70 + .../models/ExportDatabaseDefinition.java | 242 + .../ExtendedDatabaseBlobAuditingPolicies.java | 103 + .../ExtendedDatabaseBlobAuditingPolicy.java | 783 + ...dDatabaseBlobAuditingPolicyListResult.java | 59 + .../ExtendedServerBlobAuditingPolicies.java | 98 + .../ExtendedServerBlobAuditingPolicy.java | 854 + ...dedServerBlobAuditingPolicyListResult.java | 59 + .../sql/generated/models/FailoverGroup.java | 342 + .../models/FailoverGroupListResult.java | 59 + .../models/FailoverGroupReadOnlyEndpoint.java | 50 + .../FailoverGroupReadWriteEndpoint.java | 94 + .../models/FailoverGroupReplicationRole.java | 38 + .../generated/models/FailoverGroupUpdate.java | 142 + .../sql/generated/models/FailoverGroups.java | 207 + .../sql/generated/models/FirewallRule.java | 215 + .../generated/models/FirewallRuleList.java | 55 + .../models/FirewallRuleListResult.java | 59 + .../sql/generated/models/FirewallRules.java | 181 + .../generated/models/GeoBackupPolicies.java | 110 + .../sql/generated/models/GeoBackupPolicy.java | 197 + .../models/GeoBackupPolicyListResult.java | 55 + .../generated/models/GeoBackupPolicyName.java | 35 + .../models/GeoBackupPolicyState.java | 51 + .../generated/models/IPv6FirewallRule.java | 212 + .../models/IPv6FirewallRuleListResult.java | 59 + .../generated/models/IPv6FirewallRules.java | 151 + .../sql/generated/models/IdentityType.java | 47 + .../models/ImplementationMethod.java | 51 + .../ImportExistingDatabaseDefinition.java | 243 + ...rtExportExtensionsOperationListResult.java | 59 + ...ImportExportExtensionsOperationResult.java | 212 + .../models/ImportExportOperationResult.java | 110 + .../models/ImportNewDatabaseDefinition.java | 346 + .../models/InstanceFailoverGroup.java | 292 + .../InstanceFailoverGroupListResult.java | 59 + ...InstanceFailoverGroupReadOnlyEndpoint.java | 50 + ...nstanceFailoverGroupReadWriteEndpoint.java | 94 + .../InstanceFailoverGroupReplicationRole.java | 39 + .../models/InstanceFailoverGroups.java | 211 + .../sql/generated/models/InstancePool.java | 276 + .../models/InstancePoolEditionCapability.java | 99 + .../models/InstancePoolFamilyCapability.java | 117 + .../models/InstancePoolLicenseType.java | 41 + .../models/InstancePoolListResult.java | 59 + .../generated/models/InstancePoolUpdate.java | 53 + .../models/InstancePoolVcoresCapability.java | 113 + .../sql/generated/models/InstancePools.java | 162 + .../sql/generated/models/IsRetryable.java | 51 + .../sql/generated/models/Job.java | 192 + .../sql/generated/models/JobAgent.java | 243 + .../generated/models/JobAgentListResult.java | 59 + .../sql/generated/models/JobAgentState.java | 47 + .../sql/generated/models/JobAgentUpdate.java | 53 + .../sql/generated/models/JobAgents.java | 148 + .../sql/generated/models/JobCredential.java | 185 + .../models/JobCredentialListResult.java | 59 + .../sql/generated/models/JobCredentials.java | 158 + .../sql/generated/models/JobExecution.java | 131 + .../models/JobExecutionLifecycle.java | 63 + .../models/JobExecutionListResult.java | 59 + .../generated/models/JobExecutionTarget.java | 69 + .../sql/generated/models/JobExecutions.java | 262 + .../sql/generated/models/JobListResult.java | 59 + .../sql/generated/models/JobSchedule.java | 157 + .../sql/generated/models/JobScheduleType.java | 51 + .../sql/generated/models/JobStep.java | 320 + .../sql/generated/models/JobStepAction.java | 110 + .../generated/models/JobStepActionSource.java | 35 + .../generated/models/JobStepActionType.java | 35 + .../models/JobStepExecutionOptions.java | 158 + .../generated/models/JobStepExecutions.java | 116 + .../generated/models/JobStepListResult.java | 59 + .../sql/generated/models/JobStepOutput.java | 256 + .../generated/models/JobStepOutputType.java | 35 + .../sql/generated/models/JobSteps.java | 262 + .../sql/generated/models/JobTarget.java | 216 + .../generated/models/JobTargetExecutions.java | 182 + .../sql/generated/models/JobTargetGroup.java | 159 + .../models/JobTargetGroupListResult.java | 59 + .../models/JobTargetGroupMembershipType.java | 51 + .../sql/generated/models/JobTargetGroups.java | 158 + .../sql/generated/models/JobTargetType.java | 47 + .../sql/generated/models/JobVersion.java | 38 + .../models/JobVersionListResult.java | 59 + .../sql/generated/models/JobVersions.java | 84 + .../sql/generated/models/Jobs.java | 157 + .../generated/models/LedgerDigestUploads.java | 190 + .../models/LedgerDigestUploadsListResult.java | 59 + .../models/LedgerDigestUploadsName.java | 35 + .../models/LedgerDigestUploadsOperations.java | 147 + .../models/LedgerDigestUploadsState.java | 51 + .../models/LicenseTypeCapability.java | 80 + .../models/LocationCapabilities.java | 53 + .../generated/models/LogSizeCapability.java | 54 + .../sql/generated/models/LogSizeUnit.java | 47 + ...icalDatabaseTransparentDataEncryption.java | 159 + ...seTransparentDataEncryptionListResult.java | 59 + ...verAdvancedThreatProtectionListResult.java | 59 + ...alServerSecurityAlertPolicyListResult.java | 59 + .../models/LongTermRetentionBackup.java | 95 + .../LongTermRetentionBackupListResult.java | 59 + ...ongTermRetentionBackupOperationResult.java | 89 + .../models/LongTermRetentionBackups.java | 562 + ...ngTermRetentionManagedInstanceBackups.java | 378 + .../models/LongTermRetentionPolicies.java | 111 + .../models/LongTermRetentionPolicy.java | 253 + .../LongTermRetentionPolicyListResult.java | 59 + .../models/LongTermRetentionPolicyName.java | 35 + .../MaintenanceConfigurationCapability.java | 95 + .../models/MaintenanceWindowOptions.java | 90 + .../MaintenanceWindowOptionsOperations.java | 48 + .../models/MaintenanceWindowTimeRange.java | 102 + .../generated/models/MaintenanceWindows.java | 46 + .../models/MaintenanceWindowsOperations.java | 92 + ...nagedBackupShortTermRetentionPolicies.java | 114 + ...ManagedBackupShortTermRetentionPolicy.java | 164 + ...kupShortTermRetentionPolicyListResult.java | 59 + .../sql/generated/models/ManagedDatabase.java | 609 + ...nagedDatabaseAdvancedThreatProtection.java | 180 + ...aseAdvancedThreatProtectionListResult.java | 59 + ...abaseAdvancedThreatProtectionSettings.java | 116 + .../models/ManagedDatabaseColumns.java | 147 + .../models/ManagedDatabaseCreateMode.java | 56 + .../models/ManagedDatabaseListResult.java | 59 + .../models/ManagedDatabaseMoveDefinition.java | 60 + ...anagedDatabaseMoveOperationListResult.java | 59 + .../ManagedDatabaseMoveOperationResult.java | 152 + .../models/ManagedDatabaseMoveOperations.java | 74 + .../models/ManagedDatabaseQueries.java | 87 + ...dDatabaseRecommendedSensitivityLabels.java | 50 + .../models/ManagedDatabaseRestoreDetails.java | 51 + ...baseRestoreDetailsBackupSetProperties.java | 115 + .../ManagedDatabaseRestoreDetailsResult.java | 195 + ...toreDetailsUnrestorableFileProperties.java | 39 + .../models/ManagedDatabaseSchemas.java | 76 + .../ManagedDatabaseSecurityAlertPolicies.java | 114 + .../ManagedDatabaseSecurityAlertPolicy.java | 376 + ...DatabaseSecurityAlertPolicyListResult.java | 59 + .../models/ManagedDatabaseSecurityEvents.java | 53 + .../ManagedDatabaseSensitivityLabels.java | 353 + .../ManagedDatabaseStartMoveDefinition.java | 86 + .../models/ManagedDatabaseStatus.java | 53 + .../models/ManagedDatabaseTables.java | 91 + ...gedDatabaseTransparentDataEncryptions.java | 116 + .../models/ManagedDatabaseUpdate.java | 452 + ...eVulnerabilityAssessmentRuleBaselines.java | 165 + ...dDatabaseVulnerabilityAssessmentScans.java | 182 + ...nagedDatabaseVulnerabilityAssessments.java | 167 + .../generated/models/ManagedDatabases.java | 331 + .../sql/generated/models/ManagedInstance.java | 956 + .../models/ManagedInstanceAdministrator.java | 247 + ...anagedInstanceAdministratorListResult.java | 59 + .../ManagedInstanceAdministratorType.java | 35 + .../models/ManagedInstanceAdministrators.java | 151 + ...nagedInstanceAdvancedThreatProtection.java | 179 + ...nceAdvancedThreatProtectionListResult.java | 59 + ...tanceAdvancedThreatProtectionSettings.java | 110 + ...agedInstanceAzureADOnlyAuthListResult.java | 59 + ...agedInstanceAzureADOnlyAuthentication.java | 164 + ...gedInstanceAzureADOnlyAuthentications.java | 154 + .../generated/models/ManagedInstanceDtc.java | 234 + .../models/ManagedInstanceDtcListResult.java | 59 + .../ManagedInstanceDtcSecuritySettings.java | 161 + ...ansactionManagerCommunicationSettings.java | 104 + .../generated/models/ManagedInstanceDtcs.java | 101 + .../ManagedInstanceEditionCapability.java | 132 + .../ManagedInstanceEncryptionProtector.java | 257 + ...InstanceEncryptionProtectorListResult.java | 59 + .../ManagedInstanceEncryptionProtectors.java | 138 + .../ManagedInstanceExternalAdministrator.java | 181 + .../ManagedInstanceFamilyCapability.java | 132 + .../generated/models/ManagedInstanceKey.java | 194 + .../models/ManagedInstanceKeyListResult.java | 59 + .../generated/models/ManagedInstanceKeys.java | 150 + .../models/ManagedInstanceLicenseType.java | 41 + .../models/ManagedInstanceListResult.java | 59 + ...anagedInstanceLongTermRetentionBackup.java | 89 + ...anceLongTermRetentionBackupListResult.java | 59 + ...agedInstanceLongTermRetentionPolicies.java | 115 + ...anagedInstanceLongTermRetentionPolicy.java | 254 + ...anceLongTermRetentionPolicyListResult.java | 59 + ...edInstanceLongTermRetentionPolicyName.java | 36 + ...nceMaintenanceConfigurationCapability.java | 80 + .../models/ManagedInstanceOperation.java | 144 + .../ManagedInstanceOperationListResult.java | 59 + ...anagedInstanceOperationParametersPair.java | 60 + .../models/ManagedInstanceOperationSteps.java | 73 + .../models/ManagedInstanceOperations.java | 100 + .../models/ManagedInstancePairInfo.java | 76 + .../models/ManagedInstancePecProperty.java | 58 + ...agedInstancePrivateEndpointConnection.java | 203 + ...cePrivateEndpointConnectionListResult.java | 59 + ...gedInstancePrivateEndpointConnections.java | 152 + ...anagedInstancePrivateEndpointProperty.java | 50 + .../models/ManagedInstancePrivateLink.java | 45 + .../ManagedInstancePrivateLinkListResult.java | 59 + .../ManagedInstancePrivateLinkProperties.java | 55 + .../ManagedInstancePrivateLinkResources.java | 71 + ...ateLinkServiceConnectionStateProperty.java | 109 + ...edInstancePropertiesProvisioningState.java | 78 + .../models/ManagedInstanceProxyOverride.java | 41 + .../models/ManagedInstanceQuery.java | 45 + .../ManagedInstanceQueryStatistics.java | 59 + .../ManagedInstanceTdeCertificates.java | 37 + .../models/ManagedInstanceUpdate.java | 760 + .../ManagedInstanceVcoresCapability.java | 182 + .../ManagedInstanceVersionCapability.java | 117 + ...anagedInstanceVulnerabilityAssessment.java | 291 + ...anceVulnerabilityAssessmentListResult.java | 59 + ...nagedInstanceVulnerabilityAssessments.java | 163 + .../generated/models/ManagedInstances.java | 266 + ...abaseBackupShortTermRetentionPolicies.java | 172 + .../models/ManagedServerCreateMode.java | 45 + .../models/ManagedServerDnsAlias.java | 187 + .../ManagedServerDnsAliasAcquisition.java | 63 + .../models/ManagedServerDnsAliasCreation.java | 50 + .../ManagedServerDnsAliasListResult.java | 59 + .../models/ManagedServerDnsAliases.java | 191 + .../ManagedServerSecurityAlertPolicies.java | 106 + .../ManagedServerSecurityAlertPolicy.java | 381 + ...edServerSecurityAlertPolicyListResult.java | 59 + .../ManagedShortTermRetentionPolicyName.java | 36 + .../ManagedTransparentDataEncryption.java | 159 + ...edTransparentDataEncryptionListResult.java | 59 + .../models/ManagementOperationState.java | 50 + .../generated/models/MaxSizeCapability.java | 54 + .../models/MaxSizeRangeCapability.java | 137 + .../sql/generated/models/MaxSizeUnit.java | 44 + .../sql/generated/models/Metric.java | 61 + .../generated/models/MetricAvailability.java | 54 + .../generated/models/MetricDefinition.java | 53 + .../models/MetricDefinitionListResult.java | 63 + .../generated/models/MetricListResult.java | 62 + .../sql/generated/models/MetricName.java | 54 + .../sql/generated/models/MetricType.java | 47 + .../sql/generated/models/MetricValue.java | 115 + .../models/MinCapacityCapability.java | 80 + .../generated/models/MoveOperationMode.java | 38 + .../sql/generated/models/Name.java | 76 + .../models/NetworkIsolationSettings.java | 86 + .../sql/generated/models/Operation.java | 46 + .../generated/models/OperationDisplay.java | 84 + .../generated/models/OperationListResult.java | 59 + .../sql/generated/models/OperationMode.java | 35 + .../sql/generated/models/OperationOrigin.java | 38 + .../sql/generated/models/Operations.java | 31 + .../models/OutboundFirewallRule.java | 137 + .../OutboundFirewallRuleListResult.java | 59 + .../models/OutboundFirewallRules.java | 148 + .../sql/generated/models/PartnerInfo.java | 87 + .../generated/models/PartnerRegionInfo.java | 65 + .../generated/models/PauseDelayTimeUnit.java | 35 + .../models/PerformanceLevelCapability.java | 54 + .../models/PerformanceLevelUnit.java | 38 + .../models/PrimaryAggregationType.java | 50 + .../sql/generated/models/PrincipalType.java | 41 + .../models/PrivateEndpointConnection.java | 198 + .../PrivateEndpointConnectionListResult.java | 59 + ...rivateEndpointConnectionRequestStatus.java | 69 + .../models/PrivateEndpointConnections.java | 148 + .../models/PrivateEndpointProperty.java | 50 + .../PrivateEndpointProvisioningState.java | 47 + .../generated/models/PrivateLinkResource.java | 45 + .../models/PrivateLinkResourceListResult.java | 59 + .../models/PrivateLinkResourceProperties.java | 70 + .../models/PrivateLinkResources.java | 69 + ...kServiceConnectionStateActionsRequire.java | 36 + ...ateLinkServiceConnectionStateProperty.java | 106 + ...ivateLinkServiceConnectionStateStatus.java | 45 + .../generated/models/ProvisioningState.java | 47 + .../models/ProxyResourceWithWritableName.java | 32 + .../sql/generated/models/QueryCheck.java | 70 + .../generated/models/QueryMetricInterval.java | 99 + .../models/QueryMetricProperties.java | 159 + .../generated/models/QueryMetricUnitType.java | 44 + .../sql/generated/models/QueryStatistics.java | 74 + .../generated/models/QueryTimeGrainType.java | 38 + .../ReadOnlyEndpointFailoverPolicy.java | 38 + .../generated/models/ReadScaleCapability.java | 80 + .../ReadWriteEndpointFailoverPolicy.java | 41 + .../generated/models/RecommendedAction.java | 229 + .../models/RecommendedActionCurrentState.java | 83 + .../models/RecommendedActionErrorInfo.java | 56 + .../models/RecommendedActionImpactRecord.java | 107 + .../RecommendedActionImplementationInfo.java | 58 + .../models/RecommendedActionInitiatedBy.java | 51 + .../models/RecommendedActionMetricInfo.java | 104 + .../models/RecommendedActionStateInfo.java | 118 + .../RecommendedSensitivityLabelUpdate.java | 136 + ...RecommendedSensitivityLabelUpdateKind.java | 51 + ...RecommendedSensitivityLabelUpdateList.java | 54 + .../models/RecommendedSensitivityLabels.java | 50 + .../generated/models/RecoverableDatabase.java | 67 + .../models/RecoverableDatabaseListResult.java | 63 + .../models/RecoverableDatabases.java | 70 + .../models/RecoverableManagedDatabase.java | 45 + .../RecoverableManagedDatabaseListResult.java | 59 + .../models/RecoverableManagedDatabases.java | 71 + .../sql/generated/models/Remediation.java | 85 + .../sql/generated/models/ReplicaType.java | 38 + .../sql/generated/models/ReplicationLink.java | 116 + .../models/ReplicationLinkListResult.java | 59 + .../generated/models/ReplicationLinkType.java | 41 + .../generated/models/ReplicationLinks.java | 195 + .../sql/generated/models/ReplicationMode.java | 38 + .../sql/generated/models/ReplicationRole.java | 60 + .../generated/models/ReplicationState.java | 44 + .../generated/models/ResourceIdentity.java | 123 + .../models/ResourceMoveDefinition.java | 58 + .../models/ResourceWithWritableName.java | 51 + .../models/RestorableDroppedDatabase.java | 103 + .../RestorableDroppedDatabaseListResult.java | 59 + .../models/RestorableDroppedDatabases.java | 69 + .../RestorableDroppedManagedDatabase.java | 83 + ...rableDroppedManagedDatabaseListResult.java | 59 + .../RestorableDroppedManagedDatabases.java | 72 + .../generated/models/RestoreDetailsName.java | 35 + .../sql/generated/models/RestorePoint.java | 74 + .../models/RestorePointListResult.java | 59 + .../generated/models/RestorePointType.java | 51 + .../sql/generated/models/RestorePoints.java | 145 + .../sql/generated/models/RuleSeverity.java | 47 + .../sql/generated/models/RuleStatus.java | 41 + .../sql/generated/models/RuleType.java | 44 + .../sql/generated/models/SampleName.java | 41 + .../sql/generated/models/SecondaryType.java | 41 + .../models/SecurityAlertPolicyName.java | 35 + .../models/SecurityAlertPolicyState.java | 57 + .../models/SecurityAlertsPolicyState.java | 54 + .../sql/generated/models/SecurityEvent.java | 103 + .../models/SecurityEventCollection.java | 59 + ...EventSqlInjectionAdditionalProperties.java | 129 + .../generated/models/SecurityEventType.java | 54 + .../generated/models/SensitivityLabel.java | 345 + .../models/SensitivityLabelListResult.java | 59 + .../models/SensitivityLabelRank.java | 60 + .../models/SensitivityLabelSource.java | 51 + .../models/SensitivityLabelUpdate.java | 73 + .../models/SensitivityLabelUpdateKind.java | 51 + .../models/SensitivityLabelUpdateList.java | 55 + .../SensitivityLabelUpdateProperties.java | 53 + .../generated/models/SensitivityLabels.java | 374 + .../sql/generated/models/Server.java | 576 + .../ServerAdvancedThreatProtection.java | 178 + ...erverAdvancedThreatProtectionSettings.java | 107 + .../sql/generated/models/ServerAdvisors.java | 103 + .../models/ServerAutomaticTuning.java | 60 + .../models/ServerAutomaticTunings.java | 69 + .../models/ServerAzureADAdministrator.java | 254 + .../models/ServerAzureADAdministrators.java | 151 + .../ServerAzureADOnlyAuthentication.java | 159 + .../ServerAzureADOnlyAuthentications.java | 152 + .../models/ServerBlobAuditingPolicies.java | 96 + .../models/ServerBlobAuditingPolicy.java | 815 + .../ServerBlobAuditingPolicyListResult.java | 59 + .../models/ServerCommunicationLink.java | 183 + .../ServerCommunicationLinkListResult.java | 55 + .../models/ServerCommunicationLinks.java | 151 + .../models/ServerConnectionPolicies.java | 100 + .../models/ServerConnectionPolicy.java | 186 + .../ServerConnectionPolicyListResult.java | 59 + .../models/ServerConnectionType.java | 41 + .../models/ServerDevOpsAuditSettings.java | 105 + .../ServerDevOpsAuditSettingsListResult.java | 59 + .../models/ServerDevOpsAuditingSettings.java | 415 + .../sql/generated/models/ServerDnsAlias.java | 45 + .../models/ServerDnsAliasAcquisition.java | 61 + .../models/ServerDnsAliasListResult.java | 59 + .../generated/models/ServerDnsAliases.java | 162 + .../models/ServerExternalAdministrator.java | 181 + .../sql/generated/models/ServerInfo.java | 58 + .../sql/generated/models/ServerKey.java | 224 + .../generated/models/ServerKeyListResult.java | 59 + .../sql/generated/models/ServerKeyType.java | 38 + .../sql/generated/models/ServerKeys.java | 147 + .../generated/models/ServerListResult.java | 59 + .../models/ServerNetworkAccessFlag.java | 41 + .../sql/generated/models/ServerOperation.java | 130 + .../models/ServerOperationListResult.java | 59 + .../generated/models/ServerOperations.java | 38 + .../ServerPrivateEndpointConnection.java | 58 + .../models/ServerSecurityAlertPolicies.java | 101 + .../models/ServerSecurityAlertPolicy.java | 380 + .../models/ServerTrustCertificate.java | 171 + .../models/ServerTrustCertificates.java | 154 + .../ServerTrustCertificatesListResult.java | 59 + .../generated/models/ServerTrustGroup.java | 185 + .../models/ServerTrustGroupListResult.java | 59 + ...erTrustGroupPropertiesTrustScopesItem.java | 40 + .../generated/models/ServerTrustGroups.java | 176 + .../sql/generated/models/ServerUpdate.java | 376 + .../sql/generated/models/ServerUsage.java | 67 + .../models/ServerUsageListResult.java | 62 + .../sql/generated/models/ServerUsages.java | 40 + .../models/ServerVersionCapability.java | 117 + .../models/ServerVulnerabilityAssessment.java | 277 + ...rverVulnerabilityAssessmentListResult.java | 59 + .../ServerVulnerabilityAssessments.java | 159 + .../models/ServerWorkspaceFeature.java | 38 + .../sql/generated/models/Servers.java | 221 + .../generated/models/ServiceObjective.java | 73 + .../models/ServiceObjectiveCapability.java | 271 + .../models/ServiceObjectiveListResult.java | 63 + .../generated/models/ServiceObjectives.java | 71 + .../generated/models/ServicePrincipal.java | 95 + .../models/ServicePrincipalType.java | 38 + .../models/ShortTermRetentionPolicyName.java | 35 + .../sql/generated/models/Sku.java | 163 + .../models/SqlAgentConfiguration.java | 45 + .../SqlAgentConfigurationPropertiesState.java | 39 + .../sql/generated/models/SqlAgents.java | 71 + .../models/SqlVulnerabilityAssessment.java | 170 + .../SqlVulnerabilityAssessmentBaselines.java | 88 + ...rabilityAssessmentBaselinesOperations.java | 55 + ...qlVulnerabilityAssessmentExecuteScans.java | 41 + .../SqlVulnerabilityAssessmentListResult.java | 59 + .../SqlVulnerabilityAssessmentName.java | 35 + ...nerabilityAssessmentNameAutoGenerated.java | 36 + ...lVulnerabilityAssessmentRuleBaselines.java | 146 + ...lityAssessmentRuleBaselinesOperations.java | 54 + .../SqlVulnerabilityAssessmentScanError.java | 54 + ...VulnerabilityAssessmentScanListResult.java | 59 + .../SqlVulnerabilityAssessmentScanRecord.java | 161 + ...abilityAssessmentScanRecordListResult.java | 59 + ...abilityAssessmentScanResultOperations.java | 96 + ...SqlVulnerabilityAssessmentScanResults.java | 104 + .../SqlVulnerabilityAssessmentScans.java | 86 + .../SqlVulnerabilityAssessmentState.java | 54 + .../models/SqlVulnerabilityAssessments.java | 43 + .../SqlVulnerabilityAssessmentsSettings.java | 107 + .../generated/models/StorageCapability.java | 80 + .../StorageCapabilityStorageAccountType.java | 42 + .../sql/generated/models/StorageKeyType.java | 38 + .../generated/models/SubscriptionUsage.java | 66 + .../models/SubscriptionUsageListResult.java | 59 + .../generated/models/SubscriptionUsages.java | 60 + .../models/SynapseLinkWorkspace.java | 46 + .../SynapseLinkWorkspaceInfoProperties.java | 76 + .../SynapseLinkWorkspaceListResult.java | 59 + .../models/SynapseLinkWorkspaces.java | 42 + .../sql/generated/models/SyncAgent.java | 221 + .../models/SyncAgentKeyProperties.java | 24 + .../models/SyncAgentLinkedDatabase.java | 80 + .../SyncAgentLinkedDatabaseListResult.java | 59 + .../generated/models/SyncAgentListResult.java | 59 + .../sql/generated/models/SyncAgentState.java | 41 + .../sql/generated/models/SyncAgents.java | 209 + .../models/SyncConflictResolutionPolicy.java | 38 + .../models/SyncDatabaseIdListResult.java | 59 + .../models/SyncDatabaseIdProperties.java | 24 + .../sql/generated/models/SyncDirection.java | 41 + .../models/SyncFullSchemaProperties.java | 33 + .../SyncFullSchemaPropertiesListResult.java | 59 + .../generated/models/SyncFullSchemaTable.java | 103 + .../models/SyncFullSchemaTableColumn.java | 129 + .../sql/generated/models/SyncGroup.java | 501 + .../generated/models/SyncGroupListResult.java | 59 + .../models/SyncGroupLogListResult.java | 59 + .../models/SyncGroupLogProperties.java | 61 + .../generated/models/SyncGroupLogType.java | 44 + .../sql/generated/models/SyncGroupSchema.java | 80 + .../models/SyncGroupSchemaTable.java | 80 + .../models/SyncGroupSchemaTableColumn.java | 102 + .../sql/generated/models/SyncGroupState.java | 47 + .../sql/generated/models/SyncGroups.java | 358 + .../sql/generated/models/SyncGroupsType.java | 44 + .../sql/generated/models/SyncMember.java | 462 + .../generated/models/SyncMemberDbType.java | 38 + .../models/SyncMemberListResult.java | 59 + .../sql/generated/models/SyncMemberState.java | 86 + .../sql/generated/models/SyncMembers.java | 253 + .../generated/models/TableTemporalType.java | 41 + .../sql/generated/models/TdeCertificate.java | 90 + .../sql/generated/models/TdeCertificates.java | 37 + .../sql/generated/models/TimeZone.java | 52 + .../generated/models/TimeZoneListResult.java | 59 + .../sql/generated/models/TimeZones.java | 60 + .../sql/generated/models/TopQueries.java | 68 + .../models/TopQueriesListResult.java | 59 + .../models/TransparentDataEncryptionName.java | 35 + .../TransparentDataEncryptionState.java | 51 + .../models/TransparentDataEncryptions.java | 113 + .../generated/models/UnitDefinitionType.java | 50 + .../sql/generated/models/UnitType.java | 50 + ...dateLongTermRetentionBackupParameters.java | 67 + ...dateVirtualClusterDnsServersOperation.java | 46 + ...psertManagedServerOperationParameters.java | 128 + .../UpsertManagedServerOperationStep.java | 102 + ...psertManagedServerOperationStepStatus.java | 51 + .../sql/generated/models/Usage.java | 66 + .../sql/generated/models/UsageListResult.java | 59 + .../sql/generated/models/Usages.java | 40 + .../sql/generated/models/UserIdentity.java | 55 + .../sql/generated/models/VaRule.java | 166 + .../sql/generated/models/VirtualCluster.java | 75 + .../models/VirtualClusterListResult.java | 59 + .../models/VirtualClusterUpdate.java | 114 + .../sql/generated/models/VirtualClusters.java | 168 + .../generated/models/VirtualNetworkRule.java | 198 + .../models/VirtualNetworkRuleListResult.java | 59 + .../models/VirtualNetworkRuleState.java | 50 + .../generated/models/VirtualNetworkRules.java | 148 + .../models/VulnerabilityAssessmentName.java | 35 + ...erabilityAssessmentPolicyBaselineName.java | 51 + ...ityAssessmentRecurringScansProperties.java | 106 + .../VulnerabilityAssessmentScanError.java | 54 + .../VulnerabilityAssessmentScanRecord.java | 97 + ...abilityAssessmentScanRecordListResult.java | 59 + .../VulnerabilityAssessmentScanState.java | 44 + ...ulnerabilityAssessmentScanTriggerType.java | 39 + .../generated/models/WorkloadClassifier.java | 307 + .../models/WorkloadClassifierListResult.java | 59 + .../generated/models/WorkloadClassifiers.java | 183 + .../sql/generated/models/WorkloadGroup.java | 309 + .../models/WorkloadGroupListResult.java | 59 + .../sql/generated/models/WorkloadGroups.java | 156 + .../sql/generated/models/package-info.java | 10 + .../sql/generated/package-info.java | 10 + .../src/main/java/module-info.java | 19 + ...etentionPoliciesCreateOrUpdateSamples.java | 30 + ...pShortTermRetentionPoliciesGetSamples.java | 27 + ...etentionPoliciesListByDatabaseSamples.java | 25 + ...ortTermRetentionPoliciesUpdateSamples.java | 36 + .../CapabilitiesListByLocationSamples.java | 23 + ...aMaskingPoliciesCreateOrUpdateSamples.java | 45 + .../DataMaskingPoliciesGetSamples.java | 24 + ...DataMaskingRulesCreateOrUpdateSamples.java | 101 + ...DataMaskingRulesListByDatabaseSamples.java | 24 + ...ouseUserActivitiesOperationGetSamples.java | 27 + ...ivitiesOperationListByDatabaseSamples.java | 25 + ...otectionSettingsCreateOrUpdateSamples.java | 59 + ...cedThreatProtectionSettingsGetSamples.java | 31 + ...otectionSettingsListByDatabaseSamples.java | 25 + .../generated/DatabaseAdvisorsGetSamples.java | 24 + ...DatabaseAdvisorsListByDatabaseSamples.java | 41 + .../DatabaseAdvisorsUpdateSamples.java | 32 + .../DatabaseAutomaticTuningGetSamples.java | 23 + .../DatabaseAutomaticTuningUpdateSamples.java | 76 + ...AuditingPoliciesCreateOrUpdateSamples.java | 84 + ...atabaseBlobAuditingPoliciesGetSamples.java | 24 + ...AuditingPoliciesListByDatabaseSamples.java | 24 + .../generated/DatabaseColumnsGetSamples.java | 24 + .../DatabaseColumnsListByDatabaseSamples.java | 48 + .../DatabaseColumnsListByTableSamples.java | 22 + ...ensionsOperationCreateOrUpdateSamples.java | 34 + ...DatabaseExtensionsOperationGetSamples.java | 29 + ...ensionsOperationListByDatabaseSamples.java | 28 + .../DatabaseOperationsCancelSamples.java | 31 + ...tabaseOperationsListByDatabaseSamples.java | 22 + .../DatabaseRecommendedActionsGetSamples.java | 30 + ...edActionsListByDatabaseAdvisorSamples.java | 25 + ...tabaseRecommendedActionsUpdateSamples.java | 36 + .../generated/DatabaseSchemasGetSamples.java | 22 + .../DatabaseSchemasListByDatabaseSamples.java | 22 + ...ityAlertPoliciesCreateOrUpdateSamples.java | 62 + ...tabaseSecurityAlertPoliciesGetSamples.java | 26 + ...ityAlertPoliciesListByDatabaseSamples.java | 25 + ...essmentBaselinesCreateOrUpdateSamples.java | 76 + ...rabilityAssessmentBaselinesGetSamples.java | 33 + ...stBySqlVulnerabilityAssessmentSamples.java | 31 + ...tyAssessmentExecuteScanExecuteSamples.java | 31 + ...entRuleBaselinesCreateOrUpdateSamples.java | 41 + ...yAssessmentRuleBaselinesDeleteSamples.java | 34 + ...lityAssessmentRuleBaselinesGetSamples.java | 34 + ...entRuleBaselinesListByBaselineSamples.java | 33 + ...abilityAssessmentScanResultGetSamples.java | 33 + ...AssessmentScanResultListByScanSamples.java | 32 + ...ulnerabilityAssessmentScansGetSamples.java | 32 + ...tBySqlVulnerabilityAssessmentsSamples.java | 31 + ...rabilityAssessmentsSettingsGetSamples.java | 31 + ...essmentsSettingsListByDatabaseSamples.java | 26 + .../generated/DatabaseTablesGetSamples.java | 22 + .../DatabaseTablesListBySchemaSamples.java | 22 + .../DatabaseUsagesListByDatabaseSamples.java | 22 + ...entRuleBaselinesCreateOrUpdateSamples.java | 44 + ...yAssessmentRuleBaselinesDeleteSamples.java | 34 + ...lityAssessmentRuleBaselinesGetSamples.java | 34 + ...erabilityAssessmentScansExportSamples.java | 32 + ...ulnerabilityAssessmentScansGetSamples.java | 32 + ...ityAssessmentScansInitiateScanSamples.java | 32 + ...yAssessmentScansListByDatabaseSamples.java | 31 + ...ilityAssessmentsCreateOrUpdateSamples.java | 79 + ...VulnerabilityAssessmentsDeleteSamples.java | 31 + ...aseVulnerabilityAssessmentsGetSamples.java | 31 + ...ilityAssessmentsListByDatabaseSamples.java | 26 + .../DatabasesCreateOrUpdateSamples.java | 366 + .../generated/DatabasesDeleteSamples.java | 22 + .../generated/DatabasesExportSamples.java | 70 + .../generated/DatabasesFailoverSamples.java | 23 + .../generated/DatabasesGetSamples.java | 48 + .../DatabasesImportMethodSamples.java | 71 + .../DatabasesListByElasticPoolSamples.java | 22 + .../DatabasesListByServerSamples.java | 35 + ...abasesListInaccessibleByServerSamples.java | 23 + ...DatabasesListMetricDefinitionsSamples.java | 22 + .../DatabasesListMetricsSamples.java | 30 + .../generated/DatabasesPauseSamples.java | 22 + .../generated/DatabasesRenameSamples.java | 32 + .../generated/DatabasesResumeSamples.java | 22 + .../generated/DatabasesUpdateSamples.java | 116 + .../DatabasesUpgradeDataWarehouseSamples.java | 22 + .../generated/DeletedServersGetSamples.java | 22 + .../DeletedServersListByLocationSamples.java | 22 + .../generated/DeletedServersListSamples.java | 22 + .../DeletedServersRecoverSamples.java | 22 + ...ailabilityGroupsCreateOrUpdateSamples.java | 28 + ...ibutedAvailabilityGroupsDeleteSamples.java | 23 + ...stributedAvailabilityGroupsGetSamples.java | 23 + ...ailabilityGroupsListByInstanceSamples.java | 23 + ...ibutedAvailabilityGroupsUpdateSamples.java | 27 + ...oolActivitiesListByElasticPoolSamples.java | 22 + ...aseActivitiesListByElasticPoolSamples.java | 24 + .../ElasticPoolOperationsCancelSamples.java | 31 + ...oolOperationsListByElasticPoolSamples.java | 25 + .../ElasticPoolsCreateOrUpdateSamples.java | 89 + .../generated/ElasticPoolsDeleteSamples.java | 22 + .../ElasticPoolsFailoverSamples.java | 22 + .../generated/ElasticPoolsGetSamples.java | 38 + .../ElasticPoolsListByServerSamples.java | 22 + ...sticPoolsListMetricDefinitionsSamples.java | 22 + .../ElasticPoolsListMetricsSamples.java | 30 + .../generated/ElasticPoolsUpdateSamples.java | 117 + ...yptionProtectorsCreateOrUpdateSamples.java | 54 + .../EncryptionProtectorsGetSamples.java | 25 + ...cryptionProtectorsListByServerSamples.java | 22 + ...EncryptionProtectorsRevalidateSamples.java | 25 + .../EndpointCertificatesGetSamples.java | 22 + ...ointCertificatesListByInstanceSamples.java | 22 + ...AuditingPoliciesCreateOrUpdateSamples.java | 85 + ...atabaseBlobAuditingPoliciesGetSamples.java | 25 + ...AuditingPoliciesListByDatabaseSamples.java | 25 + ...AuditingPoliciesCreateOrUpdateSamples.java | 74 + ...dServerBlobAuditingPoliciesGetSamples.java | 25 + ...obAuditingPoliciesListByServerSamples.java | 25 + .../FailoverGroupsCreateOrUpdateSamples.java | 48 + .../FailoverGroupsDeleteSamples.java | 24 + .../FailoverGroupsFailoverSamples.java | 24 + ...oupsForceFailoverAllowDataLossSamples.java | 26 + .../generated/FailoverGroupsGetSamples.java | 24 + .../FailoverGroupsListByServerSamples.java | 22 + .../FailoverGroupsUpdateSamples.java | 41 + .../FirewallRulesCreateOrUpdateSamples.java | 47 + .../generated/FirewallRulesDeleteSamples.java | 25 + .../generated/FirewallRulesGetSamples.java | 25 + .../FirewallRulesListByServerSamples.java | 22 + .../FirewallRulesReplaceSamples.java | 38 + ...eoBackupPoliciesCreateOrUpdateSamples.java | 31 + .../GeoBackupPoliciesGetSamples.java | 26 + ...eoBackupPoliciesListByDatabaseSamples.java | 22 + ...Pv6FirewallRulesCreateOrUpdateSamples.java | 51 + .../IPv6FirewallRulesDeleteSamples.java | 25 + .../IPv6FirewallRulesGetSamples.java | 25 + .../IPv6FirewallRulesListByServerSamples.java | 22 + ...ceFailoverGroupsCreateOrUpdateSamples.java | 47 + .../InstanceFailoverGroupsDeleteSamples.java | 22 + ...InstanceFailoverGroupsFailoverSamples.java | 22 + ...oupsForceFailoverAllowDataLossSamples.java | 25 + .../InstanceFailoverGroupsGetSamples.java | 22 + ...ceFailoverGroupsListByLocationSamples.java | 22 + .../InstancePoolsCreateOrUpdateSamples.java | 71 + .../generated/InstancePoolsDeleteSamples.java | 22 + ...nstancePoolsGetByResourceGroupSamples.java | 22 + ...stancePoolsListByResourceGroupSamples.java | 22 + .../generated/InstancePoolsListSamples.java | 22 + .../generated/InstancePoolsUpdateSamples.java | 38 + .../JobAgentsCreateOrUpdateSamples.java | 27 + .../generated/JobAgentsDeleteSamples.java | 22 + .../generated/JobAgentsGetSamples.java | 22 + .../JobAgentsListByServerSamples.java | 22 + .../generated/JobAgentsUpdateSamples.java | 37 + .../JobCredentialsCreateOrUpdateSamples.java | 26 + .../JobCredentialsDeleteSamples.java | 22 + .../generated/JobCredentialsGetSamples.java | 22 + .../JobCredentialsListByAgentSamples.java | 22 + .../generated/JobExecutionsCancelSamples.java | 31 + .../JobExecutionsCreateOrUpdateSamples.java | 31 + .../generated/JobExecutionsCreateSamples.java | 22 + .../generated/JobExecutionsGetSamples.java | 31 + .../JobExecutionsListByAgentSamples.java | 51 + .../JobExecutionsListByJobSamples.java | 24 + .../JobStepExecutionsGetSamples.java | 32 + ...epExecutionsListByJobExecutionSamples.java | 38 + .../JobStepsCreateOrUpdateSamples.java | 82 + .../generated/JobStepsDeleteSamples.java | 22 + .../JobStepsGetByVersionSamples.java | 22 + .../generated/JobStepsGetSamples.java | 22 + .../generated/JobStepsListByJobSamples.java | 23 + .../JobStepsListByVersionSamples.java | 23 + .../JobTargetExecutionsGetSamples.java | 33 + ...etExecutionsListByJobExecutionSamples.java | 38 + .../JobTargetExecutionsListByStepSamples.java | 39 + .../JobTargetGroupsCreateOrUpdateSamples.java | 73 + .../JobTargetGroupsDeleteSamples.java | 22 + .../generated/JobTargetGroupsGetSamples.java | 22 + .../JobTargetGroupsListByAgentSamples.java | 22 + .../generated/JobVersionsGetSamples.java | 22 + .../JobVersionsListByJobSamples.java | 22 + .../generated/JobsCreateOrUpdateSamples.java | 49 + .../generated/JobsDeleteSamples.java | 22 + .../generated/generated/JobsGetSamples.java | 22 + .../generated/JobsListByAgentSamples.java | 22 + ...UploadsOperationCreateOrUpdateSamples.java | 28 + ...rDigestUploadsOperationDisableSamples.java | 26 + ...edgerDigestUploadsOperationGetSamples.java | 27 + ...UploadsOperationListByDatabaseSamples.java | 25 + ...tionBackupsCopyByResourceGroupSamples.java | 37 + .../LongTermRetentionBackupsCopySamples.java | 36 + ...onBackupsDeleteByResourceGroupSamples.java | 30 + ...LongTermRetentionBackupsDeleteSamples.java | 29 + ...ntionBackupsGetByResourceGroupSamples.java | 30 + .../LongTermRetentionBackupsGetSamples.java | 29 + ...RetentionBackupsListByDatabaseSamples.java | 25 + ...RetentionBackupsListByLocationSamples.java | 23 + ...upsListByResourceGroupDatabaseSamples.java | 26 + ...upsListByResourceGroupLocationSamples.java | 25 + ...ckupsListByResourceGroupServerSamples.java | 25 + ...rmRetentionBackupsListByServerSamples.java | 23 + ...onBackupsUpdateByResourceGroupSamples.java | 34 + ...LongTermRetentionBackupsUpdateSamples.java | 33 + ...ceBackupsDeleteByResourceGroupSamples.java | 30 + ...onManagedInstanceBackupsDeleteSamples.java | 29 + ...tanceBackupsGetByResourceGroupSamples.java | 30 + ...ntionManagedInstanceBackupsGetSamples.java | 30 + ...dInstanceBackupsListByDatabaseSamples.java | 25 + ...dInstanceBackupsListByInstanceSamples.java | 25 + ...dInstanceBackupsListByLocationSamples.java | 23 + ...upsListByResourceGroupDatabaseSamples.java | 26 + ...upsListByResourceGroupInstanceSamples.java | 25 + ...upsListByResourceGroupLocationSamples.java | 25 + ...etentionPoliciesCreateOrUpdateSamples.java | 31 + .../LongTermRetentionPoliciesGetSamples.java | 27 + ...etentionPoliciesListByDatabaseSamples.java | 23 + ...nanceWindowOptionsOperationGetSamples.java | 25 + ...WindowsOperationCreateOrUpdateSamples.java | 42 + ...MaintenanceWindowsOperationGetSamples.java | 25 + ...etentionPoliciesCreateOrUpdateSamples.java | 28 + ...pShortTermRetentionPoliciesGetSamples.java | 31 + ...etentionPoliciesListByDatabaseSamples.java | 25 + ...ortTermRetentionPoliciesUpdateSamples.java | 31 + ...otectionSettingsCreateOrUpdateSamples.java | 59 + ...cedThreatProtectionSettingsGetSamples.java | 31 + ...otectionSettingsListByDatabaseSamples.java | 25 + .../ManagedDatabaseColumnsGetSamples.java | 24 + ...dDatabaseColumnsListByDatabaseSamples.java | 48 + ...agedDatabaseColumnsListByTableSamples.java | 24 + ...nagedDatabaseMoveOperationsGetSamples.java | 26 + ...seMoveOperationsListByLocationSamples.java | 56 + .../ManagedDatabaseQueriesGetSamples.java | 24 + ...agedDatabaseQueriesListByQuerySamples.java | 71 + ...mmendedSensitivityLabelsUpdateSamples.java | 52 + ...nagedDatabaseRestoreDetailsGetSamples.java | 26 + .../ManagedDatabaseSchemasGetSamples.java | 24 + ...dDatabaseSchemasListByDatabaseSamples.java | 24 + ...ityAlertPoliciesCreateOrUpdateSamples.java | 62 + ...tabaseSecurityAlertPoliciesGetSamples.java | 26 + ...ityAlertPoliciesListByDatabaseSamples.java | 25 + ...seSecurityEventsListByDatabaseSamples.java | 48 + ...ensitivityLabelsCreateOrUpdateSamples.java | 32 + ...atabaseSensitivityLabelsDeleteSamples.java | 26 + ...ityLabelsDisableRecommendationSamples.java | 26 + ...vityLabelsEnableRecommendationSamples.java | 26 + ...edDatabaseSensitivityLabelsGetSamples.java | 34 + ...ityLabelsListCurrentByDatabaseSamples.java | 25 + ...abelsListRecommendedByDatabaseSamples.java | 25 + ...atabaseSensitivityLabelsUpdateSamples.java | 65 + .../ManagedDatabaseTablesGetSamples.java | 24 + ...agedDatabaseTablesListBySchemaSamples.java | 24 + ...ntDataEncryptionCreateOrUpdateSamples.java | 36 + ...seTransparentDataEncryptionGetSamples.java | 31 + ...ntDataEncryptionListByDatabaseSamples.java | 25 + ...entRuleBaselinesCreateOrUpdateSamples.java | 47 + ...yAssessmentRuleBaselinesDeleteSamples.java | 34 + ...lityAssessmentRuleBaselinesGetSamples.java | 34 + ...erabilityAssessmentScansExportSamples.java | 32 + ...ulnerabilityAssessmentScansGetSamples.java | 32 + ...ityAssessmentScansInitiateScanSamples.java | 32 + ...yAssessmentScansListByDatabaseSamples.java | 31 + ...ilityAssessmentsCreateOrUpdateSamples.java | 65 + ...VulnerabilityAssessmentsDeleteSamples.java | 31 + ...aseVulnerabilityAssessmentsGetSamples.java | 31 + ...ilityAssessmentsListByDatabaseSamples.java | 26 + .../ManagedDatabasesCancelMoveSamples.java | 32 + .../ManagedDatabasesCompleteMoveSamples.java | 32 + ...anagedDatabasesCompleteRestoreSamples.java | 31 + ...ManagedDatabasesCreateOrUpdateSamples.java | 174 + .../ManagedDatabasesDeleteSamples.java | 22 + .../generated/ManagedDatabasesGetSamples.java | 22 + ...ManagedDatabasesListByInstanceSamples.java | 22 + ...asesListInaccessibleByInstanceSamples.java | 23 + .../ManagedDatabasesStartMoveSamples.java | 57 + .../ManagedDatabasesUpdateSamples.java | 60 + ...ceAdministratorsCreateOrUpdateSamples.java | 60 + ...edInstanceAdministratorsDeleteSamples.java | 26 + ...nagedInstanceAdministratorsGetSamples.java | 26 + ...ceAdministratorsListByInstanceSamples.java | 24 + ...otectionSettingsCreateOrUpdateSamples.java | 57 + ...cedThreatProtectionSettingsGetSamples.java | 27 + ...otectionSettingsListByInstanceSamples.java | 25 + ...yAuthenticationsCreateOrUpdateSamples.java | 28 + ...ureADOnlyAuthenticationsDeleteSamples.java | 26 + ...eAzureADOnlyAuthenticationsGetSamples.java | 26 + ...yAuthenticationsListByInstanceSamples.java | 25 + ...agedInstanceDtcsCreateOrUpdateSamples.java | 66 + .../ManagedInstanceDtcsGetSamples.java | 23 + ...tanceDtcsListByManagedInstanceSamples.java | 23 + ...yptionProtectorsCreateOrUpdateSamples.java | 54 + ...nstanceEncryptionProtectorsGetSamples.java | 25 + ...yptionProtectorsListByInstanceSamples.java | 25 + ...EncryptionProtectorsRevalidateSamples.java | 25 + ...agedInstanceKeysCreateOrUpdateSamples.java | 28 + .../ManagedInstanceKeysDeleteSamples.java | 28 + .../ManagedInstanceKeysGetSamples.java | 28 + ...agedInstanceKeysListByInstanceSamples.java | 22 + ...etentionPoliciesCreateOrUpdateSamples.java | 31 + ...ceLongTermRetentionPoliciesGetSamples.java | 31 + ...etentionPoliciesListByDatabaseSamples.java | 25 + ...anagedInstanceOperationsCancelSamples.java | 30 + .../ManagedInstanceOperationsGetSamples.java | 30 + ...perationsListByManagedInstanceSamples.java | 23 + ...pointConnectionsCreateOrUpdateSamples.java | 31 + ...ivateEndpointConnectionsDeleteSamples.java | 25 + ...ePrivateEndpointConnectionsGetSamples.java | 24 + ...nnectionsListByManagedInstanceSamples.java | 23 + ...nstancePrivateLinkResourcesGetSamples.java | 22 + ...ResourcesListByManagedInstanceSamples.java | 22 + ...dInstanceTdeCertificatesCreateSamples.java | 25 + ...ilityAssessmentsCreateOrUpdateSamples.java | 79 + ...VulnerabilityAssessmentsDeleteSamples.java | 30 + ...nceVulnerabilityAssessmentsGetSamples.java | 30 + ...ilityAssessmentsListByInstanceSamples.java | 25 + ...ManagedInstancesCreateOrUpdateSamples.java | 104 + .../ManagedInstancesDeleteSamples.java | 22 + .../ManagedInstancesFailoverSamples.java | 23 + ...gedInstancesGetByResourceGroupSamples.java | 35 + ...gedInstancesListByInstancePoolSamples.java | 35 + ...InstancesListByManagedInstanceSamples.java | 78 + ...edInstancesListByResourceGroupSamples.java | 35 + .../ManagedInstancesListSamples.java | 35 + .../ManagedInstancesUpdateSamples.java | 98 + ...etentionPoliciesCreateOrUpdateSamples.java | 33 + ...pShortTermRetentionPoliciesGetSamples.java | 31 + ...iciesListByRestorableDroppedDatabaseS.java | 26 + ...ortTermRetentionPoliciesUpdateSamples.java | 33 + ...ManagedServerDnsAliasesAcquireSamples.java | 32 + ...ServerDnsAliasesCreateOrUpdateSamples.java | 24 + .../ManagedServerDnsAliasesDeleteSamples.java | 22 + .../ManagedServerDnsAliasesGetSamples.java | 22 + ...nsAliasesListByManagedInstanceSamples.java | 22 + ...ityAlertPoliciesCreateOrUpdateSamples.java | 62 + ...ServerSecurityAlertPoliciesGetSamples.java | 26 + ...ityAlertPoliciesListByInstanceSamples.java | 25 + ...undFirewallRulesCreateOrUpdateSamples.java | 25 + .../OutboundFirewallRulesDeleteSamples.java | 25 + .../OutboundFirewallRulesGetSamples.java | 24 + ...boundFirewallRulesListByServerSamples.java | 23 + ...pointConnectionsCreateOrUpdateSamples.java | 32 + ...ivateEndpointConnectionsDeleteSamples.java | 25 + .../PrivateEndpointConnectionsGetSamples.java | 24 + ...ndpointConnectionsListByServerSamples.java | 23 + .../PrivateLinkResourcesGetSamples.java | 22 + ...ivateLinkResourcesListByServerSamples.java | 22 + ...mmendedSensitivityLabelsUpdateSamples.java | 52 + .../RecoverableDatabasesGetSamples.java | 28 + ...coverableDatabasesListByServerSamples.java | 24 + ...RecoverableManagedDatabasesGetSamples.java | 23 + ...ManagedDatabasesListByInstanceSamples.java | 23 + .../ReplicationLinksDeleteSamples.java | 24 + ...tionLinksFailoverAllowDataLossSamples.java | 25 + .../ReplicationLinksFailoverSamples.java | 24 + .../generated/ReplicationLinksGetSamples.java | 24 + ...ReplicationLinksListByDatabaseSamples.java | 23 + .../ReplicationLinksListByServerSamples.java | 22 + .../RestorableDroppedDatabasesGetSamples.java | 24 + ...leDroppedDatabasesListByServerSamples.java | 23 + ...ableDroppedManagedDatabasesGetSamples.java | 25 + ...ManagedDatabasesListByInstanceSamples.java | 23 + .../generated/RestorePointsCreateSamples.java | 31 + .../generated/RestorePointsDeleteSamples.java | 25 + .../generated/RestorePointsGetSamples.java | 41 + .../RestorePointsListByDatabaseSamples.java | 35 + ...ensitivityLabelsCreateOrUpdateSamples.java | 40 + .../SensitivityLabelsDeleteSamples.java | 25 + ...ityLabelsDisableRecommendationSamples.java | 26 + ...vityLabelsEnableRecommendationSamples.java | 26 + .../SensitivityLabelsGetSamples.java | 34 + ...ityLabelsListCurrentByDatabaseSamples.java | 25 + ...abelsListRecommendedByDatabaseSamples.java | 25 + .../SensitivityLabelsUpdateSamples.java | 68 + ...otectionSettingsCreateOrUpdateSamples.java | 57 + ...cedThreatProtectionSettingsGetSamples.java | 27 + ...ProtectionSettingsListByServerSamples.java | 25 + .../generated/ServerAdvisorsGetSamples.java | 22 + .../ServerAdvisorsListByServerSamples.java | 37 + .../ServerAdvisorsUpdateSamples.java | 31 + .../ServerAutomaticTuningGetSamples.java | 22 + .../ServerAutomaticTuningUpdateSamples.java | 75 + ...ADAdministratorsCreateOrUpdateSamples.java | 33 + ...verAzureADAdministratorsDeleteSamples.java | 26 + ...ServerAzureADAdministratorsGetSamples.java | 26 + ...reADAdministratorsListByServerSamples.java | 23 + ...yAuthenticationsCreateOrUpdateSamples.java | 28 + ...ureADOnlyAuthenticationsDeleteSamples.java | 26 + ...rAzureADOnlyAuthenticationsGetSamples.java | 26 + ...nlyAuthenticationsListByServerSamples.java | 23 + ...AuditingPoliciesCreateOrUpdateSamples.java | 73 + .../ServerBlobAuditingPoliciesGetSamples.java | 24 + ...obAuditingPoliciesListByServerSamples.java | 24 + ...mmunicationLinksCreateOrUpdateSamples.java | 25 + ...ServerCommunicationLinksDeleteSamples.java | 24 + .../ServerCommunicationLinksGetSamples.java | 24 + ...CommunicationLinksListByServerSamples.java | 22 + ...nnectionPoliciesCreateOrUpdateSamples.java | 30 + .../ServerConnectionPoliciesGetSamples.java | 25 + ...ConnectionPoliciesListByServerSamples.java | 22 + ...OpsAuditSettingsCreateOrUpdateSamples.java | 64 + .../ServerDevOpsAuditSettingsGetSamples.java | 25 + ...evOpsAuditSettingsListByServerSamples.java | 22 + .../ServerDnsAliasesAcquireSamples.java | 32 + ...ServerDnsAliasesCreateOrUpdateSamples.java | 22 + .../ServerDnsAliasesDeleteSamples.java | 22 + .../generated/ServerDnsAliasesGetSamples.java | 22 + .../ServerDnsAliasesListByServerSamples.java | 22 + .../ServerKeysCreateOrUpdateSamples.java | 28 + .../generated/ServerKeysDeleteSamples.java | 28 + .../generated/ServerKeysGetSamples.java | 28 + .../ServerKeysListByServerSamples.java | 22 + .../ServerOperationsListByServerSamples.java | 22 + ...ityAlertPoliciesCreateOrUpdateSamples.java | 62 + ...ServerSecurityAlertPoliciesGetSamples.java | 25 + ...urityAlertPoliciesListByServerSamples.java | 23 + ...rustCertificatesCreateOrUpdateSamples.java | 25 + .../ServerTrustCertificatesDeleteSamples.java | 22 + .../ServerTrustCertificatesGetSamples.java | 22 + ...rustCertificatesListByInstanceSamples.java | 23 + ...erverTrustGroupsCreateOrUpdateSamples.java | 42 + .../ServerTrustGroupsDeleteSamples.java | 22 + .../ServerTrustGroupsGetSamples.java | 22 + ...erverTrustGroupsListByInstanceSamples.java | 23 + ...erverTrustGroupsListByLocationSamples.java | 22 + .../ServerUsagesListByServerSamples.java | 22 + ...ilityAssessmentsCreateOrUpdateSamples.java | 77 + ...VulnerabilityAssessmentsDeleteSamples.java | 30 + ...verVulnerabilityAssessmentsGetSamples.java | 29 + ...abilityAssessmentsListByServerSamples.java | 25 + .../ServersCheckNameAvailabilitySamples.java | 54 + .../ServersCreateOrUpdateSamples.java | 41 + .../generated/ServersDeleteSamples.java | 22 + .../ServersGetByResourceGroupSamples.java | 34 + .../ServersImportDatabaseSamples.java | 70 + .../ServersListByResourceGroupSamples.java | 35 + .../generated/ServersListSamples.java | 35 + .../generated/ServersUpdateSamples.java | 34 + .../ServiceObjectivesGetSamples.java | 24 + .../ServiceObjectivesListByServerSamples.java | 22 + .../SqlAgentCreateOrUpdateSamples.java | 31 + .../generated/SqlAgentGetSamples.java | 23 + ...erabilityAssessmentBaselineGetSamples.java | 32 + ...stBySqlVulnerabilityAssessmentSamples.java | 30 + ...selinesOperationCreateOrUpdateSamples.java | 76 + ...tyAssessmentExecuteScanExecuteSamples.java | 30 + ...mentRuleBaselineCreateOrUpdateSamples.java | 43 + ...ilityAssessmentRuleBaselineGetSamples.java | 33 + ...mentRuleBaselineListByBaselineSamples.java | 32 + ...ntRuleBaselinesOperationDeleteSamples.java | 33 + ...sessmentScanResultOperationGetSamples.java | 32 + ...tScanResultOperationListByScanSamples.java | 31 + ...ulnerabilityAssessmentScansGetSamples.java | 31 + ...tBySqlVulnerabilityAssessmentsSamples.java | 30 + ...VulnerabilityAssessmentsDeleteSamples.java | 29 + ...essmentsSettingsCreateOrUpdateSamples.java | 29 + ...rabilityAssessmentsSettingsGetSamples.java | 29 + ...ssessmentsSettingsListByServerSamples.java | 25 + .../SubscriptionUsagesGetSamples.java | 23 + ...bscriptionUsagesListByLocationSamples.java | 23 + ...seLinkWorkspacesListByDatabaseSamples.java | 25 + .../SyncAgentsCreateOrUpdateSamples.java | 50 + .../generated/SyncAgentsDeleteSamples.java | 22 + .../SyncAgentsGenerateKeySamples.java | 24 + .../generated/SyncAgentsGetSamples.java | 24 + .../SyncAgentsListByServerSamples.java | 22 + .../SyncAgentsListLinkedDatabasesSamples.java | 24 + .../SyncGroupsCancelSyncSamples.java | 25 + .../SyncGroupsCreateOrUpdateSamples.java | 54 + .../generated/SyncGroupsDeleteSamples.java | 25 + .../generated/SyncGroupsGetSamples.java | 25 + .../SyncGroupsListByDatabaseSamples.java | 24 + .../SyncGroupsListHubSchemasSamples.java | 25 + .../generated/SyncGroupsListLogsSamples.java | 34 + .../SyncGroupsListSyncDatabaseIdsSamples.java | 22 + .../SyncGroupsRefreshHubSchemaSamples.java | 25 + .../SyncGroupsTriggerSyncSamples.java | 25 + .../generated/SyncGroupsUpdateSamples.java | 43 + .../SyncMembersCreateOrUpdateSamples.java | 61 + .../generated/SyncMembersDeleteSamples.java | 30 + .../generated/SyncMembersGetSamples.java | 30 + .../SyncMembersListBySyncGroupSamples.java | 25 + .../SyncMembersListMemberSchemasSamples.java | 30 + ...SyncMembersRefreshMemberSchemaSamples.java | 30 + .../generated/SyncMembersUpdateSamples.java | 46 + .../TdeCertificatesCreateSamples.java | 25 + .../generated/TimeZonesGetSamples.java | 22 + .../TimeZonesListByLocationSamples.java | 23 + ...tDataEncryptionsCreateOrUpdateSamples.java | 36 + .../TransparentDataEncryptionsGetSamples.java | 31 + ...tDataEncryptionsListByDatabaseSamples.java | 25 + .../UsagesListByInstancePoolSamples.java | 35 + .../VirtualClustersDeleteSamples.java | 22 + ...tualClustersGetByResourceGroupSamples.java | 24 + ...ualClustersListByResourceGroupSamples.java | 22 + .../generated/VirtualClustersListSamples.java | 22 + ...irtualClustersUpdateDnsServersSamples.java | 25 + .../VirtualClustersUpdateSamples.java | 42 + ...tualNetworkRulesCreateOrUpdateSamples.java | 27 + .../VirtualNetworkRulesDeleteSamples.java | 22 + .../VirtualNetworkRulesGetSamples.java | 22 + ...irtualNetworkRulesListByServerSamples.java | 22 + ...kloadClassifiersCreateOrUpdateSamples.java | 49 + .../WorkloadClassifiersDeleteSamples.java | 30 + .../WorkloadClassifiersGetSamples.java | 26 + ...ClassifiersListByWorkloadGroupSamples.java | 25 + .../WorkloadGroupsCreateOrUpdateSamples.java | 51 + .../WorkloadGroupsDeleteSamples.java | 24 + .../generated/WorkloadGroupsGetSamples.java | 24 + .../WorkloadGroupsListByDatabaseSamples.java | 23 + sdk/sql/ci.yml | 47 + sdk/sql/pom.xml | 15 + 2025 files changed, 376745 insertions(+) create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/CHANGELOG.md create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/README.md create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/SAMPLE.md create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/pom.xml create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/SqlManager.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/BackupShortTermRetentionPoliciesClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/CapabilitiesClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DataMaskingPoliciesClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DataMaskingRulesClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DataWarehouseUserActivitiesOperationsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseAdvancedThreatProtectionSettingsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseAdvisorsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseAutomaticTuningsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseBlobAuditingPoliciesClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseColumnsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseExtensionsOperationsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseOperationsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseRecommendedActionsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseSchemasClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseSecurityAlertPoliciesClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseSqlVulnerabilityAssessmentBaselinesClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseSqlVulnerabilityAssessmentExecuteScansClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseSqlVulnerabilityAssessmentRuleBaselinesClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseSqlVulnerabilityAssessmentScanResultsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseSqlVulnerabilityAssessmentScansClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseSqlVulnerabilityAssessmentsSettingsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseTablesClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseUsagesClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseVulnerabilityAssessmentRuleBaselinesClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseVulnerabilityAssessmentScansClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseVulnerabilityAssessmentsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabasesClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DeletedServersClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DistributedAvailabilityGroupsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ElasticPoolActivitiesClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ElasticPoolDatabaseActivitiesClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ElasticPoolOperationsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ElasticPoolsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/EncryptionProtectorsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/EndpointCertificatesClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ExtendedDatabaseBlobAuditingPoliciesClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ExtendedServerBlobAuditingPoliciesClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/FailoverGroupsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/FirewallRulesClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/GeoBackupPoliciesClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/IPv6FirewallRulesClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/InstanceFailoverGroupsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/InstancePoolsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobAgentsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobCredentialsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobExecutionsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobStepExecutionsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobStepsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobTargetExecutionsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobTargetGroupsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobVersionsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/LedgerDigestUploadsOperationsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/LongTermRetentionBackupsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/LongTermRetentionManagedInstanceBackupsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/LongTermRetentionPoliciesClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/MaintenanceWindowOptionsOperationsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/MaintenanceWindowsOperationsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedBackupShortTermRetentionPoliciesClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseAdvancedThreatProtectionSettingsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseColumnsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseMoveOperationsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseQueriesClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseRecommendedSensitivityLabelsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseRestoreDetailsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseSchemasClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseSecurityAlertPoliciesClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseSecurityEventsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseSensitivityLabelsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseTablesClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseTransparentDataEncryptionsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseVulnerabilityAssessmentScansClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseVulnerabilityAssessmentsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabasesClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceAdministratorsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceAdvancedThreatProtectionSettingsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceAzureADOnlyAuthenticationsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceDtcsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceEncryptionProtectorsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceKeysClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceLongTermRetentionPoliciesClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceOperationsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstancePrivateEndpointConnectionsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstancePrivateLinkResourcesClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceTdeCertificatesClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceVulnerabilityAssessmentsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstancesClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedServerDnsAliasesClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedServerSecurityAlertPoliciesClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/OperationsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/OutboundFirewallRulesClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/PrivateEndpointConnectionsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/PrivateLinkResourcesClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/RecommendedSensitivityLabelsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/RecoverableDatabasesClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/RecoverableManagedDatabasesClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ReplicationLinksClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/RestorableDroppedDatabasesClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/RestorableDroppedManagedDatabasesClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/RestorePointsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SensitivityLabelsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerAdvancedThreatProtectionSettingsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerAdvisorsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerAutomaticTuningsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerAzureADAdministratorsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerAzureADOnlyAuthenticationsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerBlobAuditingPoliciesClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerCommunicationLinksClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerConnectionPoliciesClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerDevOpsAuditSettingsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerDnsAliasesClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerKeysClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerOperationsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerSecurityAlertPoliciesClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerTrustCertificatesClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerTrustGroupsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerUsagesClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerVulnerabilityAssessmentsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServersClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServiceObjectivesClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SqlAgentsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SqlManagementClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SqlVulnerabilityAssessmentBaselinesClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SqlVulnerabilityAssessmentBaselinesOperationsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SqlVulnerabilityAssessmentExecuteScansClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SqlVulnerabilityAssessmentRuleBaselinesClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SqlVulnerabilityAssessmentRuleBaselinesOperationsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SqlVulnerabilityAssessmentScanResultOperationsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SqlVulnerabilityAssessmentScansClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SqlVulnerabilityAssessmentsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SqlVulnerabilityAssessmentsSettingsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SubscriptionUsagesClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SynapseLinkWorkspacesClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SyncAgentsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SyncGroupsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SyncMembersClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/TdeCertificatesClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/TimeZonesClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/TransparentDataEncryptionsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/UsagesClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/VirtualClustersClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/VirtualNetworkRulesClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/WorkloadClassifiersClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/WorkloadGroupsClient.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/AdministratorProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/AdvancedThreatProtectionProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/AdvisorInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/AdvisorProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/AutomaticTuningServerProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/AzureADOnlyAuthProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/BackupShortTermRetentionPolicyInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/BackupShortTermRetentionPolicyProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/BaseLongTermRetentionPolicyProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/CheckNameAvailabilityResponseInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/CopyLongTermRetentionBackupParametersProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DataMaskingPolicyInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DataMaskingPolicyProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DataMaskingRuleInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DataMaskingRuleProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DataWarehouseUserActivitiesInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DataWarehouseUserActivitiesProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseAdvancedThreatProtectionInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseAutomaticTuningInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseAutomaticTuningProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseBlobAuditingPolicyInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseBlobAuditingPolicyProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseColumnInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseColumnProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseExtensionsProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseOperationInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseOperationProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseSchemaInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseSecurityAlertPolicyInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseSqlVulnerabilityAssessmentBaselineSetInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseSqlVulnerabilityAssessmentBaselineSetProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseSqlVulnerabilityAssessmentRuleBaselineInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseSqlVulnerabilityAssessmentRuleBaselineInputProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseSqlVulnerabilityAssessmentRuleBaselineListInputProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseSqlVulnerabilityAssessmentRuleBaselineProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseTableInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseTableProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseUpdateProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseUsageInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseUsageProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseVulnerabilityAssessmentInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseVulnerabilityAssessmentProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseVulnerabilityAssessmentRuleBaselineInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseVulnerabilityAssessmentRuleBaselineProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseVulnerabilityAssessmentScanExportProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseVulnerabilityAssessmentScansExportInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DeletedServerInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DeletedServerProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DistributedAvailabilityGroupInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DistributedAvailabilityGroupProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolActivityInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolActivityProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolDatabaseActivityInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolDatabaseActivityProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolOperationInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolOperationProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolUpdateProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/EncryptionProtectorInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/EncryptionProtectorProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/EndpointCertificateInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/EndpointCertificateProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ExtendedDatabaseBlobAuditingPolicyInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ExtendedDatabaseBlobAuditingPolicyProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ExtendedServerBlobAuditingPolicyInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ExtendedServerBlobAuditingPolicyProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/FailoverGroupInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/FailoverGroupProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/FailoverGroupUpdateProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/FirewallRuleInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/GeoBackupPolicyInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/GeoBackupPolicyProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/IPv6FirewallRuleInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/IPv6ServerFirewallRuleProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ImportExportExtensionsOperationResultInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ImportExportExtensionsOperationResultProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ImportExportOperationResultInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ImportExportOperationResultProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/InstanceFailoverGroupInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/InstanceFailoverGroupProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/InstancePoolInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/InstancePoolProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobAgentInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobAgentProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobCredentialInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobCredentialProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobExecutionInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobExecutionProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobStepInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobStepProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobTargetGroupInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobTargetGroupProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobVersionInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LedgerDigestUploadsInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LedgerDigestUploadsProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LocationCapabilitiesInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LogicalDatabaseTransparentDataEncryptionInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LongTermRetentionBackupInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LongTermRetentionBackupOperationResultInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LongTermRetentionBackupProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LongTermRetentionOperationResultProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LongTermRetentionPolicyInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/MaintenanceWindowOptionsInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/MaintenanceWindowOptionsProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/MaintenanceWindowsInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/MaintenanceWindowsProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedBackupShortTermRetentionPolicyInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedBackupShortTermRetentionPolicyProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedDatabaseAdvancedThreatProtectionInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedDatabaseInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedDatabaseMoveOperationResultInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedDatabaseMoveOperationResultProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedDatabaseProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedDatabaseRestoreDetailsProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedDatabaseRestoreDetailsResultInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedDatabaseSecurityAlertPolicyInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceAdministratorInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceAdministratorProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceAdvancedThreatProtectionInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceAzureADOnlyAuthProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceAzureADOnlyAuthenticationInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceDtcInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceDtcProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceEncryptionProtectorInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceEncryptionProtectorProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceKeyInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceKeyProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceLongTermRetentionBackupInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceLongTermRetentionBackupProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceLongTermRetentionPolicyInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceOperationInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceOperationProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstancePrivateEndpointConnectionInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstancePrivateEndpointConnectionProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstancePrivateLinkInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceQueryInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceVulnerabilityAssessmentInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceVulnerabilityAssessmentProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedServerDnsAliasInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedServerDnsAliasProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedServerSecurityAlertPolicyInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedTransparentDataEncryptionInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedTransparentDataEncryptionProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/MetricDefinitionInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/MetricInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/OperationInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/OutboundFirewallRuleInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/OutboundFirewallRuleProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/PrivateEndpointConnectionInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/PrivateEndpointConnectionProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/PrivateLinkResourceInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/QueryProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/QueryStatisticsInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/QueryStatisticsProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RecommendedActionInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RecommendedActionProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RecommendedSensitivityLabelUpdateProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RecoverableDatabaseInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RecoverableDatabaseProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RecoverableManagedDatabaseInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RecoverableManagedDatabaseProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ReplicationLinkInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ReplicationLinkProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RestorableDroppedDatabaseInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RestorableDroppedDatabaseProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RestorableDroppedManagedDatabaseInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RestorableDroppedManagedDatabaseProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RestorePointInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RestorePointProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SecurityAlertPolicyProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SecurityAlertsPolicyProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SecurityEventInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SecurityEventProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SensitivityLabelInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SensitivityLabelProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SensitivityLabelUpdateInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SensitivityLabelUpdatePropertiesInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerAdvancedThreatProtectionInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerAutomaticTuningInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerAzureADAdministratorInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerAzureADOnlyAuthenticationInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerBlobAuditingPolicyInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerBlobAuditingPolicyProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerCommunicationLinkInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerCommunicationLinkProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerConnectionPolicyInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerConnectionPolicyProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerDevOpsAuditSettingsProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerDevOpsAuditingSettingsInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerDnsAliasInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerDnsAliasProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerFirewallRuleProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerKeyInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerKeyProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerOperationInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerOperationProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerSecurityAlertPolicyInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerTrustCertificateInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerTrustCertificateProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerTrustGroupInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerTrustGroupProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerUsageInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerVulnerabilityAssessmentInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerVulnerabilityAssessmentProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServiceObjectiveInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServiceObjectiveProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SqlAgentConfigurationInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SqlAgentConfigurationProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SqlVulnerabilityAssessmentInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SqlVulnerabilityAssessmentPolicyProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SqlVulnerabilityAssessmentScanRecordInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SqlVulnerabilityAssessmentScanRecordProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SqlVulnerabilityAssessmentScanResultProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SqlVulnerabilityAssessmentScanResultsInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SubscriptionUsageInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SubscriptionUsageProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SynapseLinkWorkspaceInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SynapseLinkWorkspaceProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncAgentInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncAgentKeyPropertiesInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncAgentLinkedDatabaseInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncAgentLinkedDatabaseProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncAgentProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncDatabaseIdPropertiesInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncFullSchemaPropertiesInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncGroupInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncGroupLogPropertiesInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncGroupProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncMemberInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncMemberProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/TdeCertificateProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/TimeZoneInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/TimeZoneProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/TopQueriesInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/TransparentDataEncryptionProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/UpdateLongTermRetentionBackupParametersProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/UpdateVirtualClusterDnsServersOperationInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/UsageInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/VirtualClusterDnsServersProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/VirtualClusterInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/VirtualClusterProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/VirtualNetworkRuleInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/VirtualNetworkRuleProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/VulnerabilityAssessmentScanRecordInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/VulnerabilityAssessmentScanRecordProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/WorkloadClassifierInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/WorkloadClassifierProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/WorkloadGroupInner.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/WorkloadGroupProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/package-info.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/package-info.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/AdvisorImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/BackupShortTermRetentionPoliciesClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/BackupShortTermRetentionPoliciesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/BackupShortTermRetentionPolicyImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/CapabilitiesClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/CapabilitiesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/CheckNameAvailabilityResponseImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataMaskingPoliciesClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataMaskingPoliciesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataMaskingPolicyImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataMaskingRuleImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataMaskingRulesClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataMaskingRulesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataWarehouseUserActivitiesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataWarehouseUserActivitiesOperationsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataWarehouseUserActivitiesOperationsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseAdvancedThreatProtectionImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseAdvancedThreatProtectionSettingsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseAdvancedThreatProtectionSettingsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseAdvisorsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseAdvisorsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseAutomaticTuningImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseAutomaticTuningsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseAutomaticTuningsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseBlobAuditingPoliciesClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseBlobAuditingPoliciesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseBlobAuditingPolicyImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseColumnImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseColumnsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseColumnsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseExtensionsOperationsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseExtensionsOperationsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseOperationImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseOperationsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseOperationsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseRecommendedActionsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseRecommendedActionsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSchemaImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSchemasClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSchemasImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSecurityAlertPoliciesClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSecurityAlertPoliciesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSecurityAlertPolicyImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSqlVulnerabilityAssessmentBaselineSetImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSqlVulnerabilityAssessmentBaselinesClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSqlVulnerabilityAssessmentBaselinesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSqlVulnerabilityAssessmentExecuteScansClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSqlVulnerabilityAssessmentExecuteScansImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSqlVulnerabilityAssessmentRuleBaselineImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSqlVulnerabilityAssessmentRuleBaselinesClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSqlVulnerabilityAssessmentRuleBaselinesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSqlVulnerabilityAssessmentScanResultsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSqlVulnerabilityAssessmentScanResultsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSqlVulnerabilityAssessmentScansClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSqlVulnerabilityAssessmentScansImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSqlVulnerabilityAssessmentsSettingsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSqlVulnerabilityAssessmentsSettingsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseTableImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseTablesClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseTablesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseUsageImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseUsagesClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseUsagesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentRuleBaselineImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentRuleBaselinesClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentRuleBaselinesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentScansClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentScansExportImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentScansImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabasesClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabasesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DeletedServerImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DeletedServersClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DeletedServersImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DistributedAvailabilityGroupImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DistributedAvailabilityGroupsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DistributedAvailabilityGroupsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolActivitiesClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolActivitiesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolActivityImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolDatabaseActivitiesClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolDatabaseActivitiesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolDatabaseActivityImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolOperationImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolOperationsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolOperationsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/EncryptionProtectorImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/EncryptionProtectorsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/EncryptionProtectorsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/EndpointCertificateImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/EndpointCertificatesClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/EndpointCertificatesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ExtendedDatabaseBlobAuditingPoliciesClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ExtendedDatabaseBlobAuditingPoliciesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ExtendedDatabaseBlobAuditingPolicyImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ExtendedServerBlobAuditingPoliciesClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ExtendedServerBlobAuditingPoliciesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ExtendedServerBlobAuditingPolicyImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/FailoverGroupImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/FailoverGroupsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/FailoverGroupsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/FirewallRuleImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/FirewallRulesClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/FirewallRulesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/GeoBackupPoliciesClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/GeoBackupPoliciesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/GeoBackupPolicyImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/IPv6FirewallRuleImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/IPv6FirewallRulesClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/IPv6FirewallRulesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ImportExportExtensionsOperationResultImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ImportExportOperationResultImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/InstanceFailoverGroupImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/InstanceFailoverGroupsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/InstanceFailoverGroupsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/InstancePoolImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/InstancePoolsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/InstancePoolsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobAgentImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobAgentsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobAgentsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobCredentialImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobCredentialsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobCredentialsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobExecutionImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobExecutionsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobExecutionsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobStepExecutionsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobStepExecutionsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobStepImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobStepsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobStepsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobTargetExecutionsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobTargetExecutionsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobTargetGroupImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobTargetGroupsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobTargetGroupsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobVersionImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobVersionsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobVersionsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LedgerDigestUploadsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LedgerDigestUploadsOperationsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LedgerDigestUploadsOperationsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LocationCapabilitiesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LogicalDatabaseTransparentDataEncryptionImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionBackupImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionBackupOperationResultImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionBackupsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionBackupsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionManagedInstanceBackupsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionManagedInstanceBackupsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionPoliciesClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionPoliciesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionPolicyImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/MaintenanceWindowOptionsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/MaintenanceWindowOptionsOperationsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/MaintenanceWindowOptionsOperationsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/MaintenanceWindowsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/MaintenanceWindowsOperationsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/MaintenanceWindowsOperationsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedBackupShortTermRetentionPoliciesClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedBackupShortTermRetentionPoliciesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedBackupShortTermRetentionPolicyImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseAdvancedThreatProtectionImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseAdvancedThreatProtectionSettingsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseAdvancedThreatProtectionSettingsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseColumnsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseColumnsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseMoveOperationResultImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseMoveOperationsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseMoveOperationsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseQueriesClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseQueriesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseRecommendedSensitivityLabelsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseRecommendedSensitivityLabelsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseRestoreDetailsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseRestoreDetailsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseRestoreDetailsResultImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSchemasClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSchemasImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSecurityAlertPoliciesClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSecurityAlertPoliciesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSecurityAlertPolicyImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSecurityEventsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSecurityEventsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSensitivityLabelsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSensitivityLabelsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseTablesClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseTablesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseTransparentDataEncryptionsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseTransparentDataEncryptionsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseVulnerabilityAssessmentScansClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseVulnerabilityAssessmentScansImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseVulnerabilityAssessmentsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseVulnerabilityAssessmentsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabasesClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabasesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAdministratorImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAdministratorsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAdministratorsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAdvancedThreatProtectionImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAdvancedThreatProtectionSettingsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAdvancedThreatProtectionSettingsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAzureADOnlyAuthenticationImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAzureADOnlyAuthenticationsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAzureADOnlyAuthenticationsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceDtcImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceDtcsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceDtcsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceEncryptionProtectorImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceEncryptionProtectorsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceEncryptionProtectorsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceKeyImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceKeysClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceKeysImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceLongTermRetentionBackupImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceLongTermRetentionPoliciesClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceLongTermRetentionPoliciesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceLongTermRetentionPolicyImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceOperationImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceOperationsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceOperationsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstancePrivateEndpointConnectionImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstancePrivateEndpointConnectionsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstancePrivateEndpointConnectionsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstancePrivateLinkImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstancePrivateLinkResourcesClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstancePrivateLinkResourcesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceQueryImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceTdeCertificatesClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceTdeCertificatesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceVulnerabilityAssessmentImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceVulnerabilityAssessmentsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceVulnerabilityAssessmentsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstancesClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstancesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedServerDnsAliasImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedServerDnsAliasesClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedServerDnsAliasesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedServerSecurityAlertPoliciesClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedServerSecurityAlertPoliciesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedServerSecurityAlertPolicyImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedTransparentDataEncryptionImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/MetricDefinitionImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/MetricImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/OperationImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/OperationsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/OperationsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/OutboundFirewallRuleImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/OutboundFirewallRulesClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/OutboundFirewallRulesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/PrivateEndpointConnectionImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/PrivateEndpointConnectionsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/PrivateEndpointConnectionsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/PrivateLinkResourceImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/PrivateLinkResourcesClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/PrivateLinkResourcesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/QueryStatisticsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecommendedActionImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecommendedSensitivityLabelsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecommendedSensitivityLabelsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecoverableDatabaseImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecoverableDatabasesClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecoverableDatabasesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecoverableManagedDatabaseImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecoverableManagedDatabasesClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecoverableManagedDatabasesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ReplicationLinkImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ReplicationLinksClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ReplicationLinksImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorableDroppedDatabaseImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorableDroppedDatabasesClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorableDroppedDatabasesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorableDroppedManagedDatabaseImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorableDroppedManagedDatabasesClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorableDroppedManagedDatabasesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorePointImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorePointsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorePointsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SecurityEventImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SensitivityLabelImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SensitivityLabelUpdateImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SensitivityLabelUpdatePropertiesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SensitivityLabelsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SensitivityLabelsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAdvancedThreatProtectionImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAdvancedThreatProtectionSettingsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAdvancedThreatProtectionSettingsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAdvisorsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAdvisorsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAutomaticTuningImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAutomaticTuningsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAutomaticTuningsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAzureADAdministratorImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAzureADAdministratorsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAzureADAdministratorsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAzureADOnlyAuthenticationImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAzureADOnlyAuthenticationsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAzureADOnlyAuthenticationsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerBlobAuditingPoliciesClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerBlobAuditingPoliciesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerBlobAuditingPolicyImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerCommunicationLinkImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerCommunicationLinksClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerCommunicationLinksImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerConnectionPoliciesClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerConnectionPoliciesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerConnectionPolicyImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerDevOpsAuditSettingsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerDevOpsAuditSettingsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerDevOpsAuditingSettingsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerDnsAliasImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerDnsAliasesClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerDnsAliasesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerKeyImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerKeysClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerKeysImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerOperationImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerOperationsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerOperationsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerSecurityAlertPoliciesClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerSecurityAlertPoliciesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerSecurityAlertPolicyImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerTrustCertificateImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerTrustCertificatesClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerTrustCertificatesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerTrustGroupImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerTrustGroupsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerTrustGroupsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerUsageImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerUsagesClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerUsagesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerVulnerabilityAssessmentImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerVulnerabilityAssessmentsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerVulnerabilityAssessmentsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServersClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServersImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServiceObjectiveImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServiceObjectivesClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServiceObjectivesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlAgentConfigurationImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlAgentsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlAgentsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlManagementClientBuilder.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlManagementClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentBaselinesClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentBaselinesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentBaselinesOperationsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentBaselinesOperationsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentExecuteScansClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentExecuteScansImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentRuleBaselinesClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentRuleBaselinesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentRuleBaselinesOperationsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentRuleBaselinesOperationsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentScanRecordImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentScanResultOperationsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentScanResultOperationsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentScanResultsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentScansClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentScansImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentsSettingsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentsSettingsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SubscriptionUsageImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SubscriptionUsagesClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SubscriptionUsagesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SynapseLinkWorkspaceImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SynapseLinkWorkspacesClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SynapseLinkWorkspacesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncAgentImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncAgentKeyPropertiesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncAgentLinkedDatabaseImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncAgentsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncAgentsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncDatabaseIdPropertiesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncFullSchemaPropertiesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncGroupImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncGroupLogPropertiesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncGroupsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncGroupsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncMemberImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncMembersClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncMembersImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TdeCertificatesClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TdeCertificatesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TimeZoneImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TimeZonesClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TimeZonesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TopQueriesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TransparentDataEncryptionsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TransparentDataEncryptionsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/UpdateVirtualClusterDnsServersOperationImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/UsageImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/UsagesClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/UsagesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/Utils.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/VirtualClusterImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/VirtualClustersClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/VirtualClustersImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/VirtualNetworkRuleImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/VirtualNetworkRulesClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/VirtualNetworkRulesImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/VulnerabilityAssessmentScanRecordImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/WorkloadClassifierImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/WorkloadClassifiersClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/WorkloadClassifiersImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/WorkloadGroupImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/WorkloadGroupsClientImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/WorkloadGroupsImpl.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/package-info.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AdministratorListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AdministratorName.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AdministratorType.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AdvancedThreatProtectionName.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AdvancedThreatProtectionState.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Advisor.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AdvisorStatus.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AggregationFunctionType.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AlwaysEncryptedEnclaveType.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AuthenticationName.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutoExecuteStatus.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutoExecuteStatusInheritedFrom.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutoPauseDelayTimeRange.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutomaticTuningDisabledReason.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutomaticTuningMode.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutomaticTuningOptionModeActual.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutomaticTuningOptionModeDesired.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutomaticTuningOptions.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutomaticTuningServerMode.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutomaticTuningServerOptions.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutomaticTuningServerReason.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AzureADOnlyAuthListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/BackupShortTermRetentionPolicies.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/BackupShortTermRetentionPolicy.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/BackupShortTermRetentionPolicyListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/BackupStorageRedundancy.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Baseline.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/BaselineAdjustedResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/BaselineName.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/BenchmarkReference.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/BlobAuditingPolicyState.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Capabilities.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CapabilityGroup.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CapabilityStatus.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CatalogCollationType.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CheckNameAvailabilityReason.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CheckNameAvailabilityRequest.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CheckNameAvailabilityResponse.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ColumnDataType.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CompleteDatabaseRestoreDefinition.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ConnectionPolicyName.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CopyLongTermRetentionBackupParameters.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CreateDatabaseRestorePointDefinition.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CreateMode.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataMaskingFunction.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataMaskingPolicies.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataMaskingPolicy.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataMaskingRule.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataMaskingRuleListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataMaskingRuleState.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataMaskingRules.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataMaskingState.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataWarehouseUserActivities.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataWarehouseUserActivitiesListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataWarehouseUserActivitiesOperations.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataWarehouseUserActivityName.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Database.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseAdvancedThreatProtection.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseAdvancedThreatProtectionListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseAdvancedThreatProtectionSettings.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseAdvisors.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseAutomaticTuning.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseAutomaticTunings.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseBlobAuditingPolicies.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseBlobAuditingPolicy.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseBlobAuditingPolicyListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseColumn.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseColumnListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseColumns.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseExtensions.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseExtensionsOperations.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseIdentity.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseIdentityType.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseLicenseType.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseOperation.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseOperationListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseOperations.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseReadScale.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseRecommendedActions.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSchema.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSchemaListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSchemas.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSecurityAlertListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSecurityAlertPolicies.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSecurityAlertPolicy.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSqlVulnerabilityAssessmentBaselineSet.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSqlVulnerabilityAssessmentBaselineSetListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSqlVulnerabilityAssessmentBaselines.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSqlVulnerabilityAssessmentExecuteScans.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSqlVulnerabilityAssessmentRuleBaseline.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSqlVulnerabilityAssessmentRuleBaselineInput.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSqlVulnerabilityAssessmentRuleBaselineListInput.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSqlVulnerabilityAssessmentRuleBaselineListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSqlVulnerabilityAssessmentRuleBaselines.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSqlVulnerabilityAssessmentScanResults.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSqlVulnerabilityAssessmentScans.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSqlVulnerabilityAssessmentsSettings.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseState.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseStatus.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseTable.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseTableListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseTables.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseUpdate.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseUsage.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseUsageListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseUsages.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseUserIdentity.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseVulnerabilityAssessment.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseVulnerabilityAssessmentListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseVulnerabilityAssessmentRuleBaseline.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseVulnerabilityAssessmentRuleBaselineItem.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseVulnerabilityAssessmentRuleBaselines.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseVulnerabilityAssessmentScans.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseVulnerabilityAssessmentScansExport.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseVulnerabilityAssessments.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Databases.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DayOfWeek.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DeletedServer.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DeletedServerListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DeletedServers.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DevOpsAuditingSettingsName.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DiffBackupIntervalInHours.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DistributedAvailabilityGroup.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DistributedAvailabilityGroups.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DistributedAvailabilityGroupsListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DnsRefreshOperationStatus.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DtcName.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/EditionCapability.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPool.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolActivities.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolActivity.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolActivityListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolDatabaseActivities.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolDatabaseActivity.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolDatabaseActivityListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolEditionCapability.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolLicenseType.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolOperation.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolOperationListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolOperations.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolPerDatabaseMaxPerformanceLevelCapability.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolPerDatabaseMinPerformanceLevelCapability.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolPerDatabaseSettings.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolPerformanceLevelCapability.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolState.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolUpdate.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPools.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/EncryptionProtector.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/EncryptionProtectorListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/EncryptionProtectorName.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/EncryptionProtectors.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/EndpointCertificate.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/EndpointCertificateListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/EndpointCertificates.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ExportDatabaseDefinition.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ExtendedDatabaseBlobAuditingPolicies.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ExtendedDatabaseBlobAuditingPolicy.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ExtendedDatabaseBlobAuditingPolicyListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ExtendedServerBlobAuditingPolicies.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ExtendedServerBlobAuditingPolicy.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ExtendedServerBlobAuditingPolicyListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FailoverGroup.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FailoverGroupListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FailoverGroupReadOnlyEndpoint.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FailoverGroupReadWriteEndpoint.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FailoverGroupReplicationRole.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FailoverGroupUpdate.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FailoverGroups.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FirewallRule.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FirewallRuleList.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FirewallRuleListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FirewallRules.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/GeoBackupPolicies.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/GeoBackupPolicy.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/GeoBackupPolicyListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/GeoBackupPolicyName.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/GeoBackupPolicyState.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/IPv6FirewallRule.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/IPv6FirewallRuleListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/IPv6FirewallRules.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/IdentityType.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ImplementationMethod.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ImportExistingDatabaseDefinition.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ImportExportExtensionsOperationListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ImportExportExtensionsOperationResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ImportExportOperationResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ImportNewDatabaseDefinition.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstanceFailoverGroup.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstanceFailoverGroupListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstanceFailoverGroupReadOnlyEndpoint.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstanceFailoverGroupReadWriteEndpoint.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstanceFailoverGroupReplicationRole.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstanceFailoverGroups.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePool.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePoolEditionCapability.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePoolFamilyCapability.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePoolLicenseType.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePoolListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePoolUpdate.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePoolVcoresCapability.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePools.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/IsRetryable.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Job.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobAgent.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobAgentListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobAgentState.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobAgentUpdate.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobAgents.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobCredential.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobCredentialListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobCredentials.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobExecution.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobExecutionLifecycle.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobExecutionListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobExecutionTarget.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobExecutions.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobSchedule.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobScheduleType.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStep.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepAction.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepActionSource.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepActionType.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepExecutionOptions.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepExecutions.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepOutput.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepOutputType.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobSteps.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobTarget.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobTargetExecutions.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobTargetGroup.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobTargetGroupListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobTargetGroupMembershipType.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobTargetGroups.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobTargetType.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobVersion.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobVersionListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobVersions.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Jobs.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LedgerDigestUploads.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LedgerDigestUploadsListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LedgerDigestUploadsName.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LedgerDigestUploadsOperations.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LedgerDigestUploadsState.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LicenseTypeCapability.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LocationCapabilities.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LogSizeCapability.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LogSizeUnit.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LogicalDatabaseTransparentDataEncryption.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LogicalDatabaseTransparentDataEncryptionListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LogicalServerAdvancedThreatProtectionListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LogicalServerSecurityAlertPolicyListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionBackup.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionBackupListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionBackupOperationResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionBackups.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionManagedInstanceBackups.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionPolicies.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionPolicy.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionPolicyListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionPolicyName.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaintenanceConfigurationCapability.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaintenanceWindowOptions.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaintenanceWindowOptionsOperations.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaintenanceWindowTimeRange.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaintenanceWindows.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaintenanceWindowsOperations.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedBackupShortTermRetentionPolicies.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedBackupShortTermRetentionPolicy.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedBackupShortTermRetentionPolicyListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabase.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseAdvancedThreatProtection.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseAdvancedThreatProtectionListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseAdvancedThreatProtectionSettings.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseColumns.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseCreateMode.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseMoveDefinition.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseMoveOperationListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseMoveOperationResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseMoveOperations.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseQueries.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseRecommendedSensitivityLabels.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseRestoreDetails.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseRestoreDetailsBackupSetProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseRestoreDetailsResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseRestoreDetailsUnrestorableFileProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseSchemas.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseSecurityAlertPolicies.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseSecurityAlertPolicy.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseSecurityAlertPolicyListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseSecurityEvents.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseSensitivityLabels.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseStartMoveDefinition.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseStatus.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseTables.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseTransparentDataEncryptions.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseUpdate.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseVulnerabilityAssessmentRuleBaselines.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseVulnerabilityAssessmentScans.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseVulnerabilityAssessments.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabases.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstance.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAdministrator.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAdministratorListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAdministratorType.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAdministrators.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAdvancedThreatProtection.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAdvancedThreatProtectionListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAdvancedThreatProtectionSettings.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAzureADOnlyAuthListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAzureADOnlyAuthentication.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAzureADOnlyAuthentications.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceDtc.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceDtcListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceDtcSecuritySettings.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceDtcTransactionManagerCommunicationSettings.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceDtcs.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceEditionCapability.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceEncryptionProtector.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceEncryptionProtectorListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceEncryptionProtectors.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceExternalAdministrator.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceFamilyCapability.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceKey.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceKeyListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceKeys.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceLicenseType.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceLongTermRetentionBackup.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceLongTermRetentionBackupListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceLongTermRetentionPolicies.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceLongTermRetentionPolicy.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceLongTermRetentionPolicyListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceLongTermRetentionPolicyName.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceMaintenanceConfigurationCapability.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceOperation.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceOperationListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceOperationParametersPair.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceOperationSteps.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceOperations.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePairInfo.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePecProperty.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateEndpointConnection.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateEndpointConnectionListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateEndpointConnections.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateEndpointProperty.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateLink.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateLinkListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateLinkProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateLinkResources.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateLinkServiceConnectionStateProperty.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePropertiesProvisioningState.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceProxyOverride.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceQuery.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceQueryStatistics.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceTdeCertificates.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceUpdate.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceVcoresCapability.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceVersionCapability.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceVulnerabilityAssessment.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceVulnerabilityAssessmentListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceVulnerabilityAssessments.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstances.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedServerCreateMode.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedServerDnsAlias.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedServerDnsAliasAcquisition.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedServerDnsAliasCreation.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedServerDnsAliasListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedServerDnsAliases.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedServerSecurityAlertPolicies.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedServerSecurityAlertPolicy.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedServerSecurityAlertPolicyListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedShortTermRetentionPolicyName.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedTransparentDataEncryption.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedTransparentDataEncryptionListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagementOperationState.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaxSizeCapability.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaxSizeRangeCapability.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaxSizeUnit.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Metric.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MetricAvailability.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MetricDefinition.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MetricDefinitionListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MetricListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MetricName.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MetricType.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MetricValue.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MinCapacityCapability.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MoveOperationMode.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Name.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/NetworkIsolationSettings.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Operation.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/OperationDisplay.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/OperationListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/OperationMode.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/OperationOrigin.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Operations.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/OutboundFirewallRule.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/OutboundFirewallRuleListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/OutboundFirewallRules.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PartnerInfo.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PartnerRegionInfo.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PauseDelayTimeUnit.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PerformanceLevelCapability.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PerformanceLevelUnit.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrimaryAggregationType.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrincipalType.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateEndpointConnection.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateEndpointConnectionListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateEndpointConnectionRequestStatus.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateEndpointConnections.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateEndpointProperty.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateEndpointProvisioningState.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateLinkResource.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateLinkResourceListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateLinkResourceProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateLinkResources.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateLinkServiceConnectionStateActionsRequire.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateLinkServiceConnectionStateProperty.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateLinkServiceConnectionStateStatus.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ProvisioningState.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ProxyResourceWithWritableName.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/QueryCheck.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/QueryMetricInterval.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/QueryMetricProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/QueryMetricUnitType.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/QueryStatistics.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/QueryTimeGrainType.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReadOnlyEndpointFailoverPolicy.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReadScaleCapability.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReadWriteEndpointFailoverPolicy.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedAction.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedActionCurrentState.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedActionErrorInfo.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedActionImpactRecord.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedActionImplementationInfo.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedActionInitiatedBy.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedActionMetricInfo.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedActionStateInfo.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedSensitivityLabelUpdate.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedSensitivityLabelUpdateKind.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedSensitivityLabelUpdateList.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedSensitivityLabels.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecoverableDatabase.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecoverableDatabaseListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecoverableDatabases.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecoverableManagedDatabase.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecoverableManagedDatabaseListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecoverableManagedDatabases.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Remediation.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReplicaType.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReplicationLink.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReplicationLinkListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReplicationLinkType.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReplicationLinks.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReplicationMode.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReplicationRole.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReplicationState.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ResourceIdentity.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ResourceMoveDefinition.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ResourceWithWritableName.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorableDroppedDatabase.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorableDroppedDatabaseListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorableDroppedDatabases.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorableDroppedManagedDatabase.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorableDroppedManagedDatabaseListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorableDroppedManagedDatabases.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestoreDetailsName.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorePoint.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorePointListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorePointType.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorePoints.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RuleSeverity.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RuleStatus.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RuleType.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SampleName.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecondaryType.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecurityAlertPolicyName.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecurityAlertPolicyState.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecurityAlertsPolicyState.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecurityEvent.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecurityEventCollection.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecurityEventSqlInjectionAdditionalProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecurityEventType.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabel.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabelListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabelRank.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabelSource.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabelUpdate.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabelUpdateKind.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabelUpdateList.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabelUpdateProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabels.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Server.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAdvancedThreatProtection.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAdvancedThreatProtectionSettings.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAdvisors.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAutomaticTuning.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAutomaticTunings.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAzureADAdministrator.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAzureADAdministrators.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAzureADOnlyAuthentication.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAzureADOnlyAuthentications.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerBlobAuditingPolicies.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerBlobAuditingPolicy.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerBlobAuditingPolicyListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerCommunicationLink.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerCommunicationLinkListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerCommunicationLinks.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerConnectionPolicies.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerConnectionPolicy.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerConnectionPolicyListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerConnectionType.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerDevOpsAuditSettings.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerDevOpsAuditSettingsListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerDevOpsAuditingSettings.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerDnsAlias.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerDnsAliasAcquisition.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerDnsAliasListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerDnsAliases.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerExternalAdministrator.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerInfo.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerKey.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerKeyListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerKeyType.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerKeys.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerNetworkAccessFlag.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerOperation.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerOperationListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerOperations.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerPrivateEndpointConnection.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerSecurityAlertPolicies.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerSecurityAlertPolicy.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerTrustCertificate.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerTrustCertificates.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerTrustCertificatesListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerTrustGroup.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerTrustGroupListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerTrustGroupPropertiesTrustScopesItem.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerTrustGroups.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerUpdate.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerUsage.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerUsageListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerUsages.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerVersionCapability.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerVulnerabilityAssessment.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerVulnerabilityAssessmentListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerVulnerabilityAssessments.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerWorkspaceFeature.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Servers.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServiceObjective.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServiceObjectiveCapability.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServiceObjectiveListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServiceObjectives.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServicePrincipal.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServicePrincipalType.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ShortTermRetentionPolicyName.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Sku.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlAgentConfiguration.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlAgentConfigurationPropertiesState.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlAgents.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessment.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentBaselines.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentBaselinesOperations.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentExecuteScans.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentName.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentNameAutoGenerated.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentRuleBaselines.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentRuleBaselinesOperations.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentScanError.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentScanListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentScanRecord.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentScanRecordListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentScanResultOperations.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentScanResults.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentScans.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentState.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessments.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentsSettings.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/StorageCapability.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/StorageCapabilityStorageAccountType.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/StorageKeyType.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SubscriptionUsage.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SubscriptionUsageListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SubscriptionUsages.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SynapseLinkWorkspace.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SynapseLinkWorkspaceInfoProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SynapseLinkWorkspaceListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SynapseLinkWorkspaces.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncAgent.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncAgentKeyProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncAgentLinkedDatabase.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncAgentLinkedDatabaseListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncAgentListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncAgentState.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncAgents.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncConflictResolutionPolicy.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncDatabaseIdListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncDatabaseIdProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncDirection.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncFullSchemaProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncFullSchemaPropertiesListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncFullSchemaTable.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncFullSchemaTableColumn.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroup.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupLogListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupLogProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupLogType.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupSchema.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupSchemaTable.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupSchemaTableColumn.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupState.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroups.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupsType.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncMember.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncMemberDbType.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncMemberListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncMemberState.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncMembers.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TableTemporalType.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TdeCertificate.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TdeCertificates.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TimeZone.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TimeZoneListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TimeZones.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TopQueries.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TopQueriesListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TransparentDataEncryptionName.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TransparentDataEncryptionState.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TransparentDataEncryptions.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UnitDefinitionType.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UnitType.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UpdateLongTermRetentionBackupParameters.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UpdateVirtualClusterDnsServersOperation.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UpsertManagedServerOperationParameters.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UpsertManagedServerOperationStep.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UpsertManagedServerOperationStepStatus.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Usage.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UsageListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Usages.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UserIdentity.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VaRule.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualCluster.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualClusterListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualClusterUpdate.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualClusters.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualNetworkRule.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualNetworkRuleListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualNetworkRuleState.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualNetworkRules.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentName.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentPolicyBaselineName.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentRecurringScansProperties.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentScanError.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentScanRecord.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentScanRecordListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentScanState.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentScanTriggerType.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/WorkloadClassifier.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/WorkloadClassifierListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/WorkloadClassifiers.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/WorkloadGroup.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/WorkloadGroupListResult.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/WorkloadGroups.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/package-info.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/package-info.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/main/java/module-info.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/BackupShortTermRetentionPoliciesCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/BackupShortTermRetentionPoliciesGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/BackupShortTermRetentionPoliciesListByDatabaseSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/BackupShortTermRetentionPoliciesUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/CapabilitiesListByLocationSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DataMaskingPoliciesCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DataMaskingPoliciesGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DataMaskingRulesCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DataMaskingRulesListByDatabaseSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DataWarehouseUserActivitiesOperationGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DataWarehouseUserActivitiesOperationListByDatabaseSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseAdvancedThreatProtectionSettingsCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseAdvancedThreatProtectionSettingsGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseAdvancedThreatProtectionSettingsListByDatabaseSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseAdvisorsGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseAdvisorsListByDatabaseSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseAdvisorsUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseAutomaticTuningGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseAutomaticTuningUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseBlobAuditingPoliciesCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseBlobAuditingPoliciesGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseBlobAuditingPoliciesListByDatabaseSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseColumnsGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseColumnsListByDatabaseSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseColumnsListByTableSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseExtensionsOperationCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseExtensionsOperationGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseExtensionsOperationListByDatabaseSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseOperationsCancelSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseOperationsListByDatabaseSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseRecommendedActionsGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseRecommendedActionsListByDatabaseAdvisorSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseRecommendedActionsUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSchemasGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSchemasListByDatabaseSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSecurityAlertPoliciesCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSecurityAlertPoliciesGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSecurityAlertPoliciesListByDatabaseSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSqlVulnerabilityAssessmentBaselinesCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSqlVulnerabilityAssessmentBaselinesGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSqlVulnerabilityAssessmentBaselinesListBySqlVulnerabilityAssessmentSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSqlVulnerabilityAssessmentExecuteScanExecuteSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSqlVulnerabilityAssessmentRuleBaselinesCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSqlVulnerabilityAssessmentRuleBaselinesDeleteSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSqlVulnerabilityAssessmentRuleBaselinesGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSqlVulnerabilityAssessmentRuleBaselinesListByBaselineSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSqlVulnerabilityAssessmentScanResultGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSqlVulnerabilityAssessmentScanResultListByScanSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSqlVulnerabilityAssessmentScansGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSqlVulnerabilityAssessmentScansListBySqlVulnerabilityAssessmentsSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSqlVulnerabilityAssessmentsSettingsGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSqlVulnerabilityAssessmentsSettingsListByDatabaseSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseTablesGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseTablesListBySchemaSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseUsagesListByDatabaseSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentRuleBaselinesCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentRuleBaselinesDeleteSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentRuleBaselinesGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentScansExportSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentScansGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentScansInitiateScanSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentScansListByDatabaseSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentsCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentsDeleteSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentsGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentsListByDatabaseSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesDeleteSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesExportSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesFailoverSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesImportMethodSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesListByElasticPoolSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesListByServerSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesListInaccessibleByServerSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesListMetricDefinitionsSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesListMetricsSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesPauseSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesRenameSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesResumeSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesUpgradeDataWarehouseSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DeletedServersGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DeletedServersListByLocationSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DeletedServersListSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DeletedServersRecoverSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DistributedAvailabilityGroupsCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DistributedAvailabilityGroupsDeleteSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DistributedAvailabilityGroupsGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DistributedAvailabilityGroupsListByInstanceSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DistributedAvailabilityGroupsUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolActivitiesListByElasticPoolSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolDatabaseActivitiesListByElasticPoolSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolOperationsCancelSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolOperationsListByElasticPoolSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolsCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolsDeleteSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolsFailoverSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolsGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolsListByServerSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolsListMetricDefinitionsSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolsListMetricsSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolsUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/EncryptionProtectorsCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/EncryptionProtectorsGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/EncryptionProtectorsListByServerSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/EncryptionProtectorsRevalidateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/EndpointCertificatesGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/EndpointCertificatesListByInstanceSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ExtendedDatabaseBlobAuditingPoliciesCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ExtendedDatabaseBlobAuditingPoliciesGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ExtendedDatabaseBlobAuditingPoliciesListByDatabaseSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ExtendedServerBlobAuditingPoliciesCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ExtendedServerBlobAuditingPoliciesGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ExtendedServerBlobAuditingPoliciesListByServerSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FailoverGroupsCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FailoverGroupsDeleteSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FailoverGroupsFailoverSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FailoverGroupsForceFailoverAllowDataLossSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FailoverGroupsGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FailoverGroupsListByServerSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FailoverGroupsUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FirewallRulesCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FirewallRulesDeleteSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FirewallRulesGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FirewallRulesListByServerSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FirewallRulesReplaceSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/GeoBackupPoliciesCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/GeoBackupPoliciesGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/GeoBackupPoliciesListByDatabaseSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/IPv6FirewallRulesCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/IPv6FirewallRulesDeleteSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/IPv6FirewallRulesGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/IPv6FirewallRulesListByServerSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstanceFailoverGroupsCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstanceFailoverGroupsDeleteSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstanceFailoverGroupsFailoverSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstanceFailoverGroupsForceFailoverAllowDataLossSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstanceFailoverGroupsGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstanceFailoverGroupsListByLocationSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstancePoolsCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstancePoolsDeleteSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstancePoolsGetByResourceGroupSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstancePoolsListByResourceGroupSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstancePoolsListSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstancePoolsUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobAgentsCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobAgentsDeleteSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobAgentsGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobAgentsListByServerSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobAgentsUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobCredentialsCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobCredentialsDeleteSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobCredentialsGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobCredentialsListByAgentSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobExecutionsCancelSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobExecutionsCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobExecutionsCreateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobExecutionsGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobExecutionsListByAgentSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobExecutionsListByJobSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobStepExecutionsGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobStepExecutionsListByJobExecutionSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobStepsCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobStepsDeleteSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobStepsGetByVersionSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobStepsGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobStepsListByJobSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobStepsListByVersionSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobTargetExecutionsGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobTargetExecutionsListByJobExecutionSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobTargetExecutionsListByStepSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobTargetGroupsCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobTargetGroupsDeleteSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobTargetGroupsGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobTargetGroupsListByAgentSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobVersionsGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobVersionsListByJobSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobsCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobsDeleteSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobsGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobsListByAgentSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LedgerDigestUploadsOperationCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LedgerDigestUploadsOperationDisableSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LedgerDigestUploadsOperationGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LedgerDigestUploadsOperationListByDatabaseSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsCopyByResourceGroupSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsCopySamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsDeleteByResourceGroupSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsDeleteSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsGetByResourceGroupSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsListByDatabaseSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsListByLocationSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsListByResourceGroupDatabaseSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsListByResourceGroupLocationSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsListByResourceGroupServerSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsListByServerSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsUpdateByResourceGroupSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsDeleteSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsGetByResourceGroupSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsListByDatabaseSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsListByInstanceSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsListByLocationSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsListByResourceGroupDatabaseSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsListByResourceGroupInstanceSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsListByResourceGroupLocationSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionPoliciesCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionPoliciesGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionPoliciesListByDatabaseSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/MaintenanceWindowOptionsOperationGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/MaintenanceWindowsOperationCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/MaintenanceWindowsOperationGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedBackupShortTermRetentionPoliciesCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedBackupShortTermRetentionPoliciesGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedBackupShortTermRetentionPoliciesListByDatabaseSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedBackupShortTermRetentionPoliciesUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseAdvancedThreatProtectionSettingsCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseAdvancedThreatProtectionSettingsGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseAdvancedThreatProtectionSettingsListByDatabaseSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseColumnsGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseColumnsListByDatabaseSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseColumnsListByTableSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseMoveOperationsGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseMoveOperationsListByLocationSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseQueriesGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseQueriesListByQuerySamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseRecommendedSensitivityLabelsUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseRestoreDetailsGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSchemasGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSchemasListByDatabaseSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSecurityAlertPoliciesCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSecurityAlertPoliciesGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSecurityAlertPoliciesListByDatabaseSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSecurityEventsListByDatabaseSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSensitivityLabelsCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSensitivityLabelsDeleteSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSensitivityLabelsDisableRecommendationSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSensitivityLabelsEnableRecommendationSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSensitivityLabelsGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSensitivityLabelsListCurrentByDatabaseSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSensitivityLabelsListRecommendedByDatabaseSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSensitivityLabelsUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseTablesGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseTablesListBySchemaSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseTransparentDataEncryptionCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseTransparentDataEncryptionGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseTransparentDataEncryptionListByDatabaseSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesDeleteSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentScansExportSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentScansGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentScansInitiateScanSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentScansListByDatabaseSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentsCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentsDeleteSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentsGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentsListByDatabaseSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesCancelMoveSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesCompleteMoveSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesCompleteRestoreSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesDeleteSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesListByInstanceSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesListInaccessibleByInstanceSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesStartMoveSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAdministratorsCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAdministratorsDeleteSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAdministratorsGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAdministratorsListByInstanceSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAdvancedThreatProtectionSettingsCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAdvancedThreatProtectionSettingsGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAdvancedThreatProtectionSettingsListByInstanceSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAzureADOnlyAuthenticationsDeleteSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAzureADOnlyAuthenticationsGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAzureADOnlyAuthenticationsListByInstanceSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceDtcsCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceDtcsGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceDtcsListByManagedInstanceSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceEncryptionProtectorsCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceEncryptionProtectorsGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceEncryptionProtectorsListByInstanceSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceEncryptionProtectorsRevalidateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceKeysCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceKeysDeleteSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceKeysGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceKeysListByInstanceSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceLongTermRetentionPoliciesCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceLongTermRetentionPoliciesGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceLongTermRetentionPoliciesListByDatabaseSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceOperationsCancelSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceOperationsGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceOperationsListByManagedInstanceSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancePrivateEndpointConnectionsCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancePrivateEndpointConnectionsDeleteSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancePrivateEndpointConnectionsGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancePrivateEndpointConnectionsListByManagedInstanceSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancePrivateLinkResourcesGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancePrivateLinkResourcesListByManagedInstanceSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceTdeCertificatesCreateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceVulnerabilityAssessmentsCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceVulnerabilityAssessmentsDeleteSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceVulnerabilityAssessmentsGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceVulnerabilityAssessmentsListByInstanceSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesDeleteSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesFailoverSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesGetByResourceGroupSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesListByInstancePoolSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesListByManagedInstanceSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesListByResourceGroupSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesListSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesListByRestorableDroppedDatabaseS.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedServerDnsAliasesAcquireSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedServerDnsAliasesCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedServerDnsAliasesDeleteSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedServerDnsAliasesGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedServerDnsAliasesListByManagedInstanceSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedServerSecurityAlertPoliciesCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedServerSecurityAlertPoliciesGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedServerSecurityAlertPoliciesListByInstanceSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/OutboundFirewallRulesCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/OutboundFirewallRulesDeleteSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/OutboundFirewallRulesGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/OutboundFirewallRulesListByServerSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/PrivateEndpointConnectionsCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/PrivateEndpointConnectionsDeleteSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/PrivateEndpointConnectionsGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/PrivateEndpointConnectionsListByServerSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/PrivateLinkResourcesGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/PrivateLinkResourcesListByServerSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RecommendedSensitivityLabelsUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RecoverableDatabasesGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RecoverableDatabasesListByServerSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RecoverableManagedDatabasesGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RecoverableManagedDatabasesListByInstanceSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ReplicationLinksDeleteSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ReplicationLinksFailoverAllowDataLossSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ReplicationLinksFailoverSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ReplicationLinksGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ReplicationLinksListByDatabaseSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ReplicationLinksListByServerSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RestorableDroppedDatabasesGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RestorableDroppedDatabasesListByServerSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RestorableDroppedManagedDatabasesGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RestorableDroppedManagedDatabasesListByInstanceSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RestorePointsCreateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RestorePointsDeleteSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RestorePointsGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RestorePointsListByDatabaseSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SensitivityLabelsCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SensitivityLabelsDeleteSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SensitivityLabelsDisableRecommendationSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SensitivityLabelsEnableRecommendationSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SensitivityLabelsGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SensitivityLabelsListCurrentByDatabaseSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SensitivityLabelsListRecommendedByDatabaseSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SensitivityLabelsUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAdvancedThreatProtectionSettingsCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAdvancedThreatProtectionSettingsGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAdvancedThreatProtectionSettingsListByServerSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAdvisorsGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAdvisorsListByServerSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAdvisorsUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAutomaticTuningGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAutomaticTuningUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAzureADAdministratorsCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAzureADAdministratorsDeleteSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAzureADAdministratorsGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAzureADAdministratorsListByServerSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAzureADOnlyAuthenticationsCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAzureADOnlyAuthenticationsDeleteSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAzureADOnlyAuthenticationsGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAzureADOnlyAuthenticationsListByServerSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerBlobAuditingPoliciesCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerBlobAuditingPoliciesGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerBlobAuditingPoliciesListByServerSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerCommunicationLinksCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerCommunicationLinksDeleteSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerCommunicationLinksGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerCommunicationLinksListByServerSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerConnectionPoliciesCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerConnectionPoliciesGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerConnectionPoliciesListByServerSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerDevOpsAuditSettingsCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerDevOpsAuditSettingsGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerDevOpsAuditSettingsListByServerSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerDnsAliasesAcquireSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerDnsAliasesCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerDnsAliasesDeleteSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerDnsAliasesGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerDnsAliasesListByServerSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerKeysCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerKeysDeleteSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerKeysGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerKeysListByServerSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerOperationsListByServerSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerSecurityAlertPoliciesCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerSecurityAlertPoliciesGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerSecurityAlertPoliciesListByServerSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustCertificatesCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustCertificatesDeleteSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustCertificatesGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustCertificatesListByInstanceSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustGroupsCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustGroupsDeleteSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustGroupsGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustGroupsListByInstanceSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustGroupsListByLocationSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerUsagesListByServerSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerVulnerabilityAssessmentsCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerVulnerabilityAssessmentsDeleteSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerVulnerabilityAssessmentsGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerVulnerabilityAssessmentsListByServerSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServersCheckNameAvailabilitySamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServersCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServersDeleteSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServersGetByResourceGroupSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServersImportDatabaseSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServersListByResourceGroupSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServersListSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServersUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServiceObjectivesGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServiceObjectivesListByServerSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlAgentCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlAgentGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentBaselineGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentBaselineListBySqlVulnerabilityAssessmentSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentBaselinesOperationCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentExecuteScanExecuteSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentRuleBaselineCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentRuleBaselineGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentRuleBaselineListByBaselineSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentRuleBaselinesOperationDeleteSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentScanResultOperationGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentScanResultOperationListByScanSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentScansGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentScansListBySqlVulnerabilityAssessmentsSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentsDeleteSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentsSettingsCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentsSettingsGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentsSettingsListByServerSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SubscriptionUsagesGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SubscriptionUsagesListByLocationSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SynapseLinkWorkspacesListByDatabaseSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncAgentsCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncAgentsDeleteSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncAgentsGenerateKeySamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncAgentsGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncAgentsListByServerSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncAgentsListLinkedDatabasesSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsCancelSyncSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsDeleteSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsListByDatabaseSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsListHubSchemasSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsListLogsSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsListSyncDatabaseIdsSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsRefreshHubSchemaSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsTriggerSyncSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncMembersCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncMembersDeleteSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncMembersGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncMembersListBySyncGroupSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncMembersListMemberSchemasSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncMembersRefreshMemberSchemaSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncMembersUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/TdeCertificatesCreateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/TimeZonesGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/TimeZonesListByLocationSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/TransparentDataEncryptionsCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/TransparentDataEncryptionsGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/TransparentDataEncryptionsListByDatabaseSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/UsagesListByInstancePoolSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualClustersDeleteSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualClustersGetByResourceGroupSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualClustersListByResourceGroupSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualClustersListSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualClustersUpdateDnsServersSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualClustersUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualNetworkRulesCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualNetworkRulesDeleteSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualNetworkRulesGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualNetworkRulesListByServerSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/WorkloadClassifiersCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/WorkloadClassifiersDeleteSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/WorkloadClassifiersGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/WorkloadClassifiersListByWorkloadGroupSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/WorkloadGroupsCreateOrUpdateSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/WorkloadGroupsDeleteSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/WorkloadGroupsGetSamples.java create mode 100644 sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/WorkloadGroupsListByDatabaseSamples.java create mode 100644 sdk/sql/ci.yml create mode 100644 sdk/sql/pom.xml diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 2e58217d1375d..3c7dc336cbc64 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -388,6 +388,7 @@ com.azure.resourcemanager:azure-resourcemanager-elasticsan;1.0.0-beta.1;1.0.0-be com.azure.resourcemanager:azure-resourcemanager-hybridcontainerservice;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-securitydevops;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-appcomplianceautomation;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-sql-generated;1.0.0-beta.1;1.0.0-beta.1 com.azure.tools:azure-sdk-archetype;1.0.0;1.2.0-beta.1 com.azure.tools:azure-sdk-build-tool;1.0.0-beta.1;1.0.0-beta.2 diff --git a/pom.xml b/pom.xml index a261806d8ce1e..2ce9e043137d9 100644 --- a/pom.xml +++ b/pom.xml @@ -156,6 +156,7 @@ sdk/signalr sdk/spring sdk/spring-experimental + sdk/sql sdk/sqlvirtualmachine sdk/storage sdk/storagecache diff --git a/sdk/sql/azure-resourcemanager-sql-generated/CHANGELOG.md b/sdk/sql/azure-resourcemanager-sql-generated/CHANGELOG.md new file mode 100644 index 0000000000000..c3871c80dae19 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2022-12-15) + +- Azure Resource Manager Sql client library for Java. This package contains Microsoft Azure SDK for Sql Management SDK. 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 tag package-composite-v5. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). diff --git a/sdk/sql/azure-resourcemanager-sql-generated/README.md b/sdk/sql/azure-resourcemanager-sql-generated/README.md new file mode 100644 index 0000000000000..565935965e6a0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/README.md @@ -0,0 +1,105 @@ +# Azure Resource Manager Sql client library for Java + +Azure Resource Manager Sql client library for Java. + +This package contains Microsoft Azure SDK for Sql Management SDK. 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 tag package-composite-v5. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## We'd love to hear your feedback + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-sql-generated;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-sql-generated + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Include the recommended packages + +Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. + +[Azure Identity][azure_identity] and [Azure Core Netty HTTP][azure_core_http_netty] packages provide the default implementation. + +### Authentication + +By default, Azure Active Directory token authentication depends on correct configuration of the following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. + +In addition, Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable. + +With above configuration, `azure` client can be authenticated using the following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +SqlManager manager = SqlManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + +[Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/sql/azure-resourcemanager-sql-generated/SAMPLE.md) + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide][cg]. + +This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit . + +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For more information see the [Code of Conduct FAQ][coc_faq] or contact with any additional questions or comments. + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md +[cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md +[coc]: https://opensource.microsoft.com/codeofconduct/ +[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ diff --git a/sdk/sql/azure-resourcemanager-sql-generated/SAMPLE.md b/sdk/sql/azure-resourcemanager-sql-generated/SAMPLE.md new file mode 100644 index 0000000000000..2b226b3fa57a0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/SAMPLE.md @@ -0,0 +1,17010 @@ +# Code snippets and samples + + +## BackupShortTermRetentionPolicies + +- [CreateOrUpdate](#backupshorttermretentionpolicies_createorupdate) +- [Get](#backupshorttermretentionpolicies_get) +- [ListByDatabase](#backupshorttermretentionpolicies_listbydatabase) +- [Update](#backupshorttermretentionpolicies_update) + +## Capabilities + +- [ListByLocation](#capabilities_listbylocation) + +## DataMaskingPolicies + +- [CreateOrUpdate](#datamaskingpolicies_createorupdate) +- [Get](#datamaskingpolicies_get) + +## DataMaskingRules + +- [CreateOrUpdate](#datamaskingrules_createorupdate) +- [ListByDatabase](#datamaskingrules_listbydatabase) + +## DataWarehouseUserActivitiesOperation + +- [Get](#datawarehouseuseractivitiesoperation_get) +- [ListByDatabase](#datawarehouseuseractivitiesoperation_listbydatabase) + +## DatabaseAdvancedThreatProtectionSettings + +- [CreateOrUpdate](#databaseadvancedthreatprotectionsettings_createorupdate) +- [Get](#databaseadvancedthreatprotectionsettings_get) +- [ListByDatabase](#databaseadvancedthreatprotectionsettings_listbydatabase) + +## DatabaseAdvisors + +- [Get](#databaseadvisors_get) +- [ListByDatabase](#databaseadvisors_listbydatabase) +- [Update](#databaseadvisors_update) + +## DatabaseAutomaticTuning + +- [Get](#databaseautomatictuning_get) +- [Update](#databaseautomatictuning_update) + +## DatabaseBlobAuditingPolicies + +- [CreateOrUpdate](#databaseblobauditingpolicies_createorupdate) +- [Get](#databaseblobauditingpolicies_get) +- [ListByDatabase](#databaseblobauditingpolicies_listbydatabase) + +## DatabaseColumns + +- [Get](#databasecolumns_get) +- [ListByDatabase](#databasecolumns_listbydatabase) +- [ListByTable](#databasecolumns_listbytable) + +## DatabaseExtensionsOperation + +- [CreateOrUpdate](#databaseextensionsoperation_createorupdate) +- [Get](#databaseextensionsoperation_get) +- [ListByDatabase](#databaseextensionsoperation_listbydatabase) + +## DatabaseOperations + +- [Cancel](#databaseoperations_cancel) +- [ListByDatabase](#databaseoperations_listbydatabase) + +## DatabaseRecommendedActions + +- [Get](#databaserecommendedactions_get) +- [ListByDatabaseAdvisor](#databaserecommendedactions_listbydatabaseadvisor) +- [Update](#databaserecommendedactions_update) + +## DatabaseSchemas + +- [Get](#databaseschemas_get) +- [ListByDatabase](#databaseschemas_listbydatabase) + +## DatabaseSecurityAlertPolicies + +- [CreateOrUpdate](#databasesecurityalertpolicies_createorupdate) +- [Get](#databasesecurityalertpolicies_get) +- [ListByDatabase](#databasesecurityalertpolicies_listbydatabase) + +## DatabaseSqlVulnerabilityAssessmentBaselines + +- [CreateOrUpdate](#databasesqlvulnerabilityassessmentbaselines_createorupdate) +- [Get](#databasesqlvulnerabilityassessmentbaselines_get) +- [ListBySqlVulnerabilityAssessment](#databasesqlvulnerabilityassessmentbaselines_listbysqlvulnerabilityassessment) + +## DatabaseSqlVulnerabilityAssessmentExecuteScan + +- [Execute](#databasesqlvulnerabilityassessmentexecutescan_execute) + +## DatabaseSqlVulnerabilityAssessmentRuleBaselines + +- [CreateOrUpdate](#databasesqlvulnerabilityassessmentrulebaselines_createorupdate) +- [Delete](#databasesqlvulnerabilityassessmentrulebaselines_delete) +- [Get](#databasesqlvulnerabilityassessmentrulebaselines_get) +- [ListByBaseline](#databasesqlvulnerabilityassessmentrulebaselines_listbybaseline) + +## DatabaseSqlVulnerabilityAssessmentScanResult + +- [Get](#databasesqlvulnerabilityassessmentscanresult_get) +- [ListByScan](#databasesqlvulnerabilityassessmentscanresult_listbyscan) + +## DatabaseSqlVulnerabilityAssessmentScans + +- [Get](#databasesqlvulnerabilityassessmentscans_get) +- [ListBySqlVulnerabilityAssessments](#databasesqlvulnerabilityassessmentscans_listbysqlvulnerabilityassessments) + +## DatabaseSqlVulnerabilityAssessmentsSettings + +- [Get](#databasesqlvulnerabilityassessmentssettings_get) +- [ListByDatabase](#databasesqlvulnerabilityassessmentssettings_listbydatabase) + +## DatabaseTables + +- [Get](#databasetables_get) +- [ListBySchema](#databasetables_listbyschema) + +## DatabaseUsages + +- [ListByDatabase](#databaseusages_listbydatabase) + +## DatabaseVulnerabilityAssessmentRuleBaselines + +- [CreateOrUpdate](#databasevulnerabilityassessmentrulebaselines_createorupdate) +- [Delete](#databasevulnerabilityassessmentrulebaselines_delete) +- [Get](#databasevulnerabilityassessmentrulebaselines_get) + +## DatabaseVulnerabilityAssessmentScans + +- [Export](#databasevulnerabilityassessmentscans_export) +- [Get](#databasevulnerabilityassessmentscans_get) +- [InitiateScan](#databasevulnerabilityassessmentscans_initiatescan) +- [ListByDatabase](#databasevulnerabilityassessmentscans_listbydatabase) + +## DatabaseVulnerabilityAssessments + +- [CreateOrUpdate](#databasevulnerabilityassessments_createorupdate) +- [Delete](#databasevulnerabilityassessments_delete) +- [Get](#databasevulnerabilityassessments_get) +- [ListByDatabase](#databasevulnerabilityassessments_listbydatabase) + +## Databases + +- [CreateOrUpdate](#databases_createorupdate) +- [Delete](#databases_delete) +- [Export](#databases_export) +- [Failover](#databases_failover) +- [Get](#databases_get) +- [ImportMethod](#databases_importmethod) +- [ListByElasticPool](#databases_listbyelasticpool) +- [ListByServer](#databases_listbyserver) +- [ListInaccessibleByServer](#databases_listinaccessiblebyserver) +- [ListMetricDefinitions](#databases_listmetricdefinitions) +- [ListMetrics](#databases_listmetrics) +- [Pause](#databases_pause) +- [Rename](#databases_rename) +- [Resume](#databases_resume) +- [Update](#databases_update) +- [UpgradeDataWarehouse](#databases_upgradedatawarehouse) + +## DeletedServers + +- [Get](#deletedservers_get) +- [List](#deletedservers_list) +- [ListByLocation](#deletedservers_listbylocation) +- [Recover](#deletedservers_recover) + +## DistributedAvailabilityGroups + +- [CreateOrUpdate](#distributedavailabilitygroups_createorupdate) +- [Delete](#distributedavailabilitygroups_delete) +- [Get](#distributedavailabilitygroups_get) +- [ListByInstance](#distributedavailabilitygroups_listbyinstance) +- [Update](#distributedavailabilitygroups_update) + +## ElasticPoolActivities + +- [ListByElasticPool](#elasticpoolactivities_listbyelasticpool) + +## ElasticPoolDatabaseActivities + +- [ListByElasticPool](#elasticpooldatabaseactivities_listbyelasticpool) + +## ElasticPoolOperations + +- [Cancel](#elasticpooloperations_cancel) +- [ListByElasticPool](#elasticpooloperations_listbyelasticpool) + +## ElasticPools + +- [CreateOrUpdate](#elasticpools_createorupdate) +- [Delete](#elasticpools_delete) +- [Failover](#elasticpools_failover) +- [Get](#elasticpools_get) +- [ListByServer](#elasticpools_listbyserver) +- [ListMetricDefinitions](#elasticpools_listmetricdefinitions) +- [ListMetrics](#elasticpools_listmetrics) +- [Update](#elasticpools_update) + +## EncryptionProtectors + +- [CreateOrUpdate](#encryptionprotectors_createorupdate) +- [Get](#encryptionprotectors_get) +- [ListByServer](#encryptionprotectors_listbyserver) +- [Revalidate](#encryptionprotectors_revalidate) + +## EndpointCertificates + +- [Get](#endpointcertificates_get) +- [ListByInstance](#endpointcertificates_listbyinstance) + +## ExtendedDatabaseBlobAuditingPolicies + +- [CreateOrUpdate](#extendeddatabaseblobauditingpolicies_createorupdate) +- [Get](#extendeddatabaseblobauditingpolicies_get) +- [ListByDatabase](#extendeddatabaseblobauditingpolicies_listbydatabase) + +## ExtendedServerBlobAuditingPolicies + +- [CreateOrUpdate](#extendedserverblobauditingpolicies_createorupdate) +- [Get](#extendedserverblobauditingpolicies_get) +- [ListByServer](#extendedserverblobauditingpolicies_listbyserver) + +## FailoverGroups + +- [CreateOrUpdate](#failovergroups_createorupdate) +- [Delete](#failovergroups_delete) +- [Failover](#failovergroups_failover) +- [ForceFailoverAllowDataLoss](#failovergroups_forcefailoverallowdataloss) +- [Get](#failovergroups_get) +- [ListByServer](#failovergroups_listbyserver) +- [Update](#failovergroups_update) + +## FirewallRules + +- [CreateOrUpdate](#firewallrules_createorupdate) +- [Delete](#firewallrules_delete) +- [Get](#firewallrules_get) +- [ListByServer](#firewallrules_listbyserver) +- [Replace](#firewallrules_replace) + +## GeoBackupPolicies + +- [CreateOrUpdate](#geobackuppolicies_createorupdate) +- [Get](#geobackuppolicies_get) +- [ListByDatabase](#geobackuppolicies_listbydatabase) + +## IPv6FirewallRules + +- [CreateOrUpdate](#ipv6firewallrules_createorupdate) +- [Delete](#ipv6firewallrules_delete) +- [Get](#ipv6firewallrules_get) +- [ListByServer](#ipv6firewallrules_listbyserver) + +## InstanceFailoverGroups + +- [CreateOrUpdate](#instancefailovergroups_createorupdate) +- [Delete](#instancefailovergroups_delete) +- [Failover](#instancefailovergroups_failover) +- [ForceFailoverAllowDataLoss](#instancefailovergroups_forcefailoverallowdataloss) +- [Get](#instancefailovergroups_get) +- [ListByLocation](#instancefailovergroups_listbylocation) + +## InstancePools + +- [CreateOrUpdate](#instancepools_createorupdate) +- [Delete](#instancepools_delete) +- [GetByResourceGroup](#instancepools_getbyresourcegroup) +- [List](#instancepools_list) +- [ListByResourceGroup](#instancepools_listbyresourcegroup) +- [Update](#instancepools_update) + +## JobAgents + +- [CreateOrUpdate](#jobagents_createorupdate) +- [Delete](#jobagents_delete) +- [Get](#jobagents_get) +- [ListByServer](#jobagents_listbyserver) +- [Update](#jobagents_update) + +## JobCredentials + +- [CreateOrUpdate](#jobcredentials_createorupdate) +- [Delete](#jobcredentials_delete) +- [Get](#jobcredentials_get) +- [ListByAgent](#jobcredentials_listbyagent) + +## JobExecutions + +- [Cancel](#jobexecutions_cancel) +- [Create](#jobexecutions_create) +- [CreateOrUpdate](#jobexecutions_createorupdate) +- [Get](#jobexecutions_get) +- [ListByAgent](#jobexecutions_listbyagent) +- [ListByJob](#jobexecutions_listbyjob) + +## JobStepExecutions + +- [Get](#jobstepexecutions_get) +- [ListByJobExecution](#jobstepexecutions_listbyjobexecution) + +## JobSteps + +- [CreateOrUpdate](#jobsteps_createorupdate) +- [Delete](#jobsteps_delete) +- [Get](#jobsteps_get) +- [GetByVersion](#jobsteps_getbyversion) +- [ListByJob](#jobsteps_listbyjob) +- [ListByVersion](#jobsteps_listbyversion) + +## JobTargetExecutions + +- [Get](#jobtargetexecutions_get) +- [ListByJobExecution](#jobtargetexecutions_listbyjobexecution) +- [ListByStep](#jobtargetexecutions_listbystep) + +## JobTargetGroups + +- [CreateOrUpdate](#jobtargetgroups_createorupdate) +- [Delete](#jobtargetgroups_delete) +- [Get](#jobtargetgroups_get) +- [ListByAgent](#jobtargetgroups_listbyagent) + +## JobVersions + +- [Get](#jobversions_get) +- [ListByJob](#jobversions_listbyjob) + +## Jobs + +- [CreateOrUpdate](#jobs_createorupdate) +- [Delete](#jobs_delete) +- [Get](#jobs_get) +- [ListByAgent](#jobs_listbyagent) + +## LedgerDigestUploadsOperation + +- [CreateOrUpdate](#ledgerdigestuploadsoperation_createorupdate) +- [Disable](#ledgerdigestuploadsoperation_disable) +- [Get](#ledgerdigestuploadsoperation_get) +- [ListByDatabase](#ledgerdigestuploadsoperation_listbydatabase) + +## LongTermRetentionBackups + +- [Copy](#longtermretentionbackups_copy) +- [CopyByResourceGroup](#longtermretentionbackups_copybyresourcegroup) +- [Delete](#longtermretentionbackups_delete) +- [DeleteByResourceGroup](#longtermretentionbackups_deletebyresourcegroup) +- [Get](#longtermretentionbackups_get) +- [GetByResourceGroup](#longtermretentionbackups_getbyresourcegroup) +- [ListByDatabase](#longtermretentionbackups_listbydatabase) +- [ListByLocation](#longtermretentionbackups_listbylocation) +- [ListByResourceGroupDatabase](#longtermretentionbackups_listbyresourcegroupdatabase) +- [ListByResourceGroupLocation](#longtermretentionbackups_listbyresourcegrouplocation) +- [ListByResourceGroupServer](#longtermretentionbackups_listbyresourcegroupserver) +- [ListByServer](#longtermretentionbackups_listbyserver) +- [Update](#longtermretentionbackups_update) +- [UpdateByResourceGroup](#longtermretentionbackups_updatebyresourcegroup) + +## LongTermRetentionManagedInstanceBackups + +- [Delete](#longtermretentionmanagedinstancebackups_delete) +- [DeleteByResourceGroup](#longtermretentionmanagedinstancebackups_deletebyresourcegroup) +- [Get](#longtermretentionmanagedinstancebackups_get) +- [GetByResourceGroup](#longtermretentionmanagedinstancebackups_getbyresourcegroup) +- [ListByDatabase](#longtermretentionmanagedinstancebackups_listbydatabase) +- [ListByInstance](#longtermretentionmanagedinstancebackups_listbyinstance) +- [ListByLocation](#longtermretentionmanagedinstancebackups_listbylocation) +- [ListByResourceGroupDatabase](#longtermretentionmanagedinstancebackups_listbyresourcegroupdatabase) +- [ListByResourceGroupInstance](#longtermretentionmanagedinstancebackups_listbyresourcegroupinstance) +- [ListByResourceGroupLocation](#longtermretentionmanagedinstancebackups_listbyresourcegrouplocation) + +## LongTermRetentionPolicies + +- [CreateOrUpdate](#longtermretentionpolicies_createorupdate) +- [Get](#longtermretentionpolicies_get) +- [ListByDatabase](#longtermretentionpolicies_listbydatabase) + +## MaintenanceWindowOptionsOperation + +- [Get](#maintenancewindowoptionsoperation_get) + +## MaintenanceWindowsOperation + +- [CreateOrUpdate](#maintenancewindowsoperation_createorupdate) +- [Get](#maintenancewindowsoperation_get) + +## ManagedBackupShortTermRetentionPolicies + +- [CreateOrUpdate](#managedbackupshorttermretentionpolicies_createorupdate) +- [Get](#managedbackupshorttermretentionpolicies_get) +- [ListByDatabase](#managedbackupshorttermretentionpolicies_listbydatabase) +- [Update](#managedbackupshorttermretentionpolicies_update) + +## ManagedDatabaseAdvancedThreatProtectionSettings + +- [CreateOrUpdate](#manageddatabaseadvancedthreatprotectionsettings_createorupdate) +- [Get](#manageddatabaseadvancedthreatprotectionsettings_get) +- [ListByDatabase](#manageddatabaseadvancedthreatprotectionsettings_listbydatabase) + +## ManagedDatabaseColumns + +- [Get](#manageddatabasecolumns_get) +- [ListByDatabase](#manageddatabasecolumns_listbydatabase) +- [ListByTable](#manageddatabasecolumns_listbytable) + +## ManagedDatabaseMoveOperations + +- [Get](#manageddatabasemoveoperations_get) +- [ListByLocation](#manageddatabasemoveoperations_listbylocation) + +## ManagedDatabaseQueries + +- [Get](#manageddatabasequeries_get) +- [ListByQuery](#manageddatabasequeries_listbyquery) + +## ManagedDatabaseRecommendedSensitivityLabels + +- [Update](#manageddatabaserecommendedsensitivitylabels_update) + +## ManagedDatabaseRestoreDetails + +- [Get](#manageddatabaserestoredetails_get) + +## ManagedDatabaseSchemas + +- [Get](#manageddatabaseschemas_get) +- [ListByDatabase](#manageddatabaseschemas_listbydatabase) + +## ManagedDatabaseSecurityAlertPolicies + +- [CreateOrUpdate](#manageddatabasesecurityalertpolicies_createorupdate) +- [Get](#manageddatabasesecurityalertpolicies_get) +- [ListByDatabase](#manageddatabasesecurityalertpolicies_listbydatabase) + +## ManagedDatabaseSecurityEvents + +- [ListByDatabase](#manageddatabasesecurityevents_listbydatabase) + +## ManagedDatabaseSensitivityLabels + +- [CreateOrUpdate](#manageddatabasesensitivitylabels_createorupdate) +- [Delete](#manageddatabasesensitivitylabels_delete) +- [DisableRecommendation](#manageddatabasesensitivitylabels_disablerecommendation) +- [EnableRecommendation](#manageddatabasesensitivitylabels_enablerecommendation) +- [Get](#manageddatabasesensitivitylabels_get) +- [ListCurrentByDatabase](#manageddatabasesensitivitylabels_listcurrentbydatabase) +- [ListRecommendedByDatabase](#manageddatabasesensitivitylabels_listrecommendedbydatabase) +- [Update](#manageddatabasesensitivitylabels_update) + +## ManagedDatabaseTables + +- [Get](#manageddatabasetables_get) +- [ListBySchema](#manageddatabasetables_listbyschema) + +## ManagedDatabaseTransparentDataEncryption + +- [CreateOrUpdate](#manageddatabasetransparentdataencryption_createorupdate) +- [Get](#manageddatabasetransparentdataencryption_get) +- [ListByDatabase](#manageddatabasetransparentdataencryption_listbydatabase) + +## ManagedDatabaseVulnerabilityAssessmentRuleBaselines + +- [CreateOrUpdate](#manageddatabasevulnerabilityassessmentrulebaselines_createorupdate) +- [Delete](#manageddatabasevulnerabilityassessmentrulebaselines_delete) +- [Get](#manageddatabasevulnerabilityassessmentrulebaselines_get) + +## ManagedDatabaseVulnerabilityAssessmentScans + +- [Export](#manageddatabasevulnerabilityassessmentscans_export) +- [Get](#manageddatabasevulnerabilityassessmentscans_get) +- [InitiateScan](#manageddatabasevulnerabilityassessmentscans_initiatescan) +- [ListByDatabase](#manageddatabasevulnerabilityassessmentscans_listbydatabase) + +## ManagedDatabaseVulnerabilityAssessments + +- [CreateOrUpdate](#manageddatabasevulnerabilityassessments_createorupdate) +- [Delete](#manageddatabasevulnerabilityassessments_delete) +- [Get](#manageddatabasevulnerabilityassessments_get) +- [ListByDatabase](#manageddatabasevulnerabilityassessments_listbydatabase) + +## ManagedDatabases + +- [CancelMove](#manageddatabases_cancelmove) +- [CompleteMove](#manageddatabases_completemove) +- [CompleteRestore](#manageddatabases_completerestore) +- [CreateOrUpdate](#manageddatabases_createorupdate) +- [Delete](#manageddatabases_delete) +- [Get](#manageddatabases_get) +- [ListByInstance](#manageddatabases_listbyinstance) +- [ListInaccessibleByInstance](#manageddatabases_listinaccessiblebyinstance) +- [StartMove](#manageddatabases_startmove) +- [Update](#manageddatabases_update) + +## ManagedInstanceAdministrators + +- [CreateOrUpdate](#managedinstanceadministrators_createorupdate) +- [Delete](#managedinstanceadministrators_delete) +- [Get](#managedinstanceadministrators_get) +- [ListByInstance](#managedinstanceadministrators_listbyinstance) + +## ManagedInstanceAdvancedThreatProtectionSettings + +- [CreateOrUpdate](#managedinstanceadvancedthreatprotectionsettings_createorupdate) +- [Get](#managedinstanceadvancedthreatprotectionsettings_get) +- [ListByInstance](#managedinstanceadvancedthreatprotectionsettings_listbyinstance) + +## ManagedInstanceAzureADOnlyAuthentications + +- [CreateOrUpdate](#managedinstanceazureadonlyauthentications_createorupdate) +- [Delete](#managedinstanceazureadonlyauthentications_delete) +- [Get](#managedinstanceazureadonlyauthentications_get) +- [ListByInstance](#managedinstanceazureadonlyauthentications_listbyinstance) + +## ManagedInstanceDtcs + +- [CreateOrUpdate](#managedinstancedtcs_createorupdate) +- [Get](#managedinstancedtcs_get) +- [ListByManagedInstance](#managedinstancedtcs_listbymanagedinstance) + +## ManagedInstanceEncryptionProtectors + +- [CreateOrUpdate](#managedinstanceencryptionprotectors_createorupdate) +- [Get](#managedinstanceencryptionprotectors_get) +- [ListByInstance](#managedinstanceencryptionprotectors_listbyinstance) +- [Revalidate](#managedinstanceencryptionprotectors_revalidate) + +## ManagedInstanceKeys + +- [CreateOrUpdate](#managedinstancekeys_createorupdate) +- [Delete](#managedinstancekeys_delete) +- [Get](#managedinstancekeys_get) +- [ListByInstance](#managedinstancekeys_listbyinstance) + +## ManagedInstanceLongTermRetentionPolicies + +- [CreateOrUpdate](#managedinstancelongtermretentionpolicies_createorupdate) +- [Get](#managedinstancelongtermretentionpolicies_get) +- [ListByDatabase](#managedinstancelongtermretentionpolicies_listbydatabase) + +## ManagedInstanceOperations + +- [Cancel](#managedinstanceoperations_cancel) +- [Get](#managedinstanceoperations_get) +- [ListByManagedInstance](#managedinstanceoperations_listbymanagedinstance) + +## ManagedInstancePrivateEndpointConnections + +- [CreateOrUpdate](#managedinstanceprivateendpointconnections_createorupdate) +- [Delete](#managedinstanceprivateendpointconnections_delete) +- [Get](#managedinstanceprivateendpointconnections_get) +- [ListByManagedInstance](#managedinstanceprivateendpointconnections_listbymanagedinstance) + +## ManagedInstancePrivateLinkResources + +- [Get](#managedinstanceprivatelinkresources_get) +- [ListByManagedInstance](#managedinstanceprivatelinkresources_listbymanagedinstance) + +## ManagedInstanceTdeCertificates + +- [Create](#managedinstancetdecertificates_create) + +## ManagedInstanceVulnerabilityAssessments + +- [CreateOrUpdate](#managedinstancevulnerabilityassessments_createorupdate) +- [Delete](#managedinstancevulnerabilityassessments_delete) +- [Get](#managedinstancevulnerabilityassessments_get) +- [ListByInstance](#managedinstancevulnerabilityassessments_listbyinstance) + +## ManagedInstances + +- [CreateOrUpdate](#managedinstances_createorupdate) +- [Delete](#managedinstances_delete) +- [Failover](#managedinstances_failover) +- [GetByResourceGroup](#managedinstances_getbyresourcegroup) +- [List](#managedinstances_list) +- [ListByInstancePool](#managedinstances_listbyinstancepool) +- [ListByManagedInstance](#managedinstances_listbymanagedinstance) +- [ListByResourceGroup](#managedinstances_listbyresourcegroup) +- [Update](#managedinstances_update) + +## ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies + +- [CreateOrUpdate](#managedrestorabledroppeddatabasebackupshorttermretentionpolicies_createorupdate) +- [Get](#managedrestorabledroppeddatabasebackupshorttermretentionpolicies_get) +- [ListByRestorableDroppedDatabase](#managedrestorabledroppeddatabasebackupshorttermretentionpolicies_listbyrestorabledroppeddatabase) +- [Update](#managedrestorabledroppeddatabasebackupshorttermretentionpolicies_update) + +## ManagedServerDnsAliases + +- [Acquire](#managedserverdnsaliases_acquire) +- [CreateOrUpdate](#managedserverdnsaliases_createorupdate) +- [Delete](#managedserverdnsaliases_delete) +- [Get](#managedserverdnsaliases_get) +- [ListByManagedInstance](#managedserverdnsaliases_listbymanagedinstance) + +## ManagedServerSecurityAlertPolicies + +- [CreateOrUpdate](#managedserversecurityalertpolicies_createorupdate) +- [Get](#managedserversecurityalertpolicies_get) +- [ListByInstance](#managedserversecurityalertpolicies_listbyinstance) + +## OutboundFirewallRules + +- [CreateOrUpdate](#outboundfirewallrules_createorupdate) +- [Delete](#outboundfirewallrules_delete) +- [Get](#outboundfirewallrules_get) +- [ListByServer](#outboundfirewallrules_listbyserver) + +## PrivateEndpointConnections + +- [CreateOrUpdate](#privateendpointconnections_createorupdate) +- [Delete](#privateendpointconnections_delete) +- [Get](#privateendpointconnections_get) +- [ListByServer](#privateendpointconnections_listbyserver) + +## PrivateLinkResources + +- [Get](#privatelinkresources_get) +- [ListByServer](#privatelinkresources_listbyserver) + +## RecommendedSensitivityLabels + +- [Update](#recommendedsensitivitylabels_update) + +## RecoverableDatabases + +- [Get](#recoverabledatabases_get) +- [ListByServer](#recoverabledatabases_listbyserver) + +## RecoverableManagedDatabases + +- [Get](#recoverablemanageddatabases_get) +- [ListByInstance](#recoverablemanageddatabases_listbyinstance) + +## ReplicationLinks + +- [Delete](#replicationlinks_delete) +- [Failover](#replicationlinks_failover) +- [FailoverAllowDataLoss](#replicationlinks_failoverallowdataloss) +- [Get](#replicationlinks_get) +- [ListByDatabase](#replicationlinks_listbydatabase) +- [ListByServer](#replicationlinks_listbyserver) + +## RestorableDroppedDatabases + +- [Get](#restorabledroppeddatabases_get) +- [ListByServer](#restorabledroppeddatabases_listbyserver) + +## RestorableDroppedManagedDatabases + +- [Get](#restorabledroppedmanageddatabases_get) +- [ListByInstance](#restorabledroppedmanageddatabases_listbyinstance) + +## RestorePoints + +- [Create](#restorepoints_create) +- [Delete](#restorepoints_delete) +- [Get](#restorepoints_get) +- [ListByDatabase](#restorepoints_listbydatabase) + +## SensitivityLabels + +- [CreateOrUpdate](#sensitivitylabels_createorupdate) +- [Delete](#sensitivitylabels_delete) +- [DisableRecommendation](#sensitivitylabels_disablerecommendation) +- [EnableRecommendation](#sensitivitylabels_enablerecommendation) +- [Get](#sensitivitylabels_get) +- [ListCurrentByDatabase](#sensitivitylabels_listcurrentbydatabase) +- [ListRecommendedByDatabase](#sensitivitylabels_listrecommendedbydatabase) +- [Update](#sensitivitylabels_update) + +## ServerAdvancedThreatProtectionSettings + +- [CreateOrUpdate](#serveradvancedthreatprotectionsettings_createorupdate) +- [Get](#serveradvancedthreatprotectionsettings_get) +- [ListByServer](#serveradvancedthreatprotectionsettings_listbyserver) + +## ServerAdvisors + +- [Get](#serveradvisors_get) +- [ListByServer](#serveradvisors_listbyserver) +- [Update](#serveradvisors_update) + +## ServerAutomaticTuning + +- [Get](#serverautomatictuning_get) +- [Update](#serverautomatictuning_update) + +## ServerAzureADAdministrators + +- [CreateOrUpdate](#serverazureadadministrators_createorupdate) +- [Delete](#serverazureadadministrators_delete) +- [Get](#serverazureadadministrators_get) +- [ListByServer](#serverazureadadministrators_listbyserver) + +## ServerAzureADOnlyAuthentications + +- [CreateOrUpdate](#serverazureadonlyauthentications_createorupdate) +- [Delete](#serverazureadonlyauthentications_delete) +- [Get](#serverazureadonlyauthentications_get) +- [ListByServer](#serverazureadonlyauthentications_listbyserver) + +## ServerBlobAuditingPolicies + +- [CreateOrUpdate](#serverblobauditingpolicies_createorupdate) +- [Get](#serverblobauditingpolicies_get) +- [ListByServer](#serverblobauditingpolicies_listbyserver) + +## ServerCommunicationLinks + +- [CreateOrUpdate](#servercommunicationlinks_createorupdate) +- [Delete](#servercommunicationlinks_delete) +- [Get](#servercommunicationlinks_get) +- [ListByServer](#servercommunicationlinks_listbyserver) + +## ServerConnectionPolicies + +- [CreateOrUpdate](#serverconnectionpolicies_createorupdate) +- [Get](#serverconnectionpolicies_get) +- [ListByServer](#serverconnectionpolicies_listbyserver) + +## ServerDevOpsAuditSettings + +- [CreateOrUpdate](#serverdevopsauditsettings_createorupdate) +- [Get](#serverdevopsauditsettings_get) +- [ListByServer](#serverdevopsauditsettings_listbyserver) + +## ServerDnsAliases + +- [Acquire](#serverdnsaliases_acquire) +- [CreateOrUpdate](#serverdnsaliases_createorupdate) +- [Delete](#serverdnsaliases_delete) +- [Get](#serverdnsaliases_get) +- [ListByServer](#serverdnsaliases_listbyserver) + +## ServerKeys + +- [CreateOrUpdate](#serverkeys_createorupdate) +- [Delete](#serverkeys_delete) +- [Get](#serverkeys_get) +- [ListByServer](#serverkeys_listbyserver) + +## ServerOperations + +- [ListByServer](#serveroperations_listbyserver) + +## ServerSecurityAlertPolicies + +- [CreateOrUpdate](#serversecurityalertpolicies_createorupdate) +- [Get](#serversecurityalertpolicies_get) +- [ListByServer](#serversecurityalertpolicies_listbyserver) + +## ServerTrustCertificates + +- [CreateOrUpdate](#servertrustcertificates_createorupdate) +- [Delete](#servertrustcertificates_delete) +- [Get](#servertrustcertificates_get) +- [ListByInstance](#servertrustcertificates_listbyinstance) + +## ServerTrustGroups + +- [CreateOrUpdate](#servertrustgroups_createorupdate) +- [Delete](#servertrustgroups_delete) +- [Get](#servertrustgroups_get) +- [ListByInstance](#servertrustgroups_listbyinstance) +- [ListByLocation](#servertrustgroups_listbylocation) + +## ServerUsages + +- [ListByServer](#serverusages_listbyserver) + +## ServerVulnerabilityAssessments + +- [CreateOrUpdate](#servervulnerabilityassessments_createorupdate) +- [Delete](#servervulnerabilityassessments_delete) +- [Get](#servervulnerabilityassessments_get) +- [ListByServer](#servervulnerabilityassessments_listbyserver) + +## Servers + +- [CheckNameAvailability](#servers_checknameavailability) +- [CreateOrUpdate](#servers_createorupdate) +- [Delete](#servers_delete) +- [GetByResourceGroup](#servers_getbyresourcegroup) +- [ImportDatabase](#servers_importdatabase) +- [List](#servers_list) +- [ListByResourceGroup](#servers_listbyresourcegroup) +- [Update](#servers_update) + +## ServiceObjectives + +- [Get](#serviceobjectives_get) +- [ListByServer](#serviceobjectives_listbyserver) + +## SqlAgent + +- [CreateOrUpdate](#sqlagent_createorupdate) +- [Get](#sqlagent_get) + +## SqlVulnerabilityAssessmentBaseline + +- [Get](#sqlvulnerabilityassessmentbaseline_get) +- [ListBySqlVulnerabilityAssessment](#sqlvulnerabilityassessmentbaseline_listbysqlvulnerabilityassessment) + +## SqlVulnerabilityAssessmentBaselinesOperation + +- [CreateOrUpdate](#sqlvulnerabilityassessmentbaselinesoperation_createorupdate) + +## SqlVulnerabilityAssessmentExecuteScan + +- [Execute](#sqlvulnerabilityassessmentexecutescan_execute) + +## SqlVulnerabilityAssessmentRuleBaseline + +- [CreateOrUpdate](#sqlvulnerabilityassessmentrulebaseline_createorupdate) +- [Get](#sqlvulnerabilityassessmentrulebaseline_get) +- [ListByBaseline](#sqlvulnerabilityassessmentrulebaseline_listbybaseline) + +## SqlVulnerabilityAssessmentRuleBaselinesOperation + +- [Delete](#sqlvulnerabilityassessmentrulebaselinesoperation_delete) + +## SqlVulnerabilityAssessmentScanResultOperation + +- [Get](#sqlvulnerabilityassessmentscanresultoperation_get) +- [ListByScan](#sqlvulnerabilityassessmentscanresultoperation_listbyscan) + +## SqlVulnerabilityAssessmentScans + +- [Get](#sqlvulnerabilityassessmentscans_get) +- [ListBySqlVulnerabilityAssessments](#sqlvulnerabilityassessmentscans_listbysqlvulnerabilityassessments) + +## SqlVulnerabilityAssessments + +- [Delete](#sqlvulnerabilityassessments_delete) + +## SqlVulnerabilityAssessmentsSettings + +- [CreateOrUpdate](#sqlvulnerabilityassessmentssettings_createorupdate) +- [Get](#sqlvulnerabilityassessmentssettings_get) +- [ListByServer](#sqlvulnerabilityassessmentssettings_listbyserver) + +## SubscriptionUsages + +- [Get](#subscriptionusages_get) +- [ListByLocation](#subscriptionusages_listbylocation) + +## SynapseLinkWorkspaces + +- [ListByDatabase](#synapselinkworkspaces_listbydatabase) + +## SyncAgents + +- [CreateOrUpdate](#syncagents_createorupdate) +- [Delete](#syncagents_delete) +- [GenerateKey](#syncagents_generatekey) +- [Get](#syncagents_get) +- [ListByServer](#syncagents_listbyserver) +- [ListLinkedDatabases](#syncagents_listlinkeddatabases) + +## SyncGroups + +- [CancelSync](#syncgroups_cancelsync) +- [CreateOrUpdate](#syncgroups_createorupdate) +- [Delete](#syncgroups_delete) +- [Get](#syncgroups_get) +- [ListByDatabase](#syncgroups_listbydatabase) +- [ListHubSchemas](#syncgroups_listhubschemas) +- [ListLogs](#syncgroups_listlogs) +- [ListSyncDatabaseIds](#syncgroups_listsyncdatabaseids) +- [RefreshHubSchema](#syncgroups_refreshhubschema) +- [TriggerSync](#syncgroups_triggersync) +- [Update](#syncgroups_update) + +## SyncMembers + +- [CreateOrUpdate](#syncmembers_createorupdate) +- [Delete](#syncmembers_delete) +- [Get](#syncmembers_get) +- [ListBySyncGroup](#syncmembers_listbysyncgroup) +- [ListMemberSchemas](#syncmembers_listmemberschemas) +- [RefreshMemberSchema](#syncmembers_refreshmemberschema) +- [Update](#syncmembers_update) + +## TdeCertificates + +- [Create](#tdecertificates_create) + +## TimeZones + +- [Get](#timezones_get) +- [ListByLocation](#timezones_listbylocation) + +## TransparentDataEncryptions + +- [CreateOrUpdate](#transparentdataencryptions_createorupdate) +- [Get](#transparentdataencryptions_get) +- [ListByDatabase](#transparentdataencryptions_listbydatabase) + +## Usages + +- [ListByInstancePool](#usages_listbyinstancepool) + +## VirtualClusters + +- [Delete](#virtualclusters_delete) +- [GetByResourceGroup](#virtualclusters_getbyresourcegroup) +- [List](#virtualclusters_list) +- [ListByResourceGroup](#virtualclusters_listbyresourcegroup) +- [Update](#virtualclusters_update) +- [UpdateDnsServers](#virtualclusters_updatednsservers) + +## VirtualNetworkRules + +- [CreateOrUpdate](#virtualnetworkrules_createorupdate) +- [Delete](#virtualnetworkrules_delete) +- [Get](#virtualnetworkrules_get) +- [ListByServer](#virtualnetworkrules_listbyserver) + +## WorkloadClassifiers + +- [CreateOrUpdate](#workloadclassifiers_createorupdate) +- [Delete](#workloadclassifiers_delete) +- [Get](#workloadclassifiers_get) +- [ListByWorkloadGroup](#workloadclassifiers_listbyworkloadgroup) + +## WorkloadGroups + +- [CreateOrUpdate](#workloadgroups_createorupdate) +- [Delete](#workloadgroups_delete) +- [Get](#workloadgroups_get) +- [ListByDatabase](#workloadgroups_listbydatabase) +### BackupShortTermRetentionPolicies_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.DiffBackupIntervalInHours; +import com.azure.resourcemanager.sql.generated.models.ShortTermRetentionPolicyName; + +/** Samples for BackupShortTermRetentionPolicies CreateOrUpdate. */ +public final class BackupShortTermRetentionPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/UpdateShortTermRetentionPolicy.json + */ + /** + * Sample code: Update the short term retention policy for the database. + * + * @param manager Entry point to SqlManager. + */ + public static void updateTheShortTermRetentionPolicyForTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .backupShortTermRetentionPolicies() + .define(ShortTermRetentionPolicyName.DEFAULT) + .withExistingDatabase("resourceGroup", "testsvr", "testdb") + .withRetentionDays(7) + .withDiffBackupIntervalInHours(DiffBackupIntervalInHours.TWO_FOUR) + .create(); + } +} +``` + +### BackupShortTermRetentionPolicies_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ShortTermRetentionPolicyName; + +/** Samples for BackupShortTermRetentionPolicies Get. */ +public final class BackupShortTermRetentionPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/GetShortTermRetentionPolicy.json + */ + /** + * Sample code: Get the short term retention policy for the database. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheShortTermRetentionPolicyForTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .backupShortTermRetentionPolicies() + .getWithResponse( + "Default-SQL-SouthEastAsia", "testsvr", "testdb", ShortTermRetentionPolicyName.DEFAULT, Context.NONE); + } +} +``` + +### BackupShortTermRetentionPolicies_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for BackupShortTermRetentionPolicies ListByDatabase. */ +public final class BackupShortTermRetentionPoliciesListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ListShortTermRetentionPoliciesByDatabase.json + */ + /** + * Sample code: Get the short term retention policy for the database. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheShortTermRetentionPolicyForTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .backupShortTermRetentionPolicies() + .listByDatabase("Default-SQL-SouthEastAsia", "testsvr", "testdb", Context.NONE); + } +} +``` + +### BackupShortTermRetentionPolicies_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.BackupShortTermRetentionPolicy; +import com.azure.resourcemanager.sql.generated.models.DiffBackupIntervalInHours; +import com.azure.resourcemanager.sql.generated.models.ShortTermRetentionPolicyName; + +/** Samples for BackupShortTermRetentionPolicies Update. */ +public final class BackupShortTermRetentionPoliciesUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/UpdateShortTermRetentionPolicy.json + */ + /** + * Sample code: Update the short term retention policy for the database. + * + * @param manager Entry point to SqlManager. + */ + public static void updateTheShortTermRetentionPolicyForTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + BackupShortTermRetentionPolicy resource = + manager + .backupShortTermRetentionPolicies() + .getWithResponse( + "resourceGroup", "testsvr", "testdb", ShortTermRetentionPolicyName.DEFAULT, Context.NONE) + .getValue(); + resource + .update() + .withRetentionDays(7) + .withDiffBackupIntervalInHours(DiffBackupIntervalInHours.TWO_FOUR) + .apply(); + } +} +``` + +### Capabilities_ListByLocation + +```java +import com.azure.core.util.Context; + +/** Samples for Capabilities ListByLocation. */ +public final class CapabilitiesListByLocationSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/LocationCapabilityListByLocation.json + */ + /** + * Sample code: List subscription capabilities in the given location. + * + * @param manager Entry point to SqlManager. + */ + public static void listSubscriptionCapabilitiesInTheGivenLocation( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.capabilities().listByLocationWithResponse("eastus", null, Context.NONE); + } +} +``` + +### DataMaskingPolicies_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.DataMaskingState; + +/** Samples for DataMaskingPolicies CreateOrUpdate. */ +public final class DataMaskingPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/DataMaskingPolicyCreateOrUpdateMin.json + */ + /** + * Sample code: Create or update data masking policy min. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateDataMaskingPolicyMin(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .dataMaskingPolicies() + .define() + .withExistingDatabase("sqlcrudtest-6852", "sqlcrudtest-2080", "sqlcrudtest-331") + .withDataMaskingState(DataMaskingState.ENABLED) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/DataMaskingPolicyCreateOrUpdateMax.json + */ + /** + * Sample code: Create or update data masking policy max. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateDataMaskingPolicyMax(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .dataMaskingPolicies() + .define() + .withExistingDatabase("sqlcrudtest-6852", "sqlcrudtest-2080", "sqlcrudtest-331") + .withDataMaskingState(DataMaskingState.ENABLED) + .withExemptPrincipals("testuser;") + .create(); + } +} +``` + +### DataMaskingPolicies_Get + +```java +import com.azure.core.util.Context; + +/** Samples for DataMaskingPolicies Get. */ +public final class DataMaskingPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/DataMaskingPolicyGet.json + */ + /** + * Sample code: Get data masking policy. + * + * @param manager Entry point to SqlManager. + */ + public static void getDataMaskingPolicy(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .dataMaskingPolicies() + .getWithResponse("sqlcrudtest-6852", "sqlcrudtest-2080", "sqlcrudtest-331", Context.NONE); + } +} +``` + +### DataMaskingRules_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.DataMaskingFunction; +import com.azure.resourcemanager.sql.generated.models.DataMaskingRuleState; + +/** Samples for DataMaskingRules CreateOrUpdate. */ +public final class DataMaskingRulesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/DataMaskingRuleCreateOrUpdateDefaultMin.json + */ + /** + * Sample code: Create/Update data masking rule for default min. + * + * @param manager Entry point to SqlManager. + */ + public static void createUpdateDataMaskingRuleForDefaultMin( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .dataMaskingRules() + .define("rule1") + .withExistingDatabase("sqlcrudtest-6852", "sqlcrudtest-2080", "sqlcrudtest-331") + .withSchemaName("dbo") + .withTableName("Table_1") + .withColumnName("test1") + .withMaskingFunction(DataMaskingFunction.DEFAULT) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/DataMaskingRuleCreateOrUpdateDefaultMax.json + */ + /** + * Sample code: Create/Update data masking rule for default max. + * + * @param manager Entry point to SqlManager. + */ + public static void createUpdateDataMaskingRuleForDefaultMax( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .dataMaskingRules() + .define("rule1") + .withExistingDatabase("sqlcrudtest-6852", "sqlcrudtest-2080", "sqlcrudtest-331") + .withAliasName("nickname") + .withRuleState(DataMaskingRuleState.ENABLED) + .withSchemaName("dbo") + .withTableName("Table_1") + .withColumnName("test1") + .withMaskingFunction(DataMaskingFunction.DEFAULT) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/DataMaskingRuleCreateOrUpdateText.json + */ + /** + * Sample code: Create/Update data masking rule for text. + * + * @param manager Entry point to SqlManager. + */ + public static void createUpdateDataMaskingRuleForText(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .dataMaskingRules() + .define("rule1") + .withExistingDatabase("sqlcrudtest-6852", "sqlcrudtest-2080", "sqlcrudtest-331") + .withSchemaName("dbo") + .withTableName("Table_1") + .withColumnName("test1") + .withMaskingFunction(DataMaskingFunction.TEXT) + .withPrefixSize("1") + .withSuffixSize("0") + .withReplacementString("asdf") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/DataMaskingRuleCreateOrUpdateNumber.json + */ + /** + * Sample code: Create/Update data masking rule for numbers. + * + * @param manager Entry point to SqlManager. + */ + public static void createUpdateDataMaskingRuleForNumbers( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .dataMaskingRules() + .define("rule1") + .withExistingDatabase("sqlcrudtest-6852", "sqlcrudtest-2080", "sqlcrudtest-331") + .withSchemaName("dbo") + .withTableName("Table_1") + .withColumnName("test1") + .withMaskingFunction(DataMaskingFunction.NUMBER) + .withNumberFrom("0") + .withNumberTo("2") + .create(); + } +} +``` + +### DataMaskingRules_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for DataMaskingRules ListByDatabase. */ +public final class DataMaskingRulesListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/DataMaskingRuleList.json + */ + /** + * Sample code: List data masking rules. + * + * @param manager Entry point to SqlManager. + */ + public static void listDataMaskingRules(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .dataMaskingRules() + .listByDatabase("sqlcrudtest-6852", "sqlcrudtest-2080", "sqlcrudtest-331", Context.NONE); + } +} +``` + +### DataWarehouseUserActivitiesOperation_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.DataWarehouseUserActivityName; + +/** Samples for DataWarehouseUserActivitiesOperation Get. */ +public final class DataWarehouseUserActivitiesOperationGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetDataWarehouseUserActivities.json + */ + /** + * Sample code: Get the list of the user activities of a data warehouse. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheListOfTheUserActivitiesOfADataWarehouse( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .dataWarehouseUserActivitiesOperations() + .getWithResponse( + "Default-SQL-SouthEastAsia", "testsvr", "testdb", DataWarehouseUserActivityName.CURRENT, Context.NONE); + } +} +``` + +### DataWarehouseUserActivitiesOperation_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for DataWarehouseUserActivitiesOperation ListByDatabase. */ +public final class DataWarehouseUserActivitiesOperationListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListDataWarehouseUserActivities.json + */ + /** + * Sample code: List of the user activities of a data warehouse. + * + * @param manager Entry point to SqlManager. + */ + public static void listOfTheUserActivitiesOfADataWarehouse( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .dataWarehouseUserActivitiesOperations() + .listByDatabase("Default-SQL-SouthEastAsia", "testsvr", "testdb", Context.NONE); + } +} +``` + +### DatabaseAdvancedThreatProtectionSettings_CreateOrUpdate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.AdvancedThreatProtectionName; +import com.azure.resourcemanager.sql.generated.models.AdvancedThreatProtectionState; +import com.azure.resourcemanager.sql.generated.models.DatabaseAdvancedThreatProtection; + +/** Samples for DatabaseAdvancedThreatProtectionSettings CreateOrUpdate. */ +public final class DatabaseAdvancedThreatProtectionSettingsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DatabaseAdvancedThreatProtectionSettingsCreateMin.json + */ + /** + * Sample code: Update a database's Advanced Threat Protection settings with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateADatabaseSAdvancedThreatProtectionSettingsWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + DatabaseAdvancedThreatProtection resource = + manager + .databaseAdvancedThreatProtectionSettings() + .getWithResponse( + "threatprotection-4799", + "threatprotection-6440", + "testdb", + AdvancedThreatProtectionName.DEFAULT, + Context.NONE) + .getValue(); + resource.update().withState(AdvancedThreatProtectionState.DISABLED).apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DatabaseAdvancedThreatProtectionSettingsCreateMax.json + */ + /** + * Sample code: Update a database's Advanced Threat Protection settings with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateADatabaseSAdvancedThreatProtectionSettingsWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + DatabaseAdvancedThreatProtection resource = + manager + .databaseAdvancedThreatProtectionSettings() + .getWithResponse( + "threatprotection-4799", + "threatprotection-6440", + "testdb", + AdvancedThreatProtectionName.DEFAULT, + Context.NONE) + .getValue(); + resource.update().withState(AdvancedThreatProtectionState.ENABLED).apply(); + } +} +``` + +### DatabaseAdvancedThreatProtectionSettings_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.AdvancedThreatProtectionName; + +/** Samples for DatabaseAdvancedThreatProtectionSettings Get. */ +public final class DatabaseAdvancedThreatProtectionSettingsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DatabaseAdvancedThreatProtectionSettingsGet.json + */ + /** + * Sample code: Get a database's Advanced Threat Protection settings. + * + * @param manager Entry point to SqlManager. + */ + public static void getADatabaseSAdvancedThreatProtectionSettings( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseAdvancedThreatProtectionSettings() + .getWithResponse( + "threatprotection-6852", + "threatprotection-2080", + "testdb", + AdvancedThreatProtectionName.DEFAULT, + Context.NONE); + } +} +``` + +### DatabaseAdvancedThreatProtectionSettings_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for DatabaseAdvancedThreatProtectionSettings ListByDatabase. */ +public final class DatabaseAdvancedThreatProtectionSettingsListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DatabaseAdvancedThreatProtectionSettingsListByDatabase.json + */ + /** + * Sample code: Lists the database's Advanced Threat Protection settings. + * + * @param manager Entry point to SqlManager. + */ + public static void listsTheDatabaseSAdvancedThreatProtectionSettings( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseAdvancedThreatProtectionSettings() + .listByDatabase("threatprotection-6852", "threatprotection-2080", "testdb", Context.NONE); + } +} +``` + +### DatabaseAdvisors_Get + +```java +import com.azure.core.util.Context; + +/** Samples for DatabaseAdvisors Get. */ +public final class DatabaseAdvisorsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseAdvisorGet.json + */ + /** + * Sample code: Get database advisor. + * + * @param manager Entry point to SqlManager. + */ + public static void getDatabaseAdvisor(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseAdvisors() + .getWithResponse("workloadinsight-demos", "misosisvr", "IndexAdvisor_test_3", "CreateIndex", Context.NONE); + } +} +``` + +### DatabaseAdvisors_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for DatabaseAdvisors ListByDatabase. */ +public final class DatabaseAdvisorsListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseAdvisorList.json + */ + /** + * Sample code: List of database advisors. + * + * @param manager Entry point to SqlManager. + */ + public static void listOfDatabaseAdvisors(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseAdvisors() + .listByDatabaseWithResponse( + "workloadinsight-demos", "misosisvr", "IndexAdvisor_test_3", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseRecommendedActionListExpand.json + */ + /** + * Sample code: List of database recommended actions for all advisors. + * + * @param manager Entry point to SqlManager. + */ + public static void listOfDatabaseRecommendedActionsForAllAdvisors( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseAdvisors() + .listByDatabaseWithResponse( + "workloadinsight-demos", "misosisvr", "IndexAdvisor_test_3", "recommendedActions", Context.NONE); + } +} +``` + +### DatabaseAdvisors_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.AdvisorInner; +import com.azure.resourcemanager.sql.generated.models.AutoExecuteStatus; + +/** Samples for DatabaseAdvisors Update. */ +public final class DatabaseAdvisorsUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseAdvisorUpdate.json + */ + /** + * Sample code: Update database advisor. + * + * @param manager Entry point to SqlManager. + */ + public static void updateDatabaseAdvisor(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseAdvisors() + .updateWithResponse( + "workloadinsight-demos", + "misosisvr", + "IndexAdvisor_test_3", + "CreateIndex", + new AdvisorInner().withAutoExecuteStatus(AutoExecuteStatus.DISABLED), + Context.NONE); + } +} +``` + +### DatabaseAutomaticTuning_Get + +```java +import com.azure.core.util.Context; + +/** Samples for DatabaseAutomaticTuning Get. */ +public final class DatabaseAutomaticTuningGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseAutomaticTuningGet.json + */ + /** + * Sample code: Get a database's automatic tuning settings. + * + * @param manager Entry point to SqlManager. + */ + public static void getADatabaseSAutomaticTuningSettings( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databaseAutomaticTunings().getWithResponse("default-sql-onebox", "testsvr11", "db1", Context.NONE); + } +} +``` + +### DatabaseAutomaticTuning_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseAutomaticTuningInner; +import com.azure.resourcemanager.sql.generated.models.AutomaticTuningMode; +import com.azure.resourcemanager.sql.generated.models.AutomaticTuningOptionModeDesired; +import com.azure.resourcemanager.sql.generated.models.AutomaticTuningOptions; +import java.util.HashMap; +import java.util.Map; + +/** Samples for DatabaseAutomaticTuning Update. */ +public final class DatabaseAutomaticTuningUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseAutomaticTuningUpdateMax.json + */ + /** + * Sample code: Updates database automatic tuning settings with all properties. + * + * @param manager Entry point to SqlManager. + */ + public static void updatesDatabaseAutomaticTuningSettingsWithAllProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseAutomaticTunings() + .updateWithResponse( + "default-sql-onebox", + "testsvr11", + "db1", + new DatabaseAutomaticTuningInner() + .withDesiredState(AutomaticTuningMode.AUTO) + .withOptions( + mapOf( + "createIndex", + new AutomaticTuningOptions().withDesiredState(AutomaticTuningOptionModeDesired.OFF), + "dropIndex", + new AutomaticTuningOptions().withDesiredState(AutomaticTuningOptionModeDesired.ON), + "forceLastGoodPlan", + new AutomaticTuningOptions().withDesiredState(AutomaticTuningOptionModeDesired.DEFAULT))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseAutomaticTuningUpdateMin.json + */ + /** + * Sample code: Updates database automatic tuning settings with minimal properties. + * + * @param manager Entry point to SqlManager. + */ + public static void updatesDatabaseAutomaticTuningSettingsWithMinimalProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseAutomaticTunings() + .updateWithResponse( + "default-sql-onebox", + "testsvr11", + "db1", + new DatabaseAutomaticTuningInner().withDesiredState(AutomaticTuningMode.AUTO), + Context.NONE); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### DatabaseBlobAuditingPolicies_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.BlobAuditingPolicyState; +import java.util.Arrays; +import java.util.UUID; + +/** Samples for DatabaseBlobAuditingPolicies CreateOrUpdate. */ +public final class DatabaseBlobAuditingPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DatabaseAzureMonitorAuditingCreateMin.json + */ + /** + * Sample code: Create or update a database's azure monitor auditing policy with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateADatabaseSAzureMonitorAuditingPolicyWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseBlobAuditingPolicies() + .define() + .withExistingDatabase("blobauditingtest-4799", "blobauditingtest-6440", "testdb") + .withIsAzureMonitorTargetEnabled(true) + .withState(BlobAuditingPolicyState.ENABLED) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DatabaseBlobAuditingCreateMax.json + */ + /** + * Sample code: Create or update a database's blob auditing policy with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateADatabaseSBlobAuditingPolicyWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseBlobAuditingPolicies() + .define() + .withExistingDatabase("blobauditingtest-4799", "blobauditingtest-6440", "testdb") + .withRetentionDays(6) + .withAuditActionsAndGroups( + Arrays + .asList( + "DATABASE_LOGOUT_GROUP", + "DATABASE_ROLE_MEMBER_CHANGE_GROUP", + "UPDATE on database::TestDatabaseName by public")) + .withIsStorageSecondaryKeyInUse(false) + .withIsAzureMonitorTargetEnabled(true) + .withQueueDelayMs(4000) + .withState(BlobAuditingPolicyState.ENABLED) + .withStorageEndpoint("https://mystorage.blob.core.windows.net") + .withStorageAccountAccessKey( + "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==") + .withStorageAccountSubscriptionId(UUID.fromString("00000000-1234-0000-5678-000000000000")) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DatabaseBlobAuditingCreateMin.json + */ + /** + * Sample code: Create or update a database's blob auditing policy with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateADatabaseSBlobAuditingPolicyWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseBlobAuditingPolicies() + .define() + .withExistingDatabase("blobauditingtest-4799", "blobauditingtest-6440", "testdb") + .withState(BlobAuditingPolicyState.ENABLED) + .withStorageEndpoint("https://mystorage.blob.core.windows.net") + .withStorageAccountAccessKey( + "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==") + .create(); + } +} +``` + +### DatabaseBlobAuditingPolicies_Get + +```java +import com.azure.core.util.Context; + +/** Samples for DatabaseBlobAuditingPolicies Get. */ +public final class DatabaseBlobAuditingPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DatabaseBlobAuditingGet.json + */ + /** + * Sample code: Get a database's blob auditing policy. + * + * @param manager Entry point to SqlManager. + */ + public static void getADatabaseSBlobAuditingPolicy(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseBlobAuditingPolicies() + .getWithResponse("blobauditingtest-6852", "blobauditingtest-2080", "testdb", Context.NONE); + } +} +``` + +### DatabaseBlobAuditingPolicies_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for DatabaseBlobAuditingPolicies ListByDatabase. */ +public final class DatabaseBlobAuditingPoliciesListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DatabaseAuditingSettingsList.json + */ + /** + * Sample code: List audit settings of a database. + * + * @param manager Entry point to SqlManager. + */ + public static void listAuditSettingsOfADatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseBlobAuditingPolicies() + .listByDatabase("blobauditingtest-6852", "blobauditingtest-2080", "testdb", Context.NONE); + } +} +``` + +### DatabaseColumns_Get + +```java +import com.azure.core.util.Context; + +/** Samples for DatabaseColumns Get. */ +public final class DatabaseColumnsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseColumnGet.json + */ + /** + * Sample code: Get database column. + * + * @param manager Entry point to SqlManager. + */ + public static void getDatabaseColumn(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseColumns() + .getWithResponse("myRG", "serverName", "myDatabase", "dbo", "table1", "column1", Context.NONE); + } +} +``` + +### DatabaseColumns_ListByDatabase + +```java +import com.azure.core.util.Context; +import java.util.Arrays; + +/** Samples for DatabaseColumns ListByDatabase. */ +public final class DatabaseColumnsListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ColumnsListByDatabaseMax.json + */ + /** + * Sample code: Filter database columns. + * + * @param manager Entry point to SqlManager. + */ + public static void filterDatabaseColumns(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseColumns() + .listByDatabase( + "myRG", + "serverName", + "myDatabase", + Arrays.asList("dbo"), + Arrays.asList("customer", "address"), + Arrays.asList("username"), + Arrays.asList("schema asc", "table", "column desc"), + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ColumnsListByDatabaseMin.json + */ + /** + * Sample code: List database columns. + * + * @param manager Entry point to SqlManager. + */ + public static void listDatabaseColumns(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseColumns() + .listByDatabase("myRG", "serverName", "myDatabase", null, null, null, null, null, Context.NONE); + } +} +``` + +### DatabaseColumns_ListByTable + +```java +import com.azure.core.util.Context; + +/** Samples for DatabaseColumns ListByTable. */ +public final class DatabaseColumnsListByTableSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseColumnListByTable.json + */ + /** + * Sample code: List database columns. + * + * @param manager Entry point to SqlManager. + */ + public static void listDatabaseColumns(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databaseColumns().listByTable("myRG", "serverName", "myDatabase", "dbo", "table1", null, Context.NONE); + } +} +``` + +### DatabaseExtensionsOperation_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.OperationMode; +import com.azure.resourcemanager.sql.generated.models.StorageKeyType; + +/** Samples for DatabaseExtensionsOperation CreateOrUpdate. */ +public final class DatabaseExtensionsOperationCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/CreateOrUpdateDatabaseExtensions.json + */ + /** + * Sample code: Create or Update database extensions. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateDatabaseExtensions(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseExtensionsOperations() + .define("polybaseimport") + .withExistingDatabase( + "rg_20cbe0f0-c2d9-4522-9177-5469aad53029", + "srv_1ffd1cf8-9951-47fb-807d-a9c384763849", + "878e303f-1ea0-4f17-aa3d-a22ac5e9da08") + .withOperationMode(OperationMode.POLYBASE_IMPORT) + .withStorageKeyType(StorageKeyType.STORAGE_ACCESS_KEY) + .withStorageKey("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx") + .withStorageUri("https://teststorage.blob.core.windows.net/testcontainer/Manifest.xml") + .create(); + } +} +``` + +### DatabaseExtensionsOperation_Get + +```java +import com.azure.core.util.Context; + +/** Samples for DatabaseExtensionsOperation Get. */ +public final class DatabaseExtensionsOperationGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/GetDatabaseExtensions.json + */ + /** + * Sample code: Get database extensions. + * + * @param manager Entry point to SqlManager. + */ + public static void getDatabaseExtensions(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseExtensionsOperations() + .getWithResponse( + "rg_a1f9d6f8-30d5-4228-9504-8a364361bca3", + "srv_65858e0f-b1d1-4bdc-8351-a7da86ca4939", + "11aa6c5e-58ed-4693-b303-3b8e3131deaa", + "polybaseimport", + Context.NONE); + } +} +``` + +### DatabaseExtensionsOperation_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for DatabaseExtensionsOperation ListByDatabase. */ +public final class DatabaseExtensionsOperationListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ListDatabaseExtensions.json + */ + /** + * Sample code: List database extensions. + * + * @param manager Entry point to SqlManager. + */ + public static void listDatabaseExtensions(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseExtensionsOperations() + .listByDatabase( + "rg_4007c5a9-b3b0-41e1-bd46-9eef38768a4a", + "srv_3b67ec2a-519b-43a7-8533-fb62dce3431e", + "719d8fa4-bf0f-48fc-8cd3-ef40fe6ba1fe", + Context.NONE); + } +} +``` + +### DatabaseOperations_Cancel + +```java +import com.azure.core.util.Context; +import java.util.UUID; + +/** Samples for DatabaseOperations Cancel. */ +public final class DatabaseOperationsCancelSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/CancelDatabaseOperation.json + */ + /** + * Sample code: Cancel the database management operation. + * + * @param manager Entry point to SqlManager. + */ + public static void cancelTheDatabaseManagementOperation( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseOperations() + .cancelWithResponse( + "sqlcrudtest-7398", + "sqlcrudtest-6661", + "testdb", + UUID.fromString("f779414b-e748-4925-8cfe-c8598f7660ae"), + Context.NONE); + } +} +``` + +### DatabaseOperations_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for DatabaseOperations ListByDatabase. */ +public final class DatabaseOperationsListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ListDatabaseOperations.json + */ + /** + * Sample code: List the database management operations. + * + * @param manager Entry point to SqlManager. + */ + public static void listTheDatabaseManagementOperations(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databaseOperations().listByDatabase("sqlcrudtest-7398", "sqlcrudtest-4645", "testdb", Context.NONE); + } +} +``` + +### DatabaseRecommendedActions_Get + +```java +import com.azure.core.util.Context; + +/** Samples for DatabaseRecommendedActions Get. */ +public final class DatabaseRecommendedActionsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseRecommendedActionGet.json + */ + /** + * Sample code: Get database recommended action. + * + * @param manager Entry point to SqlManager. + */ + public static void getDatabaseRecommendedAction(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseRecommendedActions() + .getWithResponse( + "workloadinsight-demos", + "misosisvr", + "IndexAdvisor_test_3", + "CreateIndex", + "IR_[CRM]_[DataPoints]_4821CD2F9510D98184BB", + Context.NONE); + } +} +``` + +### DatabaseRecommendedActions_ListByDatabaseAdvisor + +```java +import com.azure.core.util.Context; + +/** Samples for DatabaseRecommendedActions ListByDatabaseAdvisor. */ +public final class DatabaseRecommendedActionsListByDatabaseAdvisorSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseRecommendedActionList.json + */ + /** + * Sample code: List of database recommended actions. + * + * @param manager Entry point to SqlManager. + */ + public static void listOfDatabaseRecommendedActions(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseRecommendedActions() + .listByDatabaseAdvisorWithResponse( + "workloadinsight-demos", "misosisvr", "IndexAdvisor_test_3", "CreateIndex", Context.NONE); + } +} +``` + +### DatabaseRecommendedActions_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.RecommendedActionInner; +import com.azure.resourcemanager.sql.generated.models.RecommendedActionCurrentState; +import com.azure.resourcemanager.sql.generated.models.RecommendedActionStateInfo; + +/** Samples for DatabaseRecommendedActions Update. */ +public final class DatabaseRecommendedActionsUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseRecommendedActionUpdate.json + */ + /** + * Sample code: Update database recommended action. + * + * @param manager Entry point to SqlManager. + */ + public static void updateDatabaseRecommendedAction(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseRecommendedActions() + .updateWithResponse( + "workloadinsight-demos", + "misosisvr", + "IndexAdvisor_test_3", + "CreateIndex", + "IR_[CRM]_[DataPoints]_4821CD2F9510D98184BB", + new RecommendedActionInner() + .withState( + new RecommendedActionStateInfo().withCurrentValue(RecommendedActionCurrentState.PENDING)), + Context.NONE); + } +} +``` + +### DatabaseSchemas_Get + +```java +import com.azure.core.util.Context; + +/** Samples for DatabaseSchemas Get. */ +public final class DatabaseSchemasGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseSchemaGet.json + */ + /** + * Sample code: Get database schema. + * + * @param manager Entry point to SqlManager. + */ + public static void getDatabaseSchema(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databaseSchemas().getWithResponse("myRG", "serverName", "myDatabase", "dbo", Context.NONE); + } +} +``` + +### DatabaseSchemas_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for DatabaseSchemas ListByDatabase. */ +public final class DatabaseSchemasListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseSchemaListByDatabase.json + */ + /** + * Sample code: List database schemas. + * + * @param manager Entry point to SqlManager. + */ + public static void listDatabaseSchemas(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databaseSchemas().listByDatabase("myRG", "serverName", "myDatabase", null, Context.NONE); + } +} +``` + +### DatabaseSecurityAlertPolicies_CreateOrUpdate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.DatabaseSecurityAlertPolicy; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyName; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertsPolicyState; +import java.util.Arrays; + +/** Samples for DatabaseSecurityAlertPolicies CreateOrUpdate. */ +public final class DatabaseSecurityAlertPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseSecurityAlertCreateMax.json + */ + /** + * Sample code: Update a database's threat detection policy with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateADatabaseSThreatDetectionPolicyWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + DatabaseSecurityAlertPolicy resource = + manager + .databaseSecurityAlertPolicies() + .getWithResponse( + "securityalert-4799", "securityalert-6440", "testdb", SecurityAlertPolicyName.DEFAULT, Context.NONE) + .getValue(); + resource + .update() + .withState(SecurityAlertsPolicyState.ENABLED) + .withDisabledAlerts(Arrays.asList("Sql_Injection", "Usage_Anomaly")) + .withEmailAddresses(Arrays.asList("test@microsoft.com", "user@microsoft.com")) + .withEmailAccountAdmins(true) + .withStorageEndpoint("https://mystorage.blob.core.windows.net") + .withStorageAccountAccessKey( + "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==") + .withRetentionDays(6) + .apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseSecurityAlertCreateMin.json + */ + /** + * Sample code: Update a database's threat detection policy with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateADatabaseSThreatDetectionPolicyWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + DatabaseSecurityAlertPolicy resource = + manager + .databaseSecurityAlertPolicies() + .getWithResponse( + "securityalert-4799", "securityalert-6440", "testdb", SecurityAlertPolicyName.DEFAULT, Context.NONE) + .getValue(); + resource.update().withState(SecurityAlertsPolicyState.ENABLED).apply(); + } +} +``` + +### DatabaseSecurityAlertPolicies_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyName; + +/** Samples for DatabaseSecurityAlertPolicies Get. */ +public final class DatabaseSecurityAlertPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseSecurityAlertGet.json + */ + /** + * Sample code: Get a database's threat detection policy. + * + * @param manager Entry point to SqlManager. + */ + public static void getADatabaseSThreatDetectionPolicy(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseSecurityAlertPolicies() + .getWithResponse( + "securityalert-6852", "securityalert-2080", "testdb", SecurityAlertPolicyName.DEFAULT, Context.NONE); + } +} +``` + +### DatabaseSecurityAlertPolicies_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for DatabaseSecurityAlertPolicies ListByDatabase. */ +public final class DatabaseSecurityAlertPoliciesListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseSecurityAlertListByDatabase.json + */ + /** + * Sample code: Get the database's threat detection policies. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheDatabaseSThreatDetectionPolicies( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseSecurityAlertPolicies() + .listByDatabase("securityalert-6852", "securityalert-2080", "testdb", Context.NONE); + } +} +``` + +### DatabaseSqlVulnerabilityAssessmentBaselines_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.BaselineName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for DatabaseSqlVulnerabilityAssessmentBaselines CreateOrUpdate. */ +public final class DatabaseSqlVulnerabilityAssessmentBaselinesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/DatabaseSqlVulnerabilityAssessmentBaselineAddLatest.json + */ + /** + * Sample code: Add a database's vulnerability assessment rule baseline from the latest scan result. + * + * @param manager Entry point to SqlManager. + */ + public static void addADatabaseSVulnerabilityAssessmentRuleBaselineFromTheLatestScanResult( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseSqlVulnerabilityAssessmentBaselines() + .define(BaselineName.DEFAULT) + .withExistingSqlVulnerabilityAssessment( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + "testdb", + VulnerabilityAssessmentName.DEFAULT) + .withLatestScan(true) + .withResults(mapOf()) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/DatabaseSqlVulnerabilityAssessmentBaselineAdd.json + */ + /** + * Sample code: Add a database's vulnerability assessment rule baseline list. + * + * @param manager Entry point to SqlManager. + */ + public static void addADatabaseSVulnerabilityAssessmentRuleBaselineList( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseSqlVulnerabilityAssessmentBaselines() + .define(BaselineName.DEFAULT) + .withExistingSqlVulnerabilityAssessment( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + "testdb", + VulnerabilityAssessmentName.DEFAULT) + .withLatestScan(false) + .withResults( + mapOf( + "VA2063", + Arrays.asList(Arrays.asList("AllowAll", "0.0.0.0", "255.255.255.255")), + "VA2065", + Arrays.asList(Arrays.asList("AllowAll", "0.0.0.0", "255.255.255.255")))) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### DatabaseSqlVulnerabilityAssessmentBaselines_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.BaselineName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for DatabaseSqlVulnerabilityAssessmentBaselines Get. */ +public final class DatabaseSqlVulnerabilityAssessmentBaselinesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/DatabaseSqlVulnerabilityAssessmentBaselineGet.json + */ + /** + * Sample code: Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAListOfDatabaseSSqlVulnerabilityAssessmentRuleBaselines( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseSqlVulnerabilityAssessmentBaselines() + .getWithResponse( + "vulnerabilityaseessmenttest-4711", + "vulnerabilityaseessmenttest-6411", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + BaselineName.DEFAULT, + Context.NONE); + } +} +``` + +### DatabaseSqlVulnerabilityAssessmentBaselines_ListBySqlVulnerabilityAssessment + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for DatabaseSqlVulnerabilityAssessmentBaselines ListBySqlVulnerabilityAssessment. */ +public final class DatabaseSqlVulnerabilityAssessmentBaselinesListBySqlVulnerabilityAssessmentSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/DatabaseSqlVulnerabilityAssessmentBaselineListBySqlVulnerabilityAssessment.json + */ + /** + * Sample code: Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAListOfDatabaseSSqlVulnerabilityAssessmentRuleBaselines( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseSqlVulnerabilityAssessmentBaselines() + .listBySqlVulnerabilityAssessment( + "vulnerabilityaseessmenttest-4711", + "vulnerabilityaseessmenttest-6411", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + Context.NONE); + } +} +``` + +### DatabaseSqlVulnerabilityAssessmentExecuteScan_Execute + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for DatabaseSqlVulnerabilityAssessmentExecuteScan Execute. */ +public final class DatabaseSqlVulnerabilityAssessmentExecuteScanExecuteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/DatabaseSqlVulnerabilityAssessmentScansExecute.json + */ + /** + * Sample code: Executes a database's vulnerability assessment scan. + * + * @param manager Entry point to SqlManager. + */ + public static void executesADatabaseSVulnerabilityAssessmentScan( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseSqlVulnerabilityAssessmentExecuteScans() + .execute( + "vulnerabilityassessmenttest-4711", + "vulnerabilityassessmenttest-6411", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + Context.NONE); + } +} +``` + +### DatabaseSqlVulnerabilityAssessmentRuleBaselines_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.BaselineName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import java.util.Arrays; + +/** Samples for DatabaseSqlVulnerabilityAssessmentRuleBaselines CreateOrUpdate. */ +public final class DatabaseSqlVulnerabilityAssessmentRuleBaselinesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/DatabaseSqlVulnerabilityAssessmentRuleBaselineCreate.json + */ + /** + * Sample code: Creates or updates a database's vulnerability assessment rule baseline. + * + * @param manager Entry point to SqlManager. + */ + public static void createsOrUpdatesADatabaseSVulnerabilityAssessmentRuleBaseline( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseSqlVulnerabilityAssessmentRuleBaselines() + .define("VA1001") + .withExistingBaseline( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + BaselineName.DEFAULT) + .withLatestScan(false) + .withResults( + Arrays + .asList( + Arrays.asList("userA", "SELECT"), + Arrays.asList("userB", "SELECT"), + Arrays.asList("userC", "SELECT"))) + .create(); + } +} +``` + +### DatabaseSqlVulnerabilityAssessmentRuleBaselines_Delete + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.BaselineName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for DatabaseSqlVulnerabilityAssessmentRuleBaselines Delete. */ +public final class DatabaseSqlVulnerabilityAssessmentRuleBaselinesDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/DatabaseSqlVulnerabilityAssessmentRuleBaselineDelete.json + */ + /** + * Sample code: Removes a database's vulnerability assessment rule baseline. + * + * @param manager Entry point to SqlManager. + */ + public static void removesADatabaseSVulnerabilityAssessmentRuleBaseline( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseSqlVulnerabilityAssessmentRuleBaselines() + .deleteWithResponse( + "vulnerabilityaseessmenttest-4711", + "vulnerabilityaseessmenttest-6411", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + BaselineName.DEFAULT, + "VA1001", + Context.NONE); + } +} +``` + +### DatabaseSqlVulnerabilityAssessmentRuleBaselines_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.BaselineName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for DatabaseSqlVulnerabilityAssessmentRuleBaselines Get. */ +public final class DatabaseSqlVulnerabilityAssessmentRuleBaselinesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/DatabaseSqlVulnerabilityAssessmentRuleBaselineGet.json + */ + /** + * Sample code: Gets a database's sql vulnerability assessment rule baseline. + * + * @param manager Entry point to SqlManager. + */ + public static void getsADatabaseSSqlVulnerabilityAssessmentRuleBaseline( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseSqlVulnerabilityAssessmentRuleBaselines() + .getWithResponse( + "vulnerabilityaseessmenttest-4711", + "vulnerabilityaseessmenttest-6411", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + BaselineName.DEFAULT, + "VA1001", + Context.NONE); + } +} +``` + +### DatabaseSqlVulnerabilityAssessmentRuleBaselines_ListByBaseline + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.BaselineName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for DatabaseSqlVulnerabilityAssessmentRuleBaselines ListByBaseline. */ +public final class DatabaseSqlVulnerabilityAssessmentRuleBaselinesListByBaselineSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/DatabaseSqlVulnerabilityAssessmentRuleBaselineListByBaseline.json + */ + /** + * Sample code: Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAListOfDatabaseSSqlVulnerabilityAssessmentRuleBaselines( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseSqlVulnerabilityAssessmentRuleBaselines() + .listByBaseline( + "vulnerabilityaseessmenttest-4711", + "vulnerabilityaseessmenttest-6411", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + BaselineName.DEFAULT, + Context.NONE); + } +} +``` + +### DatabaseSqlVulnerabilityAssessmentScanResult_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentName; + +/** Samples for DatabaseSqlVulnerabilityAssessmentScanResult Get. */ +public final class DatabaseSqlVulnerabilityAssessmentScanResultGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/DatabaseSqlVulnerabilityAssessmentScansResults.json + */ + /** + * Sample code: Get a database SQL Vulnerability Assessment scan result for scan id and scan result id. + * + * @param manager Entry point to SqlManager. + */ + public static void getADatabaseSQLVulnerabilityAssessmentScanResultForScanIdAndScanResultId( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseSqlVulnerabilityAssessmentScanResults() + .getWithResponse( + "vulnerabilityassessmenttest-4711", + "vulnerabilityassessmenttest-6411", + "master", + SqlVulnerabilityAssessmentName.DEFAULT, + "scanId1", + "VA1234", + Context.NONE); + } +} +``` + +### DatabaseSqlVulnerabilityAssessmentScanResult_ListByScan + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentName; + +/** Samples for DatabaseSqlVulnerabilityAssessmentScanResult ListByScan. */ +public final class DatabaseSqlVulnerabilityAssessmentScanResultListByScanSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/DatabaseSqlVulnerabilityAssessmentListScansResults.json + */ + /** + * Sample code: List database SQL Vulnerability Assessment scan results for scan id. + * + * @param manager Entry point to SqlManager. + */ + public static void listDatabaseSQLVulnerabilityAssessmentScanResultsForScanId( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseSqlVulnerabilityAssessmentScanResults() + .listByScan( + "vulnerabilityassessmenttest-4711", + "testsvr", + "master", + SqlVulnerabilityAssessmentName.DEFAULT, + "scanId1", + Context.NONE); + } +} +``` + +### DatabaseSqlVulnerabilityAssessmentScans_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for DatabaseSqlVulnerabilityAssessmentScans Get. */ +public final class DatabaseSqlVulnerabilityAssessmentScansGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/DatabaseSqlVulnerabilityAssessmentScan.json + */ + /** + * Sample code: Get a database's vulnerability assessment scan. + * + * @param manager Entry point to SqlManager. + */ + public static void getADatabaseSVulnerabilityAssessmentScan( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseSqlVulnerabilityAssessmentScans() + .getWithResponse( + "vulnerabilityassessmenttest-4711", + "vulnerabilityassessmenttest-6411", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + "scan001", + Context.NONE); + } +} +``` + +### DatabaseSqlVulnerabilityAssessmentScans_ListBySqlVulnerabilityAssessments + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for DatabaseSqlVulnerabilityAssessmentScans ListBySqlVulnerabilityAssessments. */ +public final class DatabaseSqlVulnerabilityAssessmentScansListBySqlVulnerabilityAssessmentsSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/DatabaseSqlVulnerabilityAssessmentScanRecordsListByDatabase.json + */ + /** + * Sample code: Gets the list of a database vulnerability assessment scan records. + * + * @param manager Entry point to SqlManager. + */ + public static void getsTheListOfADatabaseVulnerabilityAssessmentScanRecords( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseSqlVulnerabilityAssessmentScans() + .listBySqlVulnerabilityAssessments( + "vulnerabilityassessmenttest-4711", + "vulnerabilityassessmenttest-6411", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + Context.NONE); + } +} +``` + +### DatabaseSqlVulnerabilityAssessmentsSettings_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentNameAutoGenerated; + +/** Samples for DatabaseSqlVulnerabilityAssessmentsSettings Get. */ +public final class DatabaseSqlVulnerabilityAssessmentsSettingsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/DatabaseSqlVulnerabilityAssessmentGet.json + */ + /** + * Sample code: Get SQL Vulnerability Assessment policy for database. + * + * @param manager Entry point to SqlManager. + */ + public static void getSQLVulnerabilityAssessmentPolicyForDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseSqlVulnerabilityAssessmentsSettings() + .getWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + "testdb", + SqlVulnerabilityAssessmentNameAutoGenerated.DEFAULT, + Context.NONE); + } +} +``` + +### DatabaseSqlVulnerabilityAssessmentsSettings_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for DatabaseSqlVulnerabilityAssessmentsSettings ListByDatabase. */ +public final class DatabaseSqlVulnerabilityAssessmentsSettingsListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/DatabaseSqlVulnerabilityAssessmentListByDatabase.json + */ + /** + * Sample code: Get SQL Vulnerability Assessment policies on a given database. + * + * @param manager Entry point to SqlManager. + */ + public static void getSQLVulnerabilityAssessmentPoliciesOnAGivenDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseSqlVulnerabilityAssessmentsSettings() + .listByDatabase( + "vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", "testdb", Context.NONE); + } +} +``` + +### DatabaseTables_Get + +```java +import com.azure.core.util.Context; + +/** Samples for DatabaseTables Get. */ +public final class DatabaseTablesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseTableGet.json + */ + /** + * Sample code: Get database table. + * + * @param manager Entry point to SqlManager. + */ + public static void getDatabaseTable(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databaseTables().getWithResponse("myRG", "serverName", "myDatabase", "dbo", "table1", Context.NONE); + } +} +``` + +### DatabaseTables_ListBySchema + +```java +import com.azure.core.util.Context; + +/** Samples for DatabaseTables ListBySchema. */ +public final class DatabaseTablesListBySchemaSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseTableListBySchema.json + */ + /** + * Sample code: List database tables. + * + * @param manager Entry point to SqlManager. + */ + public static void listDatabaseTables(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databaseTables().listBySchema("myRG", "serverName", "myDatabase", "dbo", null, Context.NONE); + } +} +``` + +### DatabaseUsages_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for DatabaseUsages ListByDatabase. */ +public final class DatabaseUsagesListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/GetDatabaseUsages.json + */ + /** + * Sample code: Gets database usages. + * + * @param manager Entry point to SqlManager. + */ + public static void getsDatabaseUsages(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databaseUsages().listByDatabase("Default-SQL-SouthEastAsia", "testsvr", "testdb", Context.NONE); + } +} +``` + +### DatabaseVulnerabilityAssessmentRuleBaselines_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.DatabaseVulnerabilityAssessmentRuleBaselineItem; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentPolicyBaselineName; +import java.util.Arrays; + +/** Samples for DatabaseVulnerabilityAssessmentRuleBaselines CreateOrUpdate. */ +public final class DatabaseVulnerabilityAssessmentRuleBaselinesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentRuleBaselineCreate.json + */ + /** + * Sample code: Creates or updates a database's vulnerability assessment rule baseline. + * + * @param manager Entry point to SqlManager. + */ + public static void createsOrUpdatesADatabaseSVulnerabilityAssessmentRuleBaseline( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseVulnerabilityAssessmentRuleBaselines() + .define(VulnerabilityAssessmentPolicyBaselineName.DEFAULT) + .withExistingRule( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + "VA1001") + .withBaselineResults( + Arrays + .asList( + new DatabaseVulnerabilityAssessmentRuleBaselineItem() + .withResult(Arrays.asList("userA", "SELECT")), + new DatabaseVulnerabilityAssessmentRuleBaselineItem() + .withResult(Arrays.asList("userB", "SELECT")), + new DatabaseVulnerabilityAssessmentRuleBaselineItem() + .withResult(Arrays.asList("userC", "SELECT", "tableId_4")))) + .create(); + } +} +``` + +### DatabaseVulnerabilityAssessmentRuleBaselines_Delete + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentPolicyBaselineName; + +/** Samples for DatabaseVulnerabilityAssessmentRuleBaselines Delete. */ +public final class DatabaseVulnerabilityAssessmentRuleBaselinesDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentRuleBaselineDelete.json + */ + /** + * Sample code: Removes a database's vulnerability assessment rule baseline. + * + * @param manager Entry point to SqlManager. + */ + public static void removesADatabaseSVulnerabilityAssessmentRuleBaseline( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseVulnerabilityAssessmentRuleBaselines() + .deleteWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + "VA1001", + VulnerabilityAssessmentPolicyBaselineName.DEFAULT, + Context.NONE); + } +} +``` + +### DatabaseVulnerabilityAssessmentRuleBaselines_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentPolicyBaselineName; + +/** Samples for DatabaseVulnerabilityAssessmentRuleBaselines Get. */ +public final class DatabaseVulnerabilityAssessmentRuleBaselinesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentRuleBaselineGet.json + */ + /** + * Sample code: Gets a database's vulnerability assessment rule baseline. + * + * @param manager Entry point to SqlManager. + */ + public static void getsADatabaseSVulnerabilityAssessmentRuleBaseline( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseVulnerabilityAssessmentRuleBaselines() + .getWithResponse( + "vulnerabilityaseessmenttest-4711", + "vulnerabilityaseessmenttest-6411", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + "VA1001", + VulnerabilityAssessmentPolicyBaselineName.MASTER, + Context.NONE); + } +} +``` + +### DatabaseVulnerabilityAssessmentScans_Export + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for DatabaseVulnerabilityAssessmentScans Export. */ +public final class DatabaseVulnerabilityAssessmentScansExportSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentScanExport.json + */ + /** + * Sample code: Export a database's vulnerability assessment scan results. + * + * @param manager Entry point to SqlManager. + */ + public static void exportADatabaseSVulnerabilityAssessmentScanResults( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseVulnerabilityAssessmentScans() + .exportWithResponse( + "vulnerabilityassessmenttest-4799", + "vulnerabilityassessmenttest-6440", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + "scan001", + Context.NONE); + } +} +``` + +### DatabaseVulnerabilityAssessmentScans_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for DatabaseVulnerabilityAssessmentScans Get. */ +public final class DatabaseVulnerabilityAssessmentScansGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentScanRecordsGet.json + */ + /** + * Sample code: Gets a database vulnerability assessment scan record by scan ID. + * + * @param manager Entry point to SqlManager. + */ + public static void getsADatabaseVulnerabilityAssessmentScanRecordByScanID( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseVulnerabilityAssessmentScans() + .getWithResponse( + "vulnerabilityassessmenttest-4711", + "vulnerabilityassessmenttest-6411", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + "scan001", + Context.NONE); + } +} +``` + +### DatabaseVulnerabilityAssessmentScans_InitiateScan + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for DatabaseVulnerabilityAssessmentScans InitiateScan. */ +public final class DatabaseVulnerabilityAssessmentScansInitiateScanSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentScansExecute.json + */ + /** + * Sample code: Executes a database's vulnerability assessment scan. + * + * @param manager Entry point to SqlManager. + */ + public static void executesADatabaseSVulnerabilityAssessmentScan( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseVulnerabilityAssessmentScans() + .initiateScan( + "vulnerabilityassessmenttest-4711", + "vulnerabilityassessmenttest-6411", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + "scan01", + Context.NONE); + } +} +``` + +### DatabaseVulnerabilityAssessmentScans_ListByDatabase + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for DatabaseVulnerabilityAssessmentScans ListByDatabase. */ +public final class DatabaseVulnerabilityAssessmentScansListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentScanRecordsListByDatabase.json + */ + /** + * Sample code: Gets the list of a database vulnerability assessment scan records. + * + * @param manager Entry point to SqlManager. + */ + public static void getsTheListOfADatabaseVulnerabilityAssessmentScanRecords( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseVulnerabilityAssessmentScans() + .listByDatabase( + "vulnerabilityassessmenttest-4711", + "vulnerabilityassessmenttest-6411", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + Context.NONE); + } +} +``` + +### DatabaseVulnerabilityAssessments_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentRecurringScansProperties; +import java.util.Arrays; + +/** Samples for DatabaseVulnerabilityAssessments CreateOrUpdate. */ +public final class DatabaseVulnerabilityAssessmentsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentCreateContainerSasKeyMin.json + */ + /** + * Sample code: Create a database's vulnerability assessment with minimal parameters, when storageContainerSasKey is + * specified. + * + * @param manager Entry point to SqlManager. + */ + public static void + createADatabaseSVulnerabilityAssessmentWithMinimalParametersWhenStorageContainerSasKeyIsSpecified( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseVulnerabilityAssessments() + .define(VulnerabilityAssessmentName.DEFAULT) + .withExistingDatabase("vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", "testdb") + .withStorageContainerPath("https://myStorage.blob.core.windows.net/vulnerability-assessment/") + .withStorageContainerSasKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentCreateMax.json + */ + /** + * Sample code: Create a database's vulnerability assessment with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void createADatabaseSVulnerabilityAssessmentWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseVulnerabilityAssessments() + .define(VulnerabilityAssessmentName.DEFAULT) + .withExistingDatabase("vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", "testdb") + .withStorageContainerPath("https://myStorage.blob.core.windows.net/vulnerability-assessment/") + .withStorageContainerSasKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + .withStorageAccountAccessKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + .withRecurringScans( + new VulnerabilityAssessmentRecurringScansProperties() + .withIsEnabled(true) + .withEmailSubscriptionAdmins(true) + .withEmails(Arrays.asList("email1@mail.com", "email2@mail.com"))) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentCreateStorageAccessKeyMin.json + */ + /** + * Sample code: Create a database's vulnerability assessment with minimal parameters, when storageAccountAccessKey + * is specified. + * + * @param manager Entry point to SqlManager. + */ + public static void + createADatabaseSVulnerabilityAssessmentWithMinimalParametersWhenStorageAccountAccessKeyIsSpecified( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseVulnerabilityAssessments() + .define(VulnerabilityAssessmentName.DEFAULT) + .withExistingDatabase("vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", "testdb") + .withStorageContainerPath("https://myStorage.blob.core.windows.net/vulnerability-assessment/") + .withStorageAccountAccessKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + .create(); + } +} +``` + +### DatabaseVulnerabilityAssessments_Delete + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for DatabaseVulnerabilityAssessments Delete. */ +public final class DatabaseVulnerabilityAssessmentsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentDelete.json + */ + /** + * Sample code: Remove a database's vulnerability assessment. + * + * @param manager Entry point to SqlManager. + */ + public static void removeADatabaseSVulnerabilityAssessment( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseVulnerabilityAssessments() + .deleteWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + Context.NONE); + } +} +``` + +### DatabaseVulnerabilityAssessments_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for DatabaseVulnerabilityAssessments Get. */ +public final class DatabaseVulnerabilityAssessmentsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentGet.json + */ + /** + * Sample code: Get a database's vulnerability assessment. + * + * @param manager Entry point to SqlManager. + */ + public static void getADatabaseSVulnerabilityAssessment( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseVulnerabilityAssessments() + .getWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + Context.NONE); + } +} +``` + +### DatabaseVulnerabilityAssessments_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for DatabaseVulnerabilityAssessments ListByDatabase. */ +public final class DatabaseVulnerabilityAssessmentsListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentListByDatabase.json + */ + /** + * Sample code: Get the database's vulnerability assessment policies. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheDatabaseSVulnerabilityAssessmentPolicies( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseVulnerabilityAssessments() + .listByDatabase( + "vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", "testdb", Context.NONE); + } +} +``` + +### Databases_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.AlwaysEncryptedEnclaveType; +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.azure.resourcemanager.sql.generated.models.CreateMode; +import com.azure.resourcemanager.sql.generated.models.SecondaryType; +import com.azure.resourcemanager.sql.generated.models.Sku; +import java.time.OffsetDateTime; + +/** Samples for Databases CreateOrUpdate. */ +public final class DatabasesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/CreateDatabaseConfiguredBackupStorageRedundancy.json + */ + /** + * Sample code: Creates a database with specified backup storage redundancy. + * + * @param manager Entry point to SqlManager. + */ + public static void createsADatabaseWithSpecifiedBackupStorageRedundancy( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("testdb") + .withRegion("southeastasia") + .withExistingServer("Default-SQL-SouthEastAsia", "testsvr") + .withRequestedBackupStorageRedundancy(BackupStorageRedundancy.ZONE) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/CreateDatabaseVBSEnclave.json + */ + /** + * Sample code: Creates a database with VBS enclave type. + * + * @param manager Entry point to SqlManager. + */ + public static void createsADatabaseWithVBSEnclaveType(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("testdb") + .withRegion("southeastasia") + .withExistingServer("Default-SQL-SouthEastAsia", "testsvr") + .withPreferredEnclaveType(AlwaysEncryptedEnclaveType.VBS) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/CreateDatabaseDefaultMode.json + */ + /** + * Sample code: Creates a database with default mode. + * + * @param manager Entry point to SqlManager. + */ + public static void createsADatabaseWithDefaultMode(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("testdb") + .withRegion("southeastasia") + .withExistingServer("Default-SQL-SouthEastAsia", "testsvr") + .withSku(new Sku().withName("S0").withTier("Standard")) + .withCreateMode(CreateMode.DEFAULT) + .withCollation("SQL_Latin1_General_CP1_CI_AS") + .withMaxSizeBytes(1073741824L) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/CreateVCoreDatabaseByServiceObjective.json + */ + /** + * Sample code: Creates a VCore database by specifying service objective name. + * + * @param manager Entry point to SqlManager. + */ + public static void createsAVCoreDatabaseBySpecifyingServiceObjectiveName( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("testdb") + .withRegion("southeastasia") + .withExistingServer("Default-SQL-SouthEastAsia", "testsvr") + .withSku(new Sku().withName("BC").withFamily("Gen4").withCapacity(2)) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/CreateDatabaseMin.json + */ + /** + * Sample code: Creates a database with minimum number of parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void createsADatabaseWithMinimumNumberOfParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("testdb") + .withRegion("southeastasia") + .withExistingServer("Default-SQL-SouthEastAsia", "testsvr") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/CreateDatabaseStandbyMode.json + */ + /** + * Sample code: Creates a database as a standby secondary. + * + * @param manager Entry point to SqlManager. + */ + public static void createsADatabaseAsAStandbySecondary(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("testdb") + .withRegion("southeastasia") + .withExistingServer("Default-SQL-SouthEastAsia", "testsvr") + .withSku(new Sku().withName("S0").withTier("Standard")) + .withCreateMode(CreateMode.SECONDARY) + .withSourceDatabaseId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-NorthEurope/providers/Microsoft.Sql/servers/testsvr1/databases/testdb") + .withSecondaryType(SecondaryType.STANDBY) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/CreateDwDatabaseCrossSubscriptionRecovery.json + */ + /** + * Sample code: Creates a data warehouse database as a cross-subscription restore from a geo-backup. + * + * @param manager Entry point to SqlManager. + */ + public static void createsADataWarehouseDatabaseAsACrossSubscriptionRestoreFromAGeoBackup( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("testdw") + .withRegion("westus") + .withExistingServer("Default-SQL-WestUS", "testsvr") + .withCreateMode(CreateMode.RECOVERY) + .withSourceResourceId( + "/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-SQL-EastUS/providers/Microsoft.Sql/servers/srcsvr/recoverabledatabases/srcdw") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/CreateDatabaseMaintenanceConfiguration.json + */ + /** + * Sample code: Creates a database with preferred maintenance window. + * + * @param manager Entry point to SqlManager. + */ + public static void createsADatabaseWithPreferredMaintenanceWindow( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("testdb") + .withRegion("southeastasia") + .withExistingServer("Default-SQL-SouthEastAsia", "testsvr") + .withSku(new Sku().withName("S2").withTier("Standard")) + .withCreateMode(CreateMode.DEFAULT) + .withCollation("SQL_Latin1_General_CP1_CI_AS") + .withMaxSizeBytes(1073741824L) + .withMaintenanceConfigurationId( + "/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_SouthEastAsia_1") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/CreateDatabaseCopyMode.json + */ + /** + * Sample code: Creates a database as a copy. + * + * @param manager Entry point to SqlManager. + */ + public static void createsADatabaseAsACopy(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("dbcopy") + .withRegion("southeastasia") + .withExistingServer("Default-SQL-SouthEastAsia", "testsvr") + .withSku(new Sku().withName("S0").withTier("Standard")) + .withCreateMode(CreateMode.COPY) + .withSourceDatabaseId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/CreateDatabasePITRMode.json + */ + /** + * Sample code: Creates a database from PointInTimeRestore. + * + * @param manager Entry point to SqlManager. + */ + public static void createsADatabaseFromPointInTimeRestore( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("dbpitr") + .withRegion("southeastasia") + .withExistingServer("Default-SQL-SouthEastAsia", "testsvr") + .withCreateMode(CreateMode.POINT_IN_TIME_RESTORE) + .withSourceDatabaseId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SoutheastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb") + .withRestorePointInTime(OffsetDateTime.parse("2020-10-22T05:35:31.503Z")) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/CreateDatabaseLedger.json + */ + /** + * Sample code: Creates a database with ledger on. + * + * @param manager Entry point to SqlManager. + */ + public static void createsADatabaseWithLedgerOn(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("testdb") + .withRegion("southeastasia") + .withExistingServer("Default-SQL-SouthEastAsia", "testsvr") + .withIsLedgerOn(true) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/CreateDatabaseDefaultEnclave.json + */ + /** + * Sample code: Creates a database with Default enclave type. + * + * @param manager Entry point to SqlManager. + */ + public static void createsADatabaseWithDefaultEnclaveType( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("testdb") + .withRegion("southeastasia") + .withExistingServer("Default-SQL-SouthEastAsia", "testsvr") + .withPreferredEnclaveType(AlwaysEncryptedEnclaveType.DEFAULT) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/CreateDwDatabaseCrossSubscriptionPITR.json + */ + /** + * Sample code: Creates a data warehouse database as a cross-subscription restore from a restore point of an + * existing database. + * + * @param manager Entry point to SqlManager. + */ + public static void createsADataWarehouseDatabaseAsACrossSubscriptionRestoreFromARestorePointOfAnExistingDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("testdw") + .withRegion("southeastasia") + .withExistingServer("Default-SQL-SouthEastAsia", "testsvr") + .withCreateMode(CreateMode.POINT_IN_TIME_RESTORE) + .withRestorePointInTime(OffsetDateTime.parse("2022-01-22T05:35:31.503Z")) + .withSourceResourceId( + "/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/srcsvr/databases/srcdw") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/CreateVCoreDatabaseBySkuNameCapacity.json + */ + /** + * Sample code: Creates a VCore database by specifying sku name and capacity. + * + * @param manager Entry point to SqlManager. + */ + public static void createsAVCoreDatabaseBySpecifyingSkuNameAndCapacity( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("testdb") + .withRegion("southeastasia") + .withExistingServer("Default-SQL-SouthEastAsia", "testsvr") + .withSku(new Sku().withName("BC_Gen4").withCapacity(2)) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/CreateDwDatabaseCrossSubscriptionRestore.json + */ + /** + * Sample code: Creates a data warehouse database as a cross-subscription restore from a backup of a dropped + * database. + * + * @param manager Entry point to SqlManager. + */ + public static void createsADataWarehouseDatabaseAsACrossSubscriptionRestoreFromABackupOfADroppedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("testdw") + .withRegion("southeastasia") + .withExistingServer("Default-SQL-SouthEastAsia", "testsvr") + .withCreateMode(CreateMode.RESTORE) + .withSourceResourceId( + "/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/srcsvr/restorableDroppedDatabases/srcdw,131403269876900000") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/CreateDatabaseNamedReplica.json + */ + /** + * Sample code: Creates a database as named replica secondary. + * + * @param manager Entry point to SqlManager. + */ + public static void createsADatabaseAsNamedReplicaSecondary( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("testdb") + .withRegion("southeastasia") + .withExistingServer("Default-SQL-SouthEastAsia", "testsvr") + .withSku(new Sku().withName("HS_Gen4").withTier("Hyperscale").withCapacity(2)) + .withCreateMode(CreateMode.SECONDARY) + .withSourceDatabaseId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-NorthEurope/providers/Microsoft.Sql/servers/testsvr1/databases/primarydb") + .withSecondaryType(SecondaryType.NAMED) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/CreateDatabaseSecondaryMode.json + */ + /** + * Sample code: Creates a database as an on-line secondary. + * + * @param manager Entry point to SqlManager. + */ + public static void createsADatabaseAsAnOnLineSecondary(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("testdb") + .withRegion("southeastasia") + .withExistingServer("Default-SQL-SouthEastAsia", "testsvr") + .withSku(new Sku().withName("S0").withTier("Standard")) + .withCreateMode(CreateMode.SECONDARY) + .withSourceDatabaseId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-NorthEurope/providers/Microsoft.Sql/servers/testsvr1/databases/testdb") + .withSecondaryType(SecondaryType.GEO) + .create(); + } +} +``` + +### Databases_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for Databases Delete. */ +public final class DatabasesDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/DeleteDatabase.json + */ + /** + * Sample code: Deletes a database. + * + * @param manager Entry point to SqlManager. + */ + public static void deletesADatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databases().delete("Default-SQL-SouthEastAsia", "testsvr", "testdb", Context.NONE); + } +} +``` + +### Databases_Export + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ExportDatabaseDefinition; +import com.azure.resourcemanager.sql.generated.models.NetworkIsolationSettings; +import com.azure.resourcemanager.sql.generated.models.StorageKeyType; + +/** Samples for Databases Export. */ +public final class DatabasesExportSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/ExportDatabase.json + */ + /** + * Sample code: Exports a database. + * + * @param manager Entry point to SqlManager. + */ + public static void exportsADatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .export( + "Default-SQL-SouthEastAsia", + "testsvr", + "testdb", + new ExportDatabaseDefinition() + .withStorageKeyType(StorageKeyType.STORAGE_ACCESS_KEY) + .withStorageKey("fakeTokenPlaceholder") + .withStorageUri("https://test.blob.core.windows.net/test.bacpac") + .withAdministratorLogin("login") + .withAdministratorLoginPassword("fakeTokenPlaceholder") + .withAuthenticationType("Sql"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/ExportDatabaseWithNetworkIsolation.json + */ + /** + * Sample code: Exports a database, using private link to communicate with SQL server and storage account. + * + * @param manager Entry point to SqlManager. + */ + public static void exportsADatabaseUsingPrivateLinkToCommunicateWithSQLServerAndStorageAccount( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .export( + "Default-SQL-SouthEastAsia", + "testsvr", + "testdb", + new ExportDatabaseDefinition() + .withStorageKeyType(StorageKeyType.STORAGE_ACCESS_KEY) + .withStorageKey("fakeTokenPlaceholder") + .withStorageUri("https://test.blob.core.windows.net/test.bacpac") + .withAdministratorLogin("login") + .withAdministratorLoginPassword("fakeTokenPlaceholder") + .withAuthenticationType("Sql") + .withNetworkIsolation( + new NetworkIsolationSettings() + .withStorageAccountResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Storage/storageAccounts/test-privatelink") + .withSqlServerResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr")), + Context.NONE); + } +} +``` + +### Databases_Failover + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ReplicaType; + +/** Samples for Databases Failover. */ +public final class DatabasesFailoverSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/FailoverDatabase.json + */ + /** + * Sample code: Failover an database. + * + * @param manager Entry point to SqlManager. + */ + public static void failoverAnDatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databases().failover("group1", "testServer", "testDatabase", ReplicaType.PRIMARY, Context.NONE); + } +} +``` + +### Databases_Get + +```java +import com.azure.core.util.Context; + +/** Samples for Databases Get. */ +public final class DatabasesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/GetVCoreDatabase.json + */ + /** + * Sample code: Gets a database. + * + * @param manager Entry point to SqlManager. + */ + public static void getsADatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databases().getWithResponse("Default-SQL-SouthEastAsia", "testsvr", "testdb", Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/GetVCoreDatabaseDefaultEnclave.json + */ + /** + * Sample code: Gets a database configured with Default enclave type. + * + * @param manager Entry point to SqlManager. + */ + public static void getsADatabaseConfiguredWithDefaultEnclaveType( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databases().getWithResponse("Default-SQL-SouthEastAsia", "testsvr", "testdb", Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/GetVCoreDatabaseVBSEnclave.json + */ + /** + * Sample code: Gets a database configured with VBS enclave type. + * + * @param manager Entry point to SqlManager. + */ + public static void getsADatabaseConfiguredWithVBSEnclaveType( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databases().getWithResponse("Default-SQL-SouthEastAsia", "testsvr", "testdb", Context.NONE); + } +} +``` + +### Databases_ImportMethod + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ImportExistingDatabaseDefinition; +import com.azure.resourcemanager.sql.generated.models.NetworkIsolationSettings; +import com.azure.resourcemanager.sql.generated.models.StorageKeyType; + +/** Samples for Databases ImportMethod. */ +public final class DatabasesImportMethodSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/ImportDatabase.json + */ + /** + * Sample code: Imports to an existing empty database. + * + * @param manager Entry point to SqlManager. + */ + public static void importsToAnExistingEmptyDatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .importMethod( + "Default-SQL-SouthEastAsia", + "testsvr", + "testdb", + new ImportExistingDatabaseDefinition() + .withStorageKeyType(StorageKeyType.STORAGE_ACCESS_KEY) + .withStorageKey("fakeTokenPlaceholder") + .withStorageUri("https://test.blob.core.windows.net/test.bacpac") + .withAdministratorLogin("login") + .withAdministratorLoginPassword("fakeTokenPlaceholder") + .withAuthenticationType("Sql"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/ImportDatabaseWithNetworkIsolation.json + */ + /** + * Sample code: Imports to an existing empty database, using private link to communicate with SQL server and storage + * account. + * + * @param manager Entry point to SqlManager. + */ + public static void importsToAnExistingEmptyDatabaseUsingPrivateLinkToCommunicateWithSQLServerAndStorageAccount( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .importMethod( + "Default-SQL-SouthEastAsia", + "testsvr", + "testdb", + new ImportExistingDatabaseDefinition() + .withStorageKeyType(StorageKeyType.STORAGE_ACCESS_KEY) + .withStorageKey("fakeTokenPlaceholder") + .withStorageUri("https://test.blob.core.windows.net/test.bacpac") + .withAdministratorLogin("login") + .withAdministratorLoginPassword("fakeTokenPlaceholder") + .withAuthenticationType("Sql") + .withNetworkIsolation( + new NetworkIsolationSettings() + .withStorageAccountResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Storage/storageAccounts/test-privatelink") + .withSqlServerResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr")), + Context.NONE); + } +} +``` + +### Databases_ListByElasticPool + +```java +import com.azure.core.util.Context; + +/** Samples for Databases ListByElasticPool. */ +public final class DatabasesListByElasticPoolSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/ListDatabasesByElasticPool.json + */ + /** + * Sample code: Gets a list of databases in an elastic pool. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAListOfDatabasesInAnElasticPool(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databases().listByElasticPool("Default-SQL-SouthEastAsia", "testsvr", "pool1", Context.NONE); + } +} +``` + +### Databases_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for Databases ListByServer. */ +public final class DatabasesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/ListVCoreDatabasesEnclaveTypeByServer.json + */ + /** + * Sample code: Gets a list of databases configured with enclave type. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAListOfDatabasesConfiguredWithEnclaveType( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databases().listByServer("Default-SQL-SouthEastAsia", "testsvr", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/ListVCoreDatabasesByServer.json + */ + /** + * Sample code: Gets a list of databases. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAListOfDatabases(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databases().listByServer("Default-SQL-SouthEastAsia", "testsvr", null, Context.NONE); + } +} +``` + +### Databases_ListInaccessibleByServer + +```java +import com.azure.core.util.Context; + +/** Samples for Databases ListInaccessibleByServer. */ +public final class DatabasesListInaccessibleByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/ListVCoreInaccessibleDatabasesByServer.json + */ + /** + * Sample code: Gets a list of inaccessible databases in a logical server. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAListOfInaccessibleDatabasesInALogicalServer( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databases().listInaccessibleByServer("Default-SQL-SouthEastAsia", "testsvr", Context.NONE); + } +} +``` + +### Databases_ListMetricDefinitions + +```java +import com.azure.core.util.Context; + +/** Samples for Databases ListMetricDefinitions. */ +public final class DatabasesListMetricDefinitionsSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/DatabaseMetricsDefinitionsList.json + */ + /** + * Sample code: List database usage metrics. + * + * @param manager Entry point to SqlManager. + */ + public static void listDatabaseUsageMetrics(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databases().listMetricDefinitions("sqlcrudtest-6730", "sqlcrudtest-9007", "3481", Context.NONE); + } +} +``` + +### Databases_ListMetrics + +```java +import com.azure.core.util.Context; + +/** Samples for Databases ListMetrics. */ +public final class DatabasesListMetricsSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/DatabaseMetricsListWithFilter.json + */ + /** + * Sample code: List database usage metrics. + * + * @param manager Entry point to SqlManager. + */ + public static void listDatabaseUsageMetrics(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .listMetrics( + "sqlcrudtest-6730", + "sqlcrudtest-9007", + "3481", + "name/value eq 'cpu_percent' and timeGrain eq '00:10:00' and startTime eq '2017-06-02T18:35:00Z' and" + + " endTime eq '2017-06-02T18:55:00Z'", + Context.NONE); + } +} +``` + +### Databases_Pause + +```java +import com.azure.core.util.Context; + +/** Samples for Databases Pause. */ +public final class DatabasesPauseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/PauseDatabase.json + */ + /** + * Sample code: Pauses a database. + * + * @param manager Entry point to SqlManager. + */ + public static void pausesADatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databases().pause("Default-SQL-SouthEastAsia", "testsvr", "testdwdb", Context.NONE); + } +} +``` + +### Databases_Rename + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ResourceMoveDefinition; + +/** Samples for Databases Rename. */ +public final class DatabasesRenameSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/RenameDatabase.json + */ + /** + * Sample code: Renames a database. + * + * @param manager Entry point to SqlManager. + */ + public static void renamesADatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .renameWithResponse( + "Default-SQL-SouthEastAsia", + "testsvr", + "testdb", + new ResourceMoveDefinition() + .withId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/newtestdb"), + Context.NONE); + } +} +``` + +### Databases_Resume + +```java +import com.azure.core.util.Context; + +/** Samples for Databases Resume. */ +public final class DatabasesResumeSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/ResumeDatabase.json + */ + /** + * Sample code: Resumes a database. + * + * @param manager Entry point to SqlManager. + */ + public static void resumesADatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databases().resume("Default-SQL-SouthEastAsia", "testsvr", "testdwdb", Context.NONE); + } +} +``` + +### Databases_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.AlwaysEncryptedEnclaveType; +import com.azure.resourcemanager.sql.generated.models.Database; +import com.azure.resourcemanager.sql.generated.models.DatabaseLicenseType; +import com.azure.resourcemanager.sql.generated.models.Sku; + +/** Samples for Databases Update. */ +public final class DatabasesUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/PatchVCoreDatabaseAssignMaintenanceConfiguration.json + */ + /** + * Sample code: Assigns maintenance window to a database. + * + * @param manager Entry point to SqlManager. + */ + public static void assignsMaintenanceWindowToADatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + Database resource = + manager + .databases() + .getWithResponse("Default-SQL-SouthEastAsia", "testsvr", "testdb", Context.NONE) + .getValue(); + resource + .update() + .withSku(new Sku().withName("BC_Gen5_4")) + .withMaintenanceConfigurationId( + "/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_SouthEastAsia_1") + .apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/PatchDatabaseVBSEnclave.json + */ + /** + * Sample code: Creates a database with VBS enclave type. + * + * @param manager Entry point to SqlManager. + */ + public static void createsADatabaseWithVBSEnclaveType(com.azure.resourcemanager.sql.generated.SqlManager manager) { + Database resource = + manager + .databases() + .getWithResponse("Default-SQL-SouthEastAsia", "testsvr", "testdb", Context.NONE) + .getValue(); + resource.update().withPreferredEnclaveType(AlwaysEncryptedEnclaveType.VBS).apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/PatchVCoreDatabaseResetMaintenanceConfiguration.json + */ + /** + * Sample code: Resets maintenance window of a database to default. + * + * @param manager Entry point to SqlManager. + */ + public static void resetsMaintenanceWindowOfADatabaseToDefault( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + Database resource = + manager + .databases() + .getWithResponse("Default-SQL-SouthEastAsia", "testsvr", "testdb", Context.NONE) + .getValue(); + resource + .update() + .withSku(new Sku().withName("BC_Gen5_4")) + .withMaintenanceConfigurationId( + "/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_Default") + .apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/PatchDatabaseDefaultEnclave.json + */ + /** + * Sample code: Updates a database with Default enclave type. + * + * @param manager Entry point to SqlManager. + */ + public static void updatesADatabaseWithDefaultEnclaveType( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + Database resource = + manager + .databases() + .getWithResponse("Default-SQL-SouthEastAsia", "testsvr", "testdb", Context.NONE) + .getValue(); + resource.update().withPreferredEnclaveType(AlwaysEncryptedEnclaveType.DEFAULT).apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/PatchVCoreDatabase.json + */ + /** + * Sample code: Updates a database. + * + * @param manager Entry point to SqlManager. + */ + public static void updatesADatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + Database resource = + manager + .databases() + .getWithResponse("Default-SQL-SouthEastAsia", "testsvr", "testdb", Context.NONE) + .getValue(); + resource + .update() + .withSku(new Sku().withName("BC_Gen4_4")) + .withMaxSizeBytes(1073741824L) + .withLicenseType(DatabaseLicenseType.LICENSE_INCLUDED) + .apply(); + } +} +``` + +### Databases_UpgradeDataWarehouse + +```java +import com.azure.core.util.Context; + +/** Samples for Databases UpgradeDataWarehouse. */ +public final class DatabasesUpgradeDataWarehouseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/UpgradeDataWarehouse.json + */ + /** + * Sample code: Upgrades a data warehouse. + * + * @param manager Entry point to SqlManager. + */ + public static void upgradesADataWarehouse(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databases().upgradeDataWarehouse("Default-SQL-SouthEastAsia", "testsvr", "testdwdb", Context.NONE); + } +} +``` + +### DeletedServers_Get + +```java +import com.azure.core.util.Context; + +/** Samples for DeletedServers Get. */ +public final class DeletedServersGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeletedServerGet.json + */ + /** + * Sample code: Get deleted server. + * + * @param manager Entry point to SqlManager. + */ + public static void getDeletedServer(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.deletedServers().getWithResponse("japaneast", "sqlcrudtest-d-1414", Context.NONE); + } +} +``` + +### DeletedServers_List + +```java +import com.azure.core.util.Context; + +/** Samples for DeletedServers List. */ +public final class DeletedServersListSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeletedServerListBySubscription.json + */ + /** + * Sample code: List deleted servers in a subscription. + * + * @param manager Entry point to SqlManager. + */ + public static void listDeletedServersInASubscription(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.deletedServers().list(Context.NONE); + } +} +``` + +### DeletedServers_ListByLocation + +```java +import com.azure.core.util.Context; + +/** Samples for DeletedServers ListByLocation. */ +public final class DeletedServersListByLocationSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeletedServerList.json + */ + /** + * Sample code: List deleted servers. + * + * @param manager Entry point to SqlManager. + */ + public static void listDeletedServers(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.deletedServers().listByLocation("japaneast", Context.NONE); + } +} +``` + +### DeletedServers_Recover + +```java +import com.azure.core.util.Context; + +/** Samples for DeletedServers Recover. */ +public final class DeletedServersRecoverSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeletedServerRecover.json + */ + /** + * Sample code: Recover deleted server. + * + * @param manager Entry point to SqlManager. + */ + public static void recoverDeletedServer(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.deletedServers().recover("japaneast", "sqlcrudtest-d-1414", Context.NONE); + } +} +``` + +### DistributedAvailabilityGroups_CreateOrUpdate + +```java +/** Samples for DistributedAvailabilityGroups CreateOrUpdate. */ +public final class DistributedAvailabilityGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DistributedAvailabilityGroupsCreate.json + */ + /** + * Sample code: Create a distributed availability group. + * + * @param manager Entry point to SqlManager. + */ + public static void createADistributedAvailabilityGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .distributedAvailabilityGroups() + .define("dag") + .withExistingManagedInstance("testrg", "testcl") + .withTargetDatabase("testdb") + .withSourceEndpoint("TCP://SERVER:7022") + .withPrimaryAvailabilityGroupName("BoxLocalAg1") + .withSecondaryAvailabilityGroupName("testcl") + .create(); + } +} +``` + +### DistributedAvailabilityGroups_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for DistributedAvailabilityGroups Delete. */ +public final class DistributedAvailabilityGroupsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DistributedAvailabilityGroupsDelete.json + */ + /** + * Sample code: Initiate a distributed availability group drop. + * + * @param manager Entry point to SqlManager. + */ + public static void initiateADistributedAvailabilityGroupDrop( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.distributedAvailabilityGroups().delete("testrg", "testcl", "dag", Context.NONE); + } +} +``` + +### DistributedAvailabilityGroups_Get + +```java +import com.azure.core.util.Context; + +/** Samples for DistributedAvailabilityGroups Get. */ +public final class DistributedAvailabilityGroupsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DistributedAvailabilityGroupsGet.json + */ + /** + * Sample code: Gets the distributed availability group info. + * + * @param manager Entry point to SqlManager. + */ + public static void getsTheDistributedAvailabilityGroupInfo( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.distributedAvailabilityGroups().getWithResponse("testrg", "testcl", "dag", Context.NONE); + } +} +``` + +### DistributedAvailabilityGroups_ListByInstance + +```java +import com.azure.core.util.Context; + +/** Samples for DistributedAvailabilityGroups ListByInstance. */ +public final class DistributedAvailabilityGroupsListByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DistributedAvailabilityGroupsListByInstance.json + */ + /** + * Sample code: Lists all distributed availability groups in instance. + * + * @param manager Entry point to SqlManager. + */ + public static void listsAllDistributedAvailabilityGroupsInInstance( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.distributedAvailabilityGroups().listByInstance("testrg", "testcl", Context.NONE); + } +} +``` + +### DistributedAvailabilityGroups_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.DistributedAvailabilityGroup; +import com.azure.resourcemanager.sql.generated.models.ReplicationMode; + +/** Samples for DistributedAvailabilityGroups Update. */ +public final class DistributedAvailabilityGroupsUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DistributedAvailabilityGroupsUpdate.json + */ + /** + * Sample code: Update the distributed availability group replication mode before deleting it. + * + * @param manager Entry point to SqlManager. + */ + public static void updateTheDistributedAvailabilityGroupReplicationModeBeforeDeletingIt( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + DistributedAvailabilityGroup resource = + manager.distributedAvailabilityGroups().getWithResponse("testrg", "testcl", "dag", Context.NONE).getValue(); + resource.update().withReplicationMode(ReplicationMode.SYNC).apply(); + } +} +``` + +### ElasticPoolActivities_ListByElasticPool + +```java +import com.azure.core.util.Context; + +/** Samples for ElasticPoolActivities ListByElasticPool. */ +public final class ElasticPoolActivitiesListByElasticPoolSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01-legacy/examples/ElasticPoolActivityList.json + */ + /** + * Sample code: List Elastic pool activity. + * + * @param manager Entry point to SqlManager. + */ + public static void listElasticPoolActivity(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.elasticPoolActivities().listByElasticPool("sqlcrudtest-4291", "sqlcrudtest-6574", "8749", Context.NONE); + } +} +``` + +### ElasticPoolDatabaseActivities_ListByElasticPool + +```java +import com.azure.core.util.Context; + +/** Samples for ElasticPoolDatabaseActivities ListByElasticPool. */ +public final class ElasticPoolDatabaseActivitiesListByElasticPoolSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01-legacy/examples/ElasticPoolDatabaseActivityList.json + */ + /** + * Sample code: List elastic pool database activity. + * + * @param manager Entry point to SqlManager. + */ + public static void listElasticPoolDatabaseActivity(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .elasticPoolDatabaseActivities() + .listByElasticPool("sqlcrudtest-4673", "sqlcrudtest-603", "7537", Context.NONE); + } +} +``` + +### ElasticPoolOperations_Cancel + +```java +import com.azure.core.util.Context; +import java.util.UUID; + +/** Samples for ElasticPoolOperations Cancel. */ +public final class ElasticPoolOperationsCancelSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CancelElasticPoolOperation.json + */ + /** + * Sample code: Cancel the elastic pool management operation. + * + * @param manager Entry point to SqlManager. + */ + public static void cancelTheElasticPoolManagementOperation( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .elasticPoolOperations() + .cancelWithResponse( + "sqlcrudtest-7398", + "sqlcrudtest-6661", + "testpool", + UUID.fromString("f779414b-e748-4925-8cfe-c8598f7660ae"), + Context.NONE); + } +} +``` + +### ElasticPoolOperations_ListByElasticPool + +```java +import com.azure.core.util.Context; + +/** Samples for ElasticPoolOperations ListByElasticPool. */ +public final class ElasticPoolOperationsListByElasticPoolSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListElasticPoolOperations.json + */ + /** + * Sample code: List the elastic pool management operations. + * + * @param manager Entry point to SqlManager. + */ + public static void listTheElasticPoolManagementOperations( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .elasticPoolOperations() + .listByElasticPool("sqlcrudtestgroup", "sqlcrudtestserver", "testpool", Context.NONE); + } +} +``` + +### ElasticPools_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.ElasticPoolPerDatabaseSettings; +import com.azure.resourcemanager.sql.generated.models.Sku; + +/** Samples for ElasticPools CreateOrUpdate. */ +public final class ElasticPoolsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/ElasticPoolCreateOrUpdateMax.json + */ + /** + * Sample code: Create or update elastic pool with all parameter. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateElasticPoolWithAllParameter( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .elasticPools() + .define("sqlcrudtest-8102") + .withRegion("Japan East") + .withExistingServer("sqlcrudtest-2369", "sqlcrudtest-8069") + .withSku(new Sku().withName("GP_Gen4_2").withTier("GeneralPurpose").withCapacity(2)) + .withPerDatabaseSettings(new ElasticPoolPerDatabaseSettings().withMinCapacity(0.25D).withMaxCapacity(2.0D)) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/HyperscaleElasticPoolCreateOrUpdateSetHighAvailabilityReplicaCount.json + */ + /** + * Sample code: Create or update Hyperscale elastic pool with high availability replica count parameter. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateHyperscaleElasticPoolWithHighAvailabilityReplicaCountParameter( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .elasticPools() + .define("sqlcrudtest-8102") + .withRegion("Japan East") + .withExistingServer("sqlcrudtest-2369", "sqlcrudtest-8069") + .withSku(new Sku().withName("HS_Gen5_4")) + .withHighAvailabilityReplicaCount(2) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/ElasticPoolCreateOrUpdateSetMaintenanceConfiguration.json + */ + /** + * Sample code: Create or update elastic pool with maintenance configuration parameter. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateElasticPoolWithMaintenanceConfigurationParameter( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .elasticPools() + .define("sqlcrudtest-8102") + .withRegion("Japan East") + .withExistingServer("sqlcrudtest-2369", "sqlcrudtest-8069") + .withMaintenanceConfigurationId( + "/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_JapanEast_1") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/ElasticPoolCreateOrUpdateMin.json + */ + /** + * Sample code: Create or update elastic pool with minimum parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateElasticPoolWithMinimumParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .elasticPools() + .define("sqlcrudtest-8102") + .withRegion("Japan East") + .withExistingServer("sqlcrudtest-2369", "sqlcrudtest-8069") + .create(); + } +} +``` + +### ElasticPools_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for ElasticPools Delete. */ +public final class ElasticPoolsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/ElasticPoolDelete.json + */ + /** + * Sample code: Delete an elastic pool. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteAnElasticPool(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.elasticPools().delete("sqlcrudtest-3129", "sqlcrudtest-228", "sqlcrudtest-3851", Context.NONE); + } +} +``` + +### ElasticPools_Failover + +```java +import com.azure.core.util.Context; + +/** Samples for ElasticPools Failover. */ +public final class ElasticPoolsFailoverSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/FailoverElasticPool.json + */ + /** + * Sample code: Failover an elastic pool. + * + * @param manager Entry point to SqlManager. + */ + public static void failoverAnElasticPool(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.elasticPools().failover("group1", "testServer", "testElasticPool", Context.NONE); + } +} +``` + +### ElasticPools_Get + +```java +import com.azure.core.util.Context; + +/** Samples for ElasticPools Get. */ +public final class ElasticPoolsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/HyperscaleElasticPoolGet.json + */ + /** + * Sample code: Get a Hyperscale elastic pool. + * + * @param manager Entry point to SqlManager. + */ + public static void getAHyperscaleElasticPool(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .elasticPools() + .getWithResponse("sqlcrudtest-2369", "sqlcrudtest-8069", "sqlcrudtest-8102", Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/ElasticPoolGet.json + */ + /** + * Sample code: Get an elastic pool. + * + * @param manager Entry point to SqlManager. + */ + public static void getAnElasticPool(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .elasticPools() + .getWithResponse("sqlcrudtest-2369", "sqlcrudtest-8069", "sqlcrudtest-8102", Context.NONE); + } +} +``` + +### ElasticPools_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for ElasticPools ListByServer. */ +public final class ElasticPoolsListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/ElasticPoolListByServer.json + */ + /** + * Sample code: Get all elastic pools in a server. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllElasticPoolsInAServer(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.elasticPools().listByServer("sqlcrudtest-2369", "sqlcrudtest-8069", null, Context.NONE); + } +} +``` + +### ElasticPools_ListMetricDefinitions + +```java +import com.azure.core.util.Context; + +/** Samples for ElasticPools ListMetricDefinitions. */ +public final class ElasticPoolsListMetricDefinitionsSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/ElasticPoolMetricsDefinitionsList.json + */ + /** + * Sample code: List database usage metrics. + * + * @param manager Entry point to SqlManager. + */ + public static void listDatabaseUsageMetrics(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.elasticPools().listMetricDefinitions("sqlcrudtest-6730", "sqlcrudtest-9007", "3481", Context.NONE); + } +} +``` + +### ElasticPools_ListMetrics + +```java +import com.azure.core.util.Context; + +/** Samples for ElasticPools ListMetrics. */ +public final class ElasticPoolsListMetricsSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/ElasticPoolMetricsListWithFilter.json + */ + /** + * Sample code: List database usage metrics. + * + * @param manager Entry point to SqlManager. + */ + public static void listDatabaseUsageMetrics(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .elasticPools() + .listMetrics( + "sqlcrudtest-6730", + "sqlcrudtest-9007", + "3481", + "name/value eq 'cpu_percent' and timeGrain eq '00:10:00' and startTime eq '2017-06-02T18:35:00Z' and" + + " endTime eq '2017-06-02T18:55:00Z'", + Context.NONE); + } +} +``` + +### ElasticPools_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ElasticPool; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolLicenseType; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolPerDatabaseSettings; +import com.azure.resourcemanager.sql.generated.models.Sku; + +/** Samples for ElasticPools Update. */ +public final class ElasticPoolsUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/ElasticPoolUpdateMax.json + */ + /** + * Sample code: Update an elastic pool with all parameter. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAnElasticPoolWithAllParameter(com.azure.resourcemanager.sql.generated.SqlManager manager) { + ElasticPool resource = + manager + .elasticPools() + .getWithResponse("sqlcrudtest-2369", "sqlcrudtest-8069", "sqlcrudtest-8102", Context.NONE) + .getValue(); + resource + .update() + .withSku(new Sku().withName("BC_Gen4").withTier("BusinessCritical").withCapacity(2)) + .withPerDatabaseSettings(new ElasticPoolPerDatabaseSettings().withMinCapacity(0.25D).withMaxCapacity(1.0D)) + .withZoneRedundant(true) + .withLicenseType(ElasticPoolLicenseType.LICENSE_INCLUDED) + .apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/HyperscaleElasticPoolUpdateSetHighAvailabilityReplicaCount.json + */ + /** + * Sample code: Update high availability replica count of a Hyperscale elastic pool. + * + * @param manager Entry point to SqlManager. + */ + public static void updateHighAvailabilityReplicaCountOfAHyperscaleElasticPool( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ElasticPool resource = + manager + .elasticPools() + .getWithResponse("sqlcrudtest-2369", "sqlcrudtest-8069", "sqlcrudtest-8102", Context.NONE) + .getValue(); + resource.update().withHighAvailabilityReplicaCount(2).apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/ElasticPoolUpdateMin.json + */ + /** + * Sample code: Update an elastic pool with minimum parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAnElasticPoolWithMinimumParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ElasticPool resource = + manager + .elasticPools() + .getWithResponse("sqlcrudtest-2369", "sqlcrudtest-8069", "sqlcrudtest-8102", Context.NONE) + .getValue(); + resource.update().apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/ElasticPoolUpdateAssignMaintenanceConfiguration.json + */ + /** + * Sample code: Assigns maintenance configuration to an elastic pool. + * + * @param manager Entry point to SqlManager. + */ + public static void assignsMaintenanceConfigurationToAnElasticPool( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ElasticPool resource = + manager + .elasticPools() + .getWithResponse("sqlcrudtest-2369", "sqlcrudtest-8069", "sqlcrudtest-8102", Context.NONE) + .getValue(); + resource + .update() + .withMaintenanceConfigurationId( + "/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_JapanEast_1") + .apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/ElasticPoolUpdateResetMaintenanceConfiguration.json + */ + /** + * Sample code: Resets maintenance configuration of an elastic pool to default. + * + * @param manager Entry point to SqlManager. + */ + public static void resetsMaintenanceConfigurationOfAnElasticPoolToDefault( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ElasticPool resource = + manager + .elasticPools() + .getWithResponse("sqlcrudtest-2369", "sqlcrudtest-8069", "sqlcrudtest-8102", Context.NONE) + .getValue(); + resource + .update() + .withMaintenanceConfigurationId( + "/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_Default") + .apply(); + } +} +``` + +### EncryptionProtectors_CreateOrUpdate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.EncryptionProtector; +import com.azure.resourcemanager.sql.generated.models.EncryptionProtectorName; +import com.azure.resourcemanager.sql.generated.models.ServerKeyType; + +/** Samples for EncryptionProtectors CreateOrUpdate. */ +public final class EncryptionProtectorsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/EncryptionProtectorCreateOrUpdateKeyVault.json + */ + /** + * Sample code: Update the encryption protector to key vault. + * + * @param manager Entry point to SqlManager. + */ + public static void updateTheEncryptionProtectorToKeyVault( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + EncryptionProtector resource = + manager + .encryptionProtectors() + .getWithResponse("sqlcrudtest-7398", "sqlcrudtest-4645", EncryptionProtectorName.CURRENT, Context.NONE) + .getValue(); + resource + .update() + .withServerKeyName("someVault_someKey_01234567890123456789012345678901") + .withServerKeyType(ServerKeyType.AZURE_KEY_VAULT) + .withAutoRotationEnabled(false) + .apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/EncryptionProtectorCreateOrUpdateServiceManaged.json + */ + /** + * Sample code: Update the encryption protector to service managed. + * + * @param manager Entry point to SqlManager. + */ + public static void updateTheEncryptionProtectorToServiceManaged( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + EncryptionProtector resource = + manager + .encryptionProtectors() + .getWithResponse("sqlcrudtest-7398", "sqlcrudtest-4645", EncryptionProtectorName.CURRENT, Context.NONE) + .getValue(); + resource.update().withServerKeyName("ServiceManaged").withServerKeyType(ServerKeyType.SERVICE_MANAGED).apply(); + } +} +``` + +### EncryptionProtectors_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.EncryptionProtectorName; + +/** Samples for EncryptionProtectors Get. */ +public final class EncryptionProtectorsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/EncryptionProtectorGet.json + */ + /** + * Sample code: Get the encryption protector. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheEncryptionProtector(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .encryptionProtectors() + .getWithResponse("sqlcrudtest-7398", "sqlcrudtest-4645", EncryptionProtectorName.CURRENT, Context.NONE); + } +} +``` + +### EncryptionProtectors_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for EncryptionProtectors ListByServer. */ +public final class EncryptionProtectorsListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/EncryptionProtectorList.json + */ + /** + * Sample code: List encryption protectors by server. + * + * @param manager Entry point to SqlManager. + */ + public static void listEncryptionProtectorsByServer(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.encryptionProtectors().listByServer("sqlcrudtest-7398", "sqlcrudtest-4645", Context.NONE); + } +} +``` + +### EncryptionProtectors_Revalidate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.EncryptionProtectorName; + +/** Samples for EncryptionProtectors Revalidate. */ +public final class EncryptionProtectorsRevalidateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/EncryptionProtectorRevalidate.json + */ + /** + * Sample code: Revalidates the encryption protector. + * + * @param manager Entry point to SqlManager. + */ + public static void revalidatesTheEncryptionProtector(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .encryptionProtectors() + .revalidate("sqlcrudtest-7398", "sqlcrudtest-4645", EncryptionProtectorName.CURRENT, Context.NONE); + } +} +``` + +### EndpointCertificates_Get + +```java +import com.azure.core.util.Context; + +/** Samples for EndpointCertificates Get. */ +public final class EndpointCertificatesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/EndpointCertificatesGet.json + */ + /** + * Sample code: Gets an endpoint certificate. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAnEndpointCertificate(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.endpointCertificates().getWithResponse("testrg", "testcl", "DATABASE_MIRRORING", Context.NONE); + } +} +``` + +### EndpointCertificates_ListByInstance + +```java +import com.azure.core.util.Context; + +/** Samples for EndpointCertificates ListByInstance. */ +public final class EndpointCertificatesListByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/EndpointCertificatesListByInstance.json + */ + /** + * Sample code: Get a list of endpoint certificates. + * + * @param manager Entry point to SqlManager. + */ + public static void getAListOfEndpointCertificates(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.endpointCertificates().listByInstance("testrg", "testcl", Context.NONE); + } +} +``` + +### ExtendedDatabaseBlobAuditingPolicies_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.BlobAuditingPolicyState; +import java.util.Arrays; +import java.util.UUID; + +/** Samples for ExtendedDatabaseBlobAuditingPolicies CreateOrUpdate. */ +public final class ExtendedDatabaseBlobAuditingPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ExtendedDatabaseBlobAuditingCreateMin.json + */ + /** + * Sample code: Create or update an extended database's blob auditing policy with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateAnExtendedDatabaseSBlobAuditingPolicyWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .extendedDatabaseBlobAuditingPolicies() + .define() + .withExistingDatabase("blobauditingtest-4799", "blobauditingtest-6440", "testdb") + .withState(BlobAuditingPolicyState.ENABLED) + .withStorageEndpoint("https://mystorage.blob.core.windows.net") + .withStorageAccountAccessKey( + "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ExtendedDatabaseBlobAuditingCreateMax.json + */ + /** + * Sample code: Create or update an extended database's blob auditing policy with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateAnExtendedDatabaseSBlobAuditingPolicyWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .extendedDatabaseBlobAuditingPolicies() + .define() + .withExistingDatabase("blobauditingtest-4799", "blobauditingtest-6440", "testdb") + .withPredicateExpression("statement = 'select 1'") + .withRetentionDays(6) + .withAuditActionsAndGroups( + Arrays + .asList( + "DATABASE_LOGOUT_GROUP", + "DATABASE_ROLE_MEMBER_CHANGE_GROUP", + "UPDATE on database::TestDatabaseName by public")) + .withIsStorageSecondaryKeyInUse(false) + .withIsAzureMonitorTargetEnabled(true) + .withQueueDelayMs(4000) + .withState(BlobAuditingPolicyState.ENABLED) + .withStorageEndpoint("https://mystorage.blob.core.windows.net") + .withStorageAccountAccessKey( + "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==") + .withStorageAccountSubscriptionId(UUID.fromString("00000000-1234-0000-5678-000000000000")) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ExtendedDatabaseAzureMonitorAuditingCreateMin.json + */ + /** + * Sample code: Create or update an extended database's azure monitor auditing policy with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateAnExtendedDatabaseSAzureMonitorAuditingPolicyWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .extendedDatabaseBlobAuditingPolicies() + .define() + .withExistingDatabase("blobauditingtest-4799", "blobauditingtest-6440", "testdb") + .withIsAzureMonitorTargetEnabled(true) + .withState(BlobAuditingPolicyState.ENABLED) + .create(); + } +} +``` + +### ExtendedDatabaseBlobAuditingPolicies_Get + +```java +import com.azure.core.util.Context; + +/** Samples for ExtendedDatabaseBlobAuditingPolicies Get. */ +public final class ExtendedDatabaseBlobAuditingPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ExtendedDatabaseBlobAuditingGet.json + */ + /** + * Sample code: Get an extended database's blob auditing policy. + * + * @param manager Entry point to SqlManager. + */ + public static void getAnExtendedDatabaseSBlobAuditingPolicy( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .extendedDatabaseBlobAuditingPolicies() + .getWithResponse("blobauditingtest-6852", "blobauditingtest-2080", "testdb", Context.NONE); + } +} +``` + +### ExtendedDatabaseBlobAuditingPolicies_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for ExtendedDatabaseBlobAuditingPolicies ListByDatabase. */ +public final class ExtendedDatabaseBlobAuditingPoliciesListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DatabaseExtendedAuditingSettingsList.json + */ + /** + * Sample code: List extended auditing settings of a database. + * + * @param manager Entry point to SqlManager. + */ + public static void listExtendedAuditingSettingsOfADatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .extendedDatabaseBlobAuditingPolicies() + .listByDatabase("blobauditingtest-6852", "blobauditingtest-2080", "testdb", Context.NONE); + } +} +``` + +### ExtendedServerBlobAuditingPolicies_CreateOrUpdate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.BlobAuditingPolicyState; +import com.azure.resourcemanager.sql.generated.models.ExtendedServerBlobAuditingPolicy; +import java.util.Arrays; +import java.util.UUID; + +/** Samples for ExtendedServerBlobAuditingPolicies CreateOrUpdate. */ +public final class ExtendedServerBlobAuditingPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ExtendedServerBlobAuditingCreateMin.json + */ + /** + * Sample code: Update a server's extended blob auditing policy with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAServerSExtendedBlobAuditingPolicyWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ExtendedServerBlobAuditingPolicy resource = + manager + .extendedServerBlobAuditingPolicies() + .getWithResponse("blobauditingtest-4799", "blobauditingtest-6440", Context.NONE) + .getValue(); + resource + .update() + .withState(BlobAuditingPolicyState.ENABLED) + .withStorageEndpoint("https://mystorage.blob.core.windows.net") + .withStorageAccountAccessKey( + "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==") + .apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ExtendedServerBlobAuditingCreateMax.json + */ + /** + * Sample code: Update a server's extended blob auditing policy with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAServerSExtendedBlobAuditingPolicyWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ExtendedServerBlobAuditingPolicy resource = + manager + .extendedServerBlobAuditingPolicies() + .getWithResponse("blobauditingtest-4799", "blobauditingtest-6440", Context.NONE) + .getValue(); + resource + .update() + .withPredicateExpression("object_name = 'SensitiveData'") + .withRetentionDays(6) + .withAuditActionsAndGroups( + Arrays + .asList( + "SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP", + "FAILED_DATABASE_AUTHENTICATION_GROUP", + "BATCH_COMPLETED_GROUP")) + .withIsStorageSecondaryKeyInUse(false) + .withIsAzureMonitorTargetEnabled(true) + .withQueueDelayMs(4000) + .withState(BlobAuditingPolicyState.ENABLED) + .withStorageEndpoint("https://mystorage.blob.core.windows.net") + .withStorageAccountAccessKey( + "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==") + .withStorageAccountSubscriptionId(UUID.fromString("00000000-1234-0000-5678-000000000000")) + .apply(); + } +} +``` + +### ExtendedServerBlobAuditingPolicies_Get + +```java +import com.azure.core.util.Context; + +/** Samples for ExtendedServerBlobAuditingPolicies Get. */ +public final class ExtendedServerBlobAuditingPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ExtendedServerBlobAuditingGet.json + */ + /** + * Sample code: Get a server's blob extended auditing policy. + * + * @param manager Entry point to SqlManager. + */ + public static void getAServerSBlobExtendedAuditingPolicy( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .extendedServerBlobAuditingPolicies() + .getWithResponse("blobauditingtest-4799", "blobauditingtest-6440", Context.NONE); + } +} +``` + +### ExtendedServerBlobAuditingPolicies_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for ExtendedServerBlobAuditingPolicies ListByServer. */ +public final class ExtendedServerBlobAuditingPoliciesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerExtendedAuditingSettingsList.json + */ + /** + * Sample code: List extended auditing settings of a server. + * + * @param manager Entry point to SqlManager. + */ + public static void listExtendedAuditingSettingsOfAServer( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .extendedServerBlobAuditingPolicies() + .listByServer("blobauditingtest-4799", "blobauditingtest-6440", Context.NONE); + } +} +``` + +### FailoverGroups_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.FailoverGroupReadOnlyEndpoint; +import com.azure.resourcemanager.sql.generated.models.FailoverGroupReadWriteEndpoint; +import com.azure.resourcemanager.sql.generated.models.PartnerInfo; +import com.azure.resourcemanager.sql.generated.models.ReadOnlyEndpointFailoverPolicy; +import com.azure.resourcemanager.sql.generated.models.ReadWriteEndpointFailoverPolicy; +import java.util.Arrays; + +/** Samples for FailoverGroups CreateOrUpdate. */ +public final class FailoverGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FailoverGroupCreateOrUpdate.json + */ + /** + * Sample code: Create failover group. + * + * @param manager Entry point to SqlManager. + */ + public static void createFailoverGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .failoverGroups() + .define("failover-group-test-3") + .withExistingServer("Default", "failover-group-primary-server") + .withReadWriteEndpoint( + new FailoverGroupReadWriteEndpoint() + .withFailoverPolicy(ReadWriteEndpointFailoverPolicy.AUTOMATIC) + .withFailoverWithDataLossGracePeriodMinutes(480)) + .withReadOnlyEndpoint( + new FailoverGroupReadOnlyEndpoint().withFailoverPolicy(ReadOnlyEndpointFailoverPolicy.DISABLED)) + .withPartnerServers( + Arrays + .asList( + new PartnerInfo() + .withId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/failover-group-secondary-server"))) + .withDatabases( + Arrays + .asList( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/failover-group-primary-server/databases/testdb-1", + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/failover-group-primary-server/databases/testdb-2")) + .create(); + } +} +``` + +### FailoverGroups_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for FailoverGroups Delete. */ +public final class FailoverGroupsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FailoverGroupDelete.json + */ + /** + * Sample code: Delete failover group. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteFailoverGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .failoverGroups() + .delete("Default", "failover-group-primary-server", "failover-group-test-1", Context.NONE); + } +} +``` + +### FailoverGroups_Failover + +```java +import com.azure.core.util.Context; + +/** Samples for FailoverGroups Failover. */ +public final class FailoverGroupsFailoverSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FailoverGroupFailover.json + */ + /** + * Sample code: Planned failover of a failover group. + * + * @param manager Entry point to SqlManager. + */ + public static void plannedFailoverOfAFailoverGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .failoverGroups() + .failover("Default", "failover-group-secondary-server", "failover-group-test-3", Context.NONE); + } +} +``` + +### FailoverGroups_ForceFailoverAllowDataLoss + +```java +import com.azure.core.util.Context; + +/** Samples for FailoverGroups ForceFailoverAllowDataLoss. */ +public final class FailoverGroupsForceFailoverAllowDataLossSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FailoverGroupForceFailoverAllowDataLoss.json + */ + /** + * Sample code: Forced failover of a failover group allowing data loss. + * + * @param manager Entry point to SqlManager. + */ + public static void forcedFailoverOfAFailoverGroupAllowingDataLoss( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .failoverGroups() + .forceFailoverAllowDataLoss( + "Default", "failover-group-secondary-server", "failover-group-test-3", Context.NONE); + } +} +``` + +### FailoverGroups_Get + +```java +import com.azure.core.util.Context; + +/** Samples for FailoverGroups Get. */ +public final class FailoverGroupsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FailoverGroupGet.json + */ + /** + * Sample code: Get failover group. + * + * @param manager Entry point to SqlManager. + */ + public static void getFailoverGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .failoverGroups() + .getWithResponse("Default", "failover-group-primary-server", "failover-group-test", Context.NONE); + } +} +``` + +### FailoverGroups_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for FailoverGroups ListByServer. */ +public final class FailoverGroupsListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FailoverGroupList.json + */ + /** + * Sample code: List failover group. + * + * @param manager Entry point to SqlManager. + */ + public static void listFailoverGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.failoverGroups().listByServer("Default", "failover-group-primary-server", Context.NONE); + } +} +``` + +### FailoverGroups_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.FailoverGroup; +import com.azure.resourcemanager.sql.generated.models.FailoverGroupReadWriteEndpoint; +import com.azure.resourcemanager.sql.generated.models.ReadWriteEndpointFailoverPolicy; +import java.util.Arrays; + +/** Samples for FailoverGroups Update. */ +public final class FailoverGroupsUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FailoverGroupUpdate.json + */ + /** + * Sample code: Update failover group. + * + * @param manager Entry point to SqlManager. + */ + public static void updateFailoverGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + FailoverGroup resource = + manager + .failoverGroups() + .getWithResponse("Default", "failover-group-primary-server", "failover-group-test-1", Context.NONE) + .getValue(); + resource + .update() + .withReadWriteEndpoint( + new FailoverGroupReadWriteEndpoint() + .withFailoverPolicy(ReadWriteEndpointFailoverPolicy.AUTOMATIC) + .withFailoverWithDataLossGracePeriodMinutes(120)) + .withDatabases( + Arrays + .asList( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/failover-group-primary-server/databases/testdb-1")) + .apply(); + } +} +``` + +### FirewallRules_CreateOrUpdate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.FirewallRule; + +/** Samples for FirewallRules CreateOrUpdate. */ +public final class FirewallRulesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FirewallRuleCreate.json + */ + /** + * Sample code: Create a firewall rule max/min. + * + * @param manager Entry point to SqlManager. + */ + public static void createAFirewallRuleMaxMin(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .firewallRules() + .define("firewallrulecrudtest-5370") + .withExistingServer("firewallrulecrudtest-12", "firewallrulecrudtest-6285") + .withStartIpAddress("0.0.0.3") + .withEndIpAddress("0.0.0.3") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FirewallRuleUpdate.json + */ + /** + * Sample code: Update a firewall rule max/min. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAFirewallRuleMaxMin(com.azure.resourcemanager.sql.generated.SqlManager manager) { + FirewallRule resource = + manager + .firewallRules() + .getWithResponse( + "firewallrulecrudtest-12", "firewallrulecrudtest-6285", "firewallrulecrudtest-3927", Context.NONE) + .getValue(); + resource.update().withStartIpAddress("0.0.0.1").withEndIpAddress("0.0.0.1").apply(); + } +} +``` + +### FirewallRules_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for FirewallRules Delete. */ +public final class FirewallRulesDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FirewallRuleDelete.json + */ + /** + * Sample code: Delete a firewall rule. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteAFirewallRule(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .firewallRules() + .deleteWithResponse( + "firewallrulecrudtest-9886", "firewallrulecrudtest-2368", "firewallrulecrudtest-7011", Context.NONE); + } +} +``` + +### FirewallRules_Get + +```java +import com.azure.core.util.Context; + +/** Samples for FirewallRules Get. */ +public final class FirewallRulesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FirewallRuleGet.json + */ + /** + * Sample code: Get Firewall Rule. + * + * @param manager Entry point to SqlManager. + */ + public static void getFirewallRule(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .firewallRules() + .getWithResponse( + "firewallrulecrudtest-12", "firewallrulecrudtest-6285", "firewallrulecrudtest-2304", Context.NONE); + } +} +``` + +### FirewallRules_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for FirewallRules ListByServer. */ +public final class FirewallRulesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FirewallRuleList.json + */ + /** + * Sample code: List Firewall Rules. + * + * @param manager Entry point to SqlManager. + */ + public static void listFirewallRules(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.firewallRules().listByServer("firewallrulecrudtest-12", "firewallrulecrudtest-6285", Context.NONE); + } +} +``` + +### FirewallRules_Replace + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.FirewallRuleInner; +import com.azure.resourcemanager.sql.generated.models.FirewallRuleList; +import java.util.Arrays; + +/** Samples for FirewallRules Replace. */ +public final class FirewallRulesReplaceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FirewallRuleReplace.json + */ + /** + * Sample code: Replace firewall rules. + * + * @param manager Entry point to SqlManager. + */ + public static void replaceFirewallRules(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .firewallRules() + .replaceWithResponse( + "firewallrulecrudtest-12", + "firewallrulecrudtest-6285", + new FirewallRuleList() + .withValues( + Arrays + .asList( + new FirewallRuleInner() + .withName("firewallrulecrudtest-5370 ") + .withStartIpAddress("0.0.0.0") + .withEndIpAddress("100.0.0.0"))), + Context.NONE); + } +} +``` + +### GeoBackupPolicies_CreateOrUpdate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.GeoBackupPolicy; +import com.azure.resourcemanager.sql.generated.models.GeoBackupPolicyName; +import com.azure.resourcemanager.sql.generated.models.GeoBackupPolicyState; + +/** Samples for GeoBackupPolicies CreateOrUpdate. */ +public final class GeoBackupPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/GeoBackupPoliciesCreateOrUpdate.json + */ + /** + * Sample code: Update geo backup policy. + * + * @param manager Entry point to SqlManager. + */ + public static void updateGeoBackupPolicy(com.azure.resourcemanager.sql.generated.SqlManager manager) { + GeoBackupPolicy resource = + manager + .geoBackupPolicies() + .getWithResponse( + "sqlcrudtest-4799", "sqlcrudtest-5961", "testdw", GeoBackupPolicyName.DEFAULT, Context.NONE) + .getValue(); + resource.update().withState(GeoBackupPolicyState.ENABLED).apply(); + } +} +``` + +### GeoBackupPolicies_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.GeoBackupPolicyName; + +/** Samples for GeoBackupPolicies Get. */ +public final class GeoBackupPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/GeoBackupPoliciesGet.json + */ + /** + * Sample code: Get geo backup policy. + * + * @param manager Entry point to SqlManager. + */ + public static void getGeoBackupPolicy(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .geoBackupPolicies() + .getWithResponse( + "sqlcrudtest-4799", "sqlcrudtest-5961", "testdw", GeoBackupPolicyName.DEFAULT, Context.NONE); + } +} +``` + +### GeoBackupPolicies_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for GeoBackupPolicies ListByDatabase. */ +public final class GeoBackupPoliciesListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/GeoBackupPoliciesList.json + */ + /** + * Sample code: List geo backup policies. + * + * @param manager Entry point to SqlManager. + */ + public static void listGeoBackupPolicies(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.geoBackupPolicies().listByDatabase("sqlcrudtest-4799", "sqlcrudtest-5961", "testdw", Context.NONE); + } +} +``` + +### IPv6FirewallRules_CreateOrUpdate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.IPv6FirewallRule; + +/** Samples for IPv6FirewallRules CreateOrUpdate. */ +public final class IPv6FirewallRulesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/IPv6FirewallRuleCreate.json + */ + /** + * Sample code: Create an IPv6 firewall rule max/min. + * + * @param manager Entry point to SqlManager. + */ + public static void createAnIPv6FirewallRuleMaxMin(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .iPv6FirewallRules() + .define("firewallrulecrudtest-5370") + .withExistingServer("firewallrulecrudtest-12", "firewallrulecrudtest-6285") + .withStartIPv6Address("0000:0000:0000:0000:0000:ffff:0000:0003") + .withEndIPv6Address("0000:0000:0000:0000:0000:ffff:0000:0003") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/IPv6FirewallRuleUpdate.json + */ + /** + * Sample code: Update an IPv6 firewall rule max/min. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAnIPv6FirewallRuleMaxMin(com.azure.resourcemanager.sql.generated.SqlManager manager) { + IPv6FirewallRule resource = + manager + .iPv6FirewallRules() + .getWithResponse( + "firewallrulecrudtest-12", "firewallrulecrudtest-6285", "firewallrulecrudtest-3927", Context.NONE) + .getValue(); + resource + .update() + .withStartIPv6Address("0000:0000:0000:0000:0000:ffff:0000:0001") + .withEndIPv6Address("0000:0000:0000:0000:0000:ffff:0000:0001") + .apply(); + } +} +``` + +### IPv6FirewallRules_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for IPv6FirewallRules Delete. */ +public final class IPv6FirewallRulesDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/IPv6FirewallRuleDelete.json + */ + /** + * Sample code: Delete an IPv6 firewall rule. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteAnIPv6FirewallRule(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .iPv6FirewallRules() + .deleteWithResponse( + "firewallrulecrudtest-9886", "firewallrulecrudtest-2368", "firewallrulecrudtest-7011", Context.NONE); + } +} +``` + +### IPv6FirewallRules_Get + +```java +import com.azure.core.util.Context; + +/** Samples for IPv6FirewallRules Get. */ +public final class IPv6FirewallRulesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/IPv6FirewallRuleGet.json + */ + /** + * Sample code: Get IPv6 Firewall Rule. + * + * @param manager Entry point to SqlManager. + */ + public static void getIPv6FirewallRule(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .iPv6FirewallRules() + .getWithResponse( + "firewallrulecrudtest-12", "firewallrulecrudtest-6285", "firewallrulecrudtest-2304", Context.NONE); + } +} +``` + +### IPv6FirewallRules_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for IPv6FirewallRules ListByServer. */ +public final class IPv6FirewallRulesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/IPv6FirewallRuleList.json + */ + /** + * Sample code: List IPv6 Firewall Rules. + * + * @param manager Entry point to SqlManager. + */ + public static void listIPv6FirewallRules(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.iPv6FirewallRules().listByServer("firewallrulecrudtest-12", "firewallrulecrudtest-6285", Context.NONE); + } +} +``` + +### InstanceFailoverGroups_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.InstanceFailoverGroupReadOnlyEndpoint; +import com.azure.resourcemanager.sql.generated.models.InstanceFailoverGroupReadWriteEndpoint; +import com.azure.resourcemanager.sql.generated.models.ManagedInstancePairInfo; +import com.azure.resourcemanager.sql.generated.models.PartnerRegionInfo; +import com.azure.resourcemanager.sql.generated.models.ReadOnlyEndpointFailoverPolicy; +import com.azure.resourcemanager.sql.generated.models.ReadWriteEndpointFailoverPolicy; +import java.util.Arrays; + +/** Samples for InstanceFailoverGroups CreateOrUpdate. */ +public final class InstanceFailoverGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/InstanceFailoverGroupCreateOrUpdate.json + */ + /** + * Sample code: Create failover group. + * + * @param manager Entry point to SqlManager. + */ + public static void createFailoverGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .instanceFailoverGroups() + .define("failover-group-test-3") + .withExistingLocation("Default", "Japan East") + .withReadWriteEndpoint( + new InstanceFailoverGroupReadWriteEndpoint() + .withFailoverPolicy(ReadWriteEndpointFailoverPolicy.AUTOMATIC) + .withFailoverWithDataLossGracePeriodMinutes(480)) + .withReadOnlyEndpoint( + new InstanceFailoverGroupReadOnlyEndpoint().withFailoverPolicy(ReadOnlyEndpointFailoverPolicy.DISABLED)) + .withPartnerRegions(Arrays.asList(new PartnerRegionInfo().withLocation("Japan West"))) + .withManagedInstancePairs( + Arrays + .asList( + new ManagedInstancePairInfo() + .withPrimaryManagedInstanceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/failover-group-primary-mngdInstance") + .withPartnerManagedInstanceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/failover-group-secondary-mngdInstance"))) + .create(); + } +} +``` + +### InstanceFailoverGroups_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for InstanceFailoverGroups Delete. */ +public final class InstanceFailoverGroupsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/InstanceFailoverGroupDelete.json + */ + /** + * Sample code: Delete failover group. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteFailoverGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.instanceFailoverGroups().delete("Default", "Japan East", "failover-group-test-1", Context.NONE); + } +} +``` + +### InstanceFailoverGroups_Failover + +```java +import com.azure.core.util.Context; + +/** Samples for InstanceFailoverGroups Failover. */ +public final class InstanceFailoverGroupsFailoverSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/InstanceFailoverGroupFailover.json + */ + /** + * Sample code: Planned failover of a failover group. + * + * @param manager Entry point to SqlManager. + */ + public static void plannedFailoverOfAFailoverGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.instanceFailoverGroups().failover("Default", "Japan West", "failover-group-test-3", Context.NONE); + } +} +``` + +### InstanceFailoverGroups_ForceFailoverAllowDataLoss + +```java +import com.azure.core.util.Context; + +/** Samples for InstanceFailoverGroups ForceFailoverAllowDataLoss. */ +public final class InstanceFailoverGroupsForceFailoverAllowDataLossSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/InstanceFailoverGroupForceFailoverAllowDataLoss.json + */ + /** + * Sample code: Forced failover of a failover group allowing data loss. + * + * @param manager Entry point to SqlManager. + */ + public static void forcedFailoverOfAFailoverGroupAllowingDataLoss( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .instanceFailoverGroups() + .forceFailoverAllowDataLoss("Default", "Japan West", "failover-group-test-3", Context.NONE); + } +} +``` + +### InstanceFailoverGroups_Get + +```java +import com.azure.core.util.Context; + +/** Samples for InstanceFailoverGroups Get. */ +public final class InstanceFailoverGroupsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/InstanceFailoverGroupGet.json + */ + /** + * Sample code: Get failover group. + * + * @param manager Entry point to SqlManager. + */ + public static void getFailoverGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.instanceFailoverGroups().getWithResponse("Default", "Japan East", "failover-group-test", Context.NONE); + } +} +``` + +### InstanceFailoverGroups_ListByLocation + +```java +import com.azure.core.util.Context; + +/** Samples for InstanceFailoverGroups ListByLocation. */ +public final class InstanceFailoverGroupsListByLocationSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/InstanceFailoverGroupList.json + */ + /** + * Sample code: List failover group. + * + * @param manager Entry point to SqlManager. + */ + public static void listFailoverGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.instanceFailoverGroups().listByLocation("Default", "Japan East", Context.NONE); + } +} +``` + +### InstancePools_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.InstancePoolLicenseType; +import com.azure.resourcemanager.sql.generated.models.Sku; +import java.util.HashMap; +import java.util.Map; + +/** Samples for InstancePools CreateOrUpdate. */ +public final class InstancePoolsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateInstancePoolMax.json + */ + /** + * Sample code: Create an instance pool with all properties. + * + * @param manager Entry point to SqlManager. + */ + public static void createAnInstancePoolWithAllProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .instancePools() + .define("testIP") + .withRegion("japaneast") + .withExistingResourceGroup("group1") + .withTags(mapOf("a", "b")) + .withSku(new Sku().withName("GP_Gen5").withTier("GeneralPurpose").withFamily("Gen5")) + .withSubnetId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Network/virtualNetworks/myvnet/subnets/mysubnet1") + .withVCores(8) + .withLicenseType(InstancePoolLicenseType.LICENSE_INCLUDED) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateInstancePoolMin.json + */ + /** + * Sample code: Create an instance pool with min properties. + * + * @param manager Entry point to SqlManager. + */ + public static void createAnInstancePoolWithMinProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .instancePools() + .define("testIP") + .withRegion("japaneast") + .withExistingResourceGroup("group1") + .withSku(new Sku().withName("GP_Gen5").withTier("GeneralPurpose").withFamily("Gen5")) + .withSubnetId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Network/virtualNetworks/myvnet/subnets/mysubnet1") + .withVCores(8) + .withLicenseType(InstancePoolLicenseType.LICENSE_INCLUDED) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### InstancePools_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for InstancePools Delete. */ +public final class InstancePoolsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeleteInstancePool.json + */ + /** + * Sample code: Delete an instance pool. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteAnInstancePool(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.instancePools().delete("group1", "testIP", Context.NONE); + } +} +``` + +### InstancePools_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for InstancePools GetByResourceGroup. */ +public final class InstancePoolsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetInstancePool.json + */ + /** + * Sample code: Get an instance pool. + * + * @param manager Entry point to SqlManager. + */ + public static void getAnInstancePool(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.instancePools().getByResourceGroupWithResponse("group1", "testIP", Context.NONE); + } +} +``` + +### InstancePools_List + +```java +import com.azure.core.util.Context; + +/** Samples for InstancePools List. */ +public final class InstancePoolsListSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListInstancePoolsBySubscriptionId.json + */ + /** + * Sample code: List instance pools in the subscription. + * + * @param manager Entry point to SqlManager. + */ + public static void listInstancePoolsInTheSubscription(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.instancePools().list(Context.NONE); + } +} +``` + +### InstancePools_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for InstancePools ListByResourceGroup. */ +public final class InstancePoolsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListInstancePoolsByResourceGroup.json + */ + /** + * Sample code: List instance pools by resource group. + * + * @param manager Entry point to SqlManager. + */ + public static void listInstancePoolsByResourceGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.instancePools().listByResourceGroup("group1", Context.NONE); + } +} +``` + +### InstancePools_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.InstancePool; +import java.util.HashMap; +import java.util.Map; + +/** Samples for InstancePools Update. */ +public final class InstancePoolsUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/PatchInstancePool.json + */ + /** + * Sample code: Patch an instance pool. + * + * @param manager Entry point to SqlManager. + */ + public static void patchAnInstancePool(com.azure.resourcemanager.sql.generated.SqlManager manager) { + InstancePool resource = + manager.instancePools().getByResourceGroupWithResponse("group1", "testIP", Context.NONE).getValue(); + resource.update().withTags(mapOf("x", "y")).apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### JobAgents_CreateOrUpdate + +```java +/** Samples for JobAgents CreateOrUpdate. */ +public final class JobAgentsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateJobAgent.json + */ + /** + * Sample code: Create or update a job agent. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateAJobAgent(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobAgents() + .define("agent1") + .withRegion("southeastasia") + .withExistingServer("group1", "server1") + .withDatabaseId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/databases/db1") + .create(); + } +} +``` + +### JobAgents_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for JobAgents Delete. */ +public final class JobAgentsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeleteJobAgent.json + */ + /** + * Sample code: Delete a job agent. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteAJobAgent(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobAgents().delete("group1", "server1", "agent1", Context.NONE); + } +} +``` + +### JobAgents_Get + +```java +import com.azure.core.util.Context; + +/** Samples for JobAgents Get. */ +public final class JobAgentsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJobAgent.json + */ + /** + * Sample code: Get a job agent. + * + * @param manager Entry point to SqlManager. + */ + public static void getAJobAgent(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobAgents().getWithResponse("group1", "server1", "agent1", Context.NONE); + } +} +``` + +### JobAgents_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for JobAgents ListByServer. */ +public final class JobAgentsListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobAgentsByServer.json + */ + /** + * Sample code: List job agents in a server. + * + * @param manager Entry point to SqlManager. + */ + public static void listJobAgentsInAServer(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobAgents().listByServer("group1", "server1", Context.NONE); + } +} +``` + +### JobAgents_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.JobAgent; +import java.util.HashMap; +import java.util.Map; + +/** Samples for JobAgents Update. */ +public final class JobAgentsUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/UpdateJobAgent.json + */ + /** + * Sample code: Update a job agent's tags. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAJobAgentSTags(com.azure.resourcemanager.sql.generated.SqlManager manager) { + JobAgent resource = manager.jobAgents().getWithResponse("group1", "server1", "agent1", Context.NONE).getValue(); + resource.update().withTags(mapOf("mytag1", "myvalue1")).apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### JobCredentials_CreateOrUpdate + +```java +/** Samples for JobCredentials CreateOrUpdate. */ +public final class JobCredentialsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateJobCredential.json + */ + /** + * Sample code: Create or update a credential. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateACredential(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobCredentials() + .define("cred1") + .withExistingJobAgent("group1", "server1", "agent1") + .withUsername("myuser") + .withPassword("") + .create(); + } +} +``` + +### JobCredentials_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for JobCredentials Delete. */ +public final class JobCredentialsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeleteJobCredential.json + */ + /** + * Sample code: Delete a credential. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteACredential(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobCredentials().deleteWithResponse("group1", "server1", "agent1", "cred1", Context.NONE); + } +} +``` + +### JobCredentials_Get + +```java +import com.azure.core.util.Context; + +/** Samples for JobCredentials Get. */ +public final class JobCredentialsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJobCredential.json + */ + /** + * Sample code: Get a credential. + * + * @param manager Entry point to SqlManager. + */ + public static void getACredential(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobCredentials().getWithResponse("group1", "server1", "agent1", "cred1", Context.NONE); + } +} +``` + +### JobCredentials_ListByAgent + +```java +import com.azure.core.util.Context; + +/** Samples for JobCredentials ListByAgent. */ +public final class JobCredentialsListByAgentSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobCredentialsByAgent.json + */ + /** + * Sample code: List credentials in a job agent. + * + * @param manager Entry point to SqlManager. + */ + public static void listCredentialsInAJobAgent(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobCredentials().listByAgent("group1", "server1", "agent1", Context.NONE); + } +} +``` + +### JobExecutions_Cancel + +```java +import com.azure.core.util.Context; +import java.util.UUID; + +/** Samples for JobExecutions Cancel. */ +public final class JobExecutionsCancelSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CancelJobExecution.json + */ + /** + * Sample code: Cancel a job execution. + * + * @param manager Entry point to SqlManager. + */ + public static void cancelAJobExecution(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobExecutions() + .cancelWithResponse( + "group1", + "server1", + "agent1", + "job1", + UUID.fromString("5A86BF65-43AC-F258-2524-9E92992F97CA"), + Context.NONE); + } +} +``` + +### JobExecutions_Create + +```java +import com.azure.core.util.Context; + +/** Samples for JobExecutions Create. */ +public final class JobExecutionsCreateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateJobExecution.json + */ + /** + * Sample code: Start a job execution. + * + * @param manager Entry point to SqlManager. + */ + public static void startAJobExecution(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobExecutions().create("group1", "server1", "agent1", "job1", Context.NONE); + } +} +``` + +### JobExecutions_CreateOrUpdate + +```java +import com.azure.core.util.Context; +import java.util.UUID; + +/** Samples for JobExecutions CreateOrUpdate. */ +public final class JobExecutionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateJobExecution.json + */ + /** + * Sample code: Create job execution. + * + * @param manager Entry point to SqlManager. + */ + public static void createJobExecution(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobExecutions() + .createOrUpdate( + "group1", + "server1", + "agent1", + "job1", + UUID.fromString("5A86BF65-43AC-F258-2524-9E92992F97CA"), + Context.NONE); + } +} +``` + +### JobExecutions_Get + +```java +import com.azure.core.util.Context; +import java.util.UUID; + +/** Samples for JobExecutions Get. */ +public final class JobExecutionsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJobExecution.json + */ + /** + * Sample code: Get a job execution. + * + * @param manager Entry point to SqlManager. + */ + public static void getAJobExecution(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobExecutions() + .getWithResponse( + "group1", + "server1", + "agent1", + "job1", + UUID.fromString("5A86BF65-43AC-F258-2524-9E92992F97CA"), + Context.NONE); + } +} +``` + +### JobExecutions_ListByAgent + +```java +import com.azure.core.util.Context; +import java.time.OffsetDateTime; + +/** Samples for JobExecutions ListByAgent. */ +public final class JobExecutionsListByAgentSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobExecutionsByAgent.json + */ + /** + * Sample code: List all job executions in a job agent. + * + * @param manager Entry point to SqlManager. + */ + public static void listAllJobExecutionsInAJobAgent(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobExecutions() + .listByAgent("group1", "server1", "agent1", null, null, null, null, null, null, null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobExecutionsByAgentWithFilter.json + */ + /** + * Sample code: List all job executions in a job agent with filtering. + * + * @param manager Entry point to SqlManager. + */ + public static void listAllJobExecutionsInAJobAgentWithFiltering( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobExecutions() + .listByAgent( + "group1", + "server1", + "agent1", + OffsetDateTime.parse("2017-03-21T19:00:00Z"), + OffsetDateTime.parse("2017-03-21T19:05:00Z"), + OffsetDateTime.parse("2017-03-21T19:20:00Z"), + OffsetDateTime.parse("2017-03-21T19:25:00Z"), + false, + null, + null, + Context.NONE); + } +} +``` + +### JobExecutions_ListByJob + +```java +import com.azure.core.util.Context; + +/** Samples for JobExecutions ListByJob. */ +public final class JobExecutionsListByJobSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobExecutionsByJob.json + */ + /** + * Sample code: List a job's executions. + * + * @param manager Entry point to SqlManager. + */ + public static void listAJobSExecutions(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobExecutions() + .listByJob("group1", "server1", "agent1", "job1", null, null, null, null, null, null, null, Context.NONE); + } +} +``` + +### JobStepExecutions_Get + +```java +import com.azure.core.util.Context; +import java.util.UUID; + +/** Samples for JobStepExecutions Get. */ +public final class JobStepExecutionsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJobExecutionStep.json + */ + /** + * Sample code: Get a job step execution. + * + * @param manager Entry point to SqlManager. + */ + public static void getAJobStepExecution(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobStepExecutions() + .getWithResponse( + "group1", + "server1", + "agent1", + "job1", + UUID.fromString("5A86BF65-43AC-F258-2524-9E92992F97CA"), + "step1", + Context.NONE); + } +} +``` + +### JobStepExecutions_ListByJobExecution + +```java +import com.azure.core.util.Context; +import java.util.UUID; + +/** Samples for JobStepExecutions ListByJobExecution. */ +public final class JobStepExecutionsListByJobExecutionSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobExecutionSteps.json + */ + /** + * Sample code: List job step executions. + * + * @param manager Entry point to SqlManager. + */ + public static void listJobStepExecutions(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobStepExecutions() + .listByJobExecution( + "group1", + "server1", + "agent1", + "job1", + UUID.fromString("5A86BF65-43AC-F258-2524-9E92992F97CA"), + null, + null, + null, + null, + null, + null, + null, + Context.NONE); + } +} +``` + +### JobSteps_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.JobStepAction; +import com.azure.resourcemanager.sql.generated.models.JobStepActionSource; +import com.azure.resourcemanager.sql.generated.models.JobStepActionType; +import com.azure.resourcemanager.sql.generated.models.JobStepExecutionOptions; +import com.azure.resourcemanager.sql.generated.models.JobStepOutput; +import com.azure.resourcemanager.sql.generated.models.JobStepOutputType; +import java.util.UUID; + +/** Samples for JobSteps CreateOrUpdate. */ +public final class JobStepsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateJobStepMin.json + */ + /** + * Sample code: Create or update a job step with minimal properties specified. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateAJobStepWithMinimalPropertiesSpecified( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobSteps() + .define("step1") + .withExistingJob("group1", "server1", "agent1", "job1") + .withTargetGroup( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/targetGroups/targetGroup0") + .withCredential( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/cred0") + .withAction(new JobStepAction().withValue("select 1")) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateJobStepMax.json + */ + /** + * Sample code: Create or update a job step with all properties specified. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateAJobStepWithAllPropertiesSpecified( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobSteps() + .define("step1") + .withExistingJob("group1", "server1", "agent1", "job1") + .withStepId(1) + .withTargetGroup( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/targetGroups/targetGroup1") + .withCredential( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/cred1") + .withAction( + new JobStepAction() + .withType(JobStepActionType.TSQL) + .withSource(JobStepActionSource.INLINE) + .withValue("select 2")) + .withOutput( + new JobStepOutput() + .withType(JobStepOutputType.SQL_DATABASE) + .withSubscriptionId(UUID.fromString("3501b905-a848-4b5d-96e8-b253f62d735a")) + .withResourceGroupName("group3") + .withServerName("server3") + .withDatabaseName("database3") + .withSchemaName("myschema1234") + .withTableName("mytable5678") + .withCredential("fakeTokenPlaceholder")) + .withExecutionOptions( + new JobStepExecutionOptions() + .withTimeoutSeconds(1234) + .withRetryAttempts(42) + .withInitialRetryIntervalSeconds(11) + .withMaximumRetryIntervalSeconds(222) + .withRetryIntervalBackoffMultiplier(3.0F)) + .create(); + } +} +``` + +### JobSteps_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for JobSteps Delete. */ +public final class JobStepsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeleteJobStep.json + */ + /** + * Sample code: Delete a job step. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteAJobStep(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobSteps().deleteWithResponse("group1", "server1", "agent1", "job1", "step1", Context.NONE); + } +} +``` + +### JobSteps_Get + +```java +import com.azure.core.util.Context; + +/** Samples for JobSteps Get. */ +public final class JobStepsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJobStepByJob.json + */ + /** + * Sample code: Get the latest version of a job step. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheLatestVersionOfAJobStep(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobSteps().getWithResponse("group1", "server1", "agent1", "job1", "step1", Context.NONE); + } +} +``` + +### JobSteps_GetByVersion + +```java +import com.azure.core.util.Context; + +/** Samples for JobSteps GetByVersion. */ +public final class JobStepsGetByVersionSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJobStepByVersion.json + */ + /** + * Sample code: Get the specified version of a job step. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheSpecifiedVersionOfAJobStep(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobSteps().getByVersionWithResponse("group1", "server1", "agent1", "job1", 1, "step1", Context.NONE); + } +} +``` + +### JobSteps_ListByJob + +```java +import com.azure.core.util.Context; + +/** Samples for JobSteps ListByJob. */ +public final class JobStepsListByJobSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobStepsByJob.json + */ + /** + * Sample code: List job steps for the latest version of a job. + * + * @param manager Entry point to SqlManager. + */ + public static void listJobStepsForTheLatestVersionOfAJob( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobSteps().listByJob("group1", "server1", "agent1", "job1", Context.NONE); + } +} +``` + +### JobSteps_ListByVersion + +```java +import com.azure.core.util.Context; + +/** Samples for JobSteps ListByVersion. */ +public final class JobStepsListByVersionSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobStepsByVersion.json + */ + /** + * Sample code: List job steps for the specified version of a job. + * + * @param manager Entry point to SqlManager. + */ + public static void listJobStepsForTheSpecifiedVersionOfAJob( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobSteps().listByVersion("group1", "server1", "agent1", "job1", 1, Context.NONE); + } +} +``` + +### JobTargetExecutions_Get + +```java +import com.azure.core.util.Context; +import java.util.UUID; + +/** Samples for JobTargetExecutions Get. */ +public final class JobTargetExecutionsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJobExecutionTarget.json + */ + /** + * Sample code: Get a job step target execution. + * + * @param manager Entry point to SqlManager. + */ + public static void getAJobStepTargetExecution(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobTargetExecutions() + .getWithResponse( + "group1", + "server1", + "agent1", + "job1", + UUID.fromString("5A86BF65-43AC-F258-2524-9E92992F97CA"), + "step1", + UUID.fromString("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), + Context.NONE); + } +} +``` + +### JobTargetExecutions_ListByJobExecution + +```java +import com.azure.core.util.Context; +import java.util.UUID; + +/** Samples for JobTargetExecutions ListByJobExecution. */ +public final class JobTargetExecutionsListByJobExecutionSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobExecutionTargetsByExecution.json + */ + /** + * Sample code: List job step target executions. + * + * @param manager Entry point to SqlManager. + */ + public static void listJobStepTargetExecutions(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobTargetExecutions() + .listByJobExecution( + "group1", + "server1", + "agent1", + "job1", + UUID.fromString("5A86BF65-43AC-F258-2524-9E92992F97CA"), + null, + null, + null, + null, + null, + null, + null, + Context.NONE); + } +} +``` + +### JobTargetExecutions_ListByStep + +```java +import com.azure.core.util.Context; +import java.util.UUID; + +/** Samples for JobTargetExecutions ListByStep. */ +public final class JobTargetExecutionsListByStepSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobExecutionTargetsByStep.json + */ + /** + * Sample code: List job step target executions. + * + * @param manager Entry point to SqlManager. + */ + public static void listJobStepTargetExecutions(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobTargetExecutions() + .listByStep( + "group1", + "server1", + "agent1", + "job1", + UUID.fromString("5A86BF65-43AC-F258-2524-9E92992F97CA"), + "step1", + null, + null, + null, + null, + null, + null, + null, + Context.NONE); + } +} +``` + +### JobTargetGroups_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.JobTarget; +import com.azure.resourcemanager.sql.generated.models.JobTargetGroupMembershipType; +import com.azure.resourcemanager.sql.generated.models.JobTargetType; +import java.util.Arrays; + +/** Samples for JobTargetGroups CreateOrUpdate. */ +public final class JobTargetGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateJobTargetGroupMin.json + */ + /** + * Sample code: Create or update a target group with minimal properties. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateATargetGroupWithMinimalProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobTargetGroups() + .define("targetGroup1") + .withExistingJobAgent("group1", "server1", "agent1") + .withMembers(Arrays.asList()) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateJobTargetGroupMax.json + */ + /** + * Sample code: Create or update a target group with all properties. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateATargetGroupWithAllProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobTargetGroups() + .define("targetGroup1") + .withExistingJobAgent("group1", "server1", "agent1") + .withMembers( + Arrays + .asList( + new JobTarget() + .withMembershipType(JobTargetGroupMembershipType.EXCLUDE) + .withType(JobTargetType.SQL_DATABASE) + .withServerName("server1") + .withDatabaseName("database1"), + new JobTarget() + .withMembershipType(JobTargetGroupMembershipType.INCLUDE) + .withType(JobTargetType.SQL_SERVER) + .withServerName("server1") + .withRefreshCredential("fakeTokenPlaceholder"), + new JobTarget() + .withMembershipType(JobTargetGroupMembershipType.INCLUDE) + .withType(JobTargetType.SQL_ELASTIC_POOL) + .withServerName("server2") + .withElasticPoolName("pool1") + .withRefreshCredential("fakeTokenPlaceholder"), + new JobTarget() + .withMembershipType(JobTargetGroupMembershipType.INCLUDE) + .withType(JobTargetType.SQL_SHARD_MAP) + .withServerName("server3") + .withShardMapName("shardMap1") + .withRefreshCredential("fakeTokenPlaceholder"))) + .create(); + } +} +``` + +### JobTargetGroups_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for JobTargetGroups Delete. */ +public final class JobTargetGroupsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeleteJobTargetGroup.json + */ + /** + * Sample code: Delete a target group. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteATargetGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobTargetGroups().deleteWithResponse("group1", "server1", "agent1", "targetGroup1", Context.NONE); + } +} +``` + +### JobTargetGroups_Get + +```java +import com.azure.core.util.Context; + +/** Samples for JobTargetGroups Get. */ +public final class JobTargetGroupsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJobTargetGroup.json + */ + /** + * Sample code: Get a target group. + * + * @param manager Entry point to SqlManager. + */ + public static void getATargetGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobTargetGroups().getWithResponse("group1", "server1", "agent1", "targetGroup1", Context.NONE); + } +} +``` + +### JobTargetGroups_ListByAgent + +```java +import com.azure.core.util.Context; + +/** Samples for JobTargetGroups ListByAgent. */ +public final class JobTargetGroupsListByAgentSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobTargetGroups.json + */ + /** + * Sample code: Get all target groups in an agent. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllTargetGroupsInAnAgent(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobTargetGroups().listByAgent("group1", "server1", "agent1", Context.NONE); + } +} +``` + +### JobVersions_Get + +```java +import com.azure.core.util.Context; + +/** Samples for JobVersions Get. */ +public final class JobVersionsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJobVersion.json + */ + /** + * Sample code: Get a version of a job. + * + * @param manager Entry point to SqlManager. + */ + public static void getAVersionOfAJob(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobVersions().getWithResponse("group1", "server1", "agent1", "job1", 1, Context.NONE); + } +} +``` + +### JobVersions_ListByJob + +```java +import com.azure.core.util.Context; + +/** Samples for JobVersions ListByJob. */ +public final class JobVersionsListByJobSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobVersions.json + */ + /** + * Sample code: Get all versions of a job. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllVersionsOfAJob(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobVersions().listByJob("group1", "server1", "agent1", "job1", Context.NONE); + } +} +``` + +### Jobs_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.JobSchedule; +import com.azure.resourcemanager.sql.generated.models.JobScheduleType; +import java.time.OffsetDateTime; + +/** Samples for Jobs CreateOrUpdate. */ +public final class JobsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateJobMin.json + */ + /** + * Sample code: Create a job with default properties. + * + * @param manager Entry point to SqlManager. + */ + public static void createAJobWithDefaultProperties(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobs().define("job1").withExistingJobAgent("group1", "server1", "agent1").create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateJobMax.json + */ + /** + * Sample code: Create a job with all properties specified. + * + * @param manager Entry point to SqlManager. + */ + public static void createAJobWithAllPropertiesSpecified( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobs() + .define("job1") + .withExistingJobAgent("group1", "server1", "agent1") + .withDescription("my favourite job") + .withSchedule( + new JobSchedule() + .withStartTime(OffsetDateTime.parse("2015-09-24T18:30:01Z")) + .withEndTime(OffsetDateTime.parse("2015-09-24T23:59:59Z")) + .withType(JobScheduleType.RECURRING) + .withEnabled(true) + .withInterval("PT5M")) + .create(); + } +} +``` + +### Jobs_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for Jobs Delete. */ +public final class JobsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeleteJob.json + */ + /** + * Sample code: Delete a job. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteAJob(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobs().deleteWithResponse("group1", "server1", "agent1", "job1", Context.NONE); + } +} +``` + +### Jobs_Get + +```java +import com.azure.core.util.Context; + +/** Samples for Jobs Get. */ +public final class JobsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJob.json + */ + /** + * Sample code: Get a job. + * + * @param manager Entry point to SqlManager. + */ + public static void getAJob(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobs().getWithResponse("group1", "server1", "agent1", "job1", Context.NONE); + } +} +``` + +### Jobs_ListByAgent + +```java +import com.azure.core.util.Context; + +/** Samples for Jobs ListByAgent. */ +public final class JobsListByAgentSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobsByAgent.json + */ + /** + * Sample code: List jobs in a job agent. + * + * @param manager Entry point to SqlManager. + */ + public static void listJobsInAJobAgent(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobs().listByAgent("group1", "server1", "agent1", Context.NONE); + } +} +``` + +### LedgerDigestUploadsOperation_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.LedgerDigestUploadsName; + +/** Samples for LedgerDigestUploadsOperation CreateOrUpdate. */ +public final class LedgerDigestUploadsOperationCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/LedgerDigestUploadsEnable.json + */ + /** + * Sample code: Enables ledger digest upload configuration for a database. + * + * @param manager Entry point to SqlManager. + */ + public static void enablesLedgerDigestUploadConfigurationForADatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .ledgerDigestUploadsOperations() + .define(LedgerDigestUploadsName.CURRENT) + .withExistingDatabase("ledgertestrg", "ledgertestserver", "testdb") + .withDigestStorageEndpoint("https://MyAccount.blob.core.windows.net") + .create(); + } +} +``` + +### LedgerDigestUploadsOperation_Disable + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.LedgerDigestUploadsName; + +/** Samples for LedgerDigestUploadsOperation Disable. */ +public final class LedgerDigestUploadsOperationDisableSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/LedgerDigestUploadsDisable.json + */ + /** + * Sample code: Disables uploading ledger digests for a database. + * + * @param manager Entry point to SqlManager. + */ + public static void disablesUploadingLedgerDigestsForADatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .ledgerDigestUploadsOperations() + .disable("ledgertestrg", "ledgertestserver", "testdb", LedgerDigestUploadsName.CURRENT, Context.NONE); + } +} +``` + +### LedgerDigestUploadsOperation_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.LedgerDigestUploadsName; + +/** Samples for LedgerDigestUploadsOperation Get. */ +public final class LedgerDigestUploadsOperationGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/LedgerDigestUploadsGet.json + */ + /** + * Sample code: Gets the current ledger digest upload configuration for a database. + * + * @param manager Entry point to SqlManager. + */ + public static void getsTheCurrentLedgerDigestUploadConfigurationForADatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .ledgerDigestUploadsOperations() + .getWithResponse( + "ledgertestrg", "ledgertestserver", "testdb", LedgerDigestUploadsName.CURRENT, Context.NONE); + } +} +``` + +### LedgerDigestUploadsOperation_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for LedgerDigestUploadsOperation ListByDatabase. */ +public final class LedgerDigestUploadsOperationListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/LedgerDigestUploadsList.json + */ + /** + * Sample code: Gets list of ledger digest upload settings on a database. + * + * @param manager Entry point to SqlManager. + */ + public static void getsListOfLedgerDigestUploadSettingsOnADatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .ledgerDigestUploadsOperations() + .listByDatabase("ledgertestrg", "ledgertestserver", "testdb", Context.NONE); + } +} +``` + +### LongTermRetentionBackups_Copy + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.azure.resourcemanager.sql.generated.models.CopyLongTermRetentionBackupParameters; + +/** Samples for LongTermRetentionBackups Copy. */ +public final class LongTermRetentionBackupsCopySamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/LongTermRetentionBackupCopy.json + */ + /** + * Sample code: Copy the long term retention backup. + * + * @param manager Entry point to SqlManager. + */ + public static void copyTheLongTermRetentionBackup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionBackups() + .copy( + "japaneast", + "testserver", + "testDatabase", + "55555555-6666-7777-8888-999999999999;131637960820000000", + new CopyLongTermRetentionBackupParameters() + .withTargetServerResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/resourceGroups/resourceGroup/servers/testserver2") + .withTargetDatabaseName("testDatabase2") + .withTargetBackupStorageRedundancy(BackupStorageRedundancy.GEO), + Context.NONE); + } +} +``` + +### LongTermRetentionBackups_CopyByResourceGroup + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.azure.resourcemanager.sql.generated.models.CopyLongTermRetentionBackupParameters; + +/** Samples for LongTermRetentionBackups CopyByResourceGroup. */ +public final class LongTermRetentionBackupsCopyByResourceGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedLongTermRetentionBackupCopy.json + */ + /** + * Sample code: Copy the long term retention backup. + * + * @param manager Entry point to SqlManager. + */ + public static void copyTheLongTermRetentionBackup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionBackups() + .copyByResourceGroup( + "testResourceGroup", + "japaneast", + "testserver", + "testDatabase", + "55555555-6666-7777-8888-999999999999;131637960820000000", + new CopyLongTermRetentionBackupParameters() + .withTargetServerResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/resourceGroups/resourceGroup/servers/testserver2") + .withTargetDatabaseName("testDatabase2") + .withTargetBackupStorageRedundancy(BackupStorageRedundancy.GEO), + Context.NONE); + } +} +``` + +### LongTermRetentionBackups_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionBackups Delete. */ +public final class LongTermRetentionBackupsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/LongTermRetentionBackupDelete.json + */ + /** + * Sample code: Delete the long term retention backup. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteTheLongTermRetentionBackup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionBackups() + .delete( + "japaneast", + "testserver", + "testDatabase", + "55555555-6666-7777-8888-999999999999;131637960820000000", + Context.NONE); + } +} +``` + +### LongTermRetentionBackups_DeleteByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionBackups DeleteByResourceGroup. */ +public final class LongTermRetentionBackupsDeleteByResourceGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedLongTermRetentionBackupDelete.json + */ + /** + * Sample code: Delete the long term retention backup. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteTheLongTermRetentionBackup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionBackups() + .deleteByResourceGroup( + "testResourceGroup", + "japaneast", + "testserver", + "testDatabase", + "55555555-6666-7777-8888-999999999999;131637960820000000", + Context.NONE); + } +} +``` + +### LongTermRetentionBackups_Get + +```java +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionBackups Get. */ +public final class LongTermRetentionBackupsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/LongTermRetentionBackupGet.json + */ + /** + * Sample code: Get the long term retention backup. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheLongTermRetentionBackup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionBackups() + .getWithResponse( + "japaneast", + "testserver", + "testDatabase", + "55555555-6666-7777-8888-999999999999;131637960820000000", + Context.NONE); + } +} +``` + +### LongTermRetentionBackups_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionBackups GetByResourceGroup. */ +public final class LongTermRetentionBackupsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedLongTermRetentionBackupGet.json + */ + /** + * Sample code: Get the long term retention backup. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheLongTermRetentionBackup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionBackups() + .getByResourceGroupWithResponse( + "testResourceGroup", + "japaneast", + "testserver", + "testDatabase", + "55555555-6666-7777-8888-999999999999;131637960820000000", + Context.NONE); + } +} +``` + +### LongTermRetentionBackups_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionBackups ListByDatabase. */ +public final class LongTermRetentionBackupsListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/LongTermRetentionBackupListByDatabase.json + */ + /** + * Sample code: Get all long term retention backups under the database. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllLongTermRetentionBackupsUnderTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionBackups() + .listByDatabase("japaneast", "testserver", "testDatabase", null, null, Context.NONE); + } +} +``` + +### LongTermRetentionBackups_ListByLocation + +```java +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionBackups ListByLocation. */ +public final class LongTermRetentionBackupsListByLocationSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/LongTermRetentionBackupListByLocation.json + */ + /** + * Sample code: Get all long term retention backups under the location. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllLongTermRetentionBackupsUnderTheLocation( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.longTermRetentionBackups().listByLocation("japaneast", null, null, Context.NONE); + } +} +``` + +### LongTermRetentionBackups_ListByResourceGroupDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionBackups ListByResourceGroupDatabase. */ +public final class LongTermRetentionBackupsListByResourceGroupDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedLongTermRetentionBackupListByDatabase.json + */ + /** + * Sample code: Get all long term retention backups under the database. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllLongTermRetentionBackupsUnderTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionBackups() + .listByResourceGroupDatabase( + "testResourceGroup", "japaneast", "testserver", "testDatabase", null, null, Context.NONE); + } +} +``` + +### LongTermRetentionBackups_ListByResourceGroupLocation + +```java +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionBackups ListByResourceGroupLocation. */ +public final class LongTermRetentionBackupsListByResourceGroupLocationSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedLongTermRetentionBackupListByLocation.json + */ + /** + * Sample code: Get all long term retention backups under the location. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllLongTermRetentionBackupsUnderTheLocation( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionBackups() + .listByResourceGroupLocation("testResourceGroup", "japaneast", null, null, Context.NONE); + } +} +``` + +### LongTermRetentionBackups_ListByResourceGroupServer + +```java +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionBackups ListByResourceGroupServer. */ +public final class LongTermRetentionBackupsListByResourceGroupServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedLongTermRetentionBackupListByServer.json + */ + /** + * Sample code: Get all long term retention backups under the server. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllLongTermRetentionBackupsUnderTheServer( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionBackups() + .listByResourceGroupServer("testResourceGroup", "japaneast", "testserver", null, null, Context.NONE); + } +} +``` + +### LongTermRetentionBackups_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionBackups ListByServer. */ +public final class LongTermRetentionBackupsListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/LongTermRetentionBackupListByServer.json + */ + /** + * Sample code: Get all long term retention backups under the server. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllLongTermRetentionBackupsUnderTheServer( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.longTermRetentionBackups().listByServer("japaneast", "testserver", null, null, Context.NONE); + } +} +``` + +### LongTermRetentionBackups_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.azure.resourcemanager.sql.generated.models.UpdateLongTermRetentionBackupParameters; + +/** Samples for LongTermRetentionBackups Update. */ +public final class LongTermRetentionBackupsUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/LongTermRetentionBackupUpdate.json + */ + /** + * Sample code: Update the long term retention backup. + * + * @param manager Entry point to SqlManager. + */ + public static void updateTheLongTermRetentionBackup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionBackups() + .update( + "japaneast", + "testserver", + "testDatabase", + "55555555-6666-7777-8888-999999999999;131637960820000000", + new UpdateLongTermRetentionBackupParameters() + .withRequestedBackupStorageRedundancy(BackupStorageRedundancy.GEO), + Context.NONE); + } +} +``` + +### LongTermRetentionBackups_UpdateByResourceGroup + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.azure.resourcemanager.sql.generated.models.UpdateLongTermRetentionBackupParameters; + +/** Samples for LongTermRetentionBackups UpdateByResourceGroup. */ +public final class LongTermRetentionBackupsUpdateByResourceGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedLongTermRetentionBackupUpdate.json + */ + /** + * Sample code: Update the long term retention backup. + * + * @param manager Entry point to SqlManager. + */ + public static void updateTheLongTermRetentionBackup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionBackups() + .updateByResourceGroup( + "testResourceGroup", + "japaneast", + "testserver", + "testDatabase", + "55555555-6666-7777-8888-999999999999;131637960820000000", + new UpdateLongTermRetentionBackupParameters() + .withRequestedBackupStorageRedundancy(BackupStorageRedundancy.GEO), + Context.NONE); + } +} +``` + +### LongTermRetentionManagedInstanceBackups_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionManagedInstanceBackups Delete. */ +public final class LongTermRetentionManagedInstanceBackupsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceLongTermRetentionBackupDelete.json + */ + /** + * Sample code: Delete the long term retention backup. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteTheLongTermRetentionBackup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionManagedInstanceBackups() + .delete( + "japaneast", + "testInstance", + "testDatabase", + "55555555-6666-7777-8888-999999999999;131637960820000000", + Context.NONE); + } +} +``` + +### LongTermRetentionManagedInstanceBackups_DeleteByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionManagedInstanceBackups DeleteByResourceGroup. */ +public final class LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedManagedInstanceLongTermRetentionBackupDelete.json + */ + /** + * Sample code: Delete the long term retention backup. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteTheLongTermRetentionBackup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionManagedInstanceBackups() + .deleteByResourceGroup( + "testResourceGroup", + "japaneast", + "testInstance", + "testDatabase", + "55555555-6666-7777-8888-999999999999;131637960820000000", + Context.NONE); + } +} +``` + +### LongTermRetentionManagedInstanceBackups_Get + +```java +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionManagedInstanceBackups Get. */ +public final class LongTermRetentionManagedInstanceBackupsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceLongTermRetentionBackupGet.json + */ + /** + * Sample code: Get the long term retention backup of a managed database. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheLongTermRetentionBackupOfAManagedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionManagedInstanceBackups() + .getWithResponse( + "japaneast", + "testInstance", + "testDatabase", + "55555555-6666-7777-8888-999999999999;131637960820000000", + Context.NONE); + } +} +``` + +### LongTermRetentionManagedInstanceBackups_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionManagedInstanceBackups GetByResourceGroup. */ +public final class LongTermRetentionManagedInstanceBackupsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedManagedInstanceLongTermRetentionBackupGet.json + */ + /** + * Sample code: Get the long term retention backup. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheLongTermRetentionBackup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionManagedInstanceBackups() + .getByResourceGroupWithResponse( + "testResourceGroup", + "japaneast", + "testInstance", + "testDatabase", + "55555555-6666-7777-8888-999999999999;131637960820000000", + Context.NONE); + } +} +``` + +### LongTermRetentionManagedInstanceBackups_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionManagedInstanceBackups ListByDatabase. */ +public final class LongTermRetentionManagedInstanceBackupsListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceLongTermRetentionBackupListByDatabase.json + */ + /** + * Sample code: Get all long term retention backups under the database. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllLongTermRetentionBackupsUnderTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionManagedInstanceBackups() + .listByDatabase("japaneast", "testInstance", "testDatabase", null, null, Context.NONE); + } +} +``` + +### LongTermRetentionManagedInstanceBackups_ListByInstance + +```java +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionManagedInstanceBackups ListByInstance. */ +public final class LongTermRetentionManagedInstanceBackupsListByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceLongTermRetentionBackupListByInstance.json + */ + /** + * Sample code: Get all long term retention backups under the managed instance. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllLongTermRetentionBackupsUnderTheManagedInstance( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionManagedInstanceBackups() + .listByInstance("japaneast", "testInstance", null, null, Context.NONE); + } +} +``` + +### LongTermRetentionManagedInstanceBackups_ListByLocation + +```java +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionManagedInstanceBackups ListByLocation. */ +public final class LongTermRetentionManagedInstanceBackupsListByLocationSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceLongTermRetentionBackupListByLocation.json + */ + /** + * Sample code: Get all long term retention backups under the location. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllLongTermRetentionBackupsUnderTheLocation( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.longTermRetentionManagedInstanceBackups().listByLocation("japaneast", null, null, Context.NONE); + } +} +``` + +### LongTermRetentionManagedInstanceBackups_ListByResourceGroupDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionManagedInstanceBackups ListByResourceGroupDatabase. */ +public final class LongTermRetentionManagedInstanceBackupsListByResourceGroupDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedManagedInstanceLongTermRetentionBackupListByDatabase.json + */ + /** + * Sample code: Get all long term retention backups under the database. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllLongTermRetentionBackupsUnderTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionManagedInstanceBackups() + .listByResourceGroupDatabase( + "testResourceGroup", "japaneast", "testInstance", "testDatabase", null, null, Context.NONE); + } +} +``` + +### LongTermRetentionManagedInstanceBackups_ListByResourceGroupInstance + +```java +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionManagedInstanceBackups ListByResourceGroupInstance. */ +public final class LongTermRetentionManagedInstanceBackupsListByResourceGroupInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedManagedInstanceLongTermRetentionBackupListByInstance.json + */ + /** + * Sample code: Get all long term retention backups under the managed instance. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllLongTermRetentionBackupsUnderTheManagedInstance( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionManagedInstanceBackups() + .listByResourceGroupInstance("testResourceGroup", "japaneast", "testInstance", null, null, Context.NONE); + } +} +``` + +### LongTermRetentionManagedInstanceBackups_ListByResourceGroupLocation + +```java +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionManagedInstanceBackups ListByResourceGroupLocation. */ +public final class LongTermRetentionManagedInstanceBackupsListByResourceGroupLocationSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedManagedInstanceLongTermRetentionBackupListByLocation.json + */ + /** + * Sample code: Get all long term retention backups under the location. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllLongTermRetentionBackupsUnderTheLocation( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionManagedInstanceBackups() + .listByResourceGroupLocation("testResourceGroup", "japaneast", null, null, Context.NONE); + } +} +``` + +### LongTermRetentionPolicies_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.LongTermRetentionPolicyName; + +/** Samples for LongTermRetentionPolicies CreateOrUpdate. */ +public final class LongTermRetentionPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/LongTermRetentionPolicyCreateOrUpdate.json + */ + /** + * Sample code: Create or update the long term retention policy for the database. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateTheLongTermRetentionPolicyForTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionPolicies() + .define(LongTermRetentionPolicyName.DEFAULT) + .withExistingDatabase("resourceGroup", "testserver", "testDatabase") + .withWeeklyRetention("P1M") + .withMonthlyRetention("P1Y") + .withYearlyRetention("P5Y") + .withWeekOfYear(5) + .create(); + } +} +``` + +### LongTermRetentionPolicies_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.LongTermRetentionPolicyName; + +/** Samples for LongTermRetentionPolicies Get. */ +public final class LongTermRetentionPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/LongTermRetentionPolicyGet.json + */ + /** + * Sample code: Get the long term retention policy for the database. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheLongTermRetentionPolicyForTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionPolicies() + .getWithResponse( + "resourceGroup", "testserver", "testDatabase", LongTermRetentionPolicyName.DEFAULT, Context.NONE); + } +} +``` + +### LongTermRetentionPolicies_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionPolicies ListByDatabase. */ +public final class LongTermRetentionPoliciesListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/LongTermRetentionPolicyListByDatabase.json + */ + /** + * Sample code: Get the long term retention policy for the database. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheLongTermRetentionPolicyForTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.longTermRetentionPolicies().listByDatabase("resourceGroup", "testserver", "testDatabase", Context.NONE); + } +} +``` + +### MaintenanceWindowOptionsOperation_Get + +```java +import com.azure.core.util.Context; + +/** Samples for MaintenanceWindowOptionsOperation Get. */ +public final class MaintenanceWindowOptionsOperationGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetMaintenanceWindowOptions.json + */ + /** + * Sample code: Gets a list of available maintenance windows for a selected database. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAListOfAvailableMaintenanceWindowsForASelectedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .maintenanceWindowOptionsOperations() + .getWithResponse("Default-SQL-SouthEastAsia", "testsvr", "testdb", "current", Context.NONE); + } +} +``` + +### MaintenanceWindowsOperation_CreateOrUpdate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.MaintenanceWindowsInner; +import com.azure.resourcemanager.sql.generated.models.DayOfWeek; +import com.azure.resourcemanager.sql.generated.models.MaintenanceWindowTimeRange; +import java.util.Arrays; + +/** Samples for MaintenanceWindowsOperation CreateOrUpdate. */ +public final class MaintenanceWindowsOperationCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateMaintenanceWindows.json + */ + /** + * Sample code: Sets maintenance window settings for a selected database. + * + * @param manager Entry point to SqlManager. + */ + public static void setsMaintenanceWindowSettingsForASelectedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .maintenanceWindowsOperations() + .createOrUpdateWithResponse( + "Default-SQL-SouthEastAsia", + "testsvr", + "testdwdb", + "current", + new MaintenanceWindowsInner() + .withTimeRanges( + Arrays + .asList( + new MaintenanceWindowTimeRange() + .withDayOfWeek(DayOfWeek.SATURDAY) + .withStartTime("00:00:00") + .withDuration("PT60M"))), + Context.NONE); + } +} +``` + +### MaintenanceWindowsOperation_Get + +```java +import com.azure.core.util.Context; + +/** Samples for MaintenanceWindowsOperation Get. */ +public final class MaintenanceWindowsOperationGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetMaintenanceWindows.json + */ + /** + * Sample code: Gets maintenance window settings for a selected database. + * + * @param manager Entry point to SqlManager. + */ + public static void getsMaintenanceWindowSettingsForASelectedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .maintenanceWindowsOperations() + .getWithResponse("Default-SQL-SouthEastAsia", "testsvr", "testdb", "current", Context.NONE); + } +} +``` + +### ManagedBackupShortTermRetentionPolicies_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.ManagedShortTermRetentionPolicyName; + +/** Samples for ManagedBackupShortTermRetentionPolicies CreateOrUpdate. */ +public final class ManagedBackupShortTermRetentionPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/UpdateManagedShortTermRetentionPolicy.json + */ + /** + * Sample code: Update the short term retention policy for the database. + * + * @param manager Entry point to SqlManager. + */ + public static void updateTheShortTermRetentionPolicyForTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedBackupShortTermRetentionPolicies() + .define(ManagedShortTermRetentionPolicyName.DEFAULT) + .withExistingDatabase("resourceGroup", "testsvr", "testdb") + .withRetentionDays(14) + .create(); + } +} +``` + +### ManagedBackupShortTermRetentionPolicies_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ManagedShortTermRetentionPolicyName; + +/** Samples for ManagedBackupShortTermRetentionPolicies Get. */ +public final class ManagedBackupShortTermRetentionPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetManagedShortTermRetentionPolicy.json + */ + /** + * Sample code: Get the short term retention policy for the database. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheShortTermRetentionPolicyForTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedBackupShortTermRetentionPolicies() + .getWithResponse( + "Default-SQL-SouthEastAsia", + "testsvr", + "testdb", + ManagedShortTermRetentionPolicyName.DEFAULT, + Context.NONE); + } +} +``` + +### ManagedBackupShortTermRetentionPolicies_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedBackupShortTermRetentionPolicies ListByDatabase. */ +public final class ManagedBackupShortTermRetentionPoliciesListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetListManagedShortTermRetentionPolicy.json + */ + /** + * Sample code: Get the short term retention policy list for the database. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheShortTermRetentionPolicyListForTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedBackupShortTermRetentionPolicies() + .listByDatabase("Default-SQL-SouthEastAsia", "testsvr", "testdb", Context.NONE); + } +} +``` + +### ManagedBackupShortTermRetentionPolicies_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ManagedBackupShortTermRetentionPolicy; +import com.azure.resourcemanager.sql.generated.models.ManagedShortTermRetentionPolicyName; + +/** Samples for ManagedBackupShortTermRetentionPolicies Update. */ +public final class ManagedBackupShortTermRetentionPoliciesUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/UpdateManagedShortTermRetentionPolicy.json + */ + /** + * Sample code: Update the short term retention policy for the database. + * + * @param manager Entry point to SqlManager. + */ + public static void updateTheShortTermRetentionPolicyForTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedBackupShortTermRetentionPolicy resource = + manager + .managedBackupShortTermRetentionPolicies() + .getWithResponse( + "resourceGroup", "testsvr", "testdb", ManagedShortTermRetentionPolicyName.DEFAULT, Context.NONE) + .getValue(); + resource.update().withRetentionDays(14).apply(); + } +} +``` + +### ManagedDatabaseAdvancedThreatProtectionSettings_CreateOrUpdate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.AdvancedThreatProtectionName; +import com.azure.resourcemanager.sql.generated.models.AdvancedThreatProtectionState; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseAdvancedThreatProtection; + +/** Samples for ManagedDatabaseAdvancedThreatProtectionSettings CreateOrUpdate. */ +public final class ManagedDatabaseAdvancedThreatProtectionSettingsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ManagedDatabaseAdvancedThreatProtectionSettingsCreateMax.json + */ + /** + * Sample code: Update a managed database's Advanced Threat Protection settings with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAManagedDatabaseSAdvancedThreatProtectionSettingsWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedDatabaseAdvancedThreatProtection resource = + manager + .managedDatabaseAdvancedThreatProtectionSettings() + .getWithResponse( + "threatprotection-4799", + "threatprotection-6440", + "testdb", + AdvancedThreatProtectionName.DEFAULT, + Context.NONE) + .getValue(); + resource.update().withState(AdvancedThreatProtectionState.ENABLED).apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ManagedDatabaseAdvancedThreatProtectionSettingsCreateMin.json + */ + /** + * Sample code: Update a managed database's Advanced Threat Protection settings with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAManagedDatabaseSAdvancedThreatProtectionSettingsWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedDatabaseAdvancedThreatProtection resource = + manager + .managedDatabaseAdvancedThreatProtectionSettings() + .getWithResponse( + "threatprotection-4799", + "threatprotection-6440", + "testdb", + AdvancedThreatProtectionName.DEFAULT, + Context.NONE) + .getValue(); + resource.update().withState(AdvancedThreatProtectionState.DISABLED).apply(); + } +} +``` + +### ManagedDatabaseAdvancedThreatProtectionSettings_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.AdvancedThreatProtectionName; + +/** Samples for ManagedDatabaseAdvancedThreatProtectionSettings Get. */ +public final class ManagedDatabaseAdvancedThreatProtectionSettingsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ManagedDatabaseAdvancedThreatProtectionSettingsGet.json + */ + /** + * Sample code: Get a managed database's Advanced Threat Protection settings. + * + * @param manager Entry point to SqlManager. + */ + public static void getAManagedDatabaseSAdvancedThreatProtectionSettings( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseAdvancedThreatProtectionSettings() + .getWithResponse( + "threatprotection-6852", + "threatprotection-2080", + "testdb", + AdvancedThreatProtectionName.DEFAULT, + Context.NONE); + } +} +``` + +### ManagedDatabaseAdvancedThreatProtectionSettings_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseAdvancedThreatProtectionSettings ListByDatabase. */ +public final class ManagedDatabaseAdvancedThreatProtectionSettingsListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ManagedDatabaseAdvancedThreatProtectionSettingsListByDatabase.json + */ + /** + * Sample code: Get a list of the managed database's Advanced Threat Protection settings. + * + * @param manager Entry point to SqlManager. + */ + public static void getAListOfTheManagedDatabaseSAdvancedThreatProtectionSettings( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseAdvancedThreatProtectionSettings() + .listByDatabase("threatprotection-6852", "threatprotection-2080", "testdb", Context.NONE); + } +} +``` + +### ManagedDatabaseColumns_Get + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseColumns Get. */ +public final class ManagedDatabaseColumnsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseColumnGet.json + */ + /** + * Sample code: Get managed database column. + * + * @param manager Entry point to SqlManager. + */ + public static void getManagedDatabaseColumn(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseColumns() + .getWithResponse("myRG", "myManagedInstanceName", "myDatabase", "dbo", "table1", "column1", Context.NONE); + } +} +``` + +### ManagedDatabaseColumns_ListByDatabase + +```java +import com.azure.core.util.Context; +import java.util.Arrays; + +/** Samples for ManagedDatabaseColumns ListByDatabase. */ +public final class ManagedDatabaseColumnsListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedColumnsListByDatabaseMin.json + */ + /** + * Sample code: List managed database columns. + * + * @param manager Entry point to SqlManager. + */ + public static void listManagedDatabaseColumns(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseColumns() + .listByDatabase("myRG", "serverName", "myDatabase", null, null, null, null, null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedColumnsListByDatabaseMax.json + */ + /** + * Sample code: Filter managed database columns. + * + * @param manager Entry point to SqlManager. + */ + public static void filterManagedDatabaseColumns(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseColumns() + .listByDatabase( + "myRG", + "serverName", + "myDatabase", + Arrays.asList("dbo"), + Arrays.asList("customer", "address"), + Arrays.asList("username"), + Arrays.asList("schema asc", "table", "column desc"), + null, + Context.NONE); + } +} +``` + +### ManagedDatabaseColumns_ListByTable + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseColumns ListByTable. */ +public final class ManagedDatabaseColumnsListByTableSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseColumnListByTable.json + */ + /** + * Sample code: List managed database columns. + * + * @param manager Entry point to SqlManager. + */ + public static void listManagedDatabaseColumns(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseColumns() + .listByTable("myRG", "myManagedInstanceName", "myDatabase", "dbo", "table1", null, Context.NONE); + } +} +``` + +### ManagedDatabaseMoveOperations_Get + +```java +import com.azure.core.util.Context; +import java.util.UUID; + +/** Samples for ManagedDatabaseMoveOperations Get. */ +public final class ManagedDatabaseMoveOperationsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/ManagedDatabaseMoveOperationResultGet.json + */ + /** + * Sample code: Gets a managed database move operation. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAManagedDatabaseMoveOperation(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseMoveOperations() + .getWithResponse( + "rg1", "westeurope", UUID.fromString("15961324-d809-46ed-86b9-d786953140e2"), Context.NONE); + } +} +``` + +### ManagedDatabaseMoveOperations_ListByLocation + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseMoveOperations ListByLocation. */ +public final class ManagedDatabaseMoveOperationsListByLocationSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/ManagedDatabaseMoveOperationResultList.json + */ + /** + * Sample code: Gets all managed database move operations for specified subscription, resource group and location. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAllManagedDatabaseMoveOperationsForSpecifiedSubscriptionResourceGroupAndLocation( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedDatabaseMoveOperations().listByLocation("rg1", "westeurope", null, null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/ManagedDatabaseMoveOperationResultListLastOperations.json + */ + /** + * Sample code: Gets the latest managed database move operations for each database under specified subscription, + * resource group and location. + * + * @param manager Entry point to SqlManager. + */ + public static void + getsTheLatestManagedDatabaseMoveOperationsForEachDatabaseUnderSpecifiedSubscriptionResourceGroupAndLocation( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedDatabaseMoveOperations().listByLocation("rg1", "westeurope", null, null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/ManagedDatabaseMoveOperationResultListMax.json + */ + /** + * Sample code: Gets the latest managed database move operations for each database under specified subscription, + * resource group and location, filtered by operation type. + * + * @param manager Entry point to SqlManager. + */ + public static void + getsTheLatestManagedDatabaseMoveOperationsForEachDatabaseUnderSpecifiedSubscriptionResourceGroupAndLocationFilteredByOperationType( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseMoveOperations() + .listByLocation( + "rg1", "westeurope", null, "Properties/Operation eq 'StartManagedInstanceDatabaseMove'", Context.NONE); + } +} +``` + +### ManagedDatabaseQueries_Get + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseQueries Get. */ +public final class ManagedDatabaseQueriesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceQueryGet.json + */ + /** + * Sample code: Obtain query properties. + * + * @param manager Entry point to SqlManager. + */ + public static void obtainQueryProperties(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseQueries() + .getWithResponse("sqlcrudtest-7398", "sqlcrudtest-4645", "database_1", "42", Context.NONE); + } +} +``` + +### ManagedDatabaseQueries_ListByQuery + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.QueryTimeGrainType; + +/** Samples for ManagedDatabaseQueries ListByQuery. */ +public final class ManagedDatabaseQueriesListByQuerySamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceQueryStatisticsListMax.json + */ + /** + * Sample code: Obtain query execution statistics. Example with all request parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void obtainQueryExecutionStatisticsExampleWithAllRequestParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseQueries() + .listByQuery( + "sqlcrudtest-7398", + "sqlcrudtest-4645", + "database_1", + "42", + "03/01/2020 16:23:09", + "03/11/2020 14:00:00", + QueryTimeGrainType.P1D, + Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceQueryStatisticsList.json + */ + /** + * Sample code: Obtain query execution statistics. + * + * @param manager Entry point to SqlManager. + */ + public static void obtainQueryExecutionStatistics(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseQueries() + .listByQuery("sqlcrudtest-7398", "sqlcrudtest-4645", "database_1", "42", null, null, null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceQueryStatisticsListMin.json + */ + /** + * Sample code: Obtain query execution statistics. Minimal example with only mandatory request parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void obtainQueryExecutionStatisticsMinimalExampleWithOnlyMandatoryRequestParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseQueries() + .listByQuery( + "sqlcrudtest-7398", + "sqlcrudtest-4645", + "database_1", + "42", + null, + null, + QueryTimeGrainType.PT1H, + Context.NONE); + } +} +``` + +### ManagedDatabaseRecommendedSensitivityLabels_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.RecommendedSensitivityLabelUpdate; +import com.azure.resourcemanager.sql.generated.models.RecommendedSensitivityLabelUpdateKind; +import com.azure.resourcemanager.sql.generated.models.RecommendedSensitivityLabelUpdateList; +import java.util.Arrays; + +/** Samples for ManagedDatabaseRecommendedSensitivityLabels Update. */ +public final class ManagedDatabaseRecommendedSensitivityLabelsUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSensitivityLabelsRecommendedUpdate.json + */ + /** + * Sample code: Update recommended sensitivity labels of a given database using an operations batch. + * + * @param manager Entry point to SqlManager. + */ + public static void updateRecommendedSensitivityLabelsOfAGivenDatabaseUsingAnOperationsBatch( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseRecommendedSensitivityLabels() + .updateWithResponse( + "myRG", + "myManagedInstanceName", + "myDatabase", + new RecommendedSensitivityLabelUpdateList() + .withOperations( + Arrays + .asList( + new RecommendedSensitivityLabelUpdate() + .withOp(RecommendedSensitivityLabelUpdateKind.ENABLE) + .withSchema("dbo") + .withTable("table1") + .withColumn("column1"), + new RecommendedSensitivityLabelUpdate() + .withOp(RecommendedSensitivityLabelUpdateKind.DISABLE) + .withSchema("dbo") + .withTable("table2") + .withColumn("column2"), + new RecommendedSensitivityLabelUpdate() + .withOp(RecommendedSensitivityLabelUpdateKind.DISABLE) + .withSchema("dbo") + .withTable("Table1") + .withColumn("Column3"))), + Context.NONE); + } +} +``` + +### ManagedDatabaseRestoreDetails_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.RestoreDetailsName; + +/** Samples for ManagedDatabaseRestoreDetails Get. */ +public final class ManagedDatabaseRestoreDetailsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ManagedDatabaseRestoreDetails.json + */ + /** + * Sample code: Managed database restore details. + * + * @param manager Entry point to SqlManager. + */ + public static void managedDatabaseRestoreDetails(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseRestoreDetails() + .getWithResponse( + "Default-SQL-SouthEastAsia", "managedInstance", "testdb", RestoreDetailsName.DEFAULT, Context.NONE); + } +} +``` + +### ManagedDatabaseSchemas_Get + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseSchemas Get. */ +public final class ManagedDatabaseSchemasGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSchemaGet.json + */ + /** + * Sample code: Get managed database schema. + * + * @param manager Entry point to SqlManager. + */ + public static void getManagedDatabaseSchema(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseSchemas() + .getWithResponse("myRG", "myManagedInstanceName", "myDatabase", "dbo", Context.NONE); + } +} +``` + +### ManagedDatabaseSchemas_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseSchemas ListByDatabase. */ +public final class ManagedDatabaseSchemasListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSchemaListByDatabase.json + */ + /** + * Sample code: List managed database schemas. + * + * @param manager Entry point to SqlManager. + */ + public static void listManagedDatabaseSchemas(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseSchemas() + .listByDatabase("myRG", "myManagedInstanceName", "myDatabase", null, Context.NONE); + } +} +``` + +### ManagedDatabaseSecurityAlertPolicies_CreateOrUpdate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseSecurityAlertPolicy; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyName; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyState; +import java.util.Arrays; + +/** Samples for ManagedDatabaseSecurityAlertPolicies CreateOrUpdate. */ +public final class ManagedDatabaseSecurityAlertPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSecurityAlertCreateMax.json + */ + /** + * Sample code: Update a database's threat detection policy with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateADatabaseSThreatDetectionPolicyWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedDatabaseSecurityAlertPolicy resource = + manager + .managedDatabaseSecurityAlertPolicies() + .getWithResponse( + "securityalert-4799", "securityalert-6440", "testdb", SecurityAlertPolicyName.DEFAULT, Context.NONE) + .getValue(); + resource + .update() + .withState(SecurityAlertPolicyState.ENABLED) + .withDisabledAlerts(Arrays.asList("Sql_Injection", "Usage_Anomaly")) + .withEmailAddresses(Arrays.asList("test@contoso.com", "user@contoso.com")) + .withEmailAccountAdmins(true) + .withStorageEndpoint("https://mystorage.blob.core.windows.net") + .withStorageAccountAccessKey( + "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==") + .withRetentionDays(6) + .apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSecurityAlertCreateMin.json + */ + /** + * Sample code: Update a database's threat detection policy with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateADatabaseSThreatDetectionPolicyWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedDatabaseSecurityAlertPolicy resource = + manager + .managedDatabaseSecurityAlertPolicies() + .getWithResponse( + "securityalert-4799", "securityalert-6440", "testdb", SecurityAlertPolicyName.DEFAULT, Context.NONE) + .getValue(); + resource.update().withState(SecurityAlertPolicyState.ENABLED).apply(); + } +} +``` + +### ManagedDatabaseSecurityAlertPolicies_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyName; + +/** Samples for ManagedDatabaseSecurityAlertPolicies Get. */ +public final class ManagedDatabaseSecurityAlertPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSecurityAlertGet.json + */ + /** + * Sample code: Get a database's threat detection policy. + * + * @param manager Entry point to SqlManager. + */ + public static void getADatabaseSThreatDetectionPolicy(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseSecurityAlertPolicies() + .getWithResponse( + "securityalert-6852", "securityalert-2080", "testdb", SecurityAlertPolicyName.DEFAULT, Context.NONE); + } +} +``` + +### ManagedDatabaseSecurityAlertPolicies_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseSecurityAlertPolicies ListByDatabase. */ +public final class ManagedDatabaseSecurityAlertPoliciesListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSecurityAlertListByDatabase.json + */ + /** + * Sample code: Get a list of the database's threat detection policies. + * + * @param manager Entry point to SqlManager. + */ + public static void getAListOfTheDatabaseSThreatDetectionPolicies( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseSecurityAlertPolicies() + .listByDatabase("securityalert-6852", "securityalert-2080", "testdb", Context.NONE); + } +} +``` + +### ManagedDatabaseSecurityEvents_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseSecurityEvents ListByDatabase. */ +public final class ManagedDatabaseSecurityEventsListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSecurityEventsGetMin.json + */ + /** + * Sample code: Get the managed database's security events with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheManagedDatabaseSSecurityEventsWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseSecurityEvents() + .listByDatabase("testrg", "testcl", "database1", null, null, null, null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSecurityEventsGetMax.json + */ + /** + * Sample code: Get the managed database's security events with maximal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheManagedDatabaseSSecurityEventsWithMaximalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseSecurityEvents() + .listByDatabase( + "testrg", + "testcl", + "database1", + "ShowServerRecords eq true", + 0, + 1, + "eyJCbG9iTmFtZURhdGVUaW1lIjoiXC9EYXRlKDE1MTIyODg4MTIwMTArMDIwMClcLyIsIkJsb2JOYW1lUm9sbG92ZXJJbmRleCI6IjAiLCJFbmREYXRlIjoiXC9EYXRlKDE1MTI0NjYyMDA1MjkpXC8iLCJJc1NraXBUb2tlblNldCI6ZmFsc2UsIklzVjJCbG9iVGltZUZvcm1hdCI6dHJ1ZSwiU2hvd1NlcnZlclJlY29yZHMiOmZhbHNlLCJTa2lwVmFsdWUiOjAsIlRha2VWYWx1ZSI6MTB9", + Context.NONE); + } +} +``` + +### ManagedDatabaseSensitivityLabels_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelRank; + +/** Samples for ManagedDatabaseSensitivityLabels CreateOrUpdate. */ +public final class ManagedDatabaseSensitivityLabelsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseColumnSensitivityLabelCreate.json + */ + /** + * Sample code: Updates or creates a sensitivity label of a given column with all parameters in a managed database. + * + * @param manager Entry point to SqlManager. + */ + public static void updatesOrCreatesASensitivityLabelOfAGivenColumnWithAllParametersInAManagedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseSensitivityLabels() + .define() + .withExistingColumn("myRG", "myManagedInstanceName", "myDatabase", "dbo", "myTable", "myColumn") + .withLabelName("PII") + .withLabelId("bf91e08c-f4f0-478a-b016-25164b2a65ff") + .withInformationType("PhoneNumber") + .withInformationTypeId("d22fa6e9-5ee4-3bde-4c2b-a409604c4646") + .withRank(SensitivityLabelRank.HIGH) + .create(); + } +} +``` + +### ManagedDatabaseSensitivityLabels_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseSensitivityLabels Delete. */ +public final class ManagedDatabaseSensitivityLabelsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseColumnSensitivityLabelDelete.json + */ + /** + * Sample code: Deletes the sensitivity label of a given column in a managed database. + * + * @param manager Entry point to SqlManager. + */ + public static void deletesTheSensitivityLabelOfAGivenColumnInAManagedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseSensitivityLabels() + .deleteWithResponse( + "myRG", "myManagedInstanceName", "myDatabase", "dbo", "myTable", "myColumn", Context.NONE); + } +} +``` + +### ManagedDatabaseSensitivityLabels_DisableRecommendation + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseSensitivityLabels DisableRecommendation. */ +public final class ManagedDatabaseSensitivityLabelsDisableRecommendationSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseRecommendedColumnSensitivityLabelDisable.json + */ + /** + * Sample code: Disables the sensitivity recommendations on a given column. + * + * @param manager Entry point to SqlManager. + */ + public static void disablesTheSensitivityRecommendationsOnAGivenColumn( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseSensitivityLabels() + .disableRecommendationWithResponse( + "myRG", "myManagedInstanceName", "myDatabase", "dbo", "myTable", "myColumn", Context.NONE); + } +} +``` + +### ManagedDatabaseSensitivityLabels_EnableRecommendation + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseSensitivityLabels EnableRecommendation. */ +public final class ManagedDatabaseSensitivityLabelsEnableRecommendationSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseRecommendedColumnSensitivityLabelEnable.json + */ + /** + * Sample code: Enables the sensitivity recommendations on a given column. + * + * @param manager Entry point to SqlManager. + */ + public static void enablesTheSensitivityRecommendationsOnAGivenColumn( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseSensitivityLabels() + .enableRecommendationWithResponse( + "myRG", "myManagedInstanceName", "myDatabase", "dbo", "myTable", "myColumn", Context.NONE); + } +} +``` + +### ManagedDatabaseSensitivityLabels_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelSource; + +/** Samples for ManagedDatabaseSensitivityLabels Get. */ +public final class ManagedDatabaseSensitivityLabelsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseColumnSensitivityLabelGet.json + */ + /** + * Sample code: Gets the sensitivity label of a given column in a managed database. + * + * @param manager Entry point to SqlManager. + */ + public static void getsTheSensitivityLabelOfAGivenColumnInAManagedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseSensitivityLabels() + .getWithResponse( + "myRG", + "myManagedInstanceName", + "myDatabase", + "dbo", + "myTable", + "myColumn", + SensitivityLabelSource.CURRENT, + Context.NONE); + } +} +``` + +### ManagedDatabaseSensitivityLabels_ListCurrentByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseSensitivityLabels ListCurrentByDatabase. */ +public final class ManagedDatabaseSensitivityLabelsListCurrentByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSensitivityLabelsListByDatabaseCurrent.json + */ + /** + * Sample code: Gets the current sensitivity labels of a given database in a managed database. + * + * @param manager Entry point to SqlManager. + */ + public static void getsTheCurrentSensitivityLabelsOfAGivenDatabaseInAManagedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseSensitivityLabels() + .listCurrentByDatabase("myRG", "myManagedInstanceName", "myDatabase", null, null, null, Context.NONE); + } +} +``` + +### ManagedDatabaseSensitivityLabels_ListRecommendedByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseSensitivityLabels ListRecommendedByDatabase. */ +public final class ManagedDatabaseSensitivityLabelsListRecommendedByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSensitivityLabelsListByDatabaseRecommended.json + */ + /** + * Sample code: Gets the recommended sensitivity labels of a given database in a managed database. + * + * @param manager Entry point to SqlManager. + */ + public static void getsTheRecommendedSensitivityLabelsOfAGivenDatabaseInAManagedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseSensitivityLabels() + .listRecommendedByDatabase("myRG", "myManagedInstanceName", "myDatabase", null, null, null, Context.NONE); + } +} +``` + +### ManagedDatabaseSensitivityLabels_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.SensitivityLabelInner; +import com.azure.resourcemanager.sql.generated.fluent.models.SensitivityLabelUpdateInner; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelUpdateKind; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelUpdateList; +import java.util.Arrays; + +/** Samples for ManagedDatabaseSensitivityLabels Update. */ +public final class ManagedDatabaseSensitivityLabelsUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSensitivityLabelsCurrentUpdate.json + */ + /** + * Sample code: Update sensitivity labels of a given database using an operations batch. + * + * @param manager Entry point to SqlManager. + */ + public static void updateSensitivityLabelsOfAGivenDatabaseUsingAnOperationsBatch( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseSensitivityLabels() + .updateWithResponse( + "myRG", + "myManagedInstanceName", + "myDatabase", + new SensitivityLabelUpdateList() + .withOperations( + Arrays + .asList( + new SensitivityLabelUpdateInner() + .withOp(SensitivityLabelUpdateKind.SET) + .withSchema("dbo") + .withTable("table1") + .withColumn("column1") + .withSensitivityLabel( + new SensitivityLabelInner() + .withLabelName("Highly Confidential") + .withLabelId("3A477B16-9423-432B-AA97-6069B481CEC3") + .withInformationType("Financial") + .withInformationTypeId("1D3652D6-422C-4115-82F1-65DAEBC665C8")), + new SensitivityLabelUpdateInner() + .withOp(SensitivityLabelUpdateKind.SET) + .withSchema("dbo") + .withTable("table2") + .withColumn("column2") + .withSensitivityLabel( + new SensitivityLabelInner() + .withLabelName("PII") + .withLabelId("bf91e08c-f4f0-478a-b016-25164b2a65ff") + .withInformationType("PhoneNumber") + .withInformationTypeId("d22fa6e9-5ee4-3bde-4c2b-a409604c4646")), + new SensitivityLabelUpdateInner() + .withOp(SensitivityLabelUpdateKind.REMOVE) + .withSchema("dbo") + .withTable("Table1") + .withColumn("Column3"))), + Context.NONE); + } +} +``` + +### ManagedDatabaseTables_Get + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseTables Get. */ +public final class ManagedDatabaseTablesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseTableGet.json + */ + /** + * Sample code: Get managed database table. + * + * @param manager Entry point to SqlManager. + */ + public static void getManagedDatabaseTable(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseTables() + .getWithResponse("myRG", "myManagedInstanceName", "myDatabase", "dbo", "table1", Context.NONE); + } +} +``` + +### ManagedDatabaseTables_ListBySchema + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseTables ListBySchema. */ +public final class ManagedDatabaseTablesListBySchemaSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseTableListBySchema.json + */ + /** + * Sample code: List managed database tables. + * + * @param manager Entry point to SqlManager. + */ + public static void listManagedDatabaseTables(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseTables() + .listBySchema("myRG", "myManagedInstanceName", "myDatabase", "dbo", null, Context.NONE); + } +} +``` + +### ManagedDatabaseTransparentDataEncryption_CreateOrUpdate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ManagedTransparentDataEncryption; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionName; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionState; + +/** Samples for ManagedDatabaseTransparentDataEncryption CreateOrUpdate. */ +public final class ManagedDatabaseTransparentDataEncryptionCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedTransparentDataEncryptionUpdate.json + */ + /** + * Sample code: Update a database's Transparent Data Encryption state with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateADatabaseSTransparentDataEncryptionStateWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedTransparentDataEncryption resource = + manager + .managedDatabaseTransparentDataEncryptions() + .getWithResponse( + "securitytde-42-rg", + "securitytde-42", + "testdb", + TransparentDataEncryptionName.CURRENT, + Context.NONE) + .getValue(); + resource.update().withState(TransparentDataEncryptionState.ENABLED).apply(); + } +} +``` + +### ManagedDatabaseTransparentDataEncryption_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionName; + +/** Samples for ManagedDatabaseTransparentDataEncryption Get. */ +public final class ManagedDatabaseTransparentDataEncryptionGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedTransparentDataEncryptionGet.json + */ + /** + * Sample code: Get a database's transparent data encryption. + * + * @param manager Entry point to SqlManager. + */ + public static void getADatabaseSTransparentDataEncryption( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseTransparentDataEncryptions() + .getWithResponse( + "security-tde-resourcegroup", + "securitytde", + "testdb", + TransparentDataEncryptionName.CURRENT, + Context.NONE); + } +} +``` + +### ManagedDatabaseTransparentDataEncryption_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseTransparentDataEncryption ListByDatabase. */ +public final class ManagedDatabaseTransparentDataEncryptionListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedTransparentDataEncryptionList.json + */ + /** + * Sample code: Get a list of the database's transparent data encryptions. + * + * @param manager Entry point to SqlManager. + */ + public static void getAListOfTheDatabaseSTransparentDataEncryptions( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseTransparentDataEncryptions() + .listByDatabase("security-tde-resourcegroup", "securitytde", "testdb", Context.NONE); + } +} +``` + +### ManagedDatabaseVulnerabilityAssessmentRuleBaselines_CreateOrUpdate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentRuleBaselineInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseVulnerabilityAssessmentRuleBaselineItem; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentPolicyBaselineName; +import java.util.Arrays; + +/** Samples for ManagedDatabaseVulnerabilityAssessmentRuleBaselines CreateOrUpdate. */ +public final class ManagedDatabaseVulnerabilityAssessmentRuleBaselinesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentRuleBaselineCreate.json + */ + /** + * Sample code: Creates or updates a database's vulnerability assessment rule baseline. + * + * @param manager Entry point to SqlManager. + */ + public static void createsOrUpdatesADatabaseSVulnerabilityAssessmentRuleBaseline( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseVulnerabilityAssessmentRuleBaselines() + .createOrUpdateWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + "VA1001", + VulnerabilityAssessmentPolicyBaselineName.DEFAULT, + new DatabaseVulnerabilityAssessmentRuleBaselineInner() + .withBaselineResults( + Arrays + .asList( + new DatabaseVulnerabilityAssessmentRuleBaselineItem() + .withResult(Arrays.asList("userA", "SELECT")), + new DatabaseVulnerabilityAssessmentRuleBaselineItem() + .withResult(Arrays.asList("userB", "SELECT")), + new DatabaseVulnerabilityAssessmentRuleBaselineItem() + .withResult(Arrays.asList("userC", "SELECT", "tableId_4")))), + Context.NONE); + } +} +``` + +### ManagedDatabaseVulnerabilityAssessmentRuleBaselines_Delete + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentPolicyBaselineName; + +/** Samples for ManagedDatabaseVulnerabilityAssessmentRuleBaselines Delete. */ +public final class ManagedDatabaseVulnerabilityAssessmentRuleBaselinesDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentRuleBaselineDelete.json + */ + /** + * Sample code: Removes a database's vulnerability assessment rule baseline. + * + * @param manager Entry point to SqlManager. + */ + public static void removesADatabaseSVulnerabilityAssessmentRuleBaseline( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseVulnerabilityAssessmentRuleBaselines() + .deleteWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + "VA1001", + VulnerabilityAssessmentPolicyBaselineName.DEFAULT, + Context.NONE); + } +} +``` + +### ManagedDatabaseVulnerabilityAssessmentRuleBaselines_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentPolicyBaselineName; + +/** Samples for ManagedDatabaseVulnerabilityAssessmentRuleBaselines Get. */ +public final class ManagedDatabaseVulnerabilityAssessmentRuleBaselinesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentRuleBaselineGet.json + */ + /** + * Sample code: Gets a database's vulnerability assessment rule baseline. + * + * @param manager Entry point to SqlManager. + */ + public static void getsADatabaseSVulnerabilityAssessmentRuleBaseline( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseVulnerabilityAssessmentRuleBaselines() + .getWithResponse( + "vulnerabilityaseessmenttest-4711", + "vulnerabilityaseessmenttest-6411", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + "VA1001", + VulnerabilityAssessmentPolicyBaselineName.MASTER, + Context.NONE); + } +} +``` + +### ManagedDatabaseVulnerabilityAssessmentScans_Export + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for ManagedDatabaseVulnerabilityAssessmentScans Export. */ +public final class ManagedDatabaseVulnerabilityAssessmentScansExportSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentScanExport.json + */ + /** + * Sample code: Export a database's vulnerability assessment scan results. + * + * @param manager Entry point to SqlManager. + */ + public static void exportADatabaseSVulnerabilityAssessmentScanResults( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseVulnerabilityAssessmentScans() + .exportWithResponse( + "vulnerabilityassessmenttest-4799", + "vulnerabilityassessmenttest-6440", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + "scan001", + Context.NONE); + } +} +``` + +### ManagedDatabaseVulnerabilityAssessmentScans_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for ManagedDatabaseVulnerabilityAssessmentScans Get. */ +public final class ManagedDatabaseVulnerabilityAssessmentScansGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentScanRecordsGet.json + */ + /** + * Sample code: Gets a database vulnerability assessment scan record by scan ID. + * + * @param manager Entry point to SqlManager. + */ + public static void getsADatabaseVulnerabilityAssessmentScanRecordByScanID( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseVulnerabilityAssessmentScans() + .getWithResponse( + "vulnerabilityassessmenttest-4711", + "vulnerabilityassessmenttest-6411", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + "scan001", + Context.NONE); + } +} +``` + +### ManagedDatabaseVulnerabilityAssessmentScans_InitiateScan + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for ManagedDatabaseVulnerabilityAssessmentScans InitiateScan. */ +public final class ManagedDatabaseVulnerabilityAssessmentScansInitiateScanSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentScansExecute.json + */ + /** + * Sample code: Executes a database's vulnerability assessment scan. + * + * @param manager Entry point to SqlManager. + */ + public static void executesADatabaseSVulnerabilityAssessmentScan( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseVulnerabilityAssessmentScans() + .initiateScan( + "vulnerabilityassessmenttest-4711", + "vulnerabilityassessmenttest-6411", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + "scan01", + Context.NONE); + } +} +``` + +### ManagedDatabaseVulnerabilityAssessmentScans_ListByDatabase + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for ManagedDatabaseVulnerabilityAssessmentScans ListByDatabase. */ +public final class ManagedDatabaseVulnerabilityAssessmentScansListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentScanRecordsListByDatabase.json + */ + /** + * Sample code: Gets the list of a database vulnerability assessment scan records. + * + * @param manager Entry point to SqlManager. + */ + public static void getsTheListOfADatabaseVulnerabilityAssessmentScanRecords( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseVulnerabilityAssessmentScans() + .listByDatabase( + "vulnerabilityassessmenttest-4711", + "vulnerabilityassessmenttest-6411", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + Context.NONE); + } +} +``` + +### ManagedDatabaseVulnerabilityAssessments_CreateOrUpdate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentInner; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentRecurringScansProperties; +import java.util.Arrays; + +/** Samples for ManagedDatabaseVulnerabilityAssessments CreateOrUpdate. */ +public final class ManagedDatabaseVulnerabilityAssessmentsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentCreateMax.json + */ + /** + * Sample code: Create a database's vulnerability assessment with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void createADatabaseSVulnerabilityAssessmentWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseVulnerabilityAssessments() + .createOrUpdateWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + new DatabaseVulnerabilityAssessmentInner() + .withStorageContainerPath("https://myStorage.blob.core.windows.net/vulnerability-assessment/") + .withStorageContainerSasKey("fakeTokenPlaceholder") + .withRecurringScans( + new VulnerabilityAssessmentRecurringScansProperties() + .withIsEnabled(true) + .withEmailSubscriptionAdmins(true) + .withEmails(Arrays.asList("email1@mail.com", "email2@mail.com"))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentCreateMin.json + */ + /** + * Sample code: Create a database's vulnerability assessment with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void createADatabaseSVulnerabilityAssessmentWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseVulnerabilityAssessments() + .createOrUpdateWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + new DatabaseVulnerabilityAssessmentInner() + .withStorageContainerPath("https://myStorage.blob.core.windows.net/vulnerability-assessment/") + .withStorageContainerSasKey("fakeTokenPlaceholder"), + Context.NONE); + } +} +``` + +### ManagedDatabaseVulnerabilityAssessments_Delete + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for ManagedDatabaseVulnerabilityAssessments Delete. */ +public final class ManagedDatabaseVulnerabilityAssessmentsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentDelete.json + */ + /** + * Sample code: Remove a database's vulnerability assessment. + * + * @param manager Entry point to SqlManager. + */ + public static void removeADatabaseSVulnerabilityAssessment( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseVulnerabilityAssessments() + .deleteWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + Context.NONE); + } +} +``` + +### ManagedDatabaseVulnerabilityAssessments_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for ManagedDatabaseVulnerabilityAssessments Get. */ +public final class ManagedDatabaseVulnerabilityAssessmentsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentGet.json + */ + /** + * Sample code: Get a database's vulnerability assessment. + * + * @param manager Entry point to SqlManager. + */ + public static void getADatabaseSVulnerabilityAssessment( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseVulnerabilityAssessments() + .getWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + Context.NONE); + } +} +``` + +### ManagedDatabaseVulnerabilityAssessments_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseVulnerabilityAssessments ListByDatabase. */ +public final class ManagedDatabaseVulnerabilityAssessmentsListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentListByDatabase.json + */ + /** + * Sample code: Get a database's vulnerability assessments list. + * + * @param manager Entry point to SqlManager. + */ + public static void getADatabaseSVulnerabilityAssessmentsList( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseVulnerabilityAssessments() + .listByDatabase( + "vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", "testdb", Context.NONE); + } +} +``` + +### ManagedDatabases_CancelMove + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseMoveDefinition; + +/** Samples for ManagedDatabases CancelMove. */ +public final class ManagedDatabasesCancelMoveSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ManagedDatabaseCancelMove.json + */ + /** + * Sample code: Cancels a managed database move. + * + * @param manager Entry point to SqlManager. + */ + public static void cancelsAManagedDatabaseMove(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabases() + .cancelMove( + "group1", + "testInstanceSrc", + "testDatabase", + new ManagedDatabaseMoveDefinition() + .withDestinationManagedDatabaseId( + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/managedInstances/testInstanceTgt/databases/testDatabase"), + Context.NONE); + } +} +``` + +### ManagedDatabases_CompleteMove + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseMoveDefinition; + +/** Samples for ManagedDatabases CompleteMove. */ +public final class ManagedDatabasesCompleteMoveSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ManagedDatabaseCompleteMove.json + */ + /** + * Sample code: Completes a managed database move. + * + * @param manager Entry point to SqlManager. + */ + public static void completesAManagedDatabaseMove(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabases() + .completeMove( + "group1", + "testInstanceSrc", + "testDatabase", + new ManagedDatabaseMoveDefinition() + .withDestinationManagedDatabaseId( + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/managedInstances/testInstanceTgt/databases/testDatabase"), + Context.NONE); + } +} +``` + +### ManagedDatabases_CompleteRestore + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.CompleteDatabaseRestoreDefinition; + +/** Samples for ManagedDatabases CompleteRestore. */ +public final class ManagedDatabasesCompleteRestoreSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ManagedDatabaseCompleteExternalRestore.json + */ + /** + * Sample code: Completes a managed database external backup restore. + * + * @param manager Entry point to SqlManager. + */ + public static void completesAManagedDatabaseExternalBackupRestore( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabases() + .completeRestore( + "myRG", + "myManagedInstanceName", + "myDatabase", + new CompleteDatabaseRestoreDefinition().withLastBackupName("testdb1_log4"), + Context.NONE); + } +} +``` + +### ManagedDatabases_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseCreateMode; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ManagedDatabases CreateOrUpdate. */ +public final class ManagedDatabasesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ManagedDatabaseCreateRestoreExternalBackupManagedIdentity.json + */ + /** + * Sample code: Creates a new managed database by restoring from an external backup using managed identity. + * + * @param manager Entry point to SqlManager. + */ + public static void createsANewManagedDatabaseByRestoringFromAnExternalBackupUsingManagedIdentity( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabases() + .define("managedDatabase") + .withRegion("southeastasia") + .withExistingManagedInstance("Default-SQL-SouthEastAsia", "managedInstance") + .withCollation("SQL_Latin1_General_CP1_CI_AS") + .withCreateMode(ManagedDatabaseCreateMode.RESTORE_EXTERNAL_BACKUP) + .withStorageContainerUri("https://myaccountname.blob.core.windows.net/backups") + .withStorageContainerIdentity("ManagedIdentity") + .withAutoCompleteRestore(true) + .withLastBackupName("last_backup_name") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ManagedDatabaseCreateRecovery.json + */ + /** + * Sample code: Creates a new managed database from restoring a geo-replicated backup. + * + * @param manager Entry point to SqlManager. + */ + public static void createsANewManagedDatabaseFromRestoringAGeoReplicatedBackup( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabases() + .define("testdb_recovered") + .withRegion("southeastasia") + .withExistingManagedInstance("Default-SQL-SouthEastAsia", "server1") + .withCreateMode(ManagedDatabaseCreateMode.RECOVERY) + .withRecoverableDatabaseId( + "/subscriptions/11111111-2222-3333-4444-555555555555/resourceGroups/Default-SQL-WestEurope/providers/Microsoft.Sql/managedInstances/testsvr/recoverableDatabases/testdb") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ManagedDatabaseCreateRestoreExternalBackup.json + */ + /** + * Sample code: Creates a new managed database by restoring from an external backup. + * + * @param manager Entry point to SqlManager. + */ + public static void createsANewManagedDatabaseByRestoringFromAnExternalBackup( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabases() + .define("managedDatabase") + .withRegion("southeastasia") + .withExistingManagedInstance("Default-SQL-SouthEastAsia", "managedInstance") + .withCollation("SQL_Latin1_General_CP1_CI_AS") + .withCreateMode(ManagedDatabaseCreateMode.RESTORE_EXTERNAL_BACKUP) + .withStorageContainerUri("https://myaccountname.blob.core.windows.net/backups") + .withStorageContainerSasToken("sv=2015-12-11&sr=c&sp=rl&sig=1234") + .withAutoCompleteRestore(true) + .withLastBackupName("last_backup_name") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ManagedDatabaseCreateMax.json + */ + /** + * Sample code: Creates a new managed database with maximal properties. + * + * @param manager Entry point to SqlManager. + */ + public static void createsANewManagedDatabaseWithMaximalProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabases() + .define("managedDatabase") + .withRegion("southeastasia") + .withExistingManagedInstance("Default-SQL-SouthEastAsia", "managedInstance") + .withTags(mapOf("tagKey1", "TagValue1")) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ManagedDatabaseCreateMin.json + */ + /** + * Sample code: Creates a new managed database with minimal properties. + * + * @param manager Entry point to SqlManager. + */ + public static void createsANewManagedDatabaseWithMinimalProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabases() + .define("managedDatabase") + .withRegion("southeastasia") + .withExistingManagedInstance("Default-SQL-SouthEastAsia", "managedInstance") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ManagedDatabaseCreatePointInTimeRestore.json + */ + /** + * Sample code: Creates a new managed database using point in time restore. + * + * @param manager Entry point to SqlManager. + */ + public static void createsANewManagedDatabaseUsingPointInTimeRestore( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabases() + .define("managedDatabase") + .withRegion("southeastasia") + .withExistingManagedInstance("Default-SQL-SouthEastAsia", "managedInstance") + .withRestorePointInTime(OffsetDateTime.parse("2017-07-14T05:35:31.503Z")) + .withCreateMode(ManagedDatabaseCreateMode.POINT_IN_TIME_RESTORE) + .withSourceDatabaseId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testsvr/databases/testdb") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ManagedDatabaseCreateRestoreLtrBackup.json + */ + /** + * Sample code: Creates a new managed database from restoring a long term retention backup. + * + * @param manager Entry point to SqlManager. + */ + public static void createsANewManagedDatabaseFromRestoringALongTermRetentionBackup( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabases() + .define("managedDatabase") + .withRegion("southeastasia") + .withExistingManagedInstance("Default-SQL-SouthEastAsia", "managedInstance") + .withCollation("SQL_Latin1_General_CP1_CI_AS") + .withCreateMode(ManagedDatabaseCreateMode.RESTORE_EXTERNAL_BACKUP) + .withStorageContainerUri("https://myaccountname.blob.core.windows.net/backups") + .withStorageContainerSasToken("sv=2015-12-11&sr=c&sp=rl&sig=1234") + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### ManagedDatabases_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedDatabases Delete. */ +public final class ManagedDatabasesDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ManagedDatabaseDelete.json + */ + /** + * Sample code: Delete managed database. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteManagedDatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedDatabases().delete("Default-SQL-SouthEastAsia", "managedInstance", "testdb", Context.NONE); + } +} +``` + +### ManagedDatabases_Get + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedDatabases Get. */ +public final class ManagedDatabasesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ManagedDatabaseGet.json + */ + /** + * Sample code: Gets a managed database. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAManagedDatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedDatabases().getWithResponse("Test1", "managedInstance", "managedDatabase", Context.NONE); + } +} +``` + +### ManagedDatabases_ListByInstance + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedDatabases ListByInstance. */ +public final class ManagedDatabasesListByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ManagedDatabaseListByManagedInstance.json + */ + /** + * Sample code: List databases by managed instances. + * + * @param manager Entry point to SqlManager. + */ + public static void listDatabasesByManagedInstances(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedDatabases().listByInstance("Test1", "managedInstance", Context.NONE); + } +} +``` + +### ManagedDatabases_ListInaccessibleByInstance + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedDatabases ListInaccessibleByInstance. */ +public final class ManagedDatabasesListInaccessibleByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/InaccessibleManagedDatabaseListByManagedInstance.json + */ + /** + * Sample code: List inaccessible managed databases by managed instances. + * + * @param manager Entry point to SqlManager. + */ + public static void listInaccessibleManagedDatabasesByManagedInstances( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedDatabases().listInaccessibleByInstance("testrg", "testcl", Context.NONE); + } +} +``` + +### ManagedDatabases_StartMove + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseStartMoveDefinition; +import com.azure.resourcemanager.sql.generated.models.MoveOperationMode; + +/** Samples for ManagedDatabases StartMove. */ +public final class ManagedDatabasesStartMoveSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ManagedDatabaseStartMoveMax.json + */ + /** + * Sample code: Starts a managed database move with all optional parameters specified. + * + * @param manager Entry point to SqlManager. + */ + public static void startsAManagedDatabaseMoveWithAllOptionalParametersSpecified( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabases() + .startMove( + "group1", + "testInstanceSrc", + "testDatabase", + new ManagedDatabaseStartMoveDefinition() + .withDestinationManagedDatabaseId( + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/managedInstances/testInstanceTgt/databases/testDatabase") + .withOperationMode(MoveOperationMode.COPY), + Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ManagedDatabaseStartMoveMin.json + */ + /** + * Sample code: Starts a managed database move with no optional parameters specified. + * + * @param manager Entry point to SqlManager. + */ + public static void startsAManagedDatabaseMoveWithNoOptionalParametersSpecified( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabases() + .startMove( + "group1", + "testInstanceSrc", + "testDatabase", + new ManagedDatabaseStartMoveDefinition() + .withDestinationManagedDatabaseId( + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/managedInstances/testInstanceTgt/databases/testDatabase"), + Context.NONE); + } +} +``` + +### ManagedDatabases_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabase; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ManagedDatabases Update. */ +public final class ManagedDatabasesUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ManagedDatabaseUpdateMax.json + */ + /** + * Sample code: Updates a managed database with maximal properties. + * + * @param manager Entry point to SqlManager. + */ + public static void updatesAManagedDatabaseWithMaximalProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedDatabase resource = + manager + .managedDatabases() + .getWithResponse("Default-SQL-SouthEastAsia", "managedInstance", "testdb", Context.NONE) + .getValue(); + resource.update().withTags(mapOf("tagKey1", "TagValue1")).apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ManagedDatabaseUpdateMin.json + */ + /** + * Sample code: Updates a managed database with minimal properties. + * + * @param manager Entry point to SqlManager. + */ + public static void updatesAManagedDatabaseWithMinimalProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedDatabase resource = + manager + .managedDatabases() + .getWithResponse("Default-SQL-SouthEastAsia", "managedInstance", "testdb", Context.NONE) + .getValue(); + resource.update().withTags(mapOf("tagKey1", "TagValue1")).apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### ManagedInstanceAdministrators_CreateOrUpdate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.AdministratorName; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceAdministrator; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceAdministratorType; +import java.util.UUID; + +/** Samples for ManagedInstanceAdministrators CreateOrUpdate. */ +public final class ManagedInstanceAdministratorsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceAdministratorCreate.json + */ + /** + * Sample code: Create administrator of managed instance. + * + * @param manager Entry point to SqlManager. + */ + public static void createAdministratorOfManagedInstance( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceAdministrators() + .define(AdministratorName.ACTIVE_DIRECTORY) + .withExistingManagedInstance("Default-SQL-SouthEastAsia", "managedInstance") + .withAdministratorType(ManagedInstanceAdministratorType.ACTIVE_DIRECTORY) + .withLogin("bob@contoso.com") + .withSid(UUID.fromString("44444444-3333-2222-1111-000000000000")) + .withTenantId(UUID.fromString("55555555-4444-3333-2222-111111111111")) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceAdministratorUpdate.json + */ + /** + * Sample code: Update administrator of managed instance. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAdministratorOfManagedInstance( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedInstanceAdministrator resource = + manager + .managedInstanceAdministrators() + .getWithResponse( + "Default-SQL-SouthEastAsia", "managedInstance", AdministratorName.ACTIVE_DIRECTORY, Context.NONE) + .getValue(); + resource + .update() + .withAdministratorType(ManagedInstanceAdministratorType.ACTIVE_DIRECTORY) + .withLogin("bob@contoso.com") + .withSid(UUID.fromString("44444444-3333-2222-1111-000000000000")) + .withTenantId(UUID.fromString("55555555-4444-3333-2222-111111111111")) + .apply(); + } +} +``` + +### ManagedInstanceAdministrators_Delete + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.AdministratorName; + +/** Samples for ManagedInstanceAdministrators Delete. */ +public final class ManagedInstanceAdministratorsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceAdministratorDelete.json + */ + /** + * Sample code: Delete administrator of managed instance. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteAdministratorOfManagedInstance( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceAdministrators() + .delete("Default-SQL-SouthEastAsia", "managedInstance", AdministratorName.ACTIVE_DIRECTORY, Context.NONE); + } +} +``` + +### ManagedInstanceAdministrators_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.AdministratorName; + +/** Samples for ManagedInstanceAdministrators Get. */ +public final class ManagedInstanceAdministratorsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceAdministratorGet.json + */ + /** + * Sample code: Get administrator of managed instance. + * + * @param manager Entry point to SqlManager. + */ + public static void getAdministratorOfManagedInstance(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceAdministrators() + .getWithResponse( + "Default-SQL-SouthEastAsia", "managedInstance", AdministratorName.ACTIVE_DIRECTORY, Context.NONE); + } +} +``` + +### ManagedInstanceAdministrators_ListByInstance + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedInstanceAdministrators ListByInstance. */ +public final class ManagedInstanceAdministratorsListByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceAdministratorListByInstance.json + */ + /** + * Sample code: List administrators of managed instance. + * + * @param manager Entry point to SqlManager. + */ + public static void listAdministratorsOfManagedInstance(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceAdministrators() + .listByInstance("Default-SQL-SouthEastAsia", "managedInstance", Context.NONE); + } +} +``` + +### ManagedInstanceAdvancedThreatProtectionSettings_CreateOrUpdate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.AdvancedThreatProtectionName; +import com.azure.resourcemanager.sql.generated.models.AdvancedThreatProtectionState; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceAdvancedThreatProtection; + +/** Samples for ManagedInstanceAdvancedThreatProtectionSettings CreateOrUpdate. */ +public final class ManagedInstanceAdvancedThreatProtectionSettingsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ManagedInstanceAdvancedThreatProtectionSettingsCreateMin.json + */ + /** + * Sample code: Update a managed instance's Advanced Threat Protection settings with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAManagedInstanceSAdvancedThreatProtectionSettingsWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedInstanceAdvancedThreatProtection resource = + manager + .managedInstanceAdvancedThreatProtectionSettings() + .getWithResponse( + "threatprotection-4799", + "threatprotection-6440", + AdvancedThreatProtectionName.DEFAULT, + Context.NONE) + .getValue(); + resource.update().withState(AdvancedThreatProtectionState.DISABLED).apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ManagedInstanceAdvancedThreatProtectionSettingsCreateMax.json + */ + /** + * Sample code: Update a managed instance's Advanced Threat Protection settings with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAManagedInstanceSAdvancedThreatProtectionSettingsWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedInstanceAdvancedThreatProtection resource = + manager + .managedInstanceAdvancedThreatProtectionSettings() + .getWithResponse( + "threatprotection-4799", + "threatprotection-6440", + AdvancedThreatProtectionName.DEFAULT, + Context.NONE) + .getValue(); + resource.update().withState(AdvancedThreatProtectionState.ENABLED).apply(); + } +} +``` + +### ManagedInstanceAdvancedThreatProtectionSettings_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.AdvancedThreatProtectionName; + +/** Samples for ManagedInstanceAdvancedThreatProtectionSettings Get. */ +public final class ManagedInstanceAdvancedThreatProtectionSettingsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ManagedInstanceAdvancedThreatProtectionSettingsGet.json + */ + /** + * Sample code: Get a managed instance's Advanced Threat Protection settings. + * + * @param manager Entry point to SqlManager. + */ + public static void getAManagedInstanceSAdvancedThreatProtectionSettings( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceAdvancedThreatProtectionSettings() + .getWithResponse( + "threatprotection-4799", "threatprotection-6440", AdvancedThreatProtectionName.DEFAULT, Context.NONE); + } +} +``` + +### ManagedInstanceAdvancedThreatProtectionSettings_ListByInstance + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedInstanceAdvancedThreatProtectionSettings ListByInstance. */ +public final class ManagedInstanceAdvancedThreatProtectionSettingsListByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ManagedInstanceAdvancedThreatProtectionSettingsListByInstance.json + */ + /** + * Sample code: List the managed instance's Advanced Threat Protection settings. + * + * @param manager Entry point to SqlManager. + */ + public static void listTheManagedInstanceSAdvancedThreatProtectionSettings( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceAdvancedThreatProtectionSettings() + .listByInstance("threatprotection-4799", "threatprotection-6440", Context.NONE); + } +} +``` + +### ManagedInstanceAzureADOnlyAuthentications_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.AuthenticationName; + +/** Samples for ManagedInstanceAzureADOnlyAuthentications CreateOrUpdate. */ +public final class ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceAzureADOnlyAuthCreateOrUpdate.json + */ + /** + * Sample code: Creates or updates Azure Active Directory only authentication object. + * + * @param manager Entry point to SqlManager. + */ + public static void createsOrUpdatesAzureActiveDirectoryOnlyAuthenticationObject( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceAzureADOnlyAuthentications() + .define(AuthenticationName.DEFAULT) + .withExistingManagedInstance("Default-SQL-SouthEastAsia", "managedInstance") + .withAzureADOnlyAuthentication(false) + .create(); + } +} +``` + +### ManagedInstanceAzureADOnlyAuthentications_Delete + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.AuthenticationName; + +/** Samples for ManagedInstanceAzureADOnlyAuthentications Delete. */ +public final class ManagedInstanceAzureADOnlyAuthenticationsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceAzureADOnlyAuthDelete.json + */ + /** + * Sample code: Deletes Azure Active Directory only authentication object. + * + * @param manager Entry point to SqlManager. + */ + public static void deletesAzureActiveDirectoryOnlyAuthenticationObject( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceAzureADOnlyAuthentications() + .delete("Default-SQL-SouthEastAsia", "managedInstance", AuthenticationName.DEFAULT, Context.NONE); + } +} +``` + +### ManagedInstanceAzureADOnlyAuthentications_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.AuthenticationName; + +/** Samples for ManagedInstanceAzureADOnlyAuthentications Get. */ +public final class ManagedInstanceAzureADOnlyAuthenticationsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceAzureADOnlyAuthGet.json + */ + /** + * Sample code: Gets a Azure Active Directory only authentication property. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAAzureActiveDirectoryOnlyAuthenticationProperty( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceAzureADOnlyAuthentications() + .getWithResponse("Default-SQL-SouthEastAsia", "managedInstance", AuthenticationName.DEFAULT, Context.NONE); + } +} +``` + +### ManagedInstanceAzureADOnlyAuthentications_ListByInstance + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedInstanceAzureADOnlyAuthentications ListByInstance. */ +public final class ManagedInstanceAzureADOnlyAuthenticationsListByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceAzureADOnlyAuthListByInstance.json + */ + /** + * Sample code: Gets a list of Azure Active Directory only authentication object. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAListOfAzureActiveDirectoryOnlyAuthenticationObject( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceAzureADOnlyAuthentications() + .listByInstance("Default-SQL-SouthEastAsia", "managedInstance", Context.NONE); + } +} +``` + +### ManagedInstanceDtcs_CreateOrUpdate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.DtcName; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceDtc; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceDtcSecuritySettings; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceDtcTransactionManagerCommunicationSettings; +import java.util.Arrays; + +/** Samples for ManagedInstanceDtcs CreateOrUpdate. */ +public final class ManagedInstanceDtcsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/ManagedInstanceDtcUpdateEnableDtc.json + */ + /** + * Sample code: Updates managed instance DTC settings by enabling DTC. + * + * @param manager Entry point to SqlManager. + */ + public static void updatesManagedInstanceDTCSettingsByEnablingDTC( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedInstanceDtc resource = + manager + .managedInstanceDtcs() + .getWithResponse("testrg", "testinstance", DtcName.CURRENT, Context.NONE) + .getValue(); + resource.update().withDtcEnabled(true).apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/ManagedInstanceDtcUpdateMax.json + */ + /** + * Sample code: Updates managed instance DTC settings with all optional parameters specified. + * + * @param manager Entry point to SqlManager. + */ + public static void updatesManagedInstanceDTCSettingsWithAllOptionalParametersSpecified( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedInstanceDtc resource = + manager + .managedInstanceDtcs() + .getWithResponse("testrg", "testinstance", DtcName.CURRENT, Context.NONE) + .getValue(); + resource + .update() + .withDtcEnabled(true) + .withSecuritySettings( + new ManagedInstanceDtcSecuritySettings() + .withTransactionManagerCommunicationSettings( + new ManagedInstanceDtcTransactionManagerCommunicationSettings() + .withAllowInboundEnabled(false) + .withAllowOutboundEnabled(true) + .withAuthentication("NoAuth")) + .withXaTransactionsEnabled(false) + .withSnaLu6Point2TransactionsEnabled(false) + .withXaTransactionsDefaultTimeout(1000) + .withXaTransactionsMaximumTimeout(3000)) + .withExternalDnsSuffixSearchList(Arrays.asList("dns.example1.com", "dns.example2.com")) + .apply(); + } +} +``` + +### ManagedInstanceDtcs_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.DtcName; + +/** Samples for ManagedInstanceDtcs Get. */ +public final class ManagedInstanceDtcsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/ManagedInstanceDtcGet.json + */ + /** + * Sample code: Gets managed instance DTC settings. + * + * @param manager Entry point to SqlManager. + */ + public static void getsManagedInstanceDTCSettings(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstanceDtcs().getWithResponse("testrg", "testinstance", DtcName.CURRENT, Context.NONE); + } +} +``` + +### ManagedInstanceDtcs_ListByManagedInstance + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedInstanceDtcs ListByManagedInstance. */ +public final class ManagedInstanceDtcsListByManagedInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/ManagedInstanceDtcList.json + */ + /** + * Sample code: Gets a list of managed instance DTC settings. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAListOfManagedInstanceDTCSettings( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstanceDtcs().listByManagedInstance("testrg", "testinstance", Context.NONE); + } +} +``` + +### ManagedInstanceEncryptionProtectors_CreateOrUpdate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.EncryptionProtectorName; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceEncryptionProtector; +import com.azure.resourcemanager.sql.generated.models.ServerKeyType; + +/** Samples for ManagedInstanceEncryptionProtectors CreateOrUpdate. */ +public final class ManagedInstanceEncryptionProtectorsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceEncryptionProtectorCreateOrUpdateKeyVault.json + */ + /** + * Sample code: Update the encryption protector to key vault. + * + * @param manager Entry point to SqlManager. + */ + public static void updateTheEncryptionProtectorToKeyVault( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedInstanceEncryptionProtector resource = + manager + .managedInstanceEncryptionProtectors() + .getWithResponse("sqlcrudtest-7398", "sqlcrudtest-4645", EncryptionProtectorName.CURRENT, Context.NONE) + .getValue(); + resource + .update() + .withServerKeyName("someVault_someKey_01234567890123456789012345678901") + .withServerKeyType(ServerKeyType.AZURE_KEY_VAULT) + .withAutoRotationEnabled(false) + .apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceEncryptionProtectorCreateOrUpdateServiceManaged.json + */ + /** + * Sample code: Update the encryption protector to service managed. + * + * @param manager Entry point to SqlManager. + */ + public static void updateTheEncryptionProtectorToServiceManaged( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedInstanceEncryptionProtector resource = + manager + .managedInstanceEncryptionProtectors() + .getWithResponse("sqlcrudtest-7398", "sqlcrudtest-4645", EncryptionProtectorName.CURRENT, Context.NONE) + .getValue(); + resource.update().withServerKeyName("ServiceManaged").withServerKeyType(ServerKeyType.SERVICE_MANAGED).apply(); + } +} +``` + +### ManagedInstanceEncryptionProtectors_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.EncryptionProtectorName; + +/** Samples for ManagedInstanceEncryptionProtectors Get. */ +public final class ManagedInstanceEncryptionProtectorsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceEncryptionProtectorGet.json + */ + /** + * Sample code: Get the encryption protector. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheEncryptionProtector(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceEncryptionProtectors() + .getWithResponse("sqlcrudtest-7398", "sqlcrudtest-4645", EncryptionProtectorName.CURRENT, Context.NONE); + } +} +``` + +### ManagedInstanceEncryptionProtectors_ListByInstance + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedInstanceEncryptionProtectors ListByInstance. */ +public final class ManagedInstanceEncryptionProtectorsListByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceEncryptionProtectorList.json + */ + /** + * Sample code: List encryption protectors by managed instance. + * + * @param manager Entry point to SqlManager. + */ + public static void listEncryptionProtectorsByManagedInstance( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceEncryptionProtectors() + .listByInstance("sqlcrudtest-7398", "sqlcrudtest-4645", Context.NONE); + } +} +``` + +### ManagedInstanceEncryptionProtectors_Revalidate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.EncryptionProtectorName; + +/** Samples for ManagedInstanceEncryptionProtectors Revalidate. */ +public final class ManagedInstanceEncryptionProtectorsRevalidateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceEncryptionProtectorRevalidate.json + */ + /** + * Sample code: Revalidates the encryption protector. + * + * @param manager Entry point to SqlManager. + */ + public static void revalidatesTheEncryptionProtector(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceEncryptionProtectors() + .revalidate("sqlcrudtest-7398", "sqlcrudtest-4645", EncryptionProtectorName.CURRENT, Context.NONE); + } +} +``` + +### ManagedInstanceKeys_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.ServerKeyType; + +/** Samples for ManagedInstanceKeys CreateOrUpdate. */ +public final class ManagedInstanceKeysCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceKeyCreateOrUpdate.json + */ + /** + * Sample code: Creates or updates a managed instance key. + * + * @param manager Entry point to SqlManager. + */ + public static void createsOrUpdatesAManagedInstanceKey(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceKeys() + .define("someVault_someKey_01234567890123456789012345678901") + .withExistingManagedInstance("sqlcrudtest-7398", "sqlcrudtest-4645") + .withServerKeyType(ServerKeyType.AZURE_KEY_VAULT) + .withUri("https://someVault.vault.azure.net/keys/someKey/01234567890123456789012345678901") + .create(); + } +} +``` + +### ManagedInstanceKeys_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedInstanceKeys Delete. */ +public final class ManagedInstanceKeysDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceKeyDelete.json + */ + /** + * Sample code: Delete the managed instance key. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteTheManagedInstanceKey(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceKeys() + .delete( + "sqlcrudtest-7398", + "sqlcrudtest-4645", + "someVault_someKey_01234567890123456789012345678901", + Context.NONE); + } +} +``` + +### ManagedInstanceKeys_Get + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedInstanceKeys Get. */ +public final class ManagedInstanceKeysGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceKeyGet.json + */ + /** + * Sample code: Get the managed instance key. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheManagedInstanceKey(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceKeys() + .getWithResponse( + "sqlcrudtest-7398", + "sqlcrudtest-4645", + "someVault_someKey_01234567890123456789012345678901", + Context.NONE); + } +} +``` + +### ManagedInstanceKeys_ListByInstance + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedInstanceKeys ListByInstance. */ +public final class ManagedInstanceKeysListByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceKeyList.json + */ + /** + * Sample code: List the keys for a managed instance. + * + * @param manager Entry point to SqlManager. + */ + public static void listTheKeysForAManagedInstance(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstanceKeys().listByInstance("sqlcrudtest-7398", "sqlcrudtest-4645", null, Context.NONE); + } +} +``` + +### ManagedInstanceLongTermRetentionPolicies_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceLongTermRetentionPolicyName; + +/** Samples for ManagedInstanceLongTermRetentionPolicies CreateOrUpdate. */ +public final class ManagedInstanceLongTermRetentionPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceLongTermRetentionPolicyCreateOrUpdate.json + */ + /** + * Sample code: Create or update the LTR policy for the managed database. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateTheLTRPolicyForTheManagedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceLongTermRetentionPolicies() + .define(ManagedInstanceLongTermRetentionPolicyName.DEFAULT) + .withExistingDatabase("testResourceGroup", "testInstance", "testDatabase") + .withWeeklyRetention("P1M") + .withMonthlyRetention("P1Y") + .withYearlyRetention("P5Y") + .withWeekOfYear(5) + .create(); + } +} +``` + +### ManagedInstanceLongTermRetentionPolicies_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceLongTermRetentionPolicyName; + +/** Samples for ManagedInstanceLongTermRetentionPolicies Get. */ +public final class ManagedInstanceLongTermRetentionPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceLongTermRetentionPolicyGet.json + */ + /** + * Sample code: Get the long term retention policy for the managed database. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheLongTermRetentionPolicyForTheManagedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceLongTermRetentionPolicies() + .getWithResponse( + "testResourceGroup", + "testInstance", + "testDatabase", + ManagedInstanceLongTermRetentionPolicyName.DEFAULT, + Context.NONE); + } +} +``` + +### ManagedInstanceLongTermRetentionPolicies_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedInstanceLongTermRetentionPolicies ListByDatabase. */ +public final class ManagedInstanceLongTermRetentionPoliciesListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceLongTermRetentionPolicyListByDatabase.json + */ + /** + * Sample code: Get the long term retention policies for the managed database. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheLongTermRetentionPoliciesForTheManagedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceLongTermRetentionPolicies() + .listByDatabase("testResourceGroup", "testInstance", "testDatabase", Context.NONE); + } +} +``` + +### ManagedInstanceOperations_Cancel + +```java +import com.azure.core.util.Context; +import java.util.UUID; + +/** Samples for ManagedInstanceOperations Cancel. */ +public final class ManagedInstanceOperationsCancelSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CancelManagedInstanceOperation.json + */ + /** + * Sample code: Cancel the managed instance management operation. + * + * @param manager Entry point to SqlManager. + */ + public static void cancelTheManagedInstanceManagementOperation( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceOperations() + .cancelWithResponse( + "sqlcrudtest-7398", + "sqlcrudtest-4645", + UUID.fromString("11111111-1111-1111-1111-111111111111"), + Context.NONE); + } +} +``` + +### ManagedInstanceOperations_Get + +```java +import com.azure.core.util.Context; +import java.util.UUID; + +/** Samples for ManagedInstanceOperations Get. */ +public final class ManagedInstanceOperationsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetManagedInstanceOperation.json + */ + /** + * Sample code: Gets the managed instance management operation. + * + * @param manager Entry point to SqlManager. + */ + public static void getsTheManagedInstanceManagementOperation( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceOperations() + .getWithResponse( + "sqlcrudtest-7398", + "sqlcrudtest-4645", + UUID.fromString("00000000-1111-2222-3333-444444444444"), + Context.NONE); + } +} +``` + +### ManagedInstanceOperations_ListByManagedInstance + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedInstanceOperations ListByManagedInstance. */ +public final class ManagedInstanceOperationsListByManagedInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListManagedInstanceOperations.json + */ + /** + * Sample code: List the managed instance management operations. + * + * @param manager Entry point to SqlManager. + */ + public static void listTheManagedInstanceManagementOperations( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstanceOperations().listByManagedInstance("sqlcrudtest-7398", "sqlcrudtest-4645", Context.NONE); + } +} +``` + +### ManagedInstancePrivateEndpointConnections_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.ManagedInstancePrivateLinkServiceConnectionStateProperty; + +/** Samples for ManagedInstancePrivateEndpointConnections CreateOrUpdate. */ +public final class ManagedInstancePrivateEndpointConnectionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstancePrivateEndpointConnectionUpdate.json + */ + /** + * Sample code: Approve or reject a private endpoint connection with a given name. + * + * @param manager Entry point to SqlManager. + */ + public static void approveOrRejectAPrivateEndpointConnectionWithAGivenName( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstancePrivateEndpointConnections() + .define("private-endpoint-connection-name") + .withExistingManagedInstance("Default", "test-cl") + .withPrivateLinkServiceConnectionState( + new ManagedInstancePrivateLinkServiceConnectionStateProperty() + .withStatus("Approved") + .withDescription("Approved by johndoe@contoso.com")) + .create(); + } +} +``` + +### ManagedInstancePrivateEndpointConnections_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedInstancePrivateEndpointConnections Delete. */ +public final class ManagedInstancePrivateEndpointConnectionsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstancePrivateEndpointConnectionDelete.json + */ + /** + * Sample code: Deletes a private endpoint connection with a given name. + * + * @param manager Entry point to SqlManager. + */ + public static void deletesAPrivateEndpointConnectionWithAGivenName( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstancePrivateEndpointConnections() + .delete("Default", "test-cl", "private-endpoint-connection-name", Context.NONE); + } +} +``` + +### ManagedInstancePrivateEndpointConnections_Get + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedInstancePrivateEndpointConnections Get. */ +public final class ManagedInstancePrivateEndpointConnectionsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstancePrivateEndpointConnectionGet.json + */ + /** + * Sample code: Gets private endpoint connection. + * + * @param manager Entry point to SqlManager. + */ + public static void getsPrivateEndpointConnection(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstancePrivateEndpointConnections() + .getWithResponse("Default", "test-cl", "private-endpoint-connection-name", Context.NONE); + } +} +``` + +### ManagedInstancePrivateEndpointConnections_ListByManagedInstance + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedInstancePrivateEndpointConnections ListByManagedInstance. */ +public final class ManagedInstancePrivateEndpointConnectionsListByManagedInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstancePrivateEndpointConnectionList.json + */ + /** + * Sample code: Gets list of private endpoint connections on a server. + * + * @param manager Entry point to SqlManager. + */ + public static void getsListOfPrivateEndpointConnectionsOnAServer( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstancePrivateEndpointConnections().listByManagedInstance("Default", "test-cl", Context.NONE); + } +} +``` + +### ManagedInstancePrivateLinkResources_Get + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedInstancePrivateLinkResources Get. */ +public final class ManagedInstancePrivateLinkResourcesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstancePrivateLinkResourcesGet.json + */ + /** + * Sample code: Gets a private link resource for SQL. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAPrivateLinkResourceForSQL(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstancePrivateLinkResources().getWithResponse("Default", "test-cl", "plr", Context.NONE); + } +} +``` + +### ManagedInstancePrivateLinkResources_ListByManagedInstance + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedInstancePrivateLinkResources ListByManagedInstance. */ +public final class ManagedInstancePrivateLinkResourcesListByManagedInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstancePrivateLinkResourcesList.json + */ + /** + * Sample code: Gets private link resources for SQL. + * + * @param manager Entry point to SqlManager. + */ + public static void getsPrivateLinkResourcesForSQL(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstancePrivateLinkResources().listByManagedInstance("Default", "test-cl", Context.NONE); + } +} +``` + +### ManagedInstanceTdeCertificates_Create + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.TdeCertificate; + +/** Samples for ManagedInstanceTdeCertificates Create. */ +public final class ManagedInstanceTdeCertificatesCreateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceTdeCertificate.json + */ + /** + * Sample code: Upload a TDE certificate. + * + * @param manager Entry point to SqlManager. + */ + public static void uploadATDECertificate(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceTdeCertificates() + .create("testtdecert", "testtdecert", new TdeCertificate().withPrivateBlob("MIIXXXXXXXX"), Context.NONE); + } +} +``` + +### ManagedInstanceVulnerabilityAssessments_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentRecurringScansProperties; +import java.util.Arrays; + +/** Samples for ManagedInstanceVulnerabilityAssessments CreateOrUpdate. */ +public final class ManagedInstanceVulnerabilityAssessmentsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceVulnerabilityAssessmentCreateStorageAccessKeyMin.json + */ + /** + * Sample code: Create a managed instance's vulnerability assessment with minimal parameters, when + * storageAccountAccessKey is specified. + * + * @param manager Entry point to SqlManager. + */ + public static void + createAManagedInstanceSVulnerabilityAssessmentWithMinimalParametersWhenStorageAccountAccessKeyIsSpecified( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceVulnerabilityAssessments() + .define(VulnerabilityAssessmentName.DEFAULT) + .withExistingManagedInstance("vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440") + .withStorageContainerPath("https://myStorage.blob.core.windows.net/vulnerability-assessment/") + .withStorageAccountAccessKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceVulnerabilityAssessmentCreateContainerSasKeyMin.json + */ + /** + * Sample code: Create a managed instance's vulnerability assessment with minimal parameters, when + * storageContainerSasKey is specified. + * + * @param manager Entry point to SqlManager. + */ + public static void + createAManagedInstanceSVulnerabilityAssessmentWithMinimalParametersWhenStorageContainerSasKeyIsSpecified( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceVulnerabilityAssessments() + .define(VulnerabilityAssessmentName.DEFAULT) + .withExistingManagedInstance("vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440") + .withStorageContainerPath("https://myStorage.blob.core.windows.net/vulnerability-assessment/") + .withStorageContainerSasKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceVulnerabilityAssessmentCreateMax.json + */ + /** + * Sample code: Create a managed instance's vulnerability assessment with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void createAManagedInstanceSVulnerabilityAssessmentWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceVulnerabilityAssessments() + .define(VulnerabilityAssessmentName.DEFAULT) + .withExistingManagedInstance("vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440") + .withStorageContainerPath("https://myStorage.blob.core.windows.net/vulnerability-assessment/") + .withStorageContainerSasKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + .withStorageAccountAccessKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + .withRecurringScans( + new VulnerabilityAssessmentRecurringScansProperties() + .withIsEnabled(true) + .withEmailSubscriptionAdmins(true) + .withEmails(Arrays.asList("email1@mail.com", "email2@mail.com"))) + .create(); + } +} +``` + +### ManagedInstanceVulnerabilityAssessments_Delete + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for ManagedInstanceVulnerabilityAssessments Delete. */ +public final class ManagedInstanceVulnerabilityAssessmentsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceVulnerabilityAssessmentDelete.json + */ + /** + * Sample code: Remove a managed instance's vulnerability assessment. + * + * @param manager Entry point to SqlManager. + */ + public static void removeAManagedInstanceSVulnerabilityAssessment( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceVulnerabilityAssessments() + .deleteWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + VulnerabilityAssessmentName.DEFAULT, + Context.NONE); + } +} +``` + +### ManagedInstanceVulnerabilityAssessments_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for ManagedInstanceVulnerabilityAssessments Get. */ +public final class ManagedInstanceVulnerabilityAssessmentsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceVulnerabilityAssessmentGet.json + */ + /** + * Sample code: Get a managed instance's vulnerability assessment. + * + * @param manager Entry point to SqlManager. + */ + public static void getAManagedInstanceSVulnerabilityAssessment( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceVulnerabilityAssessments() + .getWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + VulnerabilityAssessmentName.DEFAULT, + Context.NONE); + } +} +``` + +### ManagedInstanceVulnerabilityAssessments_ListByInstance + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedInstanceVulnerabilityAssessments ListByInstance. */ +public final class ManagedInstanceVulnerabilityAssessmentsListByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceVulnerabilityAssessmentListByInstance.json + */ + /** + * Sample code: Get a managed instance's vulnerability assessment policies. + * + * @param manager Entry point to SqlManager. + */ + public static void getAManagedInstanceSVulnerabilityAssessmentPolicies( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceVulnerabilityAssessments() + .listByInstance("vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", Context.NONE); + } +} +``` + +### ManagedInstances_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceExternalAdministrator; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceLicenseType; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceProxyOverride; +import com.azure.resourcemanager.sql.generated.models.PrincipalType; +import com.azure.resourcemanager.sql.generated.models.ServicePrincipal; +import com.azure.resourcemanager.sql.generated.models.ServicePrincipalType; +import com.azure.resourcemanager.sql.generated.models.Sku; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +/** Samples for ManagedInstances CreateOrUpdate. */ +public final class ManagedInstancesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceCreateMin.json + */ + /** + * Sample code: Create managed instance with minimal properties. + * + * @param manager Entry point to SqlManager. + */ + public static void createManagedInstanceWithMinimalProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstances() + .define("testinstance") + .withRegion("Japan East") + .withExistingResourceGroup("testrg") + .withSku(new Sku().withName("GP_Gen4").withTier("GeneralPurpose")) + .withAdministratorLogin("dummylogin") + .withAdministratorLoginPassword("PLACEHOLDER") + .withSubnetId( + "/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1") + .withLicenseType(ManagedInstanceLicenseType.LICENSE_INCLUDED) + .withVCores(8) + .withStorageSizeInGB(1024) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceCreateMax.json + */ + /** + * Sample code: Create managed instance with all properties. + * + * @param manager Entry point to SqlManager. + */ + public static void createManagedInstanceWithAllProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstances() + .define("testinstance") + .withRegion("Japan East") + .withExistingResourceGroup("testrg") + .withTags(mapOf("tagKey1", "TagValue1")) + .withSku(new Sku().withName("GP_Gen5").withTier("GeneralPurpose")) + .withAdministratorLogin("dummylogin") + .withAdministratorLoginPassword("PLACEHOLDER") + .withSubnetId( + "/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1") + .withLicenseType(ManagedInstanceLicenseType.LICENSE_INCLUDED) + .withVCores(8) + .withStorageSizeInGB(1024) + .withCollation("SQL_Latin1_General_CP1_CI_AS") + .withDnsZonePartner( + "/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/testinstance") + .withPublicDataEndpointEnabled(false) + .withProxyOverride(ManagedInstanceProxyOverride.REDIRECT) + .withTimezoneId("UTC") + .withInstancePoolId( + "/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/testrg/providers/Microsoft.Sql/instancePools/pool1") + .withMaintenanceConfigurationId( + "/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_JapanEast_MI_1") + .withMinimalTlsVersion("1.2") + .withRequestedBackupStorageRedundancy(BackupStorageRedundancy.GEO) + .withAdministrators( + new ManagedInstanceExternalAdministrator() + .withPrincipalType(PrincipalType.USER) + .withLogin("bob@contoso.com") + .withSid(UUID.fromString("00000011-1111-2222-2222-123456789111")) + .withTenantId(UUID.fromString("00000011-1111-2222-2222-123456789111")) + .withAzureADOnlyAuthentication(true)) + .withServicePrincipal(new ServicePrincipal().withType(ServicePrincipalType.SYSTEM_ASSIGNED)) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### ManagedInstances_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedInstances Delete. */ +public final class ManagedInstancesDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceDelete.json + */ + /** + * Sample code: Delete managed instance. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteManagedInstance(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstances().delete("testrg", "testinstance", Context.NONE); + } +} +``` + +### ManagedInstances_Failover + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ReplicaType; + +/** Samples for ManagedInstances Failover. */ +public final class ManagedInstancesFailoverSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/FailoverManagedInstance.json + */ + /** + * Sample code: Failover a managed instance. + * + * @param manager Entry point to SqlManager. + */ + public static void failoverAManagedInstance(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstances().failover("group1", "instanceName", ReplicaType.PRIMARY, Context.NONE); + } +} +``` + +### ManagedInstances_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedInstances GetByResourceGroup. */ +public final class ManagedInstancesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceGetWithExpandEqualsAdministrators.json + */ + /** + * Sample code: Get managed instance with $expand=administrators/activedirectory. + * + * @param manager Entry point to SqlManager. + */ + public static void getManagedInstanceWithExpandAdministratorsActivedirectory( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstances().getByResourceGroupWithResponse("testrg", "testinstance", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceGet.json + */ + /** + * Sample code: Get managed instance. + * + * @param manager Entry point to SqlManager. + */ + public static void getManagedInstance(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstances().getByResourceGroupWithResponse("testrg", "testinstance", null, Context.NONE); + } +} +``` + +### ManagedInstances_List + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedInstances List. */ +public final class ManagedInstancesListSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceList.json + */ + /** + * Sample code: List managed instances. + * + * @param manager Entry point to SqlManager. + */ + public static void listManagedInstances(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstances().list(null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceListWithExpandEqualsAdministrators.json + */ + /** + * Sample code: List managed instances with $expand=administrators/activedirectory. + * + * @param manager Entry point to SqlManager. + */ + public static void listManagedInstancesWithExpandAdministratorsActivedirectory( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstances().list(null, Context.NONE); + } +} +``` + +### ManagedInstances_ListByInstancePool + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedInstances ListByInstancePool. */ +public final class ManagedInstancesListByInstancePoolSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceListByInstancePool.json + */ + /** + * Sample code: List managed instances by instance pool. + * + * @param manager Entry point to SqlManager. + */ + public static void listManagedInstancesByInstancePool(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstances().listByInstancePool("Test1", "pool1", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceListByInstancePoolWithExpandEqualsAdministrators.json + */ + /** + * Sample code: List managed instances by instance pool with $expand=administrators/activedirectory. + * + * @param manager Entry point to SqlManager. + */ + public static void listManagedInstancesByInstancePoolWithExpandAdministratorsActivedirectory( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstances().listByInstancePool("Test1", "pool1", null, Context.NONE); + } +} +``` + +### ManagedInstances_ListByManagedInstance + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.MetricType; +import com.azure.resourcemanager.sql.generated.models.QueryTimeGrainType; + +/** Samples for ManagedInstances ListByManagedInstance. */ +public final class ManagedInstancesListByManagedInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceTopQueriesList.json + */ + /** + * Sample code: Obtain list of instance's top resource consuming queries. + * + * @param manager Entry point to SqlManager. + */ + public static void obtainListOfInstanceSTopResourceConsumingQueries( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstances() + .listByManagedInstance( + "sqlcrudtest-7398", + "sqlcrudtest-4645", + null, + null, + null, + null, + QueryTimeGrainType.PT1H, + null, + MetricType.DURATION, + Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceTopQueriesListMax.json + */ + /** + * Sample code: Obtain list of instance's top resource consuming queries. Full-blown request and response. + * + * @param manager Entry point to SqlManager. + */ + public static void obtainListOfInstanceSTopResourceConsumingQueriesFullBlownRequestAndResponse( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstances() + .listByManagedInstance( + "sqlcrudtest-7398", + "sqlcrudtest-4645", + null, + "db1,db2", + "2020-03-10T12:00:00Z", + "2020-03-12T12:00:00Z", + QueryTimeGrainType.P1D, + null, + MetricType.CPU, + Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceTopQueriesListMin.json + */ + /** + * Sample code: Obtain list of instance's top resource consuming queries. Minimal request and response. + * + * @param manager Entry point to SqlManager. + */ + public static void obtainListOfInstanceSTopResourceConsumingQueriesMinimalRequestAndResponse( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstances() + .listByManagedInstance( + "sqlcrudtest-7398", "sqlcrudtest-4645", null, null, null, null, null, null, null, Context.NONE); + } +} +``` + +### ManagedInstances_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedInstances ListByResourceGroup. */ +public final class ManagedInstancesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceListByResourceGroupWithExpandEqualsAdministrators.json + */ + /** + * Sample code: List managed instances by resource group with $expand=administrators/activedirectory. + * + * @param manager Entry point to SqlManager. + */ + public static void listManagedInstancesByResourceGroupWithExpandAdministratorsActivedirectory( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstances().listByResourceGroup("Test1", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceListByResourceGroup.json + */ + /** + * Sample code: List managed instances by resource group. + * + * @param manager Entry point to SqlManager. + */ + public static void listManagedInstancesByResourceGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstances().listByResourceGroup("Test1", null, Context.NONE); + } +} +``` + +### ManagedInstances_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ManagedInstance; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceLicenseType; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceProxyOverride; +import com.azure.resourcemanager.sql.generated.models.Sku; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ManagedInstances Update. */ +public final class ManagedInstancesUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceUpdateMin.json + */ + /** + * Sample code: Update managed instance with minimal properties. + * + * @param manager Entry point to SqlManager. + */ + public static void updateManagedInstanceWithMinimalProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedInstance resource = + manager + .managedInstances() + .getByResourceGroupWithResponse("testrg", "testinstance", null, Context.NONE) + .getValue(); + resource.update().withTags(mapOf("tagKey1", "TagValue1")).apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceUpdateMax.json + */ + /** + * Sample code: Update managed instance with all properties. + * + * @param manager Entry point to SqlManager. + */ + public static void updateManagedInstanceWithAllProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedInstance resource = + manager + .managedInstances() + .getByResourceGroupWithResponse("testrg", "testinstance", null, Context.NONE) + .getValue(); + resource + .update() + .withTags(mapOf("tagKey1", "TagValue1")) + .withSku(new Sku().withName("GP_Gen4").withTier("GeneralPurpose").withCapacity(8)) + .withAdministratorLoginPassword("PLACEHOLDER") + .withLicenseType(ManagedInstanceLicenseType.BASE_PRICE) + .withVCores(8) + .withStorageSizeInGB(448) + .withPublicDataEndpointEnabled(false) + .withProxyOverride(ManagedInstanceProxyOverride.REDIRECT) + .withMaintenanceConfigurationId( + "/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_JapanEast_MI_1") + .withMinimalTlsVersion("1.2") + .apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceRemoveMaintenanceConfiguration.json + */ + /** + * Sample code: Remove maintenance policy from managed instance (select default maintenance policy). + * + * @param manager Entry point to SqlManager. + */ + public static void removeMaintenancePolicyFromManagedInstanceSelectDefaultMaintenancePolicy( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedInstance resource = + manager + .managedInstances() + .getByResourceGroupWithResponse("testrg", "testinstance", null, Context.NONE) + .getValue(); + resource + .update() + .withMaintenanceConfigurationId( + "/subscriptions/20d7082a-0fc7-4468-82bd-542694d5042b/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_Default") + .apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies_CreateOrUpdate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedBackupShortTermRetentionPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ManagedShortTermRetentionPolicyName; + +/** Samples for ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies CreateOrUpdate. */ +public final class ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/UpdateManagedShortTermRetentionPolicyRestorableDropped.json + */ + /** + * Sample code: Update the short term retention policy for the restorable dropped database. + * + * @param manager Entry point to SqlManager. + */ + public static void updateTheShortTermRetentionPolicyForTheRestorableDroppedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedRestorableDroppedDatabaseBackupShortTermRetentionPolicies() + .createOrUpdate( + "resourceGroup", + "testsvr", + "testdb,131403269876900000", + ManagedShortTermRetentionPolicyName.DEFAULT, + new ManagedBackupShortTermRetentionPolicyInner().withRetentionDays(14), + Context.NONE); + } +} +``` + +### ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ManagedShortTermRetentionPolicyName; + +/** Samples for ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies Get. */ +public final class ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetManagedShortTermRetentionPolicyRestorableDropped.json + */ + /** + * Sample code: Get the short term retention policy for the database. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheShortTermRetentionPolicyForTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedRestorableDroppedDatabaseBackupShortTermRetentionPolicies() + .getWithResponse( + "Default-SQL-SouthEastAsia", + "testsvr", + "testdb,131403269876900000", + ManagedShortTermRetentionPolicyName.DEFAULT, + Context.NONE); + } +} +``` + +### ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies_ListByRestorableDroppedDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies ListByRestorableDroppedDatabase. */ +public final class ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesListByRestorableDroppedDatabaseS { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetListManagedShortTermRetentionPolicyRestorableDropped.json + */ + /** + * Sample code: Get the short term retention policy list for the database. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheShortTermRetentionPolicyListForTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedRestorableDroppedDatabaseBackupShortTermRetentionPolicies() + .listByRestorableDroppedDatabase( + "Default-SQL-SouthEastAsia", "testsvr", "testdb,131403269876900000", Context.NONE); + } +} +``` + +### ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedBackupShortTermRetentionPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ManagedShortTermRetentionPolicyName; + +/** Samples for ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies Update. */ +public final class ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/UpdateManagedShortTermRetentionPolicyRestorableDropped.json + */ + /** + * Sample code: Update the short term retention policy for the restorable dropped database. + * + * @param manager Entry point to SqlManager. + */ + public static void updateTheShortTermRetentionPolicyForTheRestorableDroppedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedRestorableDroppedDatabaseBackupShortTermRetentionPolicies() + .update( + "resourceGroup", + "testsvr", + "testdb,131403269876900000", + ManagedShortTermRetentionPolicyName.DEFAULT, + new ManagedBackupShortTermRetentionPolicyInner().withRetentionDays(14), + Context.NONE); + } +} +``` + +### ManagedServerDnsAliases_Acquire + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ManagedServerDnsAliasAcquisition; + +/** Samples for ManagedServerDnsAliases Acquire. */ +public final class ManagedServerDnsAliasesAcquireSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ManagedServerDnsAliasAcquire.json + */ + /** + * Sample code: Acquire managed server DNS alias. + * + * @param manager Entry point to SqlManager. + */ + public static void acquireManagedServerDNSAlias(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedServerDnsAliases() + .acquire( + "Default", + "new-mi", + "dns-alias-mi", + new ManagedServerDnsAliasAcquisition() + .withOldManagedServerDnsAliasResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/old-mi/dnsAliases/alias1"), + Context.NONE); + } +} +``` + +### ManagedServerDnsAliases_CreateOrUpdate + +```java +/** Samples for ManagedServerDnsAliases CreateOrUpdate. */ +public final class ManagedServerDnsAliasesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ManagedServerDnsAliasCreateOrUpdate.json + */ + /** + * Sample code: Create managed server DNS alias. + * + * @param manager Entry point to SqlManager. + */ + public static void createManagedServerDNSAlias(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedServerDnsAliases() + .define("dns-alias-mi") + .withExistingManagedInstance("Default", "dns-mi") + .create(); + } +} +``` + +### ManagedServerDnsAliases_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedServerDnsAliases Delete. */ +public final class ManagedServerDnsAliasesDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ManagedServerDnsAliasDelete.json + */ + /** + * Sample code: Delete managed server DNS alias. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteManagedServerDNSAlias(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedServerDnsAliases().delete("Default", "dns-mi", "dns-alias-mi", Context.NONE); + } +} +``` + +### ManagedServerDnsAliases_Get + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedServerDnsAliases Get. */ +public final class ManagedServerDnsAliasesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ManagedServerDnsAliasGet.json + */ + /** + * Sample code: Get managed server DNS alias. + * + * @param manager Entry point to SqlManager. + */ + public static void getManagedServerDNSAlias(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedServerDnsAliases().getWithResponse("Default", "dns-mi", "dns-alias-mi", Context.NONE); + } +} +``` + +### ManagedServerDnsAliases_ListByManagedInstance + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedServerDnsAliases ListByManagedInstance. */ +public final class ManagedServerDnsAliasesListByManagedInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ManagedServerDnsAliasList.json + */ + /** + * Sample code: List managed server DNS aliases. + * + * @param manager Entry point to SqlManager. + */ + public static void listManagedServerDNSAliases(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedServerDnsAliases().listByManagedInstance("Default", "dns-mi", Context.NONE); + } +} +``` + +### ManagedServerSecurityAlertPolicies_CreateOrUpdate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ManagedServerSecurityAlertPolicy; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyName; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertsPolicyState; +import java.util.Arrays; + +/** Samples for ManagedServerSecurityAlertPolicies CreateOrUpdate. */ +public final class ManagedServerSecurityAlertPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedServerSecurityAlertCreateMin.json + */ + /** + * Sample code: Update a managed server's threat detection policy with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAManagedServerSThreatDetectionPolicyWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedServerSecurityAlertPolicy resource = + manager + .managedServerSecurityAlertPolicies() + .getWithResponse( + "securityalert-4799", "securityalert-6440", SecurityAlertPolicyName.DEFAULT, Context.NONE) + .getValue(); + resource.update().withState(SecurityAlertsPolicyState.ENABLED).apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedServerSecurityAlertCreateMax.json + */ + /** + * Sample code: Update a managed server's threat detection policy with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAManagedServerSThreatDetectionPolicyWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedServerSecurityAlertPolicy resource = + manager + .managedServerSecurityAlertPolicies() + .getWithResponse( + "securityalert-4799", "securityalert-6440", SecurityAlertPolicyName.DEFAULT, Context.NONE) + .getValue(); + resource + .update() + .withState(SecurityAlertsPolicyState.ENABLED) + .withDisabledAlerts(Arrays.asList("Access_Anomaly", "Usage_Anomaly")) + .withEmailAddresses(Arrays.asList("testSecurityAlert@microsoft.com")) + .withEmailAccountAdmins(true) + .withStorageEndpoint("https://mystorage.blob.core.windows.net") + .withStorageAccountAccessKey( + "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==") + .withRetentionDays(5) + .apply(); + } +} +``` + +### ManagedServerSecurityAlertPolicies_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyName; + +/** Samples for ManagedServerSecurityAlertPolicies Get. */ +public final class ManagedServerSecurityAlertPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedServerSecurityAlertGet.json + */ + /** + * Sample code: Get a managed server's threat detection policy. + * + * @param manager Entry point to SqlManager. + */ + public static void getAManagedServerSThreatDetectionPolicy( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedServerSecurityAlertPolicies() + .getWithResponse("securityalert-4799", "securityalert-6440", SecurityAlertPolicyName.DEFAULT, Context.NONE); + } +} +``` + +### ManagedServerSecurityAlertPolicies_ListByInstance + +```java +import com.azure.core.util.Context; + +/** Samples for ManagedServerSecurityAlertPolicies ListByInstance. */ +public final class ManagedServerSecurityAlertPoliciesListByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedServerSecurityAlertListByInstance.json + */ + /** + * Sample code: Get the managed server's threat detection policies. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheManagedServerSThreatDetectionPolicies( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedServerSecurityAlertPolicies() + .listByInstance("securityalert-4799", "securityalert-6440", Context.NONE); + } +} +``` + +### OutboundFirewallRules_CreateOrUpdate + +```java +/** Samples for OutboundFirewallRules CreateOrUpdate. */ +public final class OutboundFirewallRulesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/OutboundFirewallRuleCreate.json + */ + /** + * Sample code: Approve or reject a outbound firewall rule with a given name. + * + * @param manager Entry point to SqlManager. + */ + public static void approveOrRejectAOutboundFirewallRuleWithAGivenName( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .outboundFirewallRules() + .define("server.database.windows.net") + .withExistingServer("sqlcrudtest-7398", "sqlcrudtest-4645") + .create(); + } +} +``` + +### OutboundFirewallRules_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for OutboundFirewallRules Delete. */ +public final class OutboundFirewallRulesDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/OutboundFirewallRuleDelete.json + */ + /** + * Sample code: Deletes a outbound firewall rule with a given name. + * + * @param manager Entry point to SqlManager. + */ + public static void deletesAOutboundFirewallRuleWithAGivenName( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .outboundFirewallRules() + .delete("sqlcrudtest-7398", "sqlcrudtest-6661", "server.database.windows.net", Context.NONE); + } +} +``` + +### OutboundFirewallRules_Get + +```java +import com.azure.core.util.Context; + +/** Samples for OutboundFirewallRules Get. */ +public final class OutboundFirewallRulesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/OutboundFirewallRuleGet.json + */ + /** + * Sample code: Gets outbound firewall rule. + * + * @param manager Entry point to SqlManager. + */ + public static void getsOutboundFirewallRule(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .outboundFirewallRules() + .getWithResponse("sqlcrudtest-7398", "sqlcrudtest-4645", "server.database.windows.net", Context.NONE); + } +} +``` + +### OutboundFirewallRules_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for OutboundFirewallRules ListByServer. */ +public final class OutboundFirewallRulesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/OutboundFirewallRuleList.json + */ + /** + * Sample code: Gets list of outbound firewall rules on a server. + * + * @param manager Entry point to SqlManager. + */ + public static void getsListOfOutboundFirewallRulesOnAServer( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.outboundFirewallRules().listByServer("sqlcrudtest-7398", "sqlcrudtest-4645", Context.NONE); + } +} +``` + +### PrivateEndpointConnections_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.PrivateLinkServiceConnectionStateProperty; +import com.azure.resourcemanager.sql.generated.models.PrivateLinkServiceConnectionStateStatus; + +/** Samples for PrivateEndpointConnections CreateOrUpdate. */ +public final class PrivateEndpointConnectionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/PrivateEndpointConnectionUpdate.json + */ + /** + * Sample code: Approve or reject a private endpoint connection with a given name. + * + * @param manager Entry point to SqlManager. + */ + public static void approveOrRejectAPrivateEndpointConnectionWithAGivenName( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .privateEndpointConnections() + .define("private-endpoint-connection-name") + .withExistingServer("Default", "test-svr") + .withPrivateLinkServiceConnectionState( + new PrivateLinkServiceConnectionStateProperty() + .withStatus(PrivateLinkServiceConnectionStateStatus.APPROVED) + .withDescription("Approved by johndoe@contoso.com")) + .create(); + } +} +``` + +### PrivateEndpointConnections_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections Delete. */ +public final class PrivateEndpointConnectionsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/PrivateEndpointConnectionDelete.json + */ + /** + * Sample code: Deletes a private endpoint connection with a given name. + * + * @param manager Entry point to SqlManager. + */ + public static void deletesAPrivateEndpointConnectionWithAGivenName( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .privateEndpointConnections() + .delete("Default", "test-svr", "private-endpoint-connection-name", Context.NONE); + } +} +``` + +### PrivateEndpointConnections_Get + +```java +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections Get. */ +public final class PrivateEndpointConnectionsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/PrivateEndpointConnectionGet.json + */ + /** + * Sample code: Gets private endpoint connection. + * + * @param manager Entry point to SqlManager. + */ + public static void getsPrivateEndpointConnection(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .privateEndpointConnections() + .getWithResponse("Default", "test-svr", "private-endpoint-connection-name", Context.NONE); + } +} +``` + +### PrivateEndpointConnections_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections ListByServer. */ +public final class PrivateEndpointConnectionsListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/PrivateEndpointConnectionList.json + */ + /** + * Sample code: Gets list of private endpoint connections on a server. + * + * @param manager Entry point to SqlManager. + */ + public static void getsListOfPrivateEndpointConnectionsOnAServer( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.privateEndpointConnections().listByServer("Default", "test-svr", Context.NONE); + } +} +``` + +### PrivateLinkResources_Get + +```java +import com.azure.core.util.Context; + +/** Samples for PrivateLinkResources Get. */ +public final class PrivateLinkResourcesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/PrivateLinkResourcesGet.json + */ + /** + * Sample code: Gets a private link resource for SQL. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAPrivateLinkResourceForSQL(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.privateLinkResources().getWithResponse("Default", "test-svr", "plr", Context.NONE); + } +} +``` + +### PrivateLinkResources_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for PrivateLinkResources ListByServer. */ +public final class PrivateLinkResourcesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/PrivateLinkResourcesList.json + */ + /** + * Sample code: Gets private link resources for SQL. + * + * @param manager Entry point to SqlManager. + */ + public static void getsPrivateLinkResourcesForSQL(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.privateLinkResources().listByServer("Default", "test-svr", Context.NONE); + } +} +``` + +### RecommendedSensitivityLabels_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.RecommendedSensitivityLabelUpdate; +import com.azure.resourcemanager.sql.generated.models.RecommendedSensitivityLabelUpdateKind; +import com.azure.resourcemanager.sql.generated.models.RecommendedSensitivityLabelUpdateList; +import java.util.Arrays; + +/** Samples for RecommendedSensitivityLabels Update. */ +public final class RecommendedSensitivityLabelsUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SensitivityLabelsRecommendedUpdate.json + */ + /** + * Sample code: Update recommended sensitivity labels of a given database using an operations batch. + * + * @param manager Entry point to SqlManager. + */ + public static void updateRecommendedSensitivityLabelsOfAGivenDatabaseUsingAnOperationsBatch( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .recommendedSensitivityLabels() + .updateWithResponse( + "myRG", + "myServer", + "myDatabase", + new RecommendedSensitivityLabelUpdateList() + .withOperations( + Arrays + .asList( + new RecommendedSensitivityLabelUpdate() + .withOp(RecommendedSensitivityLabelUpdateKind.ENABLE) + .withSchema("dbo") + .withTable("table1") + .withColumn("column1"), + new RecommendedSensitivityLabelUpdate() + .withOp(RecommendedSensitivityLabelUpdateKind.ENABLE) + .withSchema("dbo") + .withTable("table2") + .withColumn("column2"), + new RecommendedSensitivityLabelUpdate() + .withOp(RecommendedSensitivityLabelUpdateKind.DISABLE) + .withSchema("dbo") + .withTable("table1") + .withColumn("column3"))), + Context.NONE); + } +} +``` + +### RecoverableDatabases_Get + +```java +import com.azure.core.util.Context; + +/** Samples for RecoverableDatabases Get. */ +public final class RecoverableDatabasesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01-legacy/examples/RecoverableDatabaseGet.json + */ + /** + * Sample code: Get a recoverable database. + * + * @param manager Entry point to SqlManager. + */ + public static void getARecoverableDatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .recoverableDatabases() + .getWithResponse( + "recoverabledatabasetest-6852", + "recoverabledatabasetest-2080", + "recoverabledatabasetest-9187", + Context.NONE); + } +} +``` + +### RecoverableDatabases_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for RecoverableDatabases ListByServer. */ +public final class RecoverableDatabasesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01-legacy/examples/RecoverableDatabaseList.json + */ + /** + * Sample code: Get list of restorable dropped databases. + * + * @param manager Entry point to SqlManager. + */ + public static void getListOfRestorableDroppedDatabases(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .recoverableDatabases() + .listByServer("recoverabledatabasetest-1234", "recoverabledatabasetest-7177", Context.NONE); + } +} +``` + +### RecoverableManagedDatabases_Get + +```java +import com.azure.core.util.Context; + +/** Samples for RecoverableManagedDatabases Get. */ +public final class RecoverableManagedDatabasesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetRecoverableManagedDatabase.json + */ + /** + * Sample code: Gets a recoverable databases by managed instances. + * + * @param manager Entry point to SqlManager. + */ + public static void getsARecoverableDatabasesByManagedInstances( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.recoverableManagedDatabases().getWithResponse("Test1", "managedInstance", "testdb", Context.NONE); + } +} +``` + +### RecoverableManagedDatabases_ListByInstance + +```java +import com.azure.core.util.Context; + +/** Samples for RecoverableManagedDatabases ListByInstance. */ +public final class RecoverableManagedDatabasesListByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListRecoverableManagedDatabasesByServer.json + */ + /** + * Sample code: List recoverable databases by managed instances. + * + * @param manager Entry point to SqlManager. + */ + public static void listRecoverableDatabasesByManagedInstances( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.recoverableManagedDatabases().listByInstance("Test1", "managedInstance", Context.NONE); + } +} +``` + +### ReplicationLinks_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for ReplicationLinks Delete. */ +public final class ReplicationLinksDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ReplicationLinkDelete.json + */ + /** + * Sample code: Delete replication link on server. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteReplicationLinkOnServer(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .replicationLinks() + .delete("Default", "sourcesvr", "gamma-db", "4891ca10-ebd0-47d7-9182-c722651780fb", Context.NONE); + } +} +``` + +### ReplicationLinks_Failover + +```java +import com.azure.core.util.Context; + +/** Samples for ReplicationLinks Failover. */ +public final class ReplicationLinksFailoverSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ReplicationLinkFailover.json + */ + /** + * Sample code: Planned failover of a replication link. + * + * @param manager Entry point to SqlManager. + */ + public static void plannedFailoverOfAReplicationLink(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .replicationLinks() + .failover("Default", "sourcesvr", "gamma-db", "4891ca10-ebd0-47d7-9182-c722651780fb", Context.NONE); + } +} +``` + +### ReplicationLinks_FailoverAllowDataLoss + +```java +import com.azure.core.util.Context; + +/** Samples for ReplicationLinks FailoverAllowDataLoss. */ +public final class ReplicationLinksFailoverAllowDataLossSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ReplicationLinkFailoverAllowDataLoss.json + */ + /** + * Sample code: Forced failover of a replication link. + * + * @param manager Entry point to SqlManager. + */ + public static void forcedFailoverOfAReplicationLink(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .replicationLinks() + .failoverAllowDataLoss( + "Default", "sourcesvr", "gamma-db", "4891ca10-ebd0-47d7-9182-c722651780fb", Context.NONE); + } +} +``` + +### ReplicationLinks_Get + +```java +import com.azure.core.util.Context; + +/** Samples for ReplicationLinks Get. */ +public final class ReplicationLinksGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ReplicationLinkGet.json + */ + /** + * Sample code: Gets the replication link. + * + * @param manager Entry point to SqlManager. + */ + public static void getsTheReplicationLink(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .replicationLinks() + .getWithResponse("Default", "sourcesvr", "gamma-db", "4891ca10-ebd0-47d7-9182-c722651780fb", Context.NONE); + } +} +``` + +### ReplicationLinks_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for ReplicationLinks ListByDatabase. */ +public final class ReplicationLinksListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ReplicationLinkListByDatabase.json + */ + /** + * Sample code: List replication links on server on database. + * + * @param manager Entry point to SqlManager. + */ + public static void listReplicationLinksOnServerOnDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.replicationLinks().listByDatabase("Default", "sourcesvr", "tetha-db", Context.NONE); + } +} +``` + +### ReplicationLinks_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for ReplicationLinks ListByServer. */ +public final class ReplicationLinksListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ReplicationLinkListByServer.json + */ + /** + * Sample code: List replication links on server. + * + * @param manager Entry point to SqlManager. + */ + public static void listReplicationLinksOnServer(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.replicationLinks().listByServer("Default", "sourcesvr", Context.NONE); + } +} +``` + +### RestorableDroppedDatabases_Get + +```java +import com.azure.core.util.Context; + +/** Samples for RestorableDroppedDatabases Get. */ +public final class RestorableDroppedDatabasesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/GetRestorableDroppedDatabase.json + */ + /** + * Sample code: Gets a restorable dropped database. + * + * @param manager Entry point to SqlManager. + */ + public static void getsARestorableDroppedDatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .restorableDroppedDatabases() + .getWithResponse("Default-SQL-SouthEastAsia", "testsvr", "testdb,131403269876900000", Context.NONE); + } +} +``` + +### RestorableDroppedDatabases_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for RestorableDroppedDatabases ListByServer. */ +public final class RestorableDroppedDatabasesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ListRestorableDroppedDatabasesByServer.json + */ + /** + * Sample code: Gets a list of restorable dropped databases. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAListOfRestorableDroppedDatabases( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.restorableDroppedDatabases().listByServer("Default-SQL-SouthEastAsia", "testsvr", Context.NONE); + } +} +``` + +### RestorableDroppedManagedDatabases_Get + +```java +import com.azure.core.util.Context; + +/** Samples for RestorableDroppedManagedDatabases Get. */ +public final class RestorableDroppedManagedDatabasesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/GetRestorableDroppedManagedDatabase.json + */ + /** + * Sample code: Gets a restorable dropped managed database. + * + * @param manager Entry point to SqlManager. + */ + public static void getsARestorableDroppedManagedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .restorableDroppedManagedDatabases() + .getWithResponse("Test1", "managedInstance", "testdb,131403269876900000", Context.NONE); + } +} +``` + +### RestorableDroppedManagedDatabases_ListByInstance + +```java +import com.azure.core.util.Context; + +/** Samples for RestorableDroppedManagedDatabases ListByInstance. */ +public final class RestorableDroppedManagedDatabasesListByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/RestorableDroppedManagedDatabaseListByManagedInstance.json + */ + /** + * Sample code: List restorable dropped databases by managed instances. + * + * @param manager Entry point to SqlManager. + */ + public static void listRestorableDroppedDatabasesByManagedInstances( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.restorableDroppedManagedDatabases().listByInstance("Test1", "managedInstance", Context.NONE); + } +} +``` + +### RestorePoints_Create + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.CreateDatabaseRestorePointDefinition; + +/** Samples for RestorePoints Create. */ +public final class RestorePointsCreateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseRestorePointsPost.json + */ + /** + * Sample code: Creates datawarehouse database restore point. + * + * @param manager Entry point to SqlManager. + */ + public static void createsDatawarehouseDatabaseRestorePoint( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .restorePoints() + .create( + "Default-SQL-SouthEastAsia", + "testserver", + "testDatabase", + new CreateDatabaseRestorePointDefinition().withRestorePointLabel("mylabel"), + Context.NONE); + } +} +``` + +### RestorePoints_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for RestorePoints Delete. */ +public final class RestorePointsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseRestorePointsDelete.json + */ + /** + * Sample code: Deletes a restore point. + * + * @param manager Entry point to SqlManager. + */ + public static void deletesARestorePoint(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .restorePoints() + .deleteWithResponse( + "Default-SQL-SouthEastAsia", "testserver", "testDatabase", "131546477590000000", Context.NONE); + } +} +``` + +### RestorePoints_Get + +```java +import com.azure.core.util.Context; + +/** Samples for RestorePoints Get. */ +public final class RestorePointsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseRestorePointsGet.json + */ + /** + * Sample code: Gets a database restore point. + * + * @param manager Entry point to SqlManager. + */ + public static void getsADatabaseRestorePoint(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .restorePoints() + .getWithResponse( + "Default-SQL-SouthEastAsia", "testserver", "testDatabase", "131546477590000000", Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DataWarehouseRestorePointsGet.json + */ + /** + * Sample code: Gets a datawarehouse database restore point. + * + * @param manager Entry point to SqlManager. + */ + public static void getsADatawarehouseDatabaseRestorePoint( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .restorePoints() + .getWithResponse( + "Default-SQL-SouthEastAsia", "testserver", "testDatabase", "131546477590000000", Context.NONE); + } +} +``` + +### RestorePoints_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for RestorePoints ListByDatabase. */ +public final class RestorePointsListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseRestorePointsListByDatabase.json + */ + /** + * Sample code: List database restore points. + * + * @param manager Entry point to SqlManager. + */ + public static void listDatabaseRestorePoints(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.restorePoints().listByDatabase("sqlcrudtest-6730", "sqlcrudtest-9007", "3481", Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DataWarehouseRestorePointsListByDatabase.json + */ + /** + * Sample code: List datawarehouse database restore points. + * + * @param manager Entry point to SqlManager. + */ + public static void listDatawarehouseDatabaseRestorePoints( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.restorePoints().listByDatabase("Default-SQL-SouthEastAsia", "testserver", "testDatabase", Context.NONE); + } +} +``` + +### SensitivityLabels_CreateOrUpdate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.SensitivityLabelInner; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelRank; + +/** Samples for SensitivityLabels CreateOrUpdate. */ +public final class SensitivityLabelsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ColumnSensitivityLabelCreateMax.json + */ + /** + * Sample code: Updates the sensitivity label of a given column with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updatesTheSensitivityLabelOfAGivenColumnWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sensitivityLabels() + .createOrUpdateWithResponse( + "myRG", + "myServer", + "myDatabase", + "dbo", + "myTable", + "myColumn", + new SensitivityLabelInner() + .withLabelName("PII") + .withLabelId("bf91e08c-f4f0-478a-b016-25164b2a65ff") + .withInformationType("PhoneNumber") + .withInformationTypeId("d22fa6e9-5ee4-3bde-4c2b-a409604c4646") + .withRank(SensitivityLabelRank.LOW), + Context.NONE); + } +} +``` + +### SensitivityLabels_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for SensitivityLabels Delete. */ +public final class SensitivityLabelsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ColumnSensitivityLabelDelete.json + */ + /** + * Sample code: Deletes the sensitivity label of a given column. + * + * @param manager Entry point to SqlManager. + */ + public static void deletesTheSensitivityLabelOfAGivenColumn( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sensitivityLabels() + .deleteWithResponse("myRG", "myServer", "myDatabase", "dbo", "myTable", "myColumn", Context.NONE); + } +} +``` + +### SensitivityLabels_DisableRecommendation + +```java +import com.azure.core.util.Context; + +/** Samples for SensitivityLabels DisableRecommendation. */ +public final class SensitivityLabelsDisableRecommendationSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/RecommendedColumnSensitivityLabelDisable.json + */ + /** + * Sample code: Disables sensitivity recommendations on a given column. + * + * @param manager Entry point to SqlManager. + */ + public static void disablesSensitivityRecommendationsOnAGivenColumn( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sensitivityLabels() + .disableRecommendationWithResponse( + "myRG", "myServer", "myDatabase", "dbo", "myTable", "myColumn", Context.NONE); + } +} +``` + +### SensitivityLabels_EnableRecommendation + +```java +import com.azure.core.util.Context; + +/** Samples for SensitivityLabels EnableRecommendation. */ +public final class SensitivityLabelsEnableRecommendationSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/RecommendedColumnSensitivityLabelEnable.json + */ + /** + * Sample code: Enables sensitivity recommendations on a given column. + * + * @param manager Entry point to SqlManager. + */ + public static void enablesSensitivityRecommendationsOnAGivenColumn( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sensitivityLabels() + .enableRecommendationWithResponse( + "myRG", "myServer", "myDatabase", "dbo", "myTable", "myColumn", Context.NONE); + } +} +``` + +### SensitivityLabels_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelSource; + +/** Samples for SensitivityLabels Get. */ +public final class SensitivityLabelsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ColumnSensitivityLabelGet.json + */ + /** + * Sample code: Gets the sensitivity label of a given column. + * + * @param manager Entry point to SqlManager. + */ + public static void getsTheSensitivityLabelOfAGivenColumn( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sensitivityLabels() + .getWithResponse( + "myRG", + "myServer", + "myDatabase", + "dbo", + "myTable", + "myColumn", + SensitivityLabelSource.CURRENT, + Context.NONE); + } +} +``` + +### SensitivityLabels_ListCurrentByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for SensitivityLabels ListCurrentByDatabase. */ +public final class SensitivityLabelsListCurrentByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SensitivityLabelsListByDatabaseWithSourceCurrent.json + */ + /** + * Sample code: Gets the current sensitivity labels of a given database. + * + * @param manager Entry point to SqlManager. + */ + public static void getsTheCurrentSensitivityLabelsOfAGivenDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sensitivityLabels() + .listCurrentByDatabase("myRG", "myServer", "myDatabase", null, null, null, Context.NONE); + } +} +``` + +### SensitivityLabels_ListRecommendedByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for SensitivityLabels ListRecommendedByDatabase. */ +public final class SensitivityLabelsListRecommendedByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SensitivityLabelsListByDatabaseWithSourceRecommended.json + */ + /** + * Sample code: Gets the recommended sensitivity labels of a given database. + * + * @param manager Entry point to SqlManager. + */ + public static void getsTheRecommendedSensitivityLabelsOfAGivenDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sensitivityLabels() + .listRecommendedByDatabase("myRG", "myServer", "myDatabase", null, null, null, Context.NONE); + } +} +``` + +### SensitivityLabels_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.SensitivityLabelInner; +import com.azure.resourcemanager.sql.generated.fluent.models.SensitivityLabelUpdateInner; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelRank; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelUpdateKind; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelUpdateList; +import java.util.Arrays; + +/** Samples for SensitivityLabels Update. */ +public final class SensitivityLabelsUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SensitivityLabelsCurrentUpdate.json + */ + /** + * Sample code: Update sensitivity labels of a given database using an operations batch. + * + * @param manager Entry point to SqlManager. + */ + public static void updateSensitivityLabelsOfAGivenDatabaseUsingAnOperationsBatch( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sensitivityLabels() + .updateWithResponse( + "myRG", + "myServer", + "myDatabase", + new SensitivityLabelUpdateList() + .withOperations( + Arrays + .asList( + new SensitivityLabelUpdateInner() + .withOp(SensitivityLabelUpdateKind.SET) + .withSchema("dbo") + .withTable("table1") + .withColumn("column1") + .withSensitivityLabel( + new SensitivityLabelInner() + .withLabelName("Highly Confidential") + .withLabelId("3A477B16-9423-432B-AA97-6069B481CEC3") + .withInformationType("Financial") + .withInformationTypeId("1D3652D6-422C-4115-82F1-65DAEBC665C8") + .withRank(SensitivityLabelRank.LOW)), + new SensitivityLabelUpdateInner() + .withOp(SensitivityLabelUpdateKind.SET) + .withSchema("dbo") + .withTable("table2") + .withColumn("column2") + .withSensitivityLabel( + new SensitivityLabelInner() + .withLabelName("PII") + .withLabelId("bf91e08c-f4f0-478a-b016-25164b2a65ff") + .withInformationType("PhoneNumber") + .withInformationTypeId("d22fa6e9-5ee4-3bde-4c2b-a409604c4646") + .withRank(SensitivityLabelRank.CRITICAL)), + new SensitivityLabelUpdateInner() + .withOp(SensitivityLabelUpdateKind.REMOVE) + .withSchema("dbo") + .withTable("Table1") + .withColumn("Column3"))), + Context.NONE); + } +} +``` + +### ServerAdvancedThreatProtectionSettings_CreateOrUpdate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.AdvancedThreatProtectionName; +import com.azure.resourcemanager.sql.generated.models.AdvancedThreatProtectionState; +import com.azure.resourcemanager.sql.generated.models.ServerAdvancedThreatProtection; + +/** Samples for ServerAdvancedThreatProtectionSettings CreateOrUpdate. */ +public final class ServerAdvancedThreatProtectionSettingsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerAdvancedThreatProtectionSettingsCreateMin.json + */ + /** + * Sample code: Update a server's Advanced Threat Protection settings with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAServerSAdvancedThreatProtectionSettingsWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ServerAdvancedThreatProtection resource = + manager + .serverAdvancedThreatProtectionSettings() + .getWithResponse( + "threatprotection-4799", + "threatprotection-6440", + AdvancedThreatProtectionName.DEFAULT, + Context.NONE) + .getValue(); + resource.update().withState(AdvancedThreatProtectionState.DISABLED).apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerAdvancedThreatProtectionSettingsCreateMax.json + */ + /** + * Sample code: Update a server's Advanced Threat Protection settings with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAServerSAdvancedThreatProtectionSettingsWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ServerAdvancedThreatProtection resource = + manager + .serverAdvancedThreatProtectionSettings() + .getWithResponse( + "threatprotection-4799", + "threatprotection-6440", + AdvancedThreatProtectionName.DEFAULT, + Context.NONE) + .getValue(); + resource.update().withState(AdvancedThreatProtectionState.ENABLED).apply(); + } +} +``` + +### ServerAdvancedThreatProtectionSettings_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.AdvancedThreatProtectionName; + +/** Samples for ServerAdvancedThreatProtectionSettings Get. */ +public final class ServerAdvancedThreatProtectionSettingsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerAdvancedThreatProtectionSettingsGet.json + */ + /** + * Sample code: Get a server's Advanced Threat Protection settings. + * + * @param manager Entry point to SqlManager. + */ + public static void getAServerSAdvancedThreatProtectionSettings( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverAdvancedThreatProtectionSettings() + .getWithResponse( + "threatprotection-4799", "threatprotection-6440", AdvancedThreatProtectionName.DEFAULT, Context.NONE); + } +} +``` + +### ServerAdvancedThreatProtectionSettings_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for ServerAdvancedThreatProtectionSettings ListByServer. */ +public final class ServerAdvancedThreatProtectionSettingsListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerAdvancedThreatProtectionSettingsListByServer.json + */ + /** + * Sample code: List the server's Advanced Threat Protection settings. + * + * @param manager Entry point to SqlManager. + */ + public static void listTheServerSAdvancedThreatProtectionSettings( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverAdvancedThreatProtectionSettings() + .listByServer("threatprotection-4799", "threatprotection-6440", Context.NONE); + } +} +``` + +### ServerAdvisors_Get + +```java +import com.azure.core.util.Context; + +/** Samples for ServerAdvisors Get. */ +public final class ServerAdvisorsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerAdvisorGet.json + */ + /** + * Sample code: Get server advisor. + * + * @param manager Entry point to SqlManager. + */ + public static void getServerAdvisor(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverAdvisors().getWithResponse("workloadinsight-demos", "misosisvr", "CreateIndex", Context.NONE); + } +} +``` + +### ServerAdvisors_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for ServerAdvisors ListByServer. */ +public final class ServerAdvisorsListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerAdvisorList.json + */ + /** + * Sample code: List of server advisors. + * + * @param manager Entry point to SqlManager. + */ + public static void listOfServerAdvisors(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverAdvisors().listByServerWithResponse("workloadinsight-demos", "misosisvr", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerRecommendedActionListExpand.json + */ + /** + * Sample code: List of server recommended actions for all advisors. + * + * @param manager Entry point to SqlManager. + */ + public static void listOfServerRecommendedActionsForAllAdvisors( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverAdvisors() + .listByServerWithResponse("workloadinsight-demos", "misosisvr", "recommendedActions", Context.NONE); + } +} +``` + +### ServerAdvisors_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.AdvisorInner; +import com.azure.resourcemanager.sql.generated.models.AutoExecuteStatus; + +/** Samples for ServerAdvisors Update. */ +public final class ServerAdvisorsUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerAdvisorUpdate.json + */ + /** + * Sample code: Update server advisor. + * + * @param manager Entry point to SqlManager. + */ + public static void updateServerAdvisor(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverAdvisors() + .updateWithResponse( + "workloadinsight-demos", + "misosisvr", + "CreateIndex", + new AdvisorInner().withAutoExecuteStatus(AutoExecuteStatus.DISABLED), + Context.NONE); + } +} +``` + +### ServerAutomaticTuning_Get + +```java +import com.azure.core.util.Context; + +/** Samples for ServerAutomaticTuning Get. */ +public final class ServerAutomaticTuningGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerAutomaticTuningGet.json + */ + /** + * Sample code: Get a server's automatic tuning settings. + * + * @param manager Entry point to SqlManager. + */ + public static void getAServerSAutomaticTuningSettings(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverAutomaticTunings().getWithResponse("default-sql-onebox", "testsvr11", Context.NONE); + } +} +``` + +### ServerAutomaticTuning_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerAutomaticTuningInner; +import com.azure.resourcemanager.sql.generated.models.AutomaticTuningOptionModeDesired; +import com.azure.resourcemanager.sql.generated.models.AutomaticTuningServerMode; +import com.azure.resourcemanager.sql.generated.models.AutomaticTuningServerOptions; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ServerAutomaticTuning Update. */ +public final class ServerAutomaticTuningUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerAutomaticTuningUpdateMax.json + */ + /** + * Sample code: Updates server automatic tuning settings with all properties. + * + * @param manager Entry point to SqlManager. + */ + public static void updatesServerAutomaticTuningSettingsWithAllProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverAutomaticTunings() + .updateWithResponse( + "default-sql-onebox", + "testsvr11", + new ServerAutomaticTuningInner() + .withDesiredState(AutomaticTuningServerMode.AUTO) + .withOptions( + mapOf( + "createIndex", + new AutomaticTuningServerOptions().withDesiredState(AutomaticTuningOptionModeDesired.OFF), + "dropIndex", + new AutomaticTuningServerOptions().withDesiredState(AutomaticTuningOptionModeDesired.ON), + "forceLastGoodPlan", + new AutomaticTuningServerOptions() + .withDesiredState(AutomaticTuningOptionModeDesired.DEFAULT))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerAutomaticTuningUpdateMin.json + */ + /** + * Sample code: Updates server automatic tuning settings with minimal properties. + * + * @param manager Entry point to SqlManager. + */ + public static void updatesServerAutomaticTuningSettingsWithMinimalProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverAutomaticTunings() + .updateWithResponse( + "default-sql-onebox", + "testsvr11", + new ServerAutomaticTuningInner().withDesiredState(AutomaticTuningServerMode.AUTO), + Context.NONE); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### ServerAzureADAdministrators_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.AdministratorName; +import com.azure.resourcemanager.sql.generated.models.AdministratorType; +import java.util.UUID; + +/** Samples for ServerAzureADAdministrators CreateOrUpdate. */ +public final class ServerAzureADAdministratorsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/AdministratorCreateOrUpdate.json + */ + /** + * Sample code: Creates or updates an existing Azure Active Directory administrator. + * + * @param manager Entry point to SqlManager. + */ + public static void createsOrUpdatesAnExistingAzureActiveDirectoryAdministrator( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverAzureADAdministrators() + .define(AdministratorName.ACTIVE_DIRECTORY) + .withExistingServer("sqlcrudtest-4799", "sqlcrudtest-6440") + .withAdministratorType(AdministratorType.ACTIVE_DIRECTORY) + .withLogin("bob@contoso.com") + .withSid(UUID.fromString("c6b82b90-a647-49cb-8a62-0d2d3cb7ac7c")) + .withTenantId(UUID.fromString("c6b82b90-a647-49cb-8a62-0d2d3cb7ac7c")) + .create(); + } +} +``` + +### ServerAzureADAdministrators_Delete + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.AdministratorName; + +/** Samples for ServerAzureADAdministrators Delete. */ +public final class ServerAzureADAdministratorsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/AdministratorDelete.json + */ + /** + * Sample code: Delete Azure Active Directory administrator. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteAzureActiveDirectoryAdministrator( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverAzureADAdministrators() + .delete("sqlcrudtest-4799", "sqlcrudtest-6440", AdministratorName.ACTIVE_DIRECTORY, Context.NONE); + } +} +``` + +### ServerAzureADAdministrators_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.AdministratorName; + +/** Samples for ServerAzureADAdministrators Get. */ +public final class ServerAzureADAdministratorsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/AdministratorGet.json + */ + /** + * Sample code: Gets a Azure Active Directory administrator. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAAzureActiveDirectoryAdministrator( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverAzureADAdministrators() + .getWithResponse("sqlcrudtest-4799", "sqlcrudtest-6440", AdministratorName.ACTIVE_DIRECTORY, Context.NONE); + } +} +``` + +### ServerAzureADAdministrators_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for ServerAzureADAdministrators ListByServer. */ +public final class ServerAzureADAdministratorsListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/AdministratorList.json + */ + /** + * Sample code: Gets a list of Azure Active Directory administrator. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAListOfAzureActiveDirectoryAdministrator( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverAzureADAdministrators().listByServer("sqlcrudtest-4799", "sqlcrudtest-6440", Context.NONE); + } +} +``` + +### ServerAzureADOnlyAuthentications_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.AuthenticationName; + +/** Samples for ServerAzureADOnlyAuthentications CreateOrUpdate. */ +public final class ServerAzureADOnlyAuthenticationsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/AzureADOnlyAuthCreateOrUpdate.json + */ + /** + * Sample code: Creates or updates Azure Active Directory only authentication object. + * + * @param manager Entry point to SqlManager. + */ + public static void createsOrUpdatesAzureActiveDirectoryOnlyAuthenticationObject( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverAzureADOnlyAuthentications() + .define(AuthenticationName.DEFAULT) + .withExistingServer("sqlcrudtest-4799", "sqlcrudtest-6440") + .withAzureADOnlyAuthentication(false) + .create(); + } +} +``` + +### ServerAzureADOnlyAuthentications_Delete + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.AuthenticationName; + +/** Samples for ServerAzureADOnlyAuthentications Delete. */ +public final class ServerAzureADOnlyAuthenticationsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/AzureADOnlyAuthDelete.json + */ + /** + * Sample code: Deletes Azure Active Directory only authentication object. + * + * @param manager Entry point to SqlManager. + */ + public static void deletesAzureActiveDirectoryOnlyAuthenticationObject( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverAzureADOnlyAuthentications() + .delete("sqlcrudtest-4799", "sqlcrudtest-6440", AuthenticationName.DEFAULT, Context.NONE); + } +} +``` + +### ServerAzureADOnlyAuthentications_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.AuthenticationName; + +/** Samples for ServerAzureADOnlyAuthentications Get. */ +public final class ServerAzureADOnlyAuthenticationsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/AzureADOnlyAuthGet.json + */ + /** + * Sample code: Gets a Azure Active Directory only authentication property. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAAzureActiveDirectoryOnlyAuthenticationProperty( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverAzureADOnlyAuthentications() + .getWithResponse("sqlcrudtest-4799", "sqlcrudtest-6440", AuthenticationName.DEFAULT, Context.NONE); + } +} +``` + +### ServerAzureADOnlyAuthentications_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for ServerAzureADOnlyAuthentications ListByServer. */ +public final class ServerAzureADOnlyAuthenticationsListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/AzureADOnlyAuthList.json + */ + /** + * Sample code: Gets a list of Azure Active Directory only authentication object. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAListOfAzureActiveDirectoryOnlyAuthenticationObject( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverAzureADOnlyAuthentications().listByServer("sqlcrudtest-4799", "sqlcrudtest-6440", Context.NONE); + } +} +``` + +### ServerBlobAuditingPolicies_CreateOrUpdate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.BlobAuditingPolicyState; +import com.azure.resourcemanager.sql.generated.models.ServerBlobAuditingPolicy; +import java.util.Arrays; +import java.util.UUID; + +/** Samples for ServerBlobAuditingPolicies CreateOrUpdate. */ +public final class ServerBlobAuditingPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerBlobAuditingCreateMin.json + */ + /** + * Sample code: Update a server's blob auditing policy with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAServerSBlobAuditingPolicyWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ServerBlobAuditingPolicy resource = + manager + .serverBlobAuditingPolicies() + .getWithResponse("blobauditingtest-4799", "blobauditingtest-6440", Context.NONE) + .getValue(); + resource + .update() + .withState(BlobAuditingPolicyState.ENABLED) + .withStorageEndpoint("https://mystorage.blob.core.windows.net") + .withStorageAccountAccessKey( + "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==") + .apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerBlobAuditingCreateMax.json + */ + /** + * Sample code: Update a server's blob auditing policy with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAServerSBlobAuditingPolicyWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ServerBlobAuditingPolicy resource = + manager + .serverBlobAuditingPolicies() + .getWithResponse("blobauditingtest-4799", "blobauditingtest-6440", Context.NONE) + .getValue(); + resource + .update() + .withRetentionDays(6) + .withAuditActionsAndGroups( + Arrays + .asList( + "SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP", + "FAILED_DATABASE_AUTHENTICATION_GROUP", + "BATCH_COMPLETED_GROUP")) + .withIsStorageSecondaryKeyInUse(false) + .withIsAzureMonitorTargetEnabled(true) + .withQueueDelayMs(4000) + .withState(BlobAuditingPolicyState.ENABLED) + .withStorageEndpoint("https://mystorage.blob.core.windows.net") + .withStorageAccountAccessKey( + "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==") + .withStorageAccountSubscriptionId(UUID.fromString("00000000-1234-0000-5678-000000000000")) + .apply(); + } +} +``` + +### ServerBlobAuditingPolicies_Get + +```java +import com.azure.core.util.Context; + +/** Samples for ServerBlobAuditingPolicies Get. */ +public final class ServerBlobAuditingPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerBlobAuditingGet.json + */ + /** + * Sample code: Get a server's blob auditing policy. + * + * @param manager Entry point to SqlManager. + */ + public static void getAServerSBlobAuditingPolicy(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverBlobAuditingPolicies() + .getWithResponse("blobauditingtest-4799", "blobauditingtest-6440", Context.NONE); + } +} +``` + +### ServerBlobAuditingPolicies_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for ServerBlobAuditingPolicies ListByServer. */ +public final class ServerBlobAuditingPoliciesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerAuditingSettingsList.json + */ + /** + * Sample code: List auditing settings of a server. + * + * @param manager Entry point to SqlManager. + */ + public static void listAuditingSettingsOfAServer(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverBlobAuditingPolicies() + .listByServer("blobauditingtest-4799", "blobauditingtest-6440", Context.NONE); + } +} +``` + +### ServerCommunicationLinks_CreateOrUpdate + +```java +/** Samples for ServerCommunicationLinks CreateOrUpdate. */ +public final class ServerCommunicationLinksCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/ServerCommunicationLinkCreateOrUpdate.json + */ + /** + * Sample code: Create a server communication link. + * + * @param manager Entry point to SqlManager. + */ + public static void createAServerCommunicationLink(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverCommunicationLinks() + .define("link1") + .withExistingServer("sqlcrudtest-7398", "sqlcrudtest-4645") + .withPartnerServer("sqldcrudtest-test") + .create(); + } +} +``` + +### ServerCommunicationLinks_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for ServerCommunicationLinks Delete. */ +public final class ServerCommunicationLinksDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/ServerCommunicationLinkDelete.json + */ + /** + * Sample code: Delete a server communication link. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteAServerCommunicationLink(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverCommunicationLinks() + .deleteWithResponse("sqlcrudtest-7398", "sqlcrudtest-4645", "link1", Context.NONE); + } +} +``` + +### ServerCommunicationLinks_Get + +```java +import com.azure.core.util.Context; + +/** Samples for ServerCommunicationLinks Get. */ +public final class ServerCommunicationLinksGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/ServerCommunicationLinkGet.json + */ + /** + * Sample code: Get a server communication link. + * + * @param manager Entry point to SqlManager. + */ + public static void getAServerCommunicationLink(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverCommunicationLinks() + .getWithResponse("sqlcrudtest-7398", "sqlcrudtest-4645", "link1", Context.NONE); + } +} +``` + +### ServerCommunicationLinks_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for ServerCommunicationLinks ListByServer. */ +public final class ServerCommunicationLinksListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/ServerCommunicationLinkList.json + */ + /** + * Sample code: List server communication links. + * + * @param manager Entry point to SqlManager. + */ + public static void listServerCommunicationLinks(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverCommunicationLinks().listByServer("sqlcrudtest-7398", "sqlcrudtest-4645", Context.NONE); + } +} +``` + +### ServerConnectionPolicies_CreateOrUpdate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ConnectionPolicyName; +import com.azure.resourcemanager.sql.generated.models.ServerConnectionPolicy; +import com.azure.resourcemanager.sql.generated.models.ServerConnectionType; + +/** Samples for ServerConnectionPolicies CreateOrUpdate. */ +public final class ServerConnectionPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ServerConnectionPoliciesUpdate.json + */ + /** + * Sample code: Updates a server connection policy. + * + * @param manager Entry point to SqlManager. + */ + public static void updatesAServerConnectionPolicy(com.azure.resourcemanager.sql.generated.SqlManager manager) { + ServerConnectionPolicy resource = + manager + .serverConnectionPolicies() + .getWithResponse("testrg", "testserver", ConnectionPolicyName.DEFAULT, Context.NONE) + .getValue(); + resource.update().withConnectionType(ServerConnectionType.REDIRECT).apply(); + } +} +``` + +### ServerConnectionPolicies_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ConnectionPolicyName; + +/** Samples for ServerConnectionPolicies Get. */ +public final class ServerConnectionPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ServerConnectionPoliciesGet.json + */ + /** + * Sample code: Gets a server connection policy. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAServerConnectionPolicy(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverConnectionPolicies() + .getWithResponse("rgtest-12", "servertest-6285", ConnectionPolicyName.DEFAULT, Context.NONE); + } +} +``` + +### ServerConnectionPolicies_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for ServerConnectionPolicies ListByServer. */ +public final class ServerConnectionPoliciesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ServerConnectionPoliciesList.json + */ + /** + * Sample code: Lists a servers connection policies. + * + * @param manager Entry point to SqlManager. + */ + public static void listsAServersConnectionPolicies(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverConnectionPolicies().listByServer("rgtest-12", "servertest-6285", Context.NONE); + } +} +``` + +### ServerDevOpsAuditSettings_CreateOrUpdate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.BlobAuditingPolicyState; +import com.azure.resourcemanager.sql.generated.models.DevOpsAuditingSettingsName; +import com.azure.resourcemanager.sql.generated.models.ServerDevOpsAuditingSettings; +import java.util.UUID; + +/** Samples for ServerDevOpsAuditSettings CreateOrUpdate. */ +public final class ServerDevOpsAuditSettingsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ServerDevOpsAuditCreateMin.json + */ + /** + * Sample code: Update a server's DevOps audit settings with minimal input. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAServerSDevOpsAuditSettingsWithMinimalInput( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ServerDevOpsAuditingSettings resource = + manager + .serverDevOpsAuditSettings() + .getWithResponse( + "devAuditTestRG", "devOpsAuditTestSvr", DevOpsAuditingSettingsName.DEFAULT, Context.NONE) + .getValue(); + resource + .update() + .withState(BlobAuditingPolicyState.ENABLED) + .withStorageEndpoint("https://mystorage.blob.core.windows.net") + .withStorageAccountAccessKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + .apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ServerDevOpsAuditCreateMax.json + */ + /** + * Sample code: Update a server's DevOps audit settings with all params. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAServerSDevOpsAuditSettingsWithAllParams( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ServerDevOpsAuditingSettings resource = + manager + .serverDevOpsAuditSettings() + .getWithResponse( + "devAuditTestRG", "devOpsAuditTestSvr", DevOpsAuditingSettingsName.DEFAULT, Context.NONE) + .getValue(); + resource + .update() + .withIsAzureMonitorTargetEnabled(true) + .withState(BlobAuditingPolicyState.ENABLED) + .withStorageEndpoint("https://mystorage.blob.core.windows.net") + .withStorageAccountAccessKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + .withStorageAccountSubscriptionId(UUID.fromString("00000000-1234-0000-5678-000000000000")) + .apply(); + } +} +``` + +### ServerDevOpsAuditSettings_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.DevOpsAuditingSettingsName; + +/** Samples for ServerDevOpsAuditSettings Get. */ +public final class ServerDevOpsAuditSettingsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ServerDevOpsAuditGet.json + */ + /** + * Sample code: Get a server's DevOps audit settings. + * + * @param manager Entry point to SqlManager. + */ + public static void getAServerSDevOpsAuditSettings(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverDevOpsAuditSettings() + .getWithResponse("devAuditTestRG", "devOpsAuditTestSvr", DevOpsAuditingSettingsName.DEFAULT, Context.NONE); + } +} +``` + +### ServerDevOpsAuditSettings_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for ServerDevOpsAuditSettings ListByServer. */ +public final class ServerDevOpsAuditSettingsListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ServerDevOpsAuditList.json + */ + /** + * Sample code: List DevOps audit settings of a server. + * + * @param manager Entry point to SqlManager. + */ + public static void listDevOpsAuditSettingsOfAServer(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverDevOpsAuditSettings().listByServer("devAuditTestRG", "devOpsAuditTestSvr", Context.NONE); + } +} +``` + +### ServerDnsAliases_Acquire + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ServerDnsAliasAcquisition; + +/** Samples for ServerDnsAliases Acquire. */ +public final class ServerDnsAliasesAcquireSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerDnsAliasAcquire.json + */ + /** + * Sample code: Acquire server DNS alias. + * + * @param manager Entry point to SqlManager. + */ + public static void acquireServerDNSAlias(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverDnsAliases() + .acquire( + "Default", + "dns-alias-new-server", + "dns-alias-name-1", + new ServerDnsAliasAcquisition() + .withOldServerDnsAliasId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/dns-alias-old-server/dnsAliases/dns-alias-name-1"), + Context.NONE); + } +} +``` + +### ServerDnsAliases_CreateOrUpdate + +```java +import com.azure.core.util.Context; + +/** Samples for ServerDnsAliases CreateOrUpdate. */ +public final class ServerDnsAliasesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerDnsAliasCreateOrUpdate.json + */ + /** + * Sample code: Create server DNS alias. + * + * @param manager Entry point to SqlManager. + */ + public static void createServerDNSAlias(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverDnsAliases().createOrUpdate("Default", "dns-alias-server", "dns-alias-name-1", Context.NONE); + } +} +``` + +### ServerDnsAliases_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for ServerDnsAliases Delete. */ +public final class ServerDnsAliasesDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerDnsAliasDelete.json + */ + /** + * Sample code: Delete server DNS alias. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteServerDNSAlias(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverDnsAliases().delete("Default", "dns-alias-server", "dns-alias-name-1", Context.NONE); + } +} +``` + +### ServerDnsAliases_Get + +```java +import com.azure.core.util.Context; + +/** Samples for ServerDnsAliases Get. */ +public final class ServerDnsAliasesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerDnsAliasGet.json + */ + /** + * Sample code: Get server DNS alias. + * + * @param manager Entry point to SqlManager. + */ + public static void getServerDNSAlias(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverDnsAliases().getWithResponse("Default", "dns-alias-server", "dns-alias-name-1", Context.NONE); + } +} +``` + +### ServerDnsAliases_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for ServerDnsAliases ListByServer. */ +public final class ServerDnsAliasesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerDnsAliasList.json + */ + /** + * Sample code: List server DNS aliases. + * + * @param manager Entry point to SqlManager. + */ + public static void listServerDNSAliases(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverDnsAliases().listByServer("Default", "dns-alias-server", Context.NONE); + } +} +``` + +### ServerKeys_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.ServerKeyType; + +/** Samples for ServerKeys CreateOrUpdate. */ +public final class ServerKeysCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerKeyCreateOrUpdate.json + */ + /** + * Sample code: Creates or updates a server key. + * + * @param manager Entry point to SqlManager. + */ + public static void createsOrUpdatesAServerKey(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverKeys() + .define("someVault_someKey_01234567890123456789012345678901") + .withExistingServer("sqlcrudtest-7398", "sqlcrudtest-4645") + .withServerKeyType(ServerKeyType.AZURE_KEY_VAULT) + .withUri("https://someVault.vault.azure.net/keys/someKey/01234567890123456789012345678901") + .create(); + } +} +``` + +### ServerKeys_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for ServerKeys Delete. */ +public final class ServerKeysDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerKeyDelete.json + */ + /** + * Sample code: Delete the server key. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteTheServerKey(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverKeys() + .delete( + "sqlcrudtest-7398", + "sqlcrudtest-4645", + "someVault_someKey_01234567890123456789012345678901", + Context.NONE); + } +} +``` + +### ServerKeys_Get + +```java +import com.azure.core.util.Context; + +/** Samples for ServerKeys Get. */ +public final class ServerKeysGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerKeyGet.json + */ + /** + * Sample code: Get the server key. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheServerKey(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverKeys() + .getWithResponse( + "sqlcrudtest-7398", + "sqlcrudtest-4645", + "someVault_someKey_01234567890123456789012345678901", + Context.NONE); + } +} +``` + +### ServerKeys_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for ServerKeys ListByServer. */ +public final class ServerKeysListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerKeyList.json + */ + /** + * Sample code: List the server keys by server. + * + * @param manager Entry point to SqlManager. + */ + public static void listTheServerKeysByServer(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverKeys().listByServer("sqlcrudtest-7398", "sqlcrudtest-4645", Context.NONE); + } +} +``` + +### ServerOperations_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for ServerOperations ListByServer. */ +public final class ServerOperationsListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListServerOperations.json + */ + /** + * Sample code: List the server management operations. + * + * @param manager Entry point to SqlManager. + */ + public static void listTheServerManagementOperations(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverOperations().listByServer("sqlcrudtest-7398", "sqlcrudtest-4645", Context.NONE); + } +} +``` + +### ServerSecurityAlertPolicies_CreateOrUpdate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyName; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertsPolicyState; +import com.azure.resourcemanager.sql.generated.models.ServerSecurityAlertPolicy; +import java.util.Arrays; + +/** Samples for ServerSecurityAlertPolicies CreateOrUpdate. */ +public final class ServerSecurityAlertPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerSecurityAlertsCreateMin.json + */ + /** + * Sample code: Update a server's threat detection policy with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAServerSThreatDetectionPolicyWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ServerSecurityAlertPolicy resource = + manager + .serverSecurityAlertPolicies() + .getWithResponse( + "securityalert-4799", "securityalert-6440", SecurityAlertPolicyName.DEFAULT, Context.NONE) + .getValue(); + resource.update().withState(SecurityAlertsPolicyState.ENABLED).apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerSecurityAlertsCreateMax.json + */ + /** + * Sample code: Update a server's threat detection policy with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAServerSThreatDetectionPolicyWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ServerSecurityAlertPolicy resource = + manager + .serverSecurityAlertPolicies() + .getWithResponse( + "securityalert-4799", "securityalert-6440", SecurityAlertPolicyName.DEFAULT, Context.NONE) + .getValue(); + resource + .update() + .withState(SecurityAlertsPolicyState.ENABLED) + .withDisabledAlerts(Arrays.asList("Access_Anomaly", "Usage_Anomaly")) + .withEmailAddresses(Arrays.asList("testSecurityAlert@microsoft.com")) + .withEmailAccountAdmins(true) + .withStorageEndpoint("https://mystorage.blob.core.windows.net") + .withStorageAccountAccessKey( + "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==") + .withRetentionDays(5) + .apply(); + } +} +``` + +### ServerSecurityAlertPolicies_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyName; + +/** Samples for ServerSecurityAlertPolicies Get. */ +public final class ServerSecurityAlertPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerSecurityAlertsGet.json + */ + /** + * Sample code: Get a server's threat detection policy. + * + * @param manager Entry point to SqlManager. + */ + public static void getAServerSThreatDetectionPolicy(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverSecurityAlertPolicies() + .getWithResponse("securityalert-4799", "securityalert-6440", SecurityAlertPolicyName.DEFAULT, Context.NONE); + } +} +``` + +### ServerSecurityAlertPolicies_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for ServerSecurityAlertPolicies ListByServer. */ +public final class ServerSecurityAlertPoliciesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerSecurityAlertsListByServer.json + */ + /** + * Sample code: List the server's threat detection policies. + * + * @param manager Entry point to SqlManager. + */ + public static void listTheServerSThreatDetectionPolicies( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverSecurityAlertPolicies().listByServer("securityalert-4799", "securityalert-6440", Context.NONE); + } +} +``` + +### ServerTrustCertificates_CreateOrUpdate + +```java +/** Samples for ServerTrustCertificates CreateOrUpdate. */ +public final class ServerTrustCertificatesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerTrustCertificatesCreate.json + */ + /** + * Sample code: Create server trust certificate. + * + * @param manager Entry point to SqlManager. + */ + public static void createServerTrustCertificate(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverTrustCertificates() + .define("customerCertificateName") + .withExistingManagedInstance("testrg", "testcl") + .withPublicBlob("308203AE30820296A0030201020210") + .create(); + } +} +``` + +### ServerTrustCertificates_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for ServerTrustCertificates Delete. */ +public final class ServerTrustCertificatesDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerTrustCertificatesDelete.json + */ + /** + * Sample code: Delete server trust certificate. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteServerTrustCertificate(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverTrustCertificates().delete("testrg", "testcl", "customerCertificateName", Context.NONE); + } +} +``` + +### ServerTrustCertificates_Get + +```java +import com.azure.core.util.Context; + +/** Samples for ServerTrustCertificates Get. */ +public final class ServerTrustCertificatesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerTrustCertificatesGet.json + */ + /** + * Sample code: Gets server trust certificate. + * + * @param manager Entry point to SqlManager. + */ + public static void getsServerTrustCertificate(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverTrustCertificates().getWithResponse("testrg", "testcl", "customerCertificateName", Context.NONE); + } +} +``` + +### ServerTrustCertificates_ListByInstance + +```java +import com.azure.core.util.Context; + +/** Samples for ServerTrustCertificates ListByInstance. */ +public final class ServerTrustCertificatesListByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerTrustCertificatesListByInstance.json + */ + /** + * Sample code: Gets a list of server trust certificates on a given server. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAListOfServerTrustCertificatesOnAGivenServer( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverTrustCertificates().listByInstance("testrg", "testcl", Context.NONE); + } +} +``` + +### ServerTrustGroups_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.ServerInfo; +import com.azure.resourcemanager.sql.generated.models.ServerTrustGroupPropertiesTrustScopesItem; +import java.util.Arrays; + +/** Samples for ServerTrustGroups CreateOrUpdate. */ +public final class ServerTrustGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerTrustGroupCreate.json + */ + /** + * Sample code: Create server trust group. + * + * @param manager Entry point to SqlManager. + */ + public static void createServerTrustGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverTrustGroups() + .define("server-trust-group-test") + .withExistingLocation("Default", "Japan East") + .withGroupMembers( + Arrays + .asList( + new ServerInfo() + .withServerId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/managedInstance-1"), + new ServerInfo() + .withServerId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/managedInstance-2"))) + .withTrustScopes( + Arrays + .asList( + ServerTrustGroupPropertiesTrustScopesItem.GLOBAL_TRANSACTIONS, + ServerTrustGroupPropertiesTrustScopesItem.SERVICE_BROKER)) + .create(); + } +} +``` + +### ServerTrustGroups_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for ServerTrustGroups Delete. */ +public final class ServerTrustGroupsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerTrustGroupDelete.json + */ + /** + * Sample code: Drop server trust group. + * + * @param manager Entry point to SqlManager. + */ + public static void dropServerTrustGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverTrustGroups().delete("Default", "Japan East", "server-trust-group-test", Context.NONE); + } +} +``` + +### ServerTrustGroups_Get + +```java +import com.azure.core.util.Context; + +/** Samples for ServerTrustGroups Get. */ +public final class ServerTrustGroupsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerTrustGroupGet.json + */ + /** + * Sample code: Get server trust group. + * + * @param manager Entry point to SqlManager. + */ + public static void getServerTrustGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverTrustGroups().getWithResponse("Default", "Japan East", "server-trust-group-test", Context.NONE); + } +} +``` + +### ServerTrustGroups_ListByInstance + +```java +import com.azure.core.util.Context; + +/** Samples for ServerTrustGroups ListByInstance. */ +public final class ServerTrustGroupsListByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerTrustGroupListByManagedInstance.json + */ + /** + * Sample code: List server trust groups by managed instance. + * + * @param manager Entry point to SqlManager. + */ + public static void listServerTrustGroupsByManagedInstance( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverTrustGroups().listByInstance("Default-SQL-SouthEastAsia", "managedInstance-1", Context.NONE); + } +} +``` + +### ServerTrustGroups_ListByLocation + +```java +import com.azure.core.util.Context; + +/** Samples for ServerTrustGroups ListByLocation. */ +public final class ServerTrustGroupsListByLocationSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerTrustGroupList.json + */ + /** + * Sample code: List server trust groups. + * + * @param manager Entry point to SqlManager. + */ + public static void listServerTrustGroups(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverTrustGroups().listByLocation("Default", "Japan East", Context.NONE); + } +} +``` + +### ServerUsages_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for ServerUsages ListByServer. */ +public final class ServerUsagesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01-legacy/examples/ServerUsageMetricsList.json + */ + /** + * Sample code: List servers usages. + * + * @param manager Entry point to SqlManager. + */ + public static void listServersUsages(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverUsages().listByServer("sqlcrudtest-6730", "sqlcrudtest-9007", Context.NONE); + } +} +``` + +### ServerVulnerabilityAssessments_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentRecurringScansProperties; +import java.util.Arrays; + +/** Samples for ServerVulnerabilityAssessments CreateOrUpdate. */ +public final class ServerVulnerabilityAssessmentsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerVulnerabilityAssessmentCreateMax.json + */ + /** + * Sample code: Create a server's vulnerability assessment with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void createAServerSVulnerabilityAssessmentWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverVulnerabilityAssessments() + .define(VulnerabilityAssessmentName.DEFAULT) + .withExistingServer("vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440") + .withStorageContainerPath("https://myStorage.blob.core.windows.net/vulnerability-assessment/") + .withStorageContainerSasKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + .withStorageAccountAccessKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + .withRecurringScans( + new VulnerabilityAssessmentRecurringScansProperties() + .withIsEnabled(true) + .withEmailSubscriptionAdmins(true) + .withEmails(Arrays.asList("email1@mail.com", "email2@mail.com"))) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerVulnerabilityAssessmentCreateStorageAccessKeyMin.json + */ + /** + * Sample code: Create a server's vulnerability assessment with minimal parameters, when storageAccountAccessKey is + * specified. + * + * @param manager Entry point to SqlManager. + */ + public static void createAServerSVulnerabilityAssessmentWithMinimalParametersWhenStorageAccountAccessKeyIsSpecified( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverVulnerabilityAssessments() + .define(VulnerabilityAssessmentName.DEFAULT) + .withExistingServer("vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440") + .withStorageContainerPath("https://myStorage.blob.core.windows.net/vulnerability-assessment/") + .withStorageAccountAccessKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerVulnerabilityAssessmentCreateContainerSasKeyMin.json + */ + /** + * Sample code: Create a server's vulnerability assessment with minimal parameters, when storageContainerSasKey is + * specified. + * + * @param manager Entry point to SqlManager. + */ + public static void createAServerSVulnerabilityAssessmentWithMinimalParametersWhenStorageContainerSasKeyIsSpecified( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverVulnerabilityAssessments() + .define(VulnerabilityAssessmentName.DEFAULT) + .withExistingServer("vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440") + .withStorageContainerPath("https://myStorage.blob.core.windows.net/vulnerability-assessment/") + .withStorageContainerSasKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + .create(); + } +} +``` + +### ServerVulnerabilityAssessments_Delete + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for ServerVulnerabilityAssessments Delete. */ +public final class ServerVulnerabilityAssessmentsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerVulnerabilityAssessmentDelete.json + */ + /** + * Sample code: Remove a server's vulnerability assessment. + * + * @param manager Entry point to SqlManager. + */ + public static void removeAServerSVulnerabilityAssessment( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverVulnerabilityAssessments() + .deleteWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + VulnerabilityAssessmentName.DEFAULT, + Context.NONE); + } +} +``` + +### ServerVulnerabilityAssessments_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for ServerVulnerabilityAssessments Get. */ +public final class ServerVulnerabilityAssessmentsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerVulnerabilityAssessmentGet.json + */ + /** + * Sample code: Get a server's vulnerability assessment. + * + * @param manager Entry point to SqlManager. + */ + public static void getAServerSVulnerabilityAssessment(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverVulnerabilityAssessments() + .getWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + VulnerabilityAssessmentName.DEFAULT, + Context.NONE); + } +} +``` + +### ServerVulnerabilityAssessments_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for ServerVulnerabilityAssessments ListByServer. */ +public final class ServerVulnerabilityAssessmentsListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerVulnerabilityAssessmentListByServer.json + */ + /** + * Sample code: Get a server's vulnerability assessment policies. + * + * @param manager Entry point to SqlManager. + */ + public static void getAServerSVulnerabilityAssessmentPolicies( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverVulnerabilityAssessments() + .listByServer("vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", Context.NONE); + } +} +``` + +### Servers_CheckNameAvailability + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.CheckNameAvailabilityRequest; + +/** Samples for Servers CheckNameAvailability. */ +public final class ServersCheckNameAvailabilitySamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/CheckNameAvailabilityServerAvailable.json + */ + /** + * Sample code: Check for a server name that is available. + * + * @param manager Entry point to SqlManager. + */ + public static void checkForAServerNameThatIsAvailable(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .servers() + .checkNameAvailabilityWithResponse(new CheckNameAvailabilityRequest().withName("server1"), Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/CheckNameAvailabilityServerAlreadyExists.json + */ + /** + * Sample code: Check for a server name that already exists. + * + * @param manager Entry point to SqlManager. + */ + public static void checkForAServerNameThatAlreadyExists( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .servers() + .checkNameAvailabilityWithResponse(new CheckNameAvailabilityRequest().withName("server1"), Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/CheckNameAvailabilityServerInvalid.json + */ + /** + * Sample code: Check for a server name that is invalid. + * + * @param manager Entry point to SqlManager. + */ + public static void checkForAServerNameThatIsInvalid(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .servers() + .checkNameAvailabilityWithResponse(new CheckNameAvailabilityRequest().withName("SERVER1"), Context.NONE); + } +} +``` + +### Servers_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.PrincipalType; +import com.azure.resourcemanager.sql.generated.models.ServerExternalAdministrator; +import com.azure.resourcemanager.sql.generated.models.ServerNetworkAccessFlag; +import java.util.UUID; + +/** Samples for Servers CreateOrUpdate. */ +public final class ServersCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ServerCreate.json + */ + /** + * Sample code: Create server. + * + * @param manager Entry point to SqlManager. + */ + public static void createServer(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .servers() + .define("sqlcrudtest-4645") + .withRegion("Japan East") + .withExistingResourceGroup("sqlcrudtest-7398") + .withAdministratorLogin("dummylogin") + .withAdministratorLoginPassword("PLACEHOLDER") + .withPublicNetworkAccess(ServerNetworkAccessFlag.ENABLED) + .withAdministrators( + new ServerExternalAdministrator() + .withPrincipalType(PrincipalType.USER) + .withLogin("bob@contoso.com") + .withSid(UUID.fromString("00000011-1111-2222-2222-123456789111")) + .withTenantId(UUID.fromString("00000011-1111-2222-2222-123456789111")) + .withAzureADOnlyAuthentication(true)) + .withRestrictOutboundNetworkAccess(ServerNetworkAccessFlag.ENABLED) + .create(); + } +} +``` + +### Servers_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for Servers Delete. */ +public final class ServersDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ServerDelete.json + */ + /** + * Sample code: Delete server. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteServer(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.servers().delete("sqlcrudtest-7398", "sqlcrudtest-6661", Context.NONE); + } +} +``` + +### Servers_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Servers GetByResourceGroup. */ +public final class ServersGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ServerGetWithExpandEqualsAdministrators.json + */ + /** + * Sample code: Get server with $expand=administrators. + * + * @param manager Entry point to SqlManager. + */ + public static void getServerWithExpandAdministrators(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.servers().getByResourceGroupWithResponse("sqlcrudtest-7398", "sqlcrudtest-4645", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ServerGet.json + */ + /** + * Sample code: Get server. + * + * @param manager Entry point to SqlManager. + */ + public static void getServer(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.servers().getByResourceGroupWithResponse("sqlcrudtest-7398", "sqlcrudtest-4645", null, Context.NONE); + } +} +``` + +### Servers_ImportDatabase + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ImportNewDatabaseDefinition; +import com.azure.resourcemanager.sql.generated.models.NetworkIsolationSettings; +import com.azure.resourcemanager.sql.generated.models.StorageKeyType; + +/** Samples for Servers ImportDatabase. */ +public final class ServersImportDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ImportNewDatabaseWithNetworkIsolation.json + */ + /** + * Sample code: Imports to a new database, using private link for the SQL server and storage account. + * + * @param manager Entry point to SqlManager. + */ + public static void importsToANewDatabaseUsingPrivateLinkForTheSQLServerAndStorageAccount( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .servers() + .importDatabase( + "Default-SQL-SouthEastAsia", + "testsvr", + new ImportNewDatabaseDefinition() + .withDatabaseName("testdb") + .withStorageKeyType(StorageKeyType.STORAGE_ACCESS_KEY) + .withStorageKey("fakeTokenPlaceholder") + .withStorageUri("https://test.blob.core.windows.net/test.bacpac") + .withAdministratorLogin("login") + .withAdministratorLoginPassword("fakeTokenPlaceholder") + .withAuthenticationType("Sql") + .withNetworkIsolation( + new NetworkIsolationSettings() + .withStorageAccountResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Storage/storageAccounts/test-privatelink") + .withSqlServerResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr")), + Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ImportNewDatabase.json + */ + /** + * Sample code: Imports to a new database. + * + * @param manager Entry point to SqlManager. + */ + public static void importsToANewDatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .servers() + .importDatabase( + "Default-SQL-SouthEastAsia", + "testsvr", + new ImportNewDatabaseDefinition() + .withDatabaseName("testdb") + .withStorageKeyType(StorageKeyType.STORAGE_ACCESS_KEY) + .withStorageKey("fakeTokenPlaceholder") + .withStorageUri("https://test.blob.core.windows.net/test.bacpac") + .withAdministratorLogin("login") + .withAdministratorLoginPassword("fakeTokenPlaceholder") + .withAuthenticationType("Sql"), + Context.NONE); + } +} +``` + +### Servers_List + +```java +import com.azure.core.util.Context; + +/** Samples for Servers List. */ +public final class ServersListSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ServerList.json + */ + /** + * Sample code: List servers. + * + * @param manager Entry point to SqlManager. + */ + public static void listServers(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.servers().list(null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ServerListWithExpandEqualsAdministrators.json + */ + /** + * Sample code: List servers with expand equals administrators. + * + * @param manager Entry point to SqlManager. + */ + public static void listServersWithExpandEqualsAdministrators( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.servers().list(null, Context.NONE); + } +} +``` + +### Servers_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Servers ListByResourceGroup. */ +public final class ServersListByResourceGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ServerListByResourceGroup.json + */ + /** + * Sample code: List servers by resource group. + * + * @param manager Entry point to SqlManager. + */ + public static void listServersByResourceGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.servers().listByResourceGroup("sqlcrudtest-7398", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ServerListByResourceGroupWithExpandEqualsAdministrators.json + */ + /** + * Sample code: List servers by resource group with $expand=administrators. + * + * @param manager Entry point to SqlManager. + */ + public static void listServersByResourceGroupWithExpandAdministrators( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.servers().listByResourceGroup("sqlcrudtest-7398", null, Context.NONE); + } +} +``` + +### Servers_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.Server; +import com.azure.resourcemanager.sql.generated.models.ServerNetworkAccessFlag; + +/** Samples for Servers Update. */ +public final class ServersUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ServerUpdate.json + */ + /** + * Sample code: Update a server. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAServer(com.azure.resourcemanager.sql.generated.SqlManager manager) { + Server resource = + manager + .servers() + .getByResourceGroupWithResponse("sqlcrudtest-7398", "sqlcrudtest-4645", null, Context.NONE) + .getValue(); + resource + .update() + .withAdministratorLoginPassword("placeholder") + .withPublicNetworkAccess(ServerNetworkAccessFlag.DISABLED) + .withRestrictOutboundNetworkAccess(ServerNetworkAccessFlag.ENABLED) + .apply(); + } +} +``` + +### ServiceObjectives_Get + +```java +import com.azure.core.util.Context; + +/** Samples for ServiceObjectives Get. */ +public final class ServiceObjectivesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/ServiceObjectiveGet.json + */ + /** + * Sample code: Get a service objective. + * + * @param manager Entry point to SqlManager. + */ + public static void getAServiceObjective(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serviceObjectives() + .getWithResponse("group1", "sqlcrudtest", "29dd7459-4a7c-4e56-be22-f0adda49440d", Context.NONE); + } +} +``` + +### ServiceObjectives_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for ServiceObjectives ListByServer. */ +public final class ServiceObjectivesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/ServiceObjectiveList.json + */ + /** + * Sample code: List service objectives. + * + * @param manager Entry point to SqlManager. + */ + public static void listServiceObjectives(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serviceObjectives().listByServer("group1", "sqlcrudtest", Context.NONE); + } +} +``` + +### SqlAgent_CreateOrUpdate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.SqlAgentConfigurationInner; +import com.azure.resourcemanager.sql.generated.models.SqlAgentConfigurationPropertiesState; + +/** Samples for SqlAgent CreateOrUpdate. */ +public final class SqlAgentCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SqlAgentConfigurationPut.json + */ + /** + * Sample code: Puts new sql agent configuration to instance. + * + * @param manager Entry point to SqlManager. + */ + public static void putsNewSqlAgentConfigurationToInstance( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sqlAgents() + .createOrUpdateWithResponse( + "sqlcrudtest-7398", + "sqlcrudtest-4645", + new SqlAgentConfigurationInner().withState(SqlAgentConfigurationPropertiesState.ENABLED), + Context.NONE); + } +} +``` + +### SqlAgent_Get + +```java +import com.azure.core.util.Context; + +/** Samples for SqlAgent Get. */ +public final class SqlAgentGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SqlAgentConfigurationGet.json + */ + /** + * Sample code: Gets current instance sql agent configuration. + * + * @param manager Entry point to SqlManager. + */ + public static void getsCurrentInstanceSqlAgentConfiguration( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.sqlAgents().getWithResponse("sqlcrudtest-7398", "sqlcrudtest-4645", Context.NONE); + } +} +``` + +### SqlVulnerabilityAssessmentBaseline_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.BaselineName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for SqlVulnerabilityAssessmentBaseline Get. */ +public final class SqlVulnerabilityAssessmentBaselineGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/SqlVulnerabilityAssessmentBaselineGet.json + */ + /** + * Sample code: Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAListOfDatabaseSSqlVulnerabilityAssessmentRuleBaselines( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sqlVulnerabilityAssessmentBaselines() + .getWithResponse( + "vulnerabilityaseessmenttest-4711", + "vulnerabilityaseessmenttest-6411", + VulnerabilityAssessmentName.DEFAULT, + BaselineName.DEFAULT, + Context.NONE); + } +} +``` + +### SqlVulnerabilityAssessmentBaseline_ListBySqlVulnerabilityAssessment + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for SqlVulnerabilityAssessmentBaseline ListBySqlVulnerabilityAssessment. */ +public final class SqlVulnerabilityAssessmentBaselineListBySqlVulnerabilityAssessmentSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/SqlVulnerabilityAssessmentBaselineListBySqlVulnerabilityAssessment.json + */ + /** + * Sample code: Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAListOfDatabaseSSqlVulnerabilityAssessmentRuleBaselines( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sqlVulnerabilityAssessmentBaselines() + .listBySqlVulnerabilityAssessment( + "vulnerabilityaseessmenttest-4711", + "vulnerabilityaseessmenttest-6411", + VulnerabilityAssessmentName.DEFAULT, + Context.NONE); + } +} +``` + +### SqlVulnerabilityAssessmentBaselinesOperation_CreateOrUpdate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.BaselineName; +import com.azure.resourcemanager.sql.generated.models.DatabaseSqlVulnerabilityAssessmentRuleBaselineListInput; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SqlVulnerabilityAssessmentBaselinesOperation CreateOrUpdate. */ +public final class SqlVulnerabilityAssessmentBaselinesOperationCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/SqlVulnerabilityAssessmentBaselineAddLatest.json + */ + /** + * Sample code: Add a database's vulnerability assessment rule baseline from the latest scan result. + * + * @param manager Entry point to SqlManager. + */ + public static void addADatabaseSVulnerabilityAssessmentRuleBaselineFromTheLatestScanResult( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sqlVulnerabilityAssessmentBaselinesOperations() + .createOrUpdateWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + VulnerabilityAssessmentName.DEFAULT, + BaselineName.DEFAULT, + new DatabaseSqlVulnerabilityAssessmentRuleBaselineListInput().withLatestScan(true).withResults(mapOf()), + Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/SqlVulnerabilityAssessmentBaselineAdd.json + */ + /** + * Sample code: Add a database's vulnerability assessment rule baseline list. + * + * @param manager Entry point to SqlManager. + */ + public static void addADatabaseSVulnerabilityAssessmentRuleBaselineList( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sqlVulnerabilityAssessmentBaselinesOperations() + .createOrUpdateWithResponse( + "vulnerabilityaseessmenttest-4711", + "vulnerabilityaseessmenttest-6411", + VulnerabilityAssessmentName.DEFAULT, + BaselineName.DEFAULT, + new DatabaseSqlVulnerabilityAssessmentRuleBaselineListInput() + .withLatestScan(false) + .withResults( + mapOf( + "VA2063", + Arrays.asList(Arrays.asList("AllowAll", "0.0.0.0", "255.255.255.255")), + "VA2065", + Arrays.asList(Arrays.asList("AllowAll", "0.0.0.0", "255.255.255.255")))), + Context.NONE); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### SqlVulnerabilityAssessmentExecuteScan_Execute + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for SqlVulnerabilityAssessmentExecuteScan Execute. */ +public final class SqlVulnerabilityAssessmentExecuteScanExecuteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/SqlVulnerabilityAssessmentScansExecute.json + */ + /** + * Sample code: Executes a database's vulnerability assessment scan. + * + * @param manager Entry point to SqlManager. + */ + public static void executesADatabaseSVulnerabilityAssessmentScan( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sqlVulnerabilityAssessmentExecuteScans() + .execute( + "vulnerabilityassessmenttest-4711", + "vulnerabilityassessmenttest-6411", + VulnerabilityAssessmentName.DEFAULT, + Context.NONE); + } +} +``` + +### SqlVulnerabilityAssessmentRuleBaseline_CreateOrUpdate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.BaselineName; +import com.azure.resourcemanager.sql.generated.models.DatabaseSqlVulnerabilityAssessmentRuleBaselineInput; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import java.util.Arrays; + +/** Samples for SqlVulnerabilityAssessmentRuleBaseline CreateOrUpdate. */ +public final class SqlVulnerabilityAssessmentRuleBaselineCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/SqlVulnerabilityAssessmentRuleBaselineCreate.json + */ + /** + * Sample code: Creates or updates a database's vulnerability assessment rule baseline. + * + * @param manager Entry point to SqlManager. + */ + public static void createsOrUpdatesADatabaseSVulnerabilityAssessmentRuleBaseline( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sqlVulnerabilityAssessmentRuleBaselines() + .createOrUpdateWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + VulnerabilityAssessmentName.DEFAULT, + BaselineName.DEFAULT, + "VA1001", + new DatabaseSqlVulnerabilityAssessmentRuleBaselineInput() + .withLatestScan(false) + .withResults( + Arrays + .asList( + Arrays.asList("userA", "SELECT"), + Arrays.asList("userB", "SELECT"), + Arrays.asList("userC", "SELECT"))), + Context.NONE); + } +} +``` + +### SqlVulnerabilityAssessmentRuleBaseline_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.BaselineName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for SqlVulnerabilityAssessmentRuleBaseline Get. */ +public final class SqlVulnerabilityAssessmentRuleBaselineGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/SqlVulnerabilityAssessmentRuleBaselineGet.json + */ + /** + * Sample code: Gets a system database's sql vulnerability assessment rule baseline. + * + * @param manager Entry point to SqlManager. + */ + public static void getsASystemDatabaseSSqlVulnerabilityAssessmentRuleBaseline( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sqlVulnerabilityAssessmentRuleBaselines() + .getWithResponse( + "vulnerabilityaseessmenttest-4711", + "vulnerabilityaseessmenttest-6411", + VulnerabilityAssessmentName.DEFAULT, + BaselineName.DEFAULT, + "VA1001", + Context.NONE); + } +} +``` + +### SqlVulnerabilityAssessmentRuleBaseline_ListByBaseline + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.BaselineName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for SqlVulnerabilityAssessmentRuleBaseline ListByBaseline. */ +public final class SqlVulnerabilityAssessmentRuleBaselineListByBaselineSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/SqlVulnerabilityAssessmentRuleBaselineListByBaseline.json + */ + /** + * Sample code: Gets a system database's sql vulnerability assessment rule baseline. + * + * @param manager Entry point to SqlManager. + */ + public static void getsASystemDatabaseSSqlVulnerabilityAssessmentRuleBaseline( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sqlVulnerabilityAssessmentRuleBaselines() + .listByBaseline( + "vulnerabilityaseessmenttest-4711", + "vulnerabilityaseessmenttest-6411", + VulnerabilityAssessmentName.DEFAULT, + BaselineName.DEFAULT, + Context.NONE); + } +} +``` + +### SqlVulnerabilityAssessmentRuleBaselinesOperation_Delete + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.BaselineName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for SqlVulnerabilityAssessmentRuleBaselinesOperation Delete. */ +public final class SqlVulnerabilityAssessmentRuleBaselinesOperationDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/SqlVulnerabilityAssessmentRuleBaselineDelete.json + */ + /** + * Sample code: Removes a database's vulnerability assessment rule baseline. + * + * @param manager Entry point to SqlManager. + */ + public static void removesADatabaseSVulnerabilityAssessmentRuleBaseline( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sqlVulnerabilityAssessmentRuleBaselinesOperations() + .deleteWithResponse( + "vulnerabilityaseessmenttest-4711", + "vulnerabilityaseessmenttest-6411", + VulnerabilityAssessmentName.DEFAULT, + BaselineName.DEFAULT, + "VA1001", + Context.NONE); + } +} +``` + +### SqlVulnerabilityAssessmentScanResultOperation_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentName; + +/** Samples for SqlVulnerabilityAssessmentScanResultOperation Get. */ +public final class SqlVulnerabilityAssessmentScanResultOperationGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/SqlVulnerabilityAssessmentScansResults.json + */ + /** + * Sample code: Get a system database SQL Vulnerability Assessment scan result for scan id and scan result id. + * + * @param manager Entry point to SqlManager. + */ + public static void getASystemDatabaseSQLVulnerabilityAssessmentScanResultForScanIdAndScanResultId( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sqlVulnerabilityAssessmentScanResultOperations() + .getWithResponse( + "vulnerabilityassessmenttest-4711", + "vulnerabilityassessmenttest-6411", + SqlVulnerabilityAssessmentName.DEFAULT, + "scanId1", + "VA1234", + Context.NONE); + } +} +``` + +### SqlVulnerabilityAssessmentScanResultOperation_ListByScan + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentName; + +/** Samples for SqlVulnerabilityAssessmentScanResultOperation ListByScan. */ +public final class SqlVulnerabilityAssessmentScanResultOperationListByScanSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/SqlVulnerabilityAssessmentListScansResults.json + */ + /** + * Sample code: List system database SQL Vulnerability Assessment scan results for scan id. + * + * @param manager Entry point to SqlManager. + */ + public static void listSystemDatabaseSQLVulnerabilityAssessmentScanResultsForScanId( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sqlVulnerabilityAssessmentScanResultOperations() + .listByScan( + "vulnerabilityassessmenttest-4711", + "testsvr", + SqlVulnerabilityAssessmentName.DEFAULT, + "scanId1", + Context.NONE); + } +} +``` + +### SqlVulnerabilityAssessmentScans_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for SqlVulnerabilityAssessmentScans Get. */ +public final class SqlVulnerabilityAssessmentScansGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/SqlVulnerabilityAssessmentScan.json + */ + /** + * Sample code: Gets the a database vulnerability assessment scan records. + * + * @param manager Entry point to SqlManager. + */ + public static void getsTheADatabaseVulnerabilityAssessmentScanRecords( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sqlVulnerabilityAssessmentScans() + .getWithResponse( + "vulnerabilityassessmenttest-4711", + "vulnerabilityassessmenttest-6411", + VulnerabilityAssessmentName.DEFAULT, + "scan001", + Context.NONE); + } +} +``` + +### SqlVulnerabilityAssessmentScans_ListBySqlVulnerabilityAssessments + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for SqlVulnerabilityAssessmentScans ListBySqlVulnerabilityAssessments. */ +public final class SqlVulnerabilityAssessmentScansListBySqlVulnerabilityAssessmentsSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/SqlVulnerabilityAssessmentScanRecordsListByDatabase.json + */ + /** + * Sample code: Gets the list of a database vulnerability assessment scan records. + * + * @param manager Entry point to SqlManager. + */ + public static void getsTheListOfADatabaseVulnerabilityAssessmentScanRecords( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sqlVulnerabilityAssessmentScans() + .listBySqlVulnerabilityAssessments( + "vulnerabilityassessmenttest-4711", + "vulnerabilityassessmenttest-6411", + VulnerabilityAssessmentName.DEFAULT, + Context.NONE); + } +} +``` + +### SqlVulnerabilityAssessments_Delete + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for SqlVulnerabilityAssessments Delete. */ +public final class SqlVulnerabilityAssessmentsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/SqlVulnerabilityAssessmentDelete.json + */ + /** + * Sample code: Remove SQL Vulnerability Assessment. + * + * @param manager Entry point to SqlManager. + */ + public static void removeSQLVulnerabilityAssessment(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sqlVulnerabilityAssessments() + .deleteWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + VulnerabilityAssessmentName.DEFAULT, + Context.NONE); + } +} +``` + +### SqlVulnerabilityAssessmentsSettings_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentState; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for SqlVulnerabilityAssessmentsSettings CreateOrUpdate. */ +public final class SqlVulnerabilityAssessmentsSettingsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/SqlVulnerabilityAssessmentCreate.json + */ + /** + * Sample code: Create a SQL Vulnerability Assessment policy. + * + * @param manager Entry point to SqlManager. + */ + public static void createASQLVulnerabilityAssessmentPolicy( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sqlVulnerabilityAssessmentsSettings() + .define(VulnerabilityAssessmentName.DEFAULT) + .withExistingServer("vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440") + .withState(SqlVulnerabilityAssessmentState.ENABLED) + .create(); + } +} +``` + +### SqlVulnerabilityAssessmentsSettings_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentNameAutoGenerated; + +/** Samples for SqlVulnerabilityAssessmentsSettings Get. */ +public final class SqlVulnerabilityAssessmentsSettingsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/SqlVulnerabilityAssessmentGet.json + */ + /** + * Sample code: Get SQL Vulnerability Assessment policy. + * + * @param manager Entry point to SqlManager. + */ + public static void getSQLVulnerabilityAssessmentPolicy(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sqlVulnerabilityAssessmentsSettings() + .getWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + SqlVulnerabilityAssessmentNameAutoGenerated.DEFAULT, + Context.NONE); + } +} +``` + +### SqlVulnerabilityAssessmentsSettings_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for SqlVulnerabilityAssessmentsSettings ListByServer. */ +public final class SqlVulnerabilityAssessmentsSettingsListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/SqlVulnerabilityAssessmentListByServer.json + */ + /** + * Sample code: Get SQL Vulnerability Assessment policies. + * + * @param manager Entry point to SqlManager. + */ + public static void getSQLVulnerabilityAssessmentPolicies( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sqlVulnerabilityAssessmentsSettings() + .listByServer("vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", Context.NONE); + } +} +``` + +### SubscriptionUsages_Get + +```java +import com.azure.core.util.Context; + +/** Samples for SubscriptionUsages Get. */ +public final class SubscriptionUsagesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SubscriptionUsageGet.json + */ + /** + * Sample code: Get specific subscription usage in the given location. + * + * @param manager Entry point to SqlManager. + */ + public static void getSpecificSubscriptionUsageInTheGivenLocation( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.subscriptionUsages().getWithResponse("WestUS", "ServerQuota", Context.NONE); + } +} +``` + +### SubscriptionUsages_ListByLocation + +```java +import com.azure.core.util.Context; + +/** Samples for SubscriptionUsages ListByLocation. */ +public final class SubscriptionUsagesListByLocationSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SubscriptionUsageListByLocation.json + */ + /** + * Sample code: List subscription usages in the given location. + * + * @param manager Entry point to SqlManager. + */ + public static void listSubscriptionUsagesInTheGivenLocation( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.subscriptionUsages().listByLocation("WestUS", Context.NONE); + } +} +``` + +### SynapseLinkWorkspaces_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for SynapseLinkWorkspaces ListByDatabase. */ +public final class SynapseLinkWorkspacesListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/SynapseLinkWorkspaceListByDatabase.json + */ + /** + * Sample code: List all synapselink workspaces for the given database. + * + * @param manager Entry point to SqlManager. + */ + public static void listAllSynapselinkWorkspacesForTheGivenDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .synapseLinkWorkspaces() + .listByDatabase("Default-SQL-SouthEastAsia", "testsvr", "dbSynapse", Context.NONE); + } +} +``` + +### SyncAgents_CreateOrUpdate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.SyncAgent; + +/** Samples for SyncAgents CreateOrUpdate. */ +public final class SyncAgentsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncAgentCreate.json + */ + /** + * Sample code: Create a new sync agent. + * + * @param manager Entry point to SqlManager. + */ + public static void createANewSyncAgent(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncAgents() + .define("syncagentcrud-3187") + .withExistingServer("syncagentcrud-65440", "syncagentcrud-8475") + .withSyncDatabaseId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-Onebox/providers/Microsoft.Sql/servers/syncagentcrud-8475/databases/sync") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncAgentUpdate.json + */ + /** + * Sample code: Update a sync agent. + * + * @param manager Entry point to SqlManager. + */ + public static void updateASyncAgent(com.azure.resourcemanager.sql.generated.SqlManager manager) { + SyncAgent resource = + manager + .syncAgents() + .getWithResponse("syncagentcrud-65440", "syncagentcrud-8475", "syncagentcrud-3187", Context.NONE) + .getValue(); + resource + .update() + .withSyncDatabaseId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-Onebox/providers/Microsoft.Sql/servers/syncagentcrud-8475/databases/sync") + .apply(); + } +} +``` + +### SyncAgents_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for SyncAgents Delete. */ +public final class SyncAgentsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncAgentDelete.json + */ + /** + * Sample code: Delete a sync agent. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteASyncAgent(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.syncAgents().delete("syncagentcrud-65440", "syncagentcrud-8475", "syncagentcrud-3187", Context.NONE); + } +} +``` + +### SyncAgents_GenerateKey + +```java +import com.azure.core.util.Context; + +/** Samples for SyncAgents GenerateKey. */ +public final class SyncAgentsGenerateKeySamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncAgentGenerateKey.json + */ + /** + * Sample code: Generate a sync agent key. + * + * @param manager Entry point to SqlManager. + */ + public static void generateASyncAgentKey(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncAgents() + .generateKeyWithResponse("syncagentcrud-65440", "syncagentcrud-8475", "syncagentcrud-3187", Context.NONE); + } +} +``` + +### SyncAgents_Get + +```java +import com.azure.core.util.Context; + +/** Samples for SyncAgents Get. */ +public final class SyncAgentsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncAgentGet.json + */ + /** + * Sample code: Get a sync agent. + * + * @param manager Entry point to SqlManager. + */ + public static void getASyncAgent(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncAgents() + .getWithResponse("syncagentcrud-65440", "syncagentcrud-8475", "syncagentcrud-3187", Context.NONE); + } +} +``` + +### SyncAgents_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for SyncAgents ListByServer. */ +public final class SyncAgentsListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncAgentListByServer.json + */ + /** + * Sample code: Get sync agents under a server. + * + * @param manager Entry point to SqlManager. + */ + public static void getSyncAgentsUnderAServer(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.syncAgents().listByServer("syncagentcrud-65440", "syncagentcrud-8475", Context.NONE); + } +} +``` + +### SyncAgents_ListLinkedDatabases + +```java +import com.azure.core.util.Context; + +/** Samples for SyncAgents ListLinkedDatabases. */ +public final class SyncAgentsListLinkedDatabasesSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncAgentGetLinkedDatabases.json + */ + /** + * Sample code: Get sync agent linked databases. + * + * @param manager Entry point to SqlManager. + */ + public static void getSyncAgentLinkedDatabases(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncAgents() + .listLinkedDatabases("syncagentcrud-65440", "syncagentcrud-8475", "syncagentcrud-3187", Context.NONE); + } +} +``` + +### SyncGroups_CancelSync + +```java +import com.azure.core.util.Context; + +/** Samples for SyncGroups CancelSync. */ +public final class SyncGroupsCancelSyncSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupCancelSync.json + */ + /** + * Sample code: Cancel a sync group synchronization. + * + * @param manager Entry point to SqlManager. + */ + public static void cancelASyncGroupSynchronization(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncGroups() + .cancelSyncWithResponse( + "syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", "syncgroupcrud-3187", Context.NONE); + } +} +``` + +### SyncGroups_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.SyncConflictResolutionPolicy; + +/** Samples for SyncGroups CreateOrUpdate. */ +public final class SyncGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupUpdate.json + */ + /** + * Sample code: Update a sync group. + * + * @param manager Entry point to SqlManager. + */ + public static void updateASyncGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncGroups() + .define("syncgroupcrud-3187") + .withExistingDatabase("syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328") + .withInterval(-1) + .withConflictResolutionPolicy(SyncConflictResolutionPolicy.HUB_WIN) + .withSyncDatabaseId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/syncgroupcrud-3521/providers/Microsoft.Sql/servers/syncgroupcrud-8475/databases/syncgroupcrud-4328") + .withHubDatabaseUsername("hubUser") + .withUsePrivateLinkConnection(true) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupCreate.json + */ + /** + * Sample code: Create a sync group. + * + * @param manager Entry point to SqlManager. + */ + public static void createASyncGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncGroups() + .define("syncgroupcrud-3187") + .withExistingDatabase("syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328") + .withInterval(-1) + .withConflictResolutionPolicy(SyncConflictResolutionPolicy.HUB_WIN) + .withSyncDatabaseId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/syncgroupcrud-3521/providers/Microsoft.Sql/servers/syncgroupcrud-8475/databases/syncgroupcrud-4328") + .withHubDatabaseUsername("hubUser") + .withUsePrivateLinkConnection(true) + .create(); + } +} +``` + +### SyncGroups_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for SyncGroups Delete. */ +public final class SyncGroupsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupDelete.json + */ + /** + * Sample code: Delete a sync group. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteASyncGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncGroups() + .delete( + "syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", "syncgroupcrud-3187", Context.NONE); + } +} +``` + +### SyncGroups_Get + +```java +import com.azure.core.util.Context; + +/** Samples for SyncGroups Get. */ +public final class SyncGroupsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupGet.json + */ + /** + * Sample code: Get a sync group. + * + * @param manager Entry point to SqlManager. + */ + public static void getASyncGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncGroups() + .getWithResponse( + "syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", "syncgroupcrud-3187", Context.NONE); + } +} +``` + +### SyncGroups_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for SyncGroups ListByDatabase. */ +public final class SyncGroupsListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupListByDatabase.json + */ + /** + * Sample code: List sync groups under a given database. + * + * @param manager Entry point to SqlManager. + */ + public static void listSyncGroupsUnderAGivenDatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncGroups() + .listByDatabase("syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", Context.NONE); + } +} +``` + +### SyncGroups_ListHubSchemas + +```java +import com.azure.core.util.Context; + +/** Samples for SyncGroups ListHubSchemas. */ +public final class SyncGroupsListHubSchemasSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupGetHubSchema.json + */ + /** + * Sample code: Get a hub database schema. + * + * @param manager Entry point to SqlManager. + */ + public static void getAHubDatabaseSchema(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncGroups() + .listHubSchemas( + "syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", "syncgroupcrud-3187", Context.NONE); + } +} +``` + +### SyncGroups_ListLogs + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.SyncGroupsType; + +/** Samples for SyncGroups ListLogs. */ +public final class SyncGroupsListLogsSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupGetLog.json + */ + /** + * Sample code: Get sync group logs. + * + * @param manager Entry point to SqlManager. + */ + public static void getSyncGroupLogs(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncGroups() + .listLogs( + "syncgroupcrud-65440", + "syncgroupcrud-8475", + "syncgroupcrud-4328", + "syncgroupcrud-3187", + "2017-01-01T00:00:00", + "2017-12-31T00:00:00", + SyncGroupsType.ALL, + null, + Context.NONE); + } +} +``` + +### SyncGroups_ListSyncDatabaseIds + +```java +import com.azure.core.util.Context; + +/** Samples for SyncGroups ListSyncDatabaseIds. */ +public final class SyncGroupsListSyncDatabaseIdsSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupGetSyncDatabaseId.json + */ + /** + * Sample code: Get a sync database ID. + * + * @param manager Entry point to SqlManager. + */ + public static void getASyncDatabaseID(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.syncGroups().listSyncDatabaseIds("westus", Context.NONE); + } +} +``` + +### SyncGroups_RefreshHubSchema + +```java +import com.azure.core.util.Context; + +/** Samples for SyncGroups RefreshHubSchema. */ +public final class SyncGroupsRefreshHubSchemaSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupRefreshHubSchema.json + */ + /** + * Sample code: Refresh a hub database schema. + * + * @param manager Entry point to SqlManager. + */ + public static void refreshAHubDatabaseSchema(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncGroups() + .refreshHubSchema( + "syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", "syncgroupcrud-3187", Context.NONE); + } +} +``` + +### SyncGroups_TriggerSync + +```java +import com.azure.core.util.Context; + +/** Samples for SyncGroups TriggerSync. */ +public final class SyncGroupsTriggerSyncSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupTriggerSync.json + */ + /** + * Sample code: Trigger a sync group synchronization. + * + * @param manager Entry point to SqlManager. + */ + public static void triggerASyncGroupSynchronization(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncGroups() + .triggerSyncWithResponse( + "syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", "syncgroupcrud-3187", Context.NONE); + } +} +``` + +### SyncGroups_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.SyncConflictResolutionPolicy; +import com.azure.resourcemanager.sql.generated.models.SyncGroup; + +/** Samples for SyncGroups Update. */ +public final class SyncGroupsUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupPatch.json + */ + /** + * Sample code: Update a sync group. + * + * @param manager Entry point to SqlManager. + */ + public static void updateASyncGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + SyncGroup resource = + manager + .syncGroups() + .getWithResponse( + "syncgroupcrud-65440", + "syncgroupcrud-8475", + "syncgroupcrud-4328", + "syncgroupcrud-3187", + Context.NONE) + .getValue(); + resource + .update() + .withInterval(-1) + .withConflictResolutionPolicy(SyncConflictResolutionPolicy.HUB_WIN) + .withSyncDatabaseId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/syncgroupcrud-3521/providers/Microsoft.Sql/servers/syncgroupcrud-8475/databases/syncgroupcrud-4328") + .withHubDatabaseUsername("hubUser") + .withHubDatabasePassword("hubPassword") + .withUsePrivateLinkConnection(true) + .apply(); + } +} +``` + +### SyncMembers_CreateOrUpdate + +```java +import com.azure.resourcemanager.sql.generated.models.SyncDirection; +import com.azure.resourcemanager.sql.generated.models.SyncMemberDbType; + +/** Samples for SyncMembers CreateOrUpdate. */ +public final class SyncMembersCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncMemberCreate.json + */ + /** + * Sample code: Create a new sync member. + * + * @param manager Entry point to SqlManager. + */ + public static void createANewSyncMember(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncMembers() + .define("syncmembercrud-4879") + .withExistingSyncGroup( + "syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", "syncgroupcrud-3187") + .withDatabaseType(SyncMemberDbType.AZURE_SQL_DATABASE) + .withSyncMemberAzureDatabaseResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/syncgroupcrud-65440/providers/Microsoft.Sql/servers/syncgroupcrud-8475/databases/syncgroupcrud-4328") + .withUsePrivateLinkConnection(true) + .withServerName("syncgroupcrud-3379.database.windows.net") + .withDatabaseName("syncgroupcrud-7421") + .withUsername("myUser") + .withSyncDirection(SyncDirection.BIDIRECTIONAL) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncMemberUpdate.json + */ + /** + * Sample code: Update a sync member. + * + * @param manager Entry point to SqlManager. + */ + public static void updateASyncMember(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncMembers() + .define("syncmembercrud-4879") + .withExistingSyncGroup( + "syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", "syncgroupcrud-3187") + .withDatabaseType(SyncMemberDbType.AZURE_SQL_DATABASE) + .withSyncMemberAzureDatabaseResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/syncgroupcrud-65440/providers/Microsoft.Sql/servers/syncgroupcrud-8475/databases/syncgroupcrud-4328") + .withUsePrivateLinkConnection(true) + .withServerName("syncgroupcrud-3379.database.windows.net") + .withDatabaseName("syncgroupcrud-7421") + .withUsername("myUser") + .withSyncDirection(SyncDirection.BIDIRECTIONAL) + .create(); + } +} +``` + +### SyncMembers_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for SyncMembers Delete. */ +public final class SyncMembersDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncMemberDelete.json + */ + /** + * Sample code: Delete a sync member. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteASyncMember(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncMembers() + .delete( + "syncgroupcrud-65440", + "syncgroupcrud-8475", + "syncgroupcrud-4328", + "syncgroupcrud-3187", + "syncgroupcrud-4879", + Context.NONE); + } +} +``` + +### SyncMembers_Get + +```java +import com.azure.core.util.Context; + +/** Samples for SyncMembers Get. */ +public final class SyncMembersGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncMemberGet.json + */ + /** + * Sample code: Get a sync member. + * + * @param manager Entry point to SqlManager. + */ + public static void getASyncMember(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncMembers() + .getWithResponse( + "syncgroupcrud-65440", + "syncgroupcrud-8475", + "syncgroupcrud-4328", + "syncgroupcrud-3187", + "syncmembercrud-4879", + Context.NONE); + } +} +``` + +### SyncMembers_ListBySyncGroup + +```java +import com.azure.core.util.Context; + +/** Samples for SyncMembers ListBySyncGroup. */ +public final class SyncMembersListBySyncGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncMemberListBySyncGroup.json + */ + /** + * Sample code: List sync members under a sync group. + * + * @param manager Entry point to SqlManager. + */ + public static void listSyncMembersUnderASyncGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncMembers() + .listBySyncGroup( + "syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", "syncgroupcrud-3187", Context.NONE); + } +} +``` + +### SyncMembers_ListMemberSchemas + +```java +import com.azure.core.util.Context; + +/** Samples for SyncMembers ListMemberSchemas. */ +public final class SyncMembersListMemberSchemasSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncMemberGetSchema.json + */ + /** + * Sample code: Get a sync member schema. + * + * @param manager Entry point to SqlManager. + */ + public static void getASyncMemberSchema(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncMembers() + .listMemberSchemas( + "syncgroupcrud-65440", + "syncgroupcrud-8475", + "syncgroupcrud-4328", + "syncgroupcrud-3187", + "syncgroupcrud-4879", + Context.NONE); + } +} +``` + +### SyncMembers_RefreshMemberSchema + +```java +import com.azure.core.util.Context; + +/** Samples for SyncMembers RefreshMemberSchema. */ +public final class SyncMembersRefreshMemberSchemaSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncMemberRefreshSchema.json + */ + /** + * Sample code: Refresh a sync member database schema. + * + * @param manager Entry point to SqlManager. + */ + public static void refreshASyncMemberDatabaseSchema(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncMembers() + .refreshMemberSchema( + "syncgroupcrud-65440", + "syncgroupcrud-8475", + "syncgroupcrud-4328", + "syncgroupcrud-3187", + "syncgroupcrud-4879", + Context.NONE); + } +} +``` + +### SyncMembers_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.SyncDirection; +import com.azure.resourcemanager.sql.generated.models.SyncMember; +import com.azure.resourcemanager.sql.generated.models.SyncMemberDbType; + +/** Samples for SyncMembers Update. */ +public final class SyncMembersUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncMemberPatch.json + */ + /** + * Sample code: Update an existing sync member. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAnExistingSyncMember(com.azure.resourcemanager.sql.generated.SqlManager manager) { + SyncMember resource = + manager + .syncMembers() + .getWithResponse( + "syncgroupcrud-65440", + "syncgroupcrud-8475", + "syncgroupcrud-4328", + "syncgroupcrud-3187", + "syncmembercrud-4879", + Context.NONE) + .getValue(); + resource + .update() + .withDatabaseType(SyncMemberDbType.AZURE_SQL_DATABASE) + .withSyncMemberAzureDatabaseResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/syncgroupcrud-65440/providers/Microsoft.Sql/servers/syncgroupcrud-8475/databases/syncgroupcrud-4328") + .withUsePrivateLinkConnection(true) + .withServerName("syncgroupcrud-3379.database.windows.net") + .withDatabaseName("syncgroupcrud-7421") + .withUsername("myUser") + .withSyncDirection(SyncDirection.BIDIRECTIONAL) + .apply(); + } +} +``` + +### TdeCertificates_Create + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.TdeCertificate; + +/** Samples for TdeCertificates Create. */ +public final class TdeCertificatesCreateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SqlTdeCertificateCreate.json + */ + /** + * Sample code: Upload a TDE certificate. + * + * @param manager Entry point to SqlManager. + */ + public static void uploadATDECertificate(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .tdeCertificates() + .create("testtdecert", "testtdecert", new TdeCertificate().withPrivateBlob("MIIXXXXXXXX"), Context.NONE); + } +} +``` + +### TimeZones_Get + +```java +import com.azure.core.util.Context; + +/** Samples for TimeZones Get. */ +public final class TimeZonesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceTimeZoneGet.json + */ + /** + * Sample code: Get managed instance time zone. + * + * @param manager Entry point to SqlManager. + */ + public static void getManagedInstanceTimeZone(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.timeZones().getWithResponse("canadaeast", "Haiti Standard Time", Context.NONE); + } +} +``` + +### TimeZones_ListByLocation + +```java +import com.azure.core.util.Context; + +/** Samples for TimeZones ListByLocation. */ +public final class TimeZonesListByLocationSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceTimeZoneListByLocation.json + */ + /** + * Sample code: List managed instance time zones by location. + * + * @param manager Entry point to SqlManager. + */ + public static void listManagedInstanceTimeZonesByLocation( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.timeZones().listByLocation("canadaeast", Context.NONE); + } +} +``` + +### TransparentDataEncryptions_CreateOrUpdate + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.LogicalDatabaseTransparentDataEncryption; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionName; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionState; + +/** Samples for TransparentDataEncryptions CreateOrUpdate. */ +public final class TransparentDataEncryptionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/TransparentDataEncryptionUpdate.json + */ + /** + * Sample code: Update a database's Transparent Data Encryption state with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateADatabaseSTransparentDataEncryptionStateWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + LogicalDatabaseTransparentDataEncryption resource = + manager + .transparentDataEncryptions() + .getWithResponse( + "securitytde-42-rg", + "securitytde-42", + "testdb", + TransparentDataEncryptionName.CURRENT, + Context.NONE) + .getValue(); + resource.update().withState(TransparentDataEncryptionState.ENABLED).apply(); + } +} +``` + +### TransparentDataEncryptions_Get + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionName; + +/** Samples for TransparentDataEncryptions Get. */ +public final class TransparentDataEncryptionsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/TransparentDataEncryptionGet.json + */ + /** + * Sample code: Get a database's transparent data encryption. + * + * @param manager Entry point to SqlManager. + */ + public static void getADatabaseSTransparentDataEncryption( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .transparentDataEncryptions() + .getWithResponse( + "security-tde-resourcegroup", + "securitytde", + "testdb", + TransparentDataEncryptionName.CURRENT, + Context.NONE); + } +} +``` + +### TransparentDataEncryptions_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for TransparentDataEncryptions ListByDatabase. */ +public final class TransparentDataEncryptionsListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/TransparentDataEncryptionList.json + */ + /** + * Sample code: Get a list of the database's transparent data encryption. + * + * @param manager Entry point to SqlManager. + */ + public static void getAListOfTheDatabaseSTransparentDataEncryption( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .transparentDataEncryptions() + .listByDatabase("security-tde-resourcegroup", "securitytde", "testdb", Context.NONE); + } +} +``` + +### Usages_ListByInstancePool + +```java +import com.azure.core.util.Context; + +/** Samples for Usages ListByInstancePool. */ +public final class UsagesListByInstancePoolSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ListInstancePoolUsage.json + */ + /** + * Sample code: List instance pool usages. + * + * @param manager Entry point to SqlManager. + */ + public static void listInstancePoolUsages(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.usages().listByInstancePool("group1", "testIP", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ListInstancePoolUsageExpanded.json + */ + /** + * Sample code: List instance pool usages expanded with children. + * + * @param manager Entry point to SqlManager. + */ + public static void listInstancePoolUsagesExpandedWithChildren( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.usages().listByInstancePool("group1", "testIP", true, Context.NONE); + } +} +``` + +### VirtualClusters_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualClusters Delete. */ +public final class VirtualClustersDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/VirtualClusterDelete.json + */ + /** + * Sample code: Delete virtual cluster. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteVirtualCluster(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.virtualClusters().delete("testrg", "vc-subnet1-f769ed71-b3ad-491a-a9d5-26eeceaa6be2", Context.NONE); + } +} +``` + +### VirtualClusters_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualClusters GetByResourceGroup. */ +public final class VirtualClustersGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/VirtualClusterGet.json + */ + /** + * Sample code: Gets a virtual cluster. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAVirtualCluster(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .virtualClusters() + .getByResourceGroupWithResponse("testrg", "vc-f769ed71-b3ad-491a-a9d5-26eeceaa6be2", Context.NONE); + } +} +``` + +### VirtualClusters_List + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualClusters List. */ +public final class VirtualClustersListSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/VirtualClusterList.json + */ + /** + * Sample code: List virtualClusters. + * + * @param manager Entry point to SqlManager. + */ + public static void listVirtualClusters(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.virtualClusters().list(Context.NONE); + } +} +``` + +### VirtualClusters_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualClusters ListByResourceGroup. */ +public final class VirtualClustersListByResourceGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/VirtualClusterListByResourceGroup.json + */ + /** + * Sample code: List virtual clusters by resource group. + * + * @param manager Entry point to SqlManager. + */ + public static void listVirtualClustersByResourceGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.virtualClusters().listByResourceGroup("testrg", Context.NONE); + } +} +``` + +### VirtualClusters_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VirtualClusterUpdate; +import java.util.HashMap; +import java.util.Map; + +/** Samples for VirtualClusters Update. */ +public final class VirtualClustersUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/VirtualClusterUpdate.json + */ + /** + * Sample code: Update virtual cluster with tags. + * + * @param manager Entry point to SqlManager. + */ + public static void updateVirtualClusterWithTags(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .virtualClusters() + .update( + "testrg", + "vc-subnet1-f769ed71-b3ad-491a-a9d5-26eeceaa6be2", + new VirtualClusterUpdate().withTags(mapOf("tkey", "tvalue1")), + Context.NONE); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### VirtualClusters_UpdateDnsServers + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualClusters UpdateDnsServers. */ +public final class VirtualClustersUpdateDnsServersSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/UpdateVirtualClusterDnsServers.json + */ + /** + * Sample code: Performs update of dns servers on managed instance. + * + * @param manager Entry point to SqlManager. + */ + public static void performsUpdateOfDnsServersOnManagedInstance( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .virtualClusters() + .updateDnsServers("sqlcrudtest-7398", "VirtualCluster2b9a846b-2e37-43ef-a8e9-f2c6d645c1d7", Context.NONE); + } +} +``` + +### VirtualNetworkRules_CreateOrUpdate + +```java +/** Samples for VirtualNetworkRules CreateOrUpdate. */ +public final class VirtualNetworkRulesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/VirtualNetworkRulesCreateOrUpdate.json + */ + /** + * Sample code: Create or update a virtual network rule. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateAVirtualNetworkRule(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .virtualNetworkRules() + .define("vnet-firewall-rule") + .withExistingServer("Default", "vnet-test-svr") + .withVirtualNetworkSubnetId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Network/virtualNetworks/testvnet/subnets/testsubnet") + .withIgnoreMissingVnetServiceEndpoint(false) + .create(); + } +} +``` + +### VirtualNetworkRules_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualNetworkRules Delete. */ +public final class VirtualNetworkRulesDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/VirtualNetworkRulesDelete.json + */ + /** + * Sample code: Delete a virtual network rule. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteAVirtualNetworkRule(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.virtualNetworkRules().delete("Default", "vnet-test-svr", "vnet-firewall-rule", Context.NONE); + } +} +``` + +### VirtualNetworkRules_Get + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualNetworkRules Get. */ +public final class VirtualNetworkRulesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/VirtualNetworkRulesGet.json + */ + /** + * Sample code: Gets a virtual network rule. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAVirtualNetworkRule(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.virtualNetworkRules().getWithResponse("Default", "vnet-test-svr", "vnet-firewall-rule", Context.NONE); + } +} +``` + +### VirtualNetworkRules_ListByServer + +```java +import com.azure.core.util.Context; + +/** Samples for VirtualNetworkRules ListByServer. */ +public final class VirtualNetworkRulesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/VirtualNetworkRulesList.json + */ + /** + * Sample code: List virtual network rules. + * + * @param manager Entry point to SqlManager. + */ + public static void listVirtualNetworkRules(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.virtualNetworkRules().listByServer("Default", "vnet-test-svr", Context.NONE); + } +} +``` + +### WorkloadClassifiers_CreateOrUpdate + +```java +/** Samples for WorkloadClassifiers CreateOrUpdate. */ +public final class WorkloadClassifiersCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateWorkloadClassifierMin.json + */ + /** + * Sample code: Create a workload group with the required properties specified. + * + * @param manager Entry point to SqlManager. + */ + public static void createAWorkloadGroupWithTheRequiredPropertiesSpecified( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .workloadClassifiers() + .define("wlm_workloadclassifier") + .withExistingWorkloadGroup("Default-SQL-SouthEastAsia", "testsvr", "testdb", "wlm_workloadgroup") + .withMemberName("dbo") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateWorkloadClassifierMax.json + */ + /** + * Sample code: Create a workload group with all properties specified. + * + * @param manager Entry point to SqlManager. + */ + public static void createAWorkloadGroupWithAllPropertiesSpecified( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .workloadClassifiers() + .define("wlm_workloadclassifier") + .withExistingWorkloadGroup("Default-SQL-SouthEastAsia", "testsvr", "testdb", "wlm_workloadgroup") + .withMemberName("dbo") + .withLabel("test_label") + .withContext("test_context") + .withStartTime("12:00") + .withEndTime("14:00") + .withImportance("high") + .create(); + } +} +``` + +### WorkloadClassifiers_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for WorkloadClassifiers Delete. */ +public final class WorkloadClassifiersDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeleteWorkloadClassifier.json + */ + /** + * Sample code: Delete a workload classifier. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteAWorkloadClassifier(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .workloadClassifiers() + .delete( + "Default-SQL-SouthEastAsia", + "testsvr", + "testdb", + "wlm_workloadgroup", + "wlm_workloadclassifier", + Context.NONE); + } +} +``` + +### WorkloadClassifiers_Get + +```java +import com.azure.core.util.Context; + +/** Samples for WorkloadClassifiers Get. */ +public final class WorkloadClassifiersGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetWorkloadClassifier.json + */ + /** + * Sample code: Gets a workload classifier for a data warehouse. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAWorkloadClassifierForADataWarehouse( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .workloadClassifiers() + .getWithResponse( + "Default-SQL-SouthEastAsia", "testsvr", "testdb", "wlm_workloadgroup", "wlm_classifier", Context.NONE); + } +} +``` + +### WorkloadClassifiers_ListByWorkloadGroup + +```java +import com.azure.core.util.Context; + +/** Samples for WorkloadClassifiers ListByWorkloadGroup. */ +public final class WorkloadClassifiersListByWorkloadGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetWorkloadClassifierList.json + */ + /** + * Sample code: Get the list of workload classifiers for a workload group. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheListOfWorkloadClassifiersForAWorkloadGroup( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .workloadClassifiers() + .listByWorkloadGroup("Default-SQL-SouthEastAsia", "testsvr", "testdb", "wlm_workloadgroup", Context.NONE); + } +} +``` + +### WorkloadGroups_CreateOrUpdate + +```java +/** Samples for WorkloadGroups CreateOrUpdate. */ +public final class WorkloadGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateWorkloadGroupMin.json + */ + /** + * Sample code: Create a workload group with the required properties specified. + * + * @param manager Entry point to SqlManager. + */ + public static void createAWorkloadGroupWithTheRequiredPropertiesSpecified( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .workloadGroups() + .define("smallrc") + .withExistingDatabase("Default-SQL-SouthEastAsia", "testsvr", "testdb") + .withMinResourcePercent(0) + .withMaxResourcePercent(100) + .withMinResourcePercentPerRequest(3.0) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateWorkloadGroupMax.json + */ + /** + * Sample code: Create a workload group with all properties specified. + * + * @param manager Entry point to SqlManager. + */ + public static void createAWorkloadGroupWithAllPropertiesSpecified( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .workloadGroups() + .define("smallrc") + .withExistingDatabase("Default-SQL-SouthEastAsia", "testsvr", "testdb") + .withMinResourcePercent(0) + .withMaxResourcePercent(100) + .withMinResourcePercentPerRequest(3.0) + .withMaxResourcePercentPerRequest(3.0D) + .withImportance("normal") + .withQueryExecutionTimeout(0) + .create(); + } +} +``` + +### WorkloadGroups_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for WorkloadGroups Delete. */ +public final class WorkloadGroupsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeleteWorkloadGroup.json + */ + /** + * Sample code: Delete a workload group. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteAWorkloadGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .workloadGroups() + .delete("Default-SQL-SouthEastAsia", "testsvr", "testdb", "wlm_workloadgroup", Context.NONE); + } +} +``` + +### WorkloadGroups_Get + +```java +import com.azure.core.util.Context; + +/** Samples for WorkloadGroups Get. */ +public final class WorkloadGroupsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetWorkloadGroup.json + */ + /** + * Sample code: Gets a workload group for a data warehouse. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAWorkloadGroupForADataWarehouse(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .workloadGroups() + .getWithResponse("Default-SQL-SouthEastAsia", "testsvr", "testdb", "smallrc", Context.NONE); + } +} +``` + +### WorkloadGroups_ListByDatabase + +```java +import com.azure.core.util.Context; + +/** Samples for WorkloadGroups ListByDatabase. */ +public final class WorkloadGroupsListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetWorkloadGroupList.json + */ + /** + * Sample code: Get the list of workload groups for a data warehouse. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheListOfWorkloadGroupsForADataWarehouse( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.workloadGroups().listByDatabase("Default-SQL-SouthEastAsia", "testsvr", "testdb", Context.NONE); + } +} +``` + diff --git a/sdk/sql/azure-resourcemanager-sql-generated/pom.xml b/sdk/sql/azure-resourcemanager-sql-generated/pom.xml new file mode 100644 index 0000000000000..94e0ae808f840 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/pom.xml @@ -0,0 +1,55 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-sql-generated + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for Sql Management + This package contains Microsoft Azure SDK for Sql Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. 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 tag package-composite-v5. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + true + + + + com.azure + azure-core + 1.34.0 + + + com.azure + azure-core-management + 1.9.0 + + + diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/SqlManager.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/SqlManager.java new file mode 100644 index 0000000000000..f1e7ce34ec1d2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/SqlManager.java @@ -0,0 +1,2730 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.SqlManagementClient; +import com.azure.resourcemanager.sql.generated.implementation.BackupShortTermRetentionPoliciesImpl; +import com.azure.resourcemanager.sql.generated.implementation.CapabilitiesImpl; +import com.azure.resourcemanager.sql.generated.implementation.DataMaskingPoliciesImpl; +import com.azure.resourcemanager.sql.generated.implementation.DataMaskingRulesImpl; +import com.azure.resourcemanager.sql.generated.implementation.DataWarehouseUserActivitiesOperationsImpl; +import com.azure.resourcemanager.sql.generated.implementation.DatabaseAdvancedThreatProtectionSettingsImpl; +import com.azure.resourcemanager.sql.generated.implementation.DatabaseAdvisorsImpl; +import com.azure.resourcemanager.sql.generated.implementation.DatabaseAutomaticTuningsImpl; +import com.azure.resourcemanager.sql.generated.implementation.DatabaseBlobAuditingPoliciesImpl; +import com.azure.resourcemanager.sql.generated.implementation.DatabaseColumnsImpl; +import com.azure.resourcemanager.sql.generated.implementation.DatabaseExtensionsOperationsImpl; +import com.azure.resourcemanager.sql.generated.implementation.DatabaseOperationsImpl; +import com.azure.resourcemanager.sql.generated.implementation.DatabaseRecommendedActionsImpl; +import com.azure.resourcemanager.sql.generated.implementation.DatabaseSchemasImpl; +import com.azure.resourcemanager.sql.generated.implementation.DatabaseSecurityAlertPoliciesImpl; +import com.azure.resourcemanager.sql.generated.implementation.DatabaseSqlVulnerabilityAssessmentBaselinesImpl; +import com.azure.resourcemanager.sql.generated.implementation.DatabaseSqlVulnerabilityAssessmentExecuteScansImpl; +import com.azure.resourcemanager.sql.generated.implementation.DatabaseSqlVulnerabilityAssessmentRuleBaselinesImpl; +import com.azure.resourcemanager.sql.generated.implementation.DatabaseSqlVulnerabilityAssessmentScanResultsImpl; +import com.azure.resourcemanager.sql.generated.implementation.DatabaseSqlVulnerabilityAssessmentScansImpl; +import com.azure.resourcemanager.sql.generated.implementation.DatabaseSqlVulnerabilityAssessmentsSettingsImpl; +import com.azure.resourcemanager.sql.generated.implementation.DatabaseTablesImpl; +import com.azure.resourcemanager.sql.generated.implementation.DatabaseUsagesImpl; +import com.azure.resourcemanager.sql.generated.implementation.DatabaseVulnerabilityAssessmentRuleBaselinesImpl; +import com.azure.resourcemanager.sql.generated.implementation.DatabaseVulnerabilityAssessmentScansImpl; +import com.azure.resourcemanager.sql.generated.implementation.DatabaseVulnerabilityAssessmentsImpl; +import com.azure.resourcemanager.sql.generated.implementation.DatabasesImpl; +import com.azure.resourcemanager.sql.generated.implementation.DeletedServersImpl; +import com.azure.resourcemanager.sql.generated.implementation.DistributedAvailabilityGroupsImpl; +import com.azure.resourcemanager.sql.generated.implementation.ElasticPoolActivitiesImpl; +import com.azure.resourcemanager.sql.generated.implementation.ElasticPoolDatabaseActivitiesImpl; +import com.azure.resourcemanager.sql.generated.implementation.ElasticPoolOperationsImpl; +import com.azure.resourcemanager.sql.generated.implementation.ElasticPoolsImpl; +import com.azure.resourcemanager.sql.generated.implementation.EncryptionProtectorsImpl; +import com.azure.resourcemanager.sql.generated.implementation.EndpointCertificatesImpl; +import com.azure.resourcemanager.sql.generated.implementation.ExtendedDatabaseBlobAuditingPoliciesImpl; +import com.azure.resourcemanager.sql.generated.implementation.ExtendedServerBlobAuditingPoliciesImpl; +import com.azure.resourcemanager.sql.generated.implementation.FailoverGroupsImpl; +import com.azure.resourcemanager.sql.generated.implementation.FirewallRulesImpl; +import com.azure.resourcemanager.sql.generated.implementation.GeoBackupPoliciesImpl; +import com.azure.resourcemanager.sql.generated.implementation.IPv6FirewallRulesImpl; +import com.azure.resourcemanager.sql.generated.implementation.InstanceFailoverGroupsImpl; +import com.azure.resourcemanager.sql.generated.implementation.InstancePoolsImpl; +import com.azure.resourcemanager.sql.generated.implementation.JobAgentsImpl; +import com.azure.resourcemanager.sql.generated.implementation.JobCredentialsImpl; +import com.azure.resourcemanager.sql.generated.implementation.JobExecutionsImpl; +import com.azure.resourcemanager.sql.generated.implementation.JobStepExecutionsImpl; +import com.azure.resourcemanager.sql.generated.implementation.JobStepsImpl; +import com.azure.resourcemanager.sql.generated.implementation.JobTargetExecutionsImpl; +import com.azure.resourcemanager.sql.generated.implementation.JobTargetGroupsImpl; +import com.azure.resourcemanager.sql.generated.implementation.JobVersionsImpl; +import com.azure.resourcemanager.sql.generated.implementation.JobsImpl; +import com.azure.resourcemanager.sql.generated.implementation.LedgerDigestUploadsOperationsImpl; +import com.azure.resourcemanager.sql.generated.implementation.LongTermRetentionBackupsImpl; +import com.azure.resourcemanager.sql.generated.implementation.LongTermRetentionManagedInstanceBackupsImpl; +import com.azure.resourcemanager.sql.generated.implementation.LongTermRetentionPoliciesImpl; +import com.azure.resourcemanager.sql.generated.implementation.MaintenanceWindowOptionsOperationsImpl; +import com.azure.resourcemanager.sql.generated.implementation.MaintenanceWindowsOperationsImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedBackupShortTermRetentionPoliciesImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedDatabaseAdvancedThreatProtectionSettingsImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedDatabaseColumnsImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedDatabaseMoveOperationsImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedDatabaseQueriesImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedDatabaseRecommendedSensitivityLabelsImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedDatabaseRestoreDetailsImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedDatabaseSchemasImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedDatabaseSecurityAlertPoliciesImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedDatabaseSecurityEventsImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedDatabaseSensitivityLabelsImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedDatabaseTablesImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedDatabaseTransparentDataEncryptionsImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedDatabaseVulnerabilityAssessmentRuleBaselinesImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedDatabaseVulnerabilityAssessmentScansImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedDatabaseVulnerabilityAssessmentsImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedDatabasesImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedInstanceAdministratorsImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedInstanceAdvancedThreatProtectionSettingsImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedInstanceAzureADOnlyAuthenticationsImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedInstanceDtcsImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedInstanceEncryptionProtectorsImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedInstanceKeysImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedInstanceLongTermRetentionPoliciesImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedInstanceOperationsImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedInstancePrivateEndpointConnectionsImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedInstancePrivateLinkResourcesImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedInstanceTdeCertificatesImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedInstanceVulnerabilityAssessmentsImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedInstancesImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedServerDnsAliasesImpl; +import com.azure.resourcemanager.sql.generated.implementation.ManagedServerSecurityAlertPoliciesImpl; +import com.azure.resourcemanager.sql.generated.implementation.OperationsImpl; +import com.azure.resourcemanager.sql.generated.implementation.OutboundFirewallRulesImpl; +import com.azure.resourcemanager.sql.generated.implementation.PrivateEndpointConnectionsImpl; +import com.azure.resourcemanager.sql.generated.implementation.PrivateLinkResourcesImpl; +import com.azure.resourcemanager.sql.generated.implementation.RecommendedSensitivityLabelsImpl; +import com.azure.resourcemanager.sql.generated.implementation.RecoverableDatabasesImpl; +import com.azure.resourcemanager.sql.generated.implementation.RecoverableManagedDatabasesImpl; +import com.azure.resourcemanager.sql.generated.implementation.ReplicationLinksImpl; +import com.azure.resourcemanager.sql.generated.implementation.RestorableDroppedDatabasesImpl; +import com.azure.resourcemanager.sql.generated.implementation.RestorableDroppedManagedDatabasesImpl; +import com.azure.resourcemanager.sql.generated.implementation.RestorePointsImpl; +import com.azure.resourcemanager.sql.generated.implementation.SensitivityLabelsImpl; +import com.azure.resourcemanager.sql.generated.implementation.ServerAdvancedThreatProtectionSettingsImpl; +import com.azure.resourcemanager.sql.generated.implementation.ServerAdvisorsImpl; +import com.azure.resourcemanager.sql.generated.implementation.ServerAutomaticTuningsImpl; +import com.azure.resourcemanager.sql.generated.implementation.ServerAzureADAdministratorsImpl; +import com.azure.resourcemanager.sql.generated.implementation.ServerAzureADOnlyAuthenticationsImpl; +import com.azure.resourcemanager.sql.generated.implementation.ServerBlobAuditingPoliciesImpl; +import com.azure.resourcemanager.sql.generated.implementation.ServerCommunicationLinksImpl; +import com.azure.resourcemanager.sql.generated.implementation.ServerConnectionPoliciesImpl; +import com.azure.resourcemanager.sql.generated.implementation.ServerDevOpsAuditSettingsImpl; +import com.azure.resourcemanager.sql.generated.implementation.ServerDnsAliasesImpl; +import com.azure.resourcemanager.sql.generated.implementation.ServerKeysImpl; +import com.azure.resourcemanager.sql.generated.implementation.ServerOperationsImpl; +import com.azure.resourcemanager.sql.generated.implementation.ServerSecurityAlertPoliciesImpl; +import com.azure.resourcemanager.sql.generated.implementation.ServerTrustCertificatesImpl; +import com.azure.resourcemanager.sql.generated.implementation.ServerTrustGroupsImpl; +import com.azure.resourcemanager.sql.generated.implementation.ServerUsagesImpl; +import com.azure.resourcemanager.sql.generated.implementation.ServerVulnerabilityAssessmentsImpl; +import com.azure.resourcemanager.sql.generated.implementation.ServersImpl; +import com.azure.resourcemanager.sql.generated.implementation.ServiceObjectivesImpl; +import com.azure.resourcemanager.sql.generated.implementation.SqlAgentsImpl; +import com.azure.resourcemanager.sql.generated.implementation.SqlManagementClientBuilder; +import com.azure.resourcemanager.sql.generated.implementation.SqlVulnerabilityAssessmentBaselinesImpl; +import com.azure.resourcemanager.sql.generated.implementation.SqlVulnerabilityAssessmentBaselinesOperationsImpl; +import com.azure.resourcemanager.sql.generated.implementation.SqlVulnerabilityAssessmentExecuteScansImpl; +import com.azure.resourcemanager.sql.generated.implementation.SqlVulnerabilityAssessmentRuleBaselinesImpl; +import com.azure.resourcemanager.sql.generated.implementation.SqlVulnerabilityAssessmentRuleBaselinesOperationsImpl; +import com.azure.resourcemanager.sql.generated.implementation.SqlVulnerabilityAssessmentScanResultOperationsImpl; +import com.azure.resourcemanager.sql.generated.implementation.SqlVulnerabilityAssessmentScansImpl; +import com.azure.resourcemanager.sql.generated.implementation.SqlVulnerabilityAssessmentsImpl; +import com.azure.resourcemanager.sql.generated.implementation.SqlVulnerabilityAssessmentsSettingsImpl; +import com.azure.resourcemanager.sql.generated.implementation.SubscriptionUsagesImpl; +import com.azure.resourcemanager.sql.generated.implementation.SynapseLinkWorkspacesImpl; +import com.azure.resourcemanager.sql.generated.implementation.SyncAgentsImpl; +import com.azure.resourcemanager.sql.generated.implementation.SyncGroupsImpl; +import com.azure.resourcemanager.sql.generated.implementation.SyncMembersImpl; +import com.azure.resourcemanager.sql.generated.implementation.TdeCertificatesImpl; +import com.azure.resourcemanager.sql.generated.implementation.TimeZonesImpl; +import com.azure.resourcemanager.sql.generated.implementation.TransparentDataEncryptionsImpl; +import com.azure.resourcemanager.sql.generated.implementation.UsagesImpl; +import com.azure.resourcemanager.sql.generated.implementation.VirtualClustersImpl; +import com.azure.resourcemanager.sql.generated.implementation.VirtualNetworkRulesImpl; +import com.azure.resourcemanager.sql.generated.implementation.WorkloadClassifiersImpl; +import com.azure.resourcemanager.sql.generated.implementation.WorkloadGroupsImpl; +import com.azure.resourcemanager.sql.generated.models.BackupShortTermRetentionPolicies; +import com.azure.resourcemanager.sql.generated.models.Capabilities; +import com.azure.resourcemanager.sql.generated.models.DataMaskingPolicies; +import com.azure.resourcemanager.sql.generated.models.DataMaskingRules; +import com.azure.resourcemanager.sql.generated.models.DataWarehouseUserActivitiesOperations; +import com.azure.resourcemanager.sql.generated.models.DatabaseAdvancedThreatProtectionSettings; +import com.azure.resourcemanager.sql.generated.models.DatabaseAdvisors; +import com.azure.resourcemanager.sql.generated.models.DatabaseAutomaticTunings; +import com.azure.resourcemanager.sql.generated.models.DatabaseBlobAuditingPolicies; +import com.azure.resourcemanager.sql.generated.models.DatabaseColumns; +import com.azure.resourcemanager.sql.generated.models.DatabaseExtensionsOperations; +import com.azure.resourcemanager.sql.generated.models.DatabaseOperations; +import com.azure.resourcemanager.sql.generated.models.DatabaseRecommendedActions; +import com.azure.resourcemanager.sql.generated.models.DatabaseSchemas; +import com.azure.resourcemanager.sql.generated.models.DatabaseSecurityAlertPolicies; +import com.azure.resourcemanager.sql.generated.models.DatabaseSqlVulnerabilityAssessmentBaselines; +import com.azure.resourcemanager.sql.generated.models.DatabaseSqlVulnerabilityAssessmentExecuteScans; +import com.azure.resourcemanager.sql.generated.models.DatabaseSqlVulnerabilityAssessmentRuleBaselines; +import com.azure.resourcemanager.sql.generated.models.DatabaseSqlVulnerabilityAssessmentScanResults; +import com.azure.resourcemanager.sql.generated.models.DatabaseSqlVulnerabilityAssessmentScans; +import com.azure.resourcemanager.sql.generated.models.DatabaseSqlVulnerabilityAssessmentsSettings; +import com.azure.resourcemanager.sql.generated.models.DatabaseTables; +import com.azure.resourcemanager.sql.generated.models.DatabaseUsages; +import com.azure.resourcemanager.sql.generated.models.DatabaseVulnerabilityAssessmentRuleBaselines; +import com.azure.resourcemanager.sql.generated.models.DatabaseVulnerabilityAssessmentScans; +import com.azure.resourcemanager.sql.generated.models.DatabaseVulnerabilityAssessments; +import com.azure.resourcemanager.sql.generated.models.Databases; +import com.azure.resourcemanager.sql.generated.models.DeletedServers; +import com.azure.resourcemanager.sql.generated.models.DistributedAvailabilityGroups; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolActivities; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolDatabaseActivities; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolOperations; +import com.azure.resourcemanager.sql.generated.models.ElasticPools; +import com.azure.resourcemanager.sql.generated.models.EncryptionProtectors; +import com.azure.resourcemanager.sql.generated.models.EndpointCertificates; +import com.azure.resourcemanager.sql.generated.models.ExtendedDatabaseBlobAuditingPolicies; +import com.azure.resourcemanager.sql.generated.models.ExtendedServerBlobAuditingPolicies; +import com.azure.resourcemanager.sql.generated.models.FailoverGroups; +import com.azure.resourcemanager.sql.generated.models.FirewallRules; +import com.azure.resourcemanager.sql.generated.models.GeoBackupPolicies; +import com.azure.resourcemanager.sql.generated.models.IPv6FirewallRules; +import com.azure.resourcemanager.sql.generated.models.InstanceFailoverGroups; +import com.azure.resourcemanager.sql.generated.models.InstancePools; +import com.azure.resourcemanager.sql.generated.models.JobAgents; +import com.azure.resourcemanager.sql.generated.models.JobCredentials; +import com.azure.resourcemanager.sql.generated.models.JobExecutions; +import com.azure.resourcemanager.sql.generated.models.JobStepExecutions; +import com.azure.resourcemanager.sql.generated.models.JobSteps; +import com.azure.resourcemanager.sql.generated.models.JobTargetExecutions; +import com.azure.resourcemanager.sql.generated.models.JobTargetGroups; +import com.azure.resourcemanager.sql.generated.models.JobVersions; +import com.azure.resourcemanager.sql.generated.models.Jobs; +import com.azure.resourcemanager.sql.generated.models.LedgerDigestUploadsOperations; +import com.azure.resourcemanager.sql.generated.models.LongTermRetentionBackups; +import com.azure.resourcemanager.sql.generated.models.LongTermRetentionManagedInstanceBackups; +import com.azure.resourcemanager.sql.generated.models.LongTermRetentionPolicies; +import com.azure.resourcemanager.sql.generated.models.MaintenanceWindowOptionsOperations; +import com.azure.resourcemanager.sql.generated.models.MaintenanceWindowsOperations; +import com.azure.resourcemanager.sql.generated.models.ManagedBackupShortTermRetentionPolicies; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseAdvancedThreatProtectionSettings; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseColumns; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseMoveOperations; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseQueries; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseRecommendedSensitivityLabels; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseRestoreDetails; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseSchemas; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseSecurityAlertPolicies; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseSecurityEvents; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseSensitivityLabels; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseTables; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseTransparentDataEncryptions; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseVulnerabilityAssessmentRuleBaselines; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseVulnerabilityAssessmentScans; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseVulnerabilityAssessments; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabases; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceAdministrators; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceAdvancedThreatProtectionSettings; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceAzureADOnlyAuthentications; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceDtcs; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceEncryptionProtectors; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceKeys; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceLongTermRetentionPolicies; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceOperations; +import com.azure.resourcemanager.sql.generated.models.ManagedInstancePrivateEndpointConnections; +import com.azure.resourcemanager.sql.generated.models.ManagedInstancePrivateLinkResources; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceTdeCertificates; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceVulnerabilityAssessments; +import com.azure.resourcemanager.sql.generated.models.ManagedInstances; +import com.azure.resourcemanager.sql.generated.models.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies; +import com.azure.resourcemanager.sql.generated.models.ManagedServerDnsAliases; +import com.azure.resourcemanager.sql.generated.models.ManagedServerSecurityAlertPolicies; +import com.azure.resourcemanager.sql.generated.models.Operations; +import com.azure.resourcemanager.sql.generated.models.OutboundFirewallRules; +import com.azure.resourcemanager.sql.generated.models.PrivateEndpointConnections; +import com.azure.resourcemanager.sql.generated.models.PrivateLinkResources; +import com.azure.resourcemanager.sql.generated.models.RecommendedSensitivityLabels; +import com.azure.resourcemanager.sql.generated.models.RecoverableDatabases; +import com.azure.resourcemanager.sql.generated.models.RecoverableManagedDatabases; +import com.azure.resourcemanager.sql.generated.models.ReplicationLinks; +import com.azure.resourcemanager.sql.generated.models.RestorableDroppedDatabases; +import com.azure.resourcemanager.sql.generated.models.RestorableDroppedManagedDatabases; +import com.azure.resourcemanager.sql.generated.models.RestorePoints; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabels; +import com.azure.resourcemanager.sql.generated.models.ServerAdvancedThreatProtectionSettings; +import com.azure.resourcemanager.sql.generated.models.ServerAdvisors; +import com.azure.resourcemanager.sql.generated.models.ServerAutomaticTunings; +import com.azure.resourcemanager.sql.generated.models.ServerAzureADAdministrators; +import com.azure.resourcemanager.sql.generated.models.ServerAzureADOnlyAuthentications; +import com.azure.resourcemanager.sql.generated.models.ServerBlobAuditingPolicies; +import com.azure.resourcemanager.sql.generated.models.ServerCommunicationLinks; +import com.azure.resourcemanager.sql.generated.models.ServerConnectionPolicies; +import com.azure.resourcemanager.sql.generated.models.ServerDevOpsAuditSettings; +import com.azure.resourcemanager.sql.generated.models.ServerDnsAliases; +import com.azure.resourcemanager.sql.generated.models.ServerKeys; +import com.azure.resourcemanager.sql.generated.models.ServerOperations; +import com.azure.resourcemanager.sql.generated.models.ServerSecurityAlertPolicies; +import com.azure.resourcemanager.sql.generated.models.ServerTrustCertificates; +import com.azure.resourcemanager.sql.generated.models.ServerTrustGroups; +import com.azure.resourcemanager.sql.generated.models.ServerUsages; +import com.azure.resourcemanager.sql.generated.models.ServerVulnerabilityAssessments; +import com.azure.resourcemanager.sql.generated.models.Servers; +import com.azure.resourcemanager.sql.generated.models.ServiceObjectives; +import com.azure.resourcemanager.sql.generated.models.SqlAgents; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentBaselines; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentBaselinesOperations; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentExecuteScans; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentRuleBaselines; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentRuleBaselinesOperations; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentScanResultOperations; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentScans; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessments; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentsSettings; +import com.azure.resourcemanager.sql.generated.models.SubscriptionUsages; +import com.azure.resourcemanager.sql.generated.models.SynapseLinkWorkspaces; +import com.azure.resourcemanager.sql.generated.models.SyncAgents; +import com.azure.resourcemanager.sql.generated.models.SyncGroups; +import com.azure.resourcemanager.sql.generated.models.SyncMembers; +import com.azure.resourcemanager.sql.generated.models.TdeCertificates; +import com.azure.resourcemanager.sql.generated.models.TimeZones; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptions; +import com.azure.resourcemanager.sql.generated.models.Usages; +import com.azure.resourcemanager.sql.generated.models.VirtualClusters; +import com.azure.resourcemanager.sql.generated.models.VirtualNetworkRules; +import com.azure.resourcemanager.sql.generated.models.WorkloadClassifiers; +import com.azure.resourcemanager.sql.generated.models.WorkloadGroups; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * Entry point to SqlManager. 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. + */ +public final class SqlManager { + private RecoverableDatabases recoverableDatabases; + + private DataMaskingPolicies dataMaskingPolicies; + + private DataMaskingRules dataMaskingRules; + + private GeoBackupPolicies geoBackupPolicies; + + private Databases databases; + + private ElasticPools elasticPools; + + private ServerCommunicationLinks serverCommunicationLinks; + + private ServiceObjectives serviceObjectives; + + private ElasticPoolActivities elasticPoolActivities; + + private ElasticPoolDatabaseActivities elasticPoolDatabaseActivities; + + private ServerUsages serverUsages; + + private DatabaseAdvisors databaseAdvisors; + + private DatabaseAutomaticTunings databaseAutomaticTunings; + + private DatabaseColumns databaseColumns; + + private DatabaseRecommendedActions databaseRecommendedActions; + + private DatabaseSchemas databaseSchemas; + + private DatabaseSecurityAlertPolicies databaseSecurityAlertPolicies; + + private DatabaseTables databaseTables; + + private DatabaseVulnerabilityAssessmentRuleBaselines databaseVulnerabilityAssessmentRuleBaselines; + + private DatabaseVulnerabilityAssessments databaseVulnerabilityAssessments; + + private DatabaseVulnerabilityAssessmentScans databaseVulnerabilityAssessmentScans; + + private DataWarehouseUserActivitiesOperations dataWarehouseUserActivitiesOperations; + + private DeletedServers deletedServers; + + private ElasticPoolOperations elasticPoolOperations; + + private EncryptionProtectors encryptionProtectors; + + private FailoverGroups failoverGroups; + + private FirewallRules firewallRules; + + private InstanceFailoverGroups instanceFailoverGroups; + + private InstancePools instancePools; + + 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 Capabilities capabilities; + + private LongTermRetentionPolicies longTermRetentionPolicies; + + private MaintenanceWindowOptionsOperations maintenanceWindowOptionsOperations; + + private MaintenanceWindowsOperations maintenanceWindowsOperations; + + private ManagedBackupShortTermRetentionPolicies managedBackupShortTermRetentionPolicies; + + private ManagedDatabaseColumns managedDatabaseColumns; + + private ManagedDatabaseQueries managedDatabaseQueries; + + private ManagedDatabaseSchemas managedDatabaseSchemas; + + private ManagedDatabaseSecurityAlertPolicies managedDatabaseSecurityAlertPolicies; + + private ManagedDatabaseSecurityEvents managedDatabaseSecurityEvents; + + private ManagedDatabaseTables managedDatabaseTables; + + private ManagedDatabaseTransparentDataEncryptions managedDatabaseTransparentDataEncryptions; + + private ManagedDatabaseVulnerabilityAssessmentRuleBaselines managedDatabaseVulnerabilityAssessmentRuleBaselines; + + private ManagedDatabaseVulnerabilityAssessments managedDatabaseVulnerabilityAssessments; + + private ManagedDatabaseVulnerabilityAssessmentScans managedDatabaseVulnerabilityAssessmentScans; + + private ManagedInstanceAdministrators managedInstanceAdministrators; + + private ManagedInstanceAzureADOnlyAuthentications managedInstanceAzureADOnlyAuthentications; + + private ManagedInstanceEncryptionProtectors managedInstanceEncryptionProtectors; + + private ManagedInstanceKeys managedInstanceKeys; + + private ManagedInstanceLongTermRetentionPolicies managedInstanceLongTermRetentionPolicies; + + private ManagedInstanceOperations managedInstanceOperations; + + private ManagedInstancePrivateEndpointConnections managedInstancePrivateEndpointConnections; + + private ManagedInstancePrivateLinkResources managedInstancePrivateLinkResources; + + private ManagedInstanceTdeCertificates managedInstanceTdeCertificates; + + private ManagedInstanceVulnerabilityAssessments managedInstanceVulnerabilityAssessments; + + private ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies + managedRestorableDroppedDatabaseBackupShortTermRetentionPolicies; + + private ManagedServerSecurityAlertPolicies managedServerSecurityAlertPolicies; + + private Operations operations; + + private PrivateEndpointConnections privateEndpointConnections; + + private PrivateLinkResources privateLinkResources; + + private RecoverableManagedDatabases recoverableManagedDatabases; + + private RestorePoints restorePoints; + + private ServerAdvisors serverAdvisors; + + private ServerAutomaticTunings serverAutomaticTunings; + + private ServerAzureADAdministrators serverAzureADAdministrators; + + private ServerAzureADOnlyAuthentications serverAzureADOnlyAuthentications; + + private ServerDevOpsAuditSettings serverDevOpsAuditSettings; + + private ServerDnsAliases serverDnsAliases; + + private ServerKeys serverKeys; + + private ServerOperations serverOperations; + + private ServerSecurityAlertPolicies serverSecurityAlertPolicies; + + private ServerTrustGroups serverTrustGroups; + + private ServerVulnerabilityAssessments serverVulnerabilityAssessments; + + private SqlAgents sqlAgents; + + private SubscriptionUsages subscriptionUsages; + + private SyncAgents syncAgents; + + private SyncGroups syncGroups; + + private SyncMembers syncMembers; + + private TdeCertificates tdeCertificates; + + private TimeZones timeZones; + + private VirtualNetworkRules virtualNetworkRules; + + private WorkloadClassifiers workloadClassifiers; + + private WorkloadGroups workloadGroups; + + private TransparentDataEncryptions transparentDataEncryptions; + + private BackupShortTermRetentionPolicies backupShortTermRetentionPolicies; + + private DatabaseExtensionsOperations databaseExtensionsOperations; + + private DatabaseOperations databaseOperations; + + private DatabaseUsages databaseUsages; + + private LedgerDigestUploadsOperations ledgerDigestUploadsOperations; + + private OutboundFirewallRules outboundFirewallRules; + + private Servers servers; + + private Usages usages; + + private LongTermRetentionBackups longTermRetentionBackups; + + private LongTermRetentionManagedInstanceBackups longTermRetentionManagedInstanceBackups; + + private ManagedInstances managedInstances; + + private RestorableDroppedDatabases restorableDroppedDatabases; + + private RestorableDroppedManagedDatabases restorableDroppedManagedDatabases; + + private ServerConnectionPolicies serverConnectionPolicies; + + private DistributedAvailabilityGroups distributedAvailabilityGroups; + + private ServerTrustCertificates serverTrustCertificates; + + private IPv6FirewallRules iPv6FirewallRules; + + private EndpointCertificates endpointCertificates; + + private ManagedDatabaseSensitivityLabels managedDatabaseSensitivityLabels; + + private ManagedDatabaseRecommendedSensitivityLabels managedDatabaseRecommendedSensitivityLabels; + + private SensitivityLabels sensitivityLabels; + + private RecommendedSensitivityLabels recommendedSensitivityLabels; + + private ServerBlobAuditingPolicies serverBlobAuditingPolicies; + + private DatabaseBlobAuditingPolicies databaseBlobAuditingPolicies; + + private ExtendedDatabaseBlobAuditingPolicies extendedDatabaseBlobAuditingPolicies; + + private ExtendedServerBlobAuditingPolicies extendedServerBlobAuditingPolicies; + + private DatabaseAdvancedThreatProtectionSettings databaseAdvancedThreatProtectionSettings; + + private ServerAdvancedThreatProtectionSettings serverAdvancedThreatProtectionSettings; + + private ManagedServerDnsAliases managedServerDnsAliases; + + private DatabaseSqlVulnerabilityAssessmentBaselines databaseSqlVulnerabilityAssessmentBaselines; + + private DatabaseSqlVulnerabilityAssessmentExecuteScans databaseSqlVulnerabilityAssessmentExecuteScans; + + private DatabaseSqlVulnerabilityAssessmentRuleBaselines databaseSqlVulnerabilityAssessmentRuleBaselines; + + private DatabaseSqlVulnerabilityAssessmentScanResults databaseSqlVulnerabilityAssessmentScanResults; + + private DatabaseSqlVulnerabilityAssessmentScans databaseSqlVulnerabilityAssessmentScans; + + private DatabaseSqlVulnerabilityAssessmentsSettings databaseSqlVulnerabilityAssessmentsSettings; + + private ManagedDatabaseAdvancedThreatProtectionSettings managedDatabaseAdvancedThreatProtectionSettings; + + private ManagedDatabaseRestoreDetails managedDatabaseRestoreDetails; + + private ManagedDatabases managedDatabases; + + private ManagedInstanceAdvancedThreatProtectionSettings managedInstanceAdvancedThreatProtectionSettings; + + private ReplicationLinks replicationLinks; + + private SqlVulnerabilityAssessmentBaselines sqlVulnerabilityAssessmentBaselines; + + private SqlVulnerabilityAssessmentBaselinesOperations sqlVulnerabilityAssessmentBaselinesOperations; + + private SqlVulnerabilityAssessmentExecuteScans sqlVulnerabilityAssessmentExecuteScans; + + private SqlVulnerabilityAssessmentRuleBaselines sqlVulnerabilityAssessmentRuleBaselines; + + private SqlVulnerabilityAssessmentRuleBaselinesOperations sqlVulnerabilityAssessmentRuleBaselinesOperations; + + private SqlVulnerabilityAssessmentScanResultOperations sqlVulnerabilityAssessmentScanResultOperations; + + private SqlVulnerabilityAssessmentScans sqlVulnerabilityAssessmentScans; + + private SqlVulnerabilityAssessmentsSettings sqlVulnerabilityAssessmentsSettings; + + private SqlVulnerabilityAssessments sqlVulnerabilityAssessments; + + private ManagedDatabaseMoveOperations managedDatabaseMoveOperations; + + private ManagedInstanceDtcs managedInstanceDtcs; + + private SynapseLinkWorkspaces synapseLinkWorkspaces; + + private VirtualClusters virtualClusters; + + private final SqlManagementClient clientObject; + + private SqlManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new SqlManagementClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of Sql service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Sql service API instance. + */ + public static SqlManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Creates an instance of Sql service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the Sql service API instance. + */ + public static SqlManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new SqlManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create SqlManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new SqlManager.Configurable(); + } + + /** The Configurable allowing configurations to be set. */ + public static final class Configurable { + private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private RetryOptions retryOptions; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the retry options for the HTTP pipeline retry policy. + * + *

This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. + * + * @param retryOptions the retry options for the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryOptions(RetryOptions retryOptions) { + this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = + Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of Sql service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Sql service API instance. + */ + public SqlManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder + .append("azsdk-java") + .append("-") + .append("com.azure.resourcemanager.sql.generated") + .append("/") + .append("1.0.0-beta.1"); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder + .append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + if (retryOptions != null) { + retryPolicy = new RetryPolicy(retryOptions); + } else { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new AddHeadersFromContextPolicy()); + policies.add(new RequestIdPolicy()); + policies + .addAll( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies + .addAll( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new SqlManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of RecoverableDatabases. + * + * @return Resource collection API of RecoverableDatabases. + */ + public RecoverableDatabases recoverableDatabases() { + if (this.recoverableDatabases == null) { + this.recoverableDatabases = new RecoverableDatabasesImpl(clientObject.getRecoverableDatabases(), this); + } + return recoverableDatabases; + } + + /** + * Gets the resource collection API of DataMaskingPolicies. It manages DataMaskingPolicy. + * + * @return Resource collection API of DataMaskingPolicies. + */ + public DataMaskingPolicies dataMaskingPolicies() { + if (this.dataMaskingPolicies == null) { + this.dataMaskingPolicies = new DataMaskingPoliciesImpl(clientObject.getDataMaskingPolicies(), this); + } + return dataMaskingPolicies; + } + + /** + * Gets the resource collection API of DataMaskingRules. It manages DataMaskingRule. + * + * @return Resource collection API of DataMaskingRules. + */ + public DataMaskingRules dataMaskingRules() { + if (this.dataMaskingRules == null) { + this.dataMaskingRules = new DataMaskingRulesImpl(clientObject.getDataMaskingRules(), this); + } + return dataMaskingRules; + } + + /** + * Gets the resource collection API of GeoBackupPolicies. It manages GeoBackupPolicy. + * + * @return Resource collection API of GeoBackupPolicies. + */ + public GeoBackupPolicies geoBackupPolicies() { + if (this.geoBackupPolicies == null) { + this.geoBackupPolicies = new GeoBackupPoliciesImpl(clientObject.getGeoBackupPolicies(), this); + } + return geoBackupPolicies; + } + + /** + * Gets the resource collection API of Databases. It manages Database. + * + * @return Resource collection API of Databases. + */ + public Databases databases() { + if (this.databases == null) { + this.databases = new DatabasesImpl(clientObject.getDatabases(), this); + } + return databases; + } + + /** + * Gets the resource collection API of ElasticPools. It manages ElasticPool. + * + * @return Resource collection API of ElasticPools. + */ + public ElasticPools elasticPools() { + if (this.elasticPools == null) { + this.elasticPools = new ElasticPoolsImpl(clientObject.getElasticPools(), this); + } + return elasticPools; + } + + /** + * Gets the resource collection API of ServerCommunicationLinks. It manages ServerCommunicationLink. + * + * @return Resource collection API of ServerCommunicationLinks. + */ + public ServerCommunicationLinks serverCommunicationLinks() { + if (this.serverCommunicationLinks == null) { + this.serverCommunicationLinks = + new ServerCommunicationLinksImpl(clientObject.getServerCommunicationLinks(), this); + } + return serverCommunicationLinks; + } + + /** + * Gets the resource collection API of ServiceObjectives. + * + * @return Resource collection API of ServiceObjectives. + */ + public ServiceObjectives serviceObjectives() { + if (this.serviceObjectives == null) { + this.serviceObjectives = new ServiceObjectivesImpl(clientObject.getServiceObjectives(), this); + } + return serviceObjectives; + } + + /** + * Gets the resource collection API of ElasticPoolActivities. + * + * @return Resource collection API of ElasticPoolActivities. + */ + public ElasticPoolActivities elasticPoolActivities() { + if (this.elasticPoolActivities == null) { + this.elasticPoolActivities = new ElasticPoolActivitiesImpl(clientObject.getElasticPoolActivities(), this); + } + return elasticPoolActivities; + } + + /** + * Gets the resource collection API of ElasticPoolDatabaseActivities. + * + * @return Resource collection API of ElasticPoolDatabaseActivities. + */ + public ElasticPoolDatabaseActivities elasticPoolDatabaseActivities() { + if (this.elasticPoolDatabaseActivities == null) { + this.elasticPoolDatabaseActivities = + new ElasticPoolDatabaseActivitiesImpl(clientObject.getElasticPoolDatabaseActivities(), this); + } + return elasticPoolDatabaseActivities; + } + + /** + * Gets the resource collection API of ServerUsages. + * + * @return Resource collection API of ServerUsages. + */ + public ServerUsages serverUsages() { + if (this.serverUsages == null) { + this.serverUsages = new ServerUsagesImpl(clientObject.getServerUsages(), this); + } + return serverUsages; + } + + /** + * Gets the resource collection API of DatabaseAdvisors. + * + * @return Resource collection API of DatabaseAdvisors. + */ + public DatabaseAdvisors databaseAdvisors() { + if (this.databaseAdvisors == null) { + this.databaseAdvisors = new DatabaseAdvisorsImpl(clientObject.getDatabaseAdvisors(), this); + } + return databaseAdvisors; + } + + /** + * Gets the resource collection API of DatabaseAutomaticTunings. + * + * @return Resource collection API of DatabaseAutomaticTunings. + */ + public DatabaseAutomaticTunings databaseAutomaticTunings() { + if (this.databaseAutomaticTunings == null) { + this.databaseAutomaticTunings = + new DatabaseAutomaticTuningsImpl(clientObject.getDatabaseAutomaticTunings(), this); + } + return databaseAutomaticTunings; + } + + /** + * Gets the resource collection API of DatabaseColumns. + * + * @return Resource collection API of DatabaseColumns. + */ + public DatabaseColumns databaseColumns() { + if (this.databaseColumns == null) { + this.databaseColumns = new DatabaseColumnsImpl(clientObject.getDatabaseColumns(), this); + } + return databaseColumns; + } + + /** + * Gets the resource collection API of DatabaseRecommendedActions. + * + * @return Resource collection API of DatabaseRecommendedActions. + */ + public DatabaseRecommendedActions databaseRecommendedActions() { + if (this.databaseRecommendedActions == null) { + this.databaseRecommendedActions = + new DatabaseRecommendedActionsImpl(clientObject.getDatabaseRecommendedActions(), this); + } + return databaseRecommendedActions; + } + + /** + * Gets the resource collection API of DatabaseSchemas. + * + * @return Resource collection API of DatabaseSchemas. + */ + public DatabaseSchemas databaseSchemas() { + if (this.databaseSchemas == null) { + this.databaseSchemas = new DatabaseSchemasImpl(clientObject.getDatabaseSchemas(), this); + } + return databaseSchemas; + } + + /** + * Gets the resource collection API of DatabaseSecurityAlertPolicies. It manages DatabaseSecurityAlertPolicy. + * + * @return Resource collection API of DatabaseSecurityAlertPolicies. + */ + public DatabaseSecurityAlertPolicies databaseSecurityAlertPolicies() { + if (this.databaseSecurityAlertPolicies == null) { + this.databaseSecurityAlertPolicies = + new DatabaseSecurityAlertPoliciesImpl(clientObject.getDatabaseSecurityAlertPolicies(), this); + } + return databaseSecurityAlertPolicies; + } + + /** + * Gets the resource collection API of DatabaseTables. + * + * @return Resource collection API of DatabaseTables. + */ + public DatabaseTables databaseTables() { + if (this.databaseTables == null) { + this.databaseTables = new DatabaseTablesImpl(clientObject.getDatabaseTables(), this); + } + return databaseTables; + } + + /** + * Gets the resource collection API of DatabaseVulnerabilityAssessmentRuleBaselines. It manages + * DatabaseVulnerabilityAssessmentRuleBaseline. + * + * @return Resource collection API of DatabaseVulnerabilityAssessmentRuleBaselines. + */ + public DatabaseVulnerabilityAssessmentRuleBaselines databaseVulnerabilityAssessmentRuleBaselines() { + if (this.databaseVulnerabilityAssessmentRuleBaselines == null) { + this.databaseVulnerabilityAssessmentRuleBaselines = + new DatabaseVulnerabilityAssessmentRuleBaselinesImpl( + clientObject.getDatabaseVulnerabilityAssessmentRuleBaselines(), this); + } + return databaseVulnerabilityAssessmentRuleBaselines; + } + + /** + * Gets the resource collection API of DatabaseVulnerabilityAssessments. It manages DatabaseVulnerabilityAssessment. + * + * @return Resource collection API of DatabaseVulnerabilityAssessments. + */ + public DatabaseVulnerabilityAssessments databaseVulnerabilityAssessments() { + if (this.databaseVulnerabilityAssessments == null) { + this.databaseVulnerabilityAssessments = + new DatabaseVulnerabilityAssessmentsImpl(clientObject.getDatabaseVulnerabilityAssessments(), this); + } + return databaseVulnerabilityAssessments; + } + + /** + * Gets the resource collection API of DatabaseVulnerabilityAssessmentScans. + * + * @return Resource collection API of DatabaseVulnerabilityAssessmentScans. + */ + public DatabaseVulnerabilityAssessmentScans databaseVulnerabilityAssessmentScans() { + if (this.databaseVulnerabilityAssessmentScans == null) { + this.databaseVulnerabilityAssessmentScans = + new DatabaseVulnerabilityAssessmentScansImpl( + clientObject.getDatabaseVulnerabilityAssessmentScans(), this); + } + return databaseVulnerabilityAssessmentScans; + } + + /** + * Gets the resource collection API of DataWarehouseUserActivitiesOperations. + * + * @return Resource collection API of DataWarehouseUserActivitiesOperations. + */ + public DataWarehouseUserActivitiesOperations dataWarehouseUserActivitiesOperations() { + if (this.dataWarehouseUserActivitiesOperations == null) { + this.dataWarehouseUserActivitiesOperations = + new DataWarehouseUserActivitiesOperationsImpl( + clientObject.getDataWarehouseUserActivitiesOperations(), this); + } + return dataWarehouseUserActivitiesOperations; + } + + /** + * Gets the resource collection API of DeletedServers. + * + * @return Resource collection API of DeletedServers. + */ + public DeletedServers deletedServers() { + if (this.deletedServers == null) { + this.deletedServers = new DeletedServersImpl(clientObject.getDeletedServers(), this); + } + return deletedServers; + } + + /** + * Gets the resource collection API of ElasticPoolOperations. + * + * @return Resource collection API of ElasticPoolOperations. + */ + public ElasticPoolOperations elasticPoolOperations() { + if (this.elasticPoolOperations == null) { + this.elasticPoolOperations = new ElasticPoolOperationsImpl(clientObject.getElasticPoolOperations(), this); + } + return elasticPoolOperations; + } + + /** + * Gets the resource collection API of EncryptionProtectors. It manages EncryptionProtector. + * + * @return Resource collection API of EncryptionProtectors. + */ + public EncryptionProtectors encryptionProtectors() { + if (this.encryptionProtectors == null) { + this.encryptionProtectors = new EncryptionProtectorsImpl(clientObject.getEncryptionProtectors(), this); + } + return encryptionProtectors; + } + + /** + * Gets the resource collection API of FailoverGroups. It manages FailoverGroup. + * + * @return Resource collection API of FailoverGroups. + */ + public FailoverGroups failoverGroups() { + if (this.failoverGroups == null) { + this.failoverGroups = new FailoverGroupsImpl(clientObject.getFailoverGroups(), this); + } + return failoverGroups; + } + + /** + * Gets the resource collection API of FirewallRules. It manages FirewallRule. + * + * @return Resource collection API of FirewallRules. + */ + public FirewallRules firewallRules() { + if (this.firewallRules == null) { + this.firewallRules = new FirewallRulesImpl(clientObject.getFirewallRules(), this); + } + return firewallRules; + } + + /** + * Gets the resource collection API of InstanceFailoverGroups. It manages InstanceFailoverGroup. + * + * @return Resource collection API of InstanceFailoverGroups. + */ + public InstanceFailoverGroups instanceFailoverGroups() { + if (this.instanceFailoverGroups == null) { + this.instanceFailoverGroups = + new InstanceFailoverGroupsImpl(clientObject.getInstanceFailoverGroups(), this); + } + return instanceFailoverGroups; + } + + /** + * Gets the resource collection API of InstancePools. It manages InstancePool. + * + * @return Resource collection API of InstancePools. + */ + public InstancePools instancePools() { + if (this.instancePools == null) { + this.instancePools = new InstancePoolsImpl(clientObject.getInstancePools(), this); + } + return instancePools; + } + + /** + * Gets the resource collection API of JobAgents. It manages JobAgent. + * + * @return Resource collection API of JobAgents. + */ + public JobAgents jobAgents() { + if (this.jobAgents == null) { + this.jobAgents = new JobAgentsImpl(clientObject.getJobAgents(), this); + } + return jobAgents; + } + + /** + * Gets the resource collection API of JobCredentials. It manages JobCredential. + * + * @return Resource collection API of JobCredentials. + */ + public JobCredentials jobCredentials() { + if (this.jobCredentials == null) { + this.jobCredentials = new JobCredentialsImpl(clientObject.getJobCredentials(), this); + } + return jobCredentials; + } + + /** + * Gets the resource collection API of JobExecutions. + * + * @return Resource collection API of JobExecutions. + */ + public JobExecutions jobExecutions() { + if (this.jobExecutions == null) { + this.jobExecutions = new JobExecutionsImpl(clientObject.getJobExecutions(), this); + } + return jobExecutions; + } + + /** + * Gets the resource collection API of Jobs. It manages Job. + * + * @return Resource collection API of Jobs. + */ + public Jobs jobs() { + if (this.jobs == null) { + this.jobs = new JobsImpl(clientObject.getJobs(), this); + } + return jobs; + } + + /** + * Gets the resource collection API of JobStepExecutions. + * + * @return Resource collection API of JobStepExecutions. + */ + public JobStepExecutions jobStepExecutions() { + if (this.jobStepExecutions == null) { + this.jobStepExecutions = new JobStepExecutionsImpl(clientObject.getJobStepExecutions(), this); + } + return jobStepExecutions; + } + + /** + * Gets the resource collection API of JobSteps. It manages JobStep. + * + * @return Resource collection API of JobSteps. + */ + public JobSteps jobSteps() { + if (this.jobSteps == null) { + this.jobSteps = new JobStepsImpl(clientObject.getJobSteps(), this); + } + return jobSteps; + } + + /** + * Gets the resource collection API of JobTargetExecutions. + * + * @return Resource collection API of JobTargetExecutions. + */ + public JobTargetExecutions jobTargetExecutions() { + if (this.jobTargetExecutions == null) { + this.jobTargetExecutions = new JobTargetExecutionsImpl(clientObject.getJobTargetExecutions(), this); + } + return jobTargetExecutions; + } + + /** + * Gets the resource collection API of JobTargetGroups. It manages JobTargetGroup. + * + * @return Resource collection API of JobTargetGroups. + */ + public JobTargetGroups jobTargetGroups() { + if (this.jobTargetGroups == null) { + this.jobTargetGroups = new JobTargetGroupsImpl(clientObject.getJobTargetGroups(), this); + } + return jobTargetGroups; + } + + /** + * Gets the resource collection API of JobVersions. + * + * @return Resource collection API of JobVersions. + */ + public JobVersions jobVersions() { + if (this.jobVersions == null) { + this.jobVersions = new JobVersionsImpl(clientObject.getJobVersions(), this); + } + return jobVersions; + } + + /** + * Gets the resource collection API of Capabilities. + * + * @return Resource collection API of Capabilities. + */ + public Capabilities capabilities() { + if (this.capabilities == null) { + this.capabilities = new CapabilitiesImpl(clientObject.getCapabilities(), this); + } + return capabilities; + } + + /** + * Gets the resource collection API of LongTermRetentionPolicies. It manages LongTermRetentionPolicy. + * + * @return Resource collection API of LongTermRetentionPolicies. + */ + public LongTermRetentionPolicies longTermRetentionPolicies() { + if (this.longTermRetentionPolicies == null) { + this.longTermRetentionPolicies = + new LongTermRetentionPoliciesImpl(clientObject.getLongTermRetentionPolicies(), this); + } + return longTermRetentionPolicies; + } + + /** + * Gets the resource collection API of MaintenanceWindowOptionsOperations. + * + * @return Resource collection API of MaintenanceWindowOptionsOperations. + */ + public MaintenanceWindowOptionsOperations maintenanceWindowOptionsOperations() { + if (this.maintenanceWindowOptionsOperations == null) { + this.maintenanceWindowOptionsOperations = + new MaintenanceWindowOptionsOperationsImpl(clientObject.getMaintenanceWindowOptionsOperations(), this); + } + return maintenanceWindowOptionsOperations; + } + + /** + * Gets the resource collection API of MaintenanceWindowsOperations. + * + * @return Resource collection API of MaintenanceWindowsOperations. + */ + public MaintenanceWindowsOperations maintenanceWindowsOperations() { + if (this.maintenanceWindowsOperations == null) { + this.maintenanceWindowsOperations = + new MaintenanceWindowsOperationsImpl(clientObject.getMaintenanceWindowsOperations(), this); + } + return maintenanceWindowsOperations; + } + + /** + * Gets the resource collection API of ManagedBackupShortTermRetentionPolicies. It manages + * ManagedBackupShortTermRetentionPolicy. + * + * @return Resource collection API of ManagedBackupShortTermRetentionPolicies. + */ + public ManagedBackupShortTermRetentionPolicies managedBackupShortTermRetentionPolicies() { + if (this.managedBackupShortTermRetentionPolicies == null) { + this.managedBackupShortTermRetentionPolicies = + new ManagedBackupShortTermRetentionPoliciesImpl( + clientObject.getManagedBackupShortTermRetentionPolicies(), this); + } + return managedBackupShortTermRetentionPolicies; + } + + /** + * Gets the resource collection API of ManagedDatabaseColumns. + * + * @return Resource collection API of ManagedDatabaseColumns. + */ + public ManagedDatabaseColumns managedDatabaseColumns() { + if (this.managedDatabaseColumns == null) { + this.managedDatabaseColumns = + new ManagedDatabaseColumnsImpl(clientObject.getManagedDatabaseColumns(), this); + } + return managedDatabaseColumns; + } + + /** + * Gets the resource collection API of ManagedDatabaseQueries. + * + * @return Resource collection API of ManagedDatabaseQueries. + */ + public ManagedDatabaseQueries managedDatabaseQueries() { + if (this.managedDatabaseQueries == null) { + this.managedDatabaseQueries = + new ManagedDatabaseQueriesImpl(clientObject.getManagedDatabaseQueries(), this); + } + return managedDatabaseQueries; + } + + /** + * Gets the resource collection API of ManagedDatabaseSchemas. + * + * @return Resource collection API of ManagedDatabaseSchemas. + */ + public ManagedDatabaseSchemas managedDatabaseSchemas() { + if (this.managedDatabaseSchemas == null) { + this.managedDatabaseSchemas = + new ManagedDatabaseSchemasImpl(clientObject.getManagedDatabaseSchemas(), this); + } + return managedDatabaseSchemas; + } + + /** + * Gets the resource collection API of ManagedDatabaseSecurityAlertPolicies. It manages + * ManagedDatabaseSecurityAlertPolicy. + * + * @return Resource collection API of ManagedDatabaseSecurityAlertPolicies. + */ + public ManagedDatabaseSecurityAlertPolicies managedDatabaseSecurityAlertPolicies() { + if (this.managedDatabaseSecurityAlertPolicies == null) { + this.managedDatabaseSecurityAlertPolicies = + new ManagedDatabaseSecurityAlertPoliciesImpl( + clientObject.getManagedDatabaseSecurityAlertPolicies(), this); + } + return managedDatabaseSecurityAlertPolicies; + } + + /** + * Gets the resource collection API of ManagedDatabaseSecurityEvents. + * + * @return Resource collection API of ManagedDatabaseSecurityEvents. + */ + public ManagedDatabaseSecurityEvents managedDatabaseSecurityEvents() { + if (this.managedDatabaseSecurityEvents == null) { + this.managedDatabaseSecurityEvents = + new ManagedDatabaseSecurityEventsImpl(clientObject.getManagedDatabaseSecurityEvents(), this); + } + return managedDatabaseSecurityEvents; + } + + /** + * Gets the resource collection API of ManagedDatabaseTables. + * + * @return Resource collection API of ManagedDatabaseTables. + */ + public ManagedDatabaseTables managedDatabaseTables() { + if (this.managedDatabaseTables == null) { + this.managedDatabaseTables = new ManagedDatabaseTablesImpl(clientObject.getManagedDatabaseTables(), this); + } + return managedDatabaseTables; + } + + /** + * Gets the resource collection API of ManagedDatabaseTransparentDataEncryptions. It manages + * ManagedTransparentDataEncryption. + * + * @return Resource collection API of ManagedDatabaseTransparentDataEncryptions. + */ + public ManagedDatabaseTransparentDataEncryptions managedDatabaseTransparentDataEncryptions() { + if (this.managedDatabaseTransparentDataEncryptions == null) { + this.managedDatabaseTransparentDataEncryptions = + new ManagedDatabaseTransparentDataEncryptionsImpl( + clientObject.getManagedDatabaseTransparentDataEncryptions(), this); + } + return managedDatabaseTransparentDataEncryptions; + } + + /** + * Gets the resource collection API of ManagedDatabaseVulnerabilityAssessmentRuleBaselines. + * + * @return Resource collection API of ManagedDatabaseVulnerabilityAssessmentRuleBaselines. + */ + public ManagedDatabaseVulnerabilityAssessmentRuleBaselines managedDatabaseVulnerabilityAssessmentRuleBaselines() { + if (this.managedDatabaseVulnerabilityAssessmentRuleBaselines == null) { + this.managedDatabaseVulnerabilityAssessmentRuleBaselines = + new ManagedDatabaseVulnerabilityAssessmentRuleBaselinesImpl( + clientObject.getManagedDatabaseVulnerabilityAssessmentRuleBaselines(), this); + } + return managedDatabaseVulnerabilityAssessmentRuleBaselines; + } + + /** + * Gets the resource collection API of ManagedDatabaseVulnerabilityAssessments. + * + * @return Resource collection API of ManagedDatabaseVulnerabilityAssessments. + */ + public ManagedDatabaseVulnerabilityAssessments managedDatabaseVulnerabilityAssessments() { + if (this.managedDatabaseVulnerabilityAssessments == null) { + this.managedDatabaseVulnerabilityAssessments = + new ManagedDatabaseVulnerabilityAssessmentsImpl( + clientObject.getManagedDatabaseVulnerabilityAssessments(), this); + } + return managedDatabaseVulnerabilityAssessments; + } + + /** + * Gets the resource collection API of ManagedDatabaseVulnerabilityAssessmentScans. + * + * @return Resource collection API of ManagedDatabaseVulnerabilityAssessmentScans. + */ + public ManagedDatabaseVulnerabilityAssessmentScans managedDatabaseVulnerabilityAssessmentScans() { + if (this.managedDatabaseVulnerabilityAssessmentScans == null) { + this.managedDatabaseVulnerabilityAssessmentScans = + new ManagedDatabaseVulnerabilityAssessmentScansImpl( + clientObject.getManagedDatabaseVulnerabilityAssessmentScans(), this); + } + return managedDatabaseVulnerabilityAssessmentScans; + } + + /** + * Gets the resource collection API of ManagedInstanceAdministrators. It manages ManagedInstanceAdministrator. + * + * @return Resource collection API of ManagedInstanceAdministrators. + */ + public ManagedInstanceAdministrators managedInstanceAdministrators() { + if (this.managedInstanceAdministrators == null) { + this.managedInstanceAdministrators = + new ManagedInstanceAdministratorsImpl(clientObject.getManagedInstanceAdministrators(), this); + } + return managedInstanceAdministrators; + } + + /** + * Gets the resource collection API of ManagedInstanceAzureADOnlyAuthentications. It manages + * ManagedInstanceAzureADOnlyAuthentication. + * + * @return Resource collection API of ManagedInstanceAzureADOnlyAuthentications. + */ + public ManagedInstanceAzureADOnlyAuthentications managedInstanceAzureADOnlyAuthentications() { + if (this.managedInstanceAzureADOnlyAuthentications == null) { + this.managedInstanceAzureADOnlyAuthentications = + new ManagedInstanceAzureADOnlyAuthenticationsImpl( + clientObject.getManagedInstanceAzureADOnlyAuthentications(), this); + } + return managedInstanceAzureADOnlyAuthentications; + } + + /** + * Gets the resource collection API of ManagedInstanceEncryptionProtectors. It manages + * ManagedInstanceEncryptionProtector. + * + * @return Resource collection API of ManagedInstanceEncryptionProtectors. + */ + public ManagedInstanceEncryptionProtectors managedInstanceEncryptionProtectors() { + if (this.managedInstanceEncryptionProtectors == null) { + this.managedInstanceEncryptionProtectors = + new ManagedInstanceEncryptionProtectorsImpl( + clientObject.getManagedInstanceEncryptionProtectors(), this); + } + return managedInstanceEncryptionProtectors; + } + + /** + * Gets the resource collection API of ManagedInstanceKeys. It manages ManagedInstanceKey. + * + * @return Resource collection API of ManagedInstanceKeys. + */ + public ManagedInstanceKeys managedInstanceKeys() { + if (this.managedInstanceKeys == null) { + this.managedInstanceKeys = new ManagedInstanceKeysImpl(clientObject.getManagedInstanceKeys(), this); + } + return managedInstanceKeys; + } + + /** + * Gets the resource collection API of ManagedInstanceLongTermRetentionPolicies. It manages + * ManagedInstanceLongTermRetentionPolicy. + * + * @return Resource collection API of ManagedInstanceLongTermRetentionPolicies. + */ + public ManagedInstanceLongTermRetentionPolicies managedInstanceLongTermRetentionPolicies() { + if (this.managedInstanceLongTermRetentionPolicies == null) { + this.managedInstanceLongTermRetentionPolicies = + new ManagedInstanceLongTermRetentionPoliciesImpl( + clientObject.getManagedInstanceLongTermRetentionPolicies(), this); + } + return managedInstanceLongTermRetentionPolicies; + } + + /** + * Gets the resource collection API of ManagedInstanceOperations. + * + * @return Resource collection API of ManagedInstanceOperations. + */ + public ManagedInstanceOperations managedInstanceOperations() { + if (this.managedInstanceOperations == null) { + this.managedInstanceOperations = + new ManagedInstanceOperationsImpl(clientObject.getManagedInstanceOperations(), this); + } + return managedInstanceOperations; + } + + /** + * Gets the resource collection API of ManagedInstancePrivateEndpointConnections. It manages + * ManagedInstancePrivateEndpointConnection. + * + * @return Resource collection API of ManagedInstancePrivateEndpointConnections. + */ + public ManagedInstancePrivateEndpointConnections managedInstancePrivateEndpointConnections() { + if (this.managedInstancePrivateEndpointConnections == null) { + this.managedInstancePrivateEndpointConnections = + new ManagedInstancePrivateEndpointConnectionsImpl( + clientObject.getManagedInstancePrivateEndpointConnections(), this); + } + return managedInstancePrivateEndpointConnections; + } + + /** + * Gets the resource collection API of ManagedInstancePrivateLinkResources. + * + * @return Resource collection API of ManagedInstancePrivateLinkResources. + */ + public ManagedInstancePrivateLinkResources managedInstancePrivateLinkResources() { + if (this.managedInstancePrivateLinkResources == null) { + this.managedInstancePrivateLinkResources = + new ManagedInstancePrivateLinkResourcesImpl( + clientObject.getManagedInstancePrivateLinkResources(), this); + } + return managedInstancePrivateLinkResources; + } + + /** + * Gets the resource collection API of ManagedInstanceTdeCertificates. + * + * @return Resource collection API of ManagedInstanceTdeCertificates. + */ + public ManagedInstanceTdeCertificates managedInstanceTdeCertificates() { + if (this.managedInstanceTdeCertificates == null) { + this.managedInstanceTdeCertificates = + new ManagedInstanceTdeCertificatesImpl(clientObject.getManagedInstanceTdeCertificates(), this); + } + return managedInstanceTdeCertificates; + } + + /** + * Gets the resource collection API of ManagedInstanceVulnerabilityAssessments. It manages + * ManagedInstanceVulnerabilityAssessment. + * + * @return Resource collection API of ManagedInstanceVulnerabilityAssessments. + */ + public ManagedInstanceVulnerabilityAssessments managedInstanceVulnerabilityAssessments() { + if (this.managedInstanceVulnerabilityAssessments == null) { + this.managedInstanceVulnerabilityAssessments = + new ManagedInstanceVulnerabilityAssessmentsImpl( + clientObject.getManagedInstanceVulnerabilityAssessments(), this); + } + return managedInstanceVulnerabilityAssessments; + } + + /** + * Gets the resource collection API of ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies. + * + * @return Resource collection API of ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies. + */ + public ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies + managedRestorableDroppedDatabaseBackupShortTermRetentionPolicies() { + if (this.managedRestorableDroppedDatabaseBackupShortTermRetentionPolicies == null) { + this.managedRestorableDroppedDatabaseBackupShortTermRetentionPolicies = + new ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesImpl( + clientObject.getManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies(), this); + } + return managedRestorableDroppedDatabaseBackupShortTermRetentionPolicies; + } + + /** + * Gets the resource collection API of ManagedServerSecurityAlertPolicies. It manages + * ManagedServerSecurityAlertPolicy. + * + * @return Resource collection API of ManagedServerSecurityAlertPolicies. + */ + public ManagedServerSecurityAlertPolicies managedServerSecurityAlertPolicies() { + if (this.managedServerSecurityAlertPolicies == null) { + this.managedServerSecurityAlertPolicies = + new ManagedServerSecurityAlertPoliciesImpl(clientObject.getManagedServerSecurityAlertPolicies(), this); + } + return managedServerSecurityAlertPolicies; + } + + /** + * Gets the resource collection API of Operations. + * + * @return Resource collection API of Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** + * Gets the resource collection API of PrivateEndpointConnections. It manages PrivateEndpointConnection. + * + * @return Resource collection API of PrivateEndpointConnections. + */ + public PrivateEndpointConnections privateEndpointConnections() { + if (this.privateEndpointConnections == null) { + this.privateEndpointConnections = + new PrivateEndpointConnectionsImpl(clientObject.getPrivateEndpointConnections(), this); + } + return privateEndpointConnections; + } + + /** + * Gets the resource collection API of PrivateLinkResources. + * + * @return Resource collection API of PrivateLinkResources. + */ + public PrivateLinkResources privateLinkResources() { + if (this.privateLinkResources == null) { + this.privateLinkResources = new PrivateLinkResourcesImpl(clientObject.getPrivateLinkResources(), this); + } + return privateLinkResources; + } + + /** + * Gets the resource collection API of RecoverableManagedDatabases. + * + * @return Resource collection API of RecoverableManagedDatabases. + */ + public RecoverableManagedDatabases recoverableManagedDatabases() { + if (this.recoverableManagedDatabases == null) { + this.recoverableManagedDatabases = + new RecoverableManagedDatabasesImpl(clientObject.getRecoverableManagedDatabases(), this); + } + return recoverableManagedDatabases; + } + + /** + * Gets the resource collection API of RestorePoints. + * + * @return Resource collection API of RestorePoints. + */ + public RestorePoints restorePoints() { + if (this.restorePoints == null) { + this.restorePoints = new RestorePointsImpl(clientObject.getRestorePoints(), this); + } + return restorePoints; + } + + /** + * Gets the resource collection API of ServerAdvisors. + * + * @return Resource collection API of ServerAdvisors. + */ + public ServerAdvisors serverAdvisors() { + if (this.serverAdvisors == null) { + this.serverAdvisors = new ServerAdvisorsImpl(clientObject.getServerAdvisors(), this); + } + return serverAdvisors; + } + + /** + * Gets the resource collection API of ServerAutomaticTunings. + * + * @return Resource collection API of ServerAutomaticTunings. + */ + public ServerAutomaticTunings serverAutomaticTunings() { + if (this.serverAutomaticTunings == null) { + this.serverAutomaticTunings = + new ServerAutomaticTuningsImpl(clientObject.getServerAutomaticTunings(), this); + } + return serverAutomaticTunings; + } + + /** + * Gets the resource collection API of ServerAzureADAdministrators. It manages ServerAzureADAdministrator. + * + * @return Resource collection API of ServerAzureADAdministrators. + */ + public ServerAzureADAdministrators serverAzureADAdministrators() { + if (this.serverAzureADAdministrators == null) { + this.serverAzureADAdministrators = + new ServerAzureADAdministratorsImpl(clientObject.getServerAzureADAdministrators(), this); + } + return serverAzureADAdministrators; + } + + /** + * Gets the resource collection API of ServerAzureADOnlyAuthentications. It manages ServerAzureADOnlyAuthentication. + * + * @return Resource collection API of ServerAzureADOnlyAuthentications. + */ + public ServerAzureADOnlyAuthentications serverAzureADOnlyAuthentications() { + if (this.serverAzureADOnlyAuthentications == null) { + this.serverAzureADOnlyAuthentications = + new ServerAzureADOnlyAuthenticationsImpl(clientObject.getServerAzureADOnlyAuthentications(), this); + } + return serverAzureADOnlyAuthentications; + } + + /** + * Gets the resource collection API of ServerDevOpsAuditSettings. It manages ServerDevOpsAuditingSettings. + * + * @return Resource collection API of ServerDevOpsAuditSettings. + */ + public ServerDevOpsAuditSettings serverDevOpsAuditSettings() { + if (this.serverDevOpsAuditSettings == null) { + this.serverDevOpsAuditSettings = + new ServerDevOpsAuditSettingsImpl(clientObject.getServerDevOpsAuditSettings(), this); + } + return serverDevOpsAuditSettings; + } + + /** + * Gets the resource collection API of ServerDnsAliases. + * + * @return Resource collection API of ServerDnsAliases. + */ + public ServerDnsAliases serverDnsAliases() { + if (this.serverDnsAliases == null) { + this.serverDnsAliases = new ServerDnsAliasesImpl(clientObject.getServerDnsAliases(), this); + } + return serverDnsAliases; + } + + /** + * Gets the resource collection API of ServerKeys. It manages ServerKey. + * + * @return Resource collection API of ServerKeys. + */ + public ServerKeys serverKeys() { + if (this.serverKeys == null) { + this.serverKeys = new ServerKeysImpl(clientObject.getServerKeys(), this); + } + return serverKeys; + } + + /** + * Gets the resource collection API of ServerOperations. + * + * @return Resource collection API of ServerOperations. + */ + public ServerOperations serverOperations() { + if (this.serverOperations == null) { + this.serverOperations = new ServerOperationsImpl(clientObject.getServerOperations(), this); + } + return serverOperations; + } + + /** + * Gets the resource collection API of ServerSecurityAlertPolicies. It manages ServerSecurityAlertPolicy. + * + * @return Resource collection API of ServerSecurityAlertPolicies. + */ + public ServerSecurityAlertPolicies serverSecurityAlertPolicies() { + if (this.serverSecurityAlertPolicies == null) { + this.serverSecurityAlertPolicies = + new ServerSecurityAlertPoliciesImpl(clientObject.getServerSecurityAlertPolicies(), this); + } + return serverSecurityAlertPolicies; + } + + /** + * Gets the resource collection API of ServerTrustGroups. It manages ServerTrustGroup. + * + * @return Resource collection API of ServerTrustGroups. + */ + public ServerTrustGroups serverTrustGroups() { + if (this.serverTrustGroups == null) { + this.serverTrustGroups = new ServerTrustGroupsImpl(clientObject.getServerTrustGroups(), this); + } + return serverTrustGroups; + } + + /** + * Gets the resource collection API of ServerVulnerabilityAssessments. It manages ServerVulnerabilityAssessment. + * + * @return Resource collection API of ServerVulnerabilityAssessments. + */ + public ServerVulnerabilityAssessments serverVulnerabilityAssessments() { + if (this.serverVulnerabilityAssessments == null) { + this.serverVulnerabilityAssessments = + new ServerVulnerabilityAssessmentsImpl(clientObject.getServerVulnerabilityAssessments(), this); + } + return serverVulnerabilityAssessments; + } + + /** + * Gets the resource collection API of SqlAgents. + * + * @return Resource collection API of SqlAgents. + */ + public SqlAgents sqlAgents() { + if (this.sqlAgents == null) { + this.sqlAgents = new SqlAgentsImpl(clientObject.getSqlAgents(), this); + } + return sqlAgents; + } + + /** + * Gets the resource collection API of SubscriptionUsages. + * + * @return Resource collection API of SubscriptionUsages. + */ + public SubscriptionUsages subscriptionUsages() { + if (this.subscriptionUsages == null) { + this.subscriptionUsages = new SubscriptionUsagesImpl(clientObject.getSubscriptionUsages(), this); + } + return subscriptionUsages; + } + + /** + * Gets the resource collection API of SyncAgents. It manages SyncAgent. + * + * @return Resource collection API of SyncAgents. + */ + public SyncAgents syncAgents() { + if (this.syncAgents == null) { + this.syncAgents = new SyncAgentsImpl(clientObject.getSyncAgents(), this); + } + return syncAgents; + } + + /** + * Gets the resource collection API of SyncGroups. It manages SyncGroup. + * + * @return Resource collection API of SyncGroups. + */ + public SyncGroups syncGroups() { + if (this.syncGroups == null) { + this.syncGroups = new SyncGroupsImpl(clientObject.getSyncGroups(), this); + } + return syncGroups; + } + + /** + * Gets the resource collection API of SyncMembers. It manages SyncMember. + * + * @return Resource collection API of SyncMembers. + */ + public SyncMembers syncMembers() { + if (this.syncMembers == null) { + this.syncMembers = new SyncMembersImpl(clientObject.getSyncMembers(), this); + } + return syncMembers; + } + + /** + * Gets the resource collection API of TdeCertificates. + * + * @return Resource collection API of TdeCertificates. + */ + public TdeCertificates tdeCertificates() { + if (this.tdeCertificates == null) { + this.tdeCertificates = new TdeCertificatesImpl(clientObject.getTdeCertificates(), this); + } + return tdeCertificates; + } + + /** + * Gets the resource collection API of TimeZones. + * + * @return Resource collection API of TimeZones. + */ + public TimeZones timeZones() { + if (this.timeZones == null) { + this.timeZones = new TimeZonesImpl(clientObject.getTimeZones(), this); + } + return timeZones; + } + + /** + * Gets the resource collection API of VirtualNetworkRules. It manages VirtualNetworkRule. + * + * @return Resource collection API of VirtualNetworkRules. + */ + public VirtualNetworkRules virtualNetworkRules() { + if (this.virtualNetworkRules == null) { + this.virtualNetworkRules = new VirtualNetworkRulesImpl(clientObject.getVirtualNetworkRules(), this); + } + return virtualNetworkRules; + } + + /** + * Gets the resource collection API of WorkloadClassifiers. It manages WorkloadClassifier. + * + * @return Resource collection API of WorkloadClassifiers. + */ + public WorkloadClassifiers workloadClassifiers() { + if (this.workloadClassifiers == null) { + this.workloadClassifiers = new WorkloadClassifiersImpl(clientObject.getWorkloadClassifiers(), this); + } + return workloadClassifiers; + } + + /** + * Gets the resource collection API of WorkloadGroups. It manages WorkloadGroup. + * + * @return Resource collection API of WorkloadGroups. + */ + public WorkloadGroups workloadGroups() { + if (this.workloadGroups == null) { + this.workloadGroups = new WorkloadGroupsImpl(clientObject.getWorkloadGroups(), this); + } + return workloadGroups; + } + + /** + * Gets the resource collection API of TransparentDataEncryptions. It manages + * LogicalDatabaseTransparentDataEncryption. + * + * @return Resource collection API of TransparentDataEncryptions. + */ + public TransparentDataEncryptions transparentDataEncryptions() { + if (this.transparentDataEncryptions == null) { + this.transparentDataEncryptions = + new TransparentDataEncryptionsImpl(clientObject.getTransparentDataEncryptions(), this); + } + return transparentDataEncryptions; + } + + /** + * Gets the resource collection API of BackupShortTermRetentionPolicies. It manages BackupShortTermRetentionPolicy. + * + * @return Resource collection API of BackupShortTermRetentionPolicies. + */ + public BackupShortTermRetentionPolicies backupShortTermRetentionPolicies() { + if (this.backupShortTermRetentionPolicies == null) { + this.backupShortTermRetentionPolicies = + new BackupShortTermRetentionPoliciesImpl(clientObject.getBackupShortTermRetentionPolicies(), this); + } + return backupShortTermRetentionPolicies; + } + + /** + * Gets the resource collection API of DatabaseExtensionsOperations. It manages + * ImportExportExtensionsOperationResult. + * + * @return Resource collection API of DatabaseExtensionsOperations. + */ + public DatabaseExtensionsOperations databaseExtensionsOperations() { + if (this.databaseExtensionsOperations == null) { + this.databaseExtensionsOperations = + new DatabaseExtensionsOperationsImpl(clientObject.getDatabaseExtensionsOperations(), this); + } + return databaseExtensionsOperations; + } + + /** + * Gets the resource collection API of DatabaseOperations. + * + * @return Resource collection API of DatabaseOperations. + */ + public DatabaseOperations databaseOperations() { + if (this.databaseOperations == null) { + this.databaseOperations = new DatabaseOperationsImpl(clientObject.getDatabaseOperations(), this); + } + return databaseOperations; + } + + /** + * Gets the resource collection API of DatabaseUsages. + * + * @return Resource collection API of DatabaseUsages. + */ + public DatabaseUsages databaseUsages() { + if (this.databaseUsages == null) { + this.databaseUsages = new DatabaseUsagesImpl(clientObject.getDatabaseUsages(), this); + } + return databaseUsages; + } + + /** + * Gets the resource collection API of LedgerDigestUploadsOperations. It manages LedgerDigestUploads. + * + * @return Resource collection API of LedgerDigestUploadsOperations. + */ + public LedgerDigestUploadsOperations ledgerDigestUploadsOperations() { + if (this.ledgerDigestUploadsOperations == null) { + this.ledgerDigestUploadsOperations = + new LedgerDigestUploadsOperationsImpl(clientObject.getLedgerDigestUploadsOperations(), this); + } + return ledgerDigestUploadsOperations; + } + + /** + * Gets the resource collection API of OutboundFirewallRules. It manages OutboundFirewallRule. + * + * @return Resource collection API of OutboundFirewallRules. + */ + public OutboundFirewallRules outboundFirewallRules() { + if (this.outboundFirewallRules == null) { + this.outboundFirewallRules = new OutboundFirewallRulesImpl(clientObject.getOutboundFirewallRules(), this); + } + return outboundFirewallRules; + } + + /** + * Gets the resource collection API of Servers. It manages Server. + * + * @return Resource collection API of Servers. + */ + public Servers servers() { + if (this.servers == null) { + this.servers = new ServersImpl(clientObject.getServers(), this); + } + return servers; + } + + /** + * Gets the resource collection API of Usages. + * + * @return Resource collection API of Usages. + */ + public Usages usages() { + if (this.usages == null) { + this.usages = new UsagesImpl(clientObject.getUsages(), this); + } + return usages; + } + + /** + * Gets the resource collection API of LongTermRetentionBackups. + * + * @return Resource collection API of LongTermRetentionBackups. + */ + public LongTermRetentionBackups longTermRetentionBackups() { + if (this.longTermRetentionBackups == null) { + this.longTermRetentionBackups = + new LongTermRetentionBackupsImpl(clientObject.getLongTermRetentionBackups(), this); + } + return longTermRetentionBackups; + } + + /** + * Gets the resource collection API of LongTermRetentionManagedInstanceBackups. + * + * @return Resource collection API of LongTermRetentionManagedInstanceBackups. + */ + public LongTermRetentionManagedInstanceBackups longTermRetentionManagedInstanceBackups() { + if (this.longTermRetentionManagedInstanceBackups == null) { + this.longTermRetentionManagedInstanceBackups = + new LongTermRetentionManagedInstanceBackupsImpl( + clientObject.getLongTermRetentionManagedInstanceBackups(), this); + } + return longTermRetentionManagedInstanceBackups; + } + + /** + * Gets the resource collection API of ManagedInstances. It manages ManagedInstance. + * + * @return Resource collection API of ManagedInstances. + */ + public ManagedInstances managedInstances() { + if (this.managedInstances == null) { + this.managedInstances = new ManagedInstancesImpl(clientObject.getManagedInstances(), this); + } + return managedInstances; + } + + /** + * Gets the resource collection API of RestorableDroppedDatabases. + * + * @return Resource collection API of RestorableDroppedDatabases. + */ + public RestorableDroppedDatabases restorableDroppedDatabases() { + if (this.restorableDroppedDatabases == null) { + this.restorableDroppedDatabases = + new RestorableDroppedDatabasesImpl(clientObject.getRestorableDroppedDatabases(), this); + } + return restorableDroppedDatabases; + } + + /** + * Gets the resource collection API of RestorableDroppedManagedDatabases. + * + * @return Resource collection API of RestorableDroppedManagedDatabases. + */ + public RestorableDroppedManagedDatabases restorableDroppedManagedDatabases() { + if (this.restorableDroppedManagedDatabases == null) { + this.restorableDroppedManagedDatabases = + new RestorableDroppedManagedDatabasesImpl(clientObject.getRestorableDroppedManagedDatabases(), this); + } + return restorableDroppedManagedDatabases; + } + + /** + * Gets the resource collection API of ServerConnectionPolicies. It manages ServerConnectionPolicy. + * + * @return Resource collection API of ServerConnectionPolicies. + */ + public ServerConnectionPolicies serverConnectionPolicies() { + if (this.serverConnectionPolicies == null) { + this.serverConnectionPolicies = + new ServerConnectionPoliciesImpl(clientObject.getServerConnectionPolicies(), this); + } + return serverConnectionPolicies; + } + + /** + * Gets the resource collection API of DistributedAvailabilityGroups. It manages DistributedAvailabilityGroup. + * + * @return Resource collection API of DistributedAvailabilityGroups. + */ + public DistributedAvailabilityGroups distributedAvailabilityGroups() { + if (this.distributedAvailabilityGroups == null) { + this.distributedAvailabilityGroups = + new DistributedAvailabilityGroupsImpl(clientObject.getDistributedAvailabilityGroups(), this); + } + return distributedAvailabilityGroups; + } + + /** + * Gets the resource collection API of ServerTrustCertificates. It manages ServerTrustCertificate. + * + * @return Resource collection API of ServerTrustCertificates. + */ + public ServerTrustCertificates serverTrustCertificates() { + if (this.serverTrustCertificates == null) { + this.serverTrustCertificates = + new ServerTrustCertificatesImpl(clientObject.getServerTrustCertificates(), this); + } + return serverTrustCertificates; + } + + /** + * Gets the resource collection API of IPv6FirewallRules. It manages IPv6FirewallRule. + * + * @return Resource collection API of IPv6FirewallRules. + */ + public IPv6FirewallRules iPv6FirewallRules() { + if (this.iPv6FirewallRules == null) { + this.iPv6FirewallRules = new IPv6FirewallRulesImpl(clientObject.getIPv6FirewallRules(), this); + } + return iPv6FirewallRules; + } + + /** + * Gets the resource collection API of EndpointCertificates. + * + * @return Resource collection API of EndpointCertificates. + */ + public EndpointCertificates endpointCertificates() { + if (this.endpointCertificates == null) { + this.endpointCertificates = new EndpointCertificatesImpl(clientObject.getEndpointCertificates(), this); + } + return endpointCertificates; + } + + /** + * Gets the resource collection API of ManagedDatabaseSensitivityLabels. It manages SensitivityLabel. + * + * @return Resource collection API of ManagedDatabaseSensitivityLabels. + */ + public ManagedDatabaseSensitivityLabels managedDatabaseSensitivityLabels() { + if (this.managedDatabaseSensitivityLabels == null) { + this.managedDatabaseSensitivityLabels = + new ManagedDatabaseSensitivityLabelsImpl(clientObject.getManagedDatabaseSensitivityLabels(), this); + } + return managedDatabaseSensitivityLabels; + } + + /** + * Gets the resource collection API of ManagedDatabaseRecommendedSensitivityLabels. + * + * @return Resource collection API of ManagedDatabaseRecommendedSensitivityLabels. + */ + public ManagedDatabaseRecommendedSensitivityLabels managedDatabaseRecommendedSensitivityLabels() { + if (this.managedDatabaseRecommendedSensitivityLabels == null) { + this.managedDatabaseRecommendedSensitivityLabels = + new ManagedDatabaseRecommendedSensitivityLabelsImpl( + clientObject.getManagedDatabaseRecommendedSensitivityLabels(), this); + } + return managedDatabaseRecommendedSensitivityLabels; + } + + /** + * Gets the resource collection API of SensitivityLabels. + * + * @return Resource collection API of SensitivityLabels. + */ + public SensitivityLabels sensitivityLabels() { + if (this.sensitivityLabels == null) { + this.sensitivityLabels = new SensitivityLabelsImpl(clientObject.getSensitivityLabels(), this); + } + return sensitivityLabels; + } + + /** + * Gets the resource collection API of RecommendedSensitivityLabels. + * + * @return Resource collection API of RecommendedSensitivityLabels. + */ + public RecommendedSensitivityLabels recommendedSensitivityLabels() { + if (this.recommendedSensitivityLabels == null) { + this.recommendedSensitivityLabels = + new RecommendedSensitivityLabelsImpl(clientObject.getRecommendedSensitivityLabels(), this); + } + return recommendedSensitivityLabels; + } + + /** + * Gets the resource collection API of ServerBlobAuditingPolicies. It manages ServerBlobAuditingPolicy. + * + * @return Resource collection API of ServerBlobAuditingPolicies. + */ + public ServerBlobAuditingPolicies serverBlobAuditingPolicies() { + if (this.serverBlobAuditingPolicies == null) { + this.serverBlobAuditingPolicies = + new ServerBlobAuditingPoliciesImpl(clientObject.getServerBlobAuditingPolicies(), this); + } + return serverBlobAuditingPolicies; + } + + /** + * Gets the resource collection API of DatabaseBlobAuditingPolicies. It manages DatabaseBlobAuditingPolicy. + * + * @return Resource collection API of DatabaseBlobAuditingPolicies. + */ + public DatabaseBlobAuditingPolicies databaseBlobAuditingPolicies() { + if (this.databaseBlobAuditingPolicies == null) { + this.databaseBlobAuditingPolicies = + new DatabaseBlobAuditingPoliciesImpl(clientObject.getDatabaseBlobAuditingPolicies(), this); + } + return databaseBlobAuditingPolicies; + } + + /** + * Gets the resource collection API of ExtendedDatabaseBlobAuditingPolicies. It manages + * ExtendedDatabaseBlobAuditingPolicy. + * + * @return Resource collection API of ExtendedDatabaseBlobAuditingPolicies. + */ + public ExtendedDatabaseBlobAuditingPolicies extendedDatabaseBlobAuditingPolicies() { + if (this.extendedDatabaseBlobAuditingPolicies == null) { + this.extendedDatabaseBlobAuditingPolicies = + new ExtendedDatabaseBlobAuditingPoliciesImpl( + clientObject.getExtendedDatabaseBlobAuditingPolicies(), this); + } + return extendedDatabaseBlobAuditingPolicies; + } + + /** + * Gets the resource collection API of ExtendedServerBlobAuditingPolicies. It manages + * ExtendedServerBlobAuditingPolicy. + * + * @return Resource collection API of ExtendedServerBlobAuditingPolicies. + */ + public ExtendedServerBlobAuditingPolicies extendedServerBlobAuditingPolicies() { + if (this.extendedServerBlobAuditingPolicies == null) { + this.extendedServerBlobAuditingPolicies = + new ExtendedServerBlobAuditingPoliciesImpl(clientObject.getExtendedServerBlobAuditingPolicies(), this); + } + return extendedServerBlobAuditingPolicies; + } + + /** + * Gets the resource collection API of DatabaseAdvancedThreatProtectionSettings. It manages + * DatabaseAdvancedThreatProtection. + * + * @return Resource collection API of DatabaseAdvancedThreatProtectionSettings. + */ + public DatabaseAdvancedThreatProtectionSettings databaseAdvancedThreatProtectionSettings() { + if (this.databaseAdvancedThreatProtectionSettings == null) { + this.databaseAdvancedThreatProtectionSettings = + new DatabaseAdvancedThreatProtectionSettingsImpl( + clientObject.getDatabaseAdvancedThreatProtectionSettings(), this); + } + return databaseAdvancedThreatProtectionSettings; + } + + /** + * Gets the resource collection API of ServerAdvancedThreatProtectionSettings. It manages + * ServerAdvancedThreatProtection. + * + * @return Resource collection API of ServerAdvancedThreatProtectionSettings. + */ + public ServerAdvancedThreatProtectionSettings serverAdvancedThreatProtectionSettings() { + if (this.serverAdvancedThreatProtectionSettings == null) { + this.serverAdvancedThreatProtectionSettings = + new ServerAdvancedThreatProtectionSettingsImpl( + clientObject.getServerAdvancedThreatProtectionSettings(), this); + } + return serverAdvancedThreatProtectionSettings; + } + + /** + * Gets the resource collection API of ManagedServerDnsAliases. It manages ManagedServerDnsAlias. + * + * @return Resource collection API of ManagedServerDnsAliases. + */ + public ManagedServerDnsAliases managedServerDnsAliases() { + if (this.managedServerDnsAliases == null) { + this.managedServerDnsAliases = + new ManagedServerDnsAliasesImpl(clientObject.getManagedServerDnsAliases(), this); + } + return managedServerDnsAliases; + } + + /** + * Gets the resource collection API of DatabaseSqlVulnerabilityAssessmentBaselines. It manages + * DatabaseSqlVulnerabilityAssessmentBaselineSet. + * + * @return Resource collection API of DatabaseSqlVulnerabilityAssessmentBaselines. + */ + public DatabaseSqlVulnerabilityAssessmentBaselines databaseSqlVulnerabilityAssessmentBaselines() { + if (this.databaseSqlVulnerabilityAssessmentBaselines == null) { + this.databaseSqlVulnerabilityAssessmentBaselines = + new DatabaseSqlVulnerabilityAssessmentBaselinesImpl( + clientObject.getDatabaseSqlVulnerabilityAssessmentBaselines(), this); + } + return databaseSqlVulnerabilityAssessmentBaselines; + } + + /** + * Gets the resource collection API of DatabaseSqlVulnerabilityAssessmentExecuteScans. + * + * @return Resource collection API of DatabaseSqlVulnerabilityAssessmentExecuteScans. + */ + public DatabaseSqlVulnerabilityAssessmentExecuteScans databaseSqlVulnerabilityAssessmentExecuteScans() { + if (this.databaseSqlVulnerabilityAssessmentExecuteScans == null) { + this.databaseSqlVulnerabilityAssessmentExecuteScans = + new DatabaseSqlVulnerabilityAssessmentExecuteScansImpl( + clientObject.getDatabaseSqlVulnerabilityAssessmentExecuteScans(), this); + } + return databaseSqlVulnerabilityAssessmentExecuteScans; + } + + /** + * Gets the resource collection API of DatabaseSqlVulnerabilityAssessmentRuleBaselines. It manages + * DatabaseSqlVulnerabilityAssessmentRuleBaseline. + * + * @return Resource collection API of DatabaseSqlVulnerabilityAssessmentRuleBaselines. + */ + public DatabaseSqlVulnerabilityAssessmentRuleBaselines databaseSqlVulnerabilityAssessmentRuleBaselines() { + if (this.databaseSqlVulnerabilityAssessmentRuleBaselines == null) { + this.databaseSqlVulnerabilityAssessmentRuleBaselines = + new DatabaseSqlVulnerabilityAssessmentRuleBaselinesImpl( + clientObject.getDatabaseSqlVulnerabilityAssessmentRuleBaselines(), this); + } + return databaseSqlVulnerabilityAssessmentRuleBaselines; + } + + /** + * Gets the resource collection API of DatabaseSqlVulnerabilityAssessmentScanResults. + * + * @return Resource collection API of DatabaseSqlVulnerabilityAssessmentScanResults. + */ + public DatabaseSqlVulnerabilityAssessmentScanResults databaseSqlVulnerabilityAssessmentScanResults() { + if (this.databaseSqlVulnerabilityAssessmentScanResults == null) { + this.databaseSqlVulnerabilityAssessmentScanResults = + new DatabaseSqlVulnerabilityAssessmentScanResultsImpl( + clientObject.getDatabaseSqlVulnerabilityAssessmentScanResults(), this); + } + return databaseSqlVulnerabilityAssessmentScanResults; + } + + /** + * Gets the resource collection API of DatabaseSqlVulnerabilityAssessmentScans. + * + * @return Resource collection API of DatabaseSqlVulnerabilityAssessmentScans. + */ + public DatabaseSqlVulnerabilityAssessmentScans databaseSqlVulnerabilityAssessmentScans() { + if (this.databaseSqlVulnerabilityAssessmentScans == null) { + this.databaseSqlVulnerabilityAssessmentScans = + new DatabaseSqlVulnerabilityAssessmentScansImpl( + clientObject.getDatabaseSqlVulnerabilityAssessmentScans(), this); + } + return databaseSqlVulnerabilityAssessmentScans; + } + + /** + * Gets the resource collection API of DatabaseSqlVulnerabilityAssessmentsSettings. + * + * @return Resource collection API of DatabaseSqlVulnerabilityAssessmentsSettings. + */ + public DatabaseSqlVulnerabilityAssessmentsSettings databaseSqlVulnerabilityAssessmentsSettings() { + if (this.databaseSqlVulnerabilityAssessmentsSettings == null) { + this.databaseSqlVulnerabilityAssessmentsSettings = + new DatabaseSqlVulnerabilityAssessmentsSettingsImpl( + clientObject.getDatabaseSqlVulnerabilityAssessmentsSettings(), this); + } + return databaseSqlVulnerabilityAssessmentsSettings; + } + + /** + * Gets the resource collection API of ManagedDatabaseAdvancedThreatProtectionSettings. It manages + * ManagedDatabaseAdvancedThreatProtection. + * + * @return Resource collection API of ManagedDatabaseAdvancedThreatProtectionSettings. + */ + public ManagedDatabaseAdvancedThreatProtectionSettings managedDatabaseAdvancedThreatProtectionSettings() { + if (this.managedDatabaseAdvancedThreatProtectionSettings == null) { + this.managedDatabaseAdvancedThreatProtectionSettings = + new ManagedDatabaseAdvancedThreatProtectionSettingsImpl( + clientObject.getManagedDatabaseAdvancedThreatProtectionSettings(), this); + } + return managedDatabaseAdvancedThreatProtectionSettings; + } + + /** + * Gets the resource collection API of ManagedDatabaseRestoreDetails. + * + * @return Resource collection API of ManagedDatabaseRestoreDetails. + */ + public ManagedDatabaseRestoreDetails managedDatabaseRestoreDetails() { + if (this.managedDatabaseRestoreDetails == null) { + this.managedDatabaseRestoreDetails = + new ManagedDatabaseRestoreDetailsImpl(clientObject.getManagedDatabaseRestoreDetails(), this); + } + return managedDatabaseRestoreDetails; + } + + /** + * Gets the resource collection API of ManagedDatabases. It manages ManagedDatabase. + * + * @return Resource collection API of ManagedDatabases. + */ + public ManagedDatabases managedDatabases() { + if (this.managedDatabases == null) { + this.managedDatabases = new ManagedDatabasesImpl(clientObject.getManagedDatabases(), this); + } + return managedDatabases; + } + + /** + * Gets the resource collection API of ManagedInstanceAdvancedThreatProtectionSettings. It manages + * ManagedInstanceAdvancedThreatProtection. + * + * @return Resource collection API of ManagedInstanceAdvancedThreatProtectionSettings. + */ + public ManagedInstanceAdvancedThreatProtectionSettings managedInstanceAdvancedThreatProtectionSettings() { + if (this.managedInstanceAdvancedThreatProtectionSettings == null) { + this.managedInstanceAdvancedThreatProtectionSettings = + new ManagedInstanceAdvancedThreatProtectionSettingsImpl( + clientObject.getManagedInstanceAdvancedThreatProtectionSettings(), this); + } + return managedInstanceAdvancedThreatProtectionSettings; + } + + /** + * Gets the resource collection API of ReplicationLinks. + * + * @return Resource collection API of ReplicationLinks. + */ + public ReplicationLinks replicationLinks() { + if (this.replicationLinks == null) { + this.replicationLinks = new ReplicationLinksImpl(clientObject.getReplicationLinks(), this); + } + return replicationLinks; + } + + /** + * Gets the resource collection API of SqlVulnerabilityAssessmentBaselines. + * + * @return Resource collection API of SqlVulnerabilityAssessmentBaselines. + */ + public SqlVulnerabilityAssessmentBaselines sqlVulnerabilityAssessmentBaselines() { + if (this.sqlVulnerabilityAssessmentBaselines == null) { + this.sqlVulnerabilityAssessmentBaselines = + new SqlVulnerabilityAssessmentBaselinesImpl( + clientObject.getSqlVulnerabilityAssessmentBaselines(), this); + } + return sqlVulnerabilityAssessmentBaselines; + } + + /** + * Gets the resource collection API of SqlVulnerabilityAssessmentBaselinesOperations. + * + * @return Resource collection API of SqlVulnerabilityAssessmentBaselinesOperations. + */ + public SqlVulnerabilityAssessmentBaselinesOperations sqlVulnerabilityAssessmentBaselinesOperations() { + if (this.sqlVulnerabilityAssessmentBaselinesOperations == null) { + this.sqlVulnerabilityAssessmentBaselinesOperations = + new SqlVulnerabilityAssessmentBaselinesOperationsImpl( + clientObject.getSqlVulnerabilityAssessmentBaselinesOperations(), this); + } + return sqlVulnerabilityAssessmentBaselinesOperations; + } + + /** + * Gets the resource collection API of SqlVulnerabilityAssessmentExecuteScans. + * + * @return Resource collection API of SqlVulnerabilityAssessmentExecuteScans. + */ + public SqlVulnerabilityAssessmentExecuteScans sqlVulnerabilityAssessmentExecuteScans() { + if (this.sqlVulnerabilityAssessmentExecuteScans == null) { + this.sqlVulnerabilityAssessmentExecuteScans = + new SqlVulnerabilityAssessmentExecuteScansImpl( + clientObject.getSqlVulnerabilityAssessmentExecuteScans(), this); + } + return sqlVulnerabilityAssessmentExecuteScans; + } + + /** + * Gets the resource collection API of SqlVulnerabilityAssessmentRuleBaselines. + * + * @return Resource collection API of SqlVulnerabilityAssessmentRuleBaselines. + */ + public SqlVulnerabilityAssessmentRuleBaselines sqlVulnerabilityAssessmentRuleBaselines() { + if (this.sqlVulnerabilityAssessmentRuleBaselines == null) { + this.sqlVulnerabilityAssessmentRuleBaselines = + new SqlVulnerabilityAssessmentRuleBaselinesImpl( + clientObject.getSqlVulnerabilityAssessmentRuleBaselines(), this); + } + return sqlVulnerabilityAssessmentRuleBaselines; + } + + /** + * Gets the resource collection API of SqlVulnerabilityAssessmentRuleBaselinesOperations. + * + * @return Resource collection API of SqlVulnerabilityAssessmentRuleBaselinesOperations. + */ + public SqlVulnerabilityAssessmentRuleBaselinesOperations sqlVulnerabilityAssessmentRuleBaselinesOperations() { + if (this.sqlVulnerabilityAssessmentRuleBaselinesOperations == null) { + this.sqlVulnerabilityAssessmentRuleBaselinesOperations = + new SqlVulnerabilityAssessmentRuleBaselinesOperationsImpl( + clientObject.getSqlVulnerabilityAssessmentRuleBaselinesOperations(), this); + } + return sqlVulnerabilityAssessmentRuleBaselinesOperations; + } + + /** + * Gets the resource collection API of SqlVulnerabilityAssessmentScanResultOperations. + * + * @return Resource collection API of SqlVulnerabilityAssessmentScanResultOperations. + */ + public SqlVulnerabilityAssessmentScanResultOperations sqlVulnerabilityAssessmentScanResultOperations() { + if (this.sqlVulnerabilityAssessmentScanResultOperations == null) { + this.sqlVulnerabilityAssessmentScanResultOperations = + new SqlVulnerabilityAssessmentScanResultOperationsImpl( + clientObject.getSqlVulnerabilityAssessmentScanResultOperations(), this); + } + return sqlVulnerabilityAssessmentScanResultOperations; + } + + /** + * Gets the resource collection API of SqlVulnerabilityAssessmentScans. + * + * @return Resource collection API of SqlVulnerabilityAssessmentScans. + */ + public SqlVulnerabilityAssessmentScans sqlVulnerabilityAssessmentScans() { + if (this.sqlVulnerabilityAssessmentScans == null) { + this.sqlVulnerabilityAssessmentScans = + new SqlVulnerabilityAssessmentScansImpl(clientObject.getSqlVulnerabilityAssessmentScans(), this); + } + return sqlVulnerabilityAssessmentScans; + } + + /** + * Gets the resource collection API of SqlVulnerabilityAssessmentsSettings. It manages SqlVulnerabilityAssessment. + * + * @return Resource collection API of SqlVulnerabilityAssessmentsSettings. + */ + public SqlVulnerabilityAssessmentsSettings sqlVulnerabilityAssessmentsSettings() { + if (this.sqlVulnerabilityAssessmentsSettings == null) { + this.sqlVulnerabilityAssessmentsSettings = + new SqlVulnerabilityAssessmentsSettingsImpl( + clientObject.getSqlVulnerabilityAssessmentsSettings(), this); + } + return sqlVulnerabilityAssessmentsSettings; + } + + /** + * Gets the resource collection API of SqlVulnerabilityAssessments. + * + * @return Resource collection API of SqlVulnerabilityAssessments. + */ + public SqlVulnerabilityAssessments sqlVulnerabilityAssessments() { + if (this.sqlVulnerabilityAssessments == null) { + this.sqlVulnerabilityAssessments = + new SqlVulnerabilityAssessmentsImpl(clientObject.getSqlVulnerabilityAssessments(), this); + } + return sqlVulnerabilityAssessments; + } + + /** + * Gets the resource collection API of ManagedDatabaseMoveOperations. + * + * @return Resource collection API of ManagedDatabaseMoveOperations. + */ + public ManagedDatabaseMoveOperations managedDatabaseMoveOperations() { + if (this.managedDatabaseMoveOperations == null) { + this.managedDatabaseMoveOperations = + new ManagedDatabaseMoveOperationsImpl(clientObject.getManagedDatabaseMoveOperations(), this); + } + return managedDatabaseMoveOperations; + } + + /** + * Gets the resource collection API of ManagedInstanceDtcs. It manages ManagedInstanceDtc. + * + * @return Resource collection API of ManagedInstanceDtcs. + */ + public ManagedInstanceDtcs managedInstanceDtcs() { + if (this.managedInstanceDtcs == null) { + this.managedInstanceDtcs = new ManagedInstanceDtcsImpl(clientObject.getManagedInstanceDtcs(), this); + } + return managedInstanceDtcs; + } + + /** + * Gets the resource collection API of SynapseLinkWorkspaces. + * + * @return Resource collection API of SynapseLinkWorkspaces. + */ + public SynapseLinkWorkspaces synapseLinkWorkspaces() { + if (this.synapseLinkWorkspaces == null) { + this.synapseLinkWorkspaces = new SynapseLinkWorkspacesImpl(clientObject.getSynapseLinkWorkspaces(), this); + } + return synapseLinkWorkspaces; + } + + /** + * Gets the resource collection API of VirtualClusters. + * + * @return Resource collection API of VirtualClusters. + */ + public VirtualClusters virtualClusters() { + if (this.virtualClusters == null) { + this.virtualClusters = new VirtualClustersImpl(clientObject.getVirtualClusters(), this); + } + return virtualClusters; + } + + /** + * @return Wrapped service client SqlManagementClient providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + */ + public SqlManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/BackupShortTermRetentionPoliciesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/BackupShortTermRetentionPoliciesClient.java new file mode 100644 index 0000000000000..a3213547bea7b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/BackupShortTermRetentionPoliciesClient.java @@ -0,0 +1,278 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.BackupShortTermRetentionPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ShortTermRetentionPolicyName; + +/** + * An instance of this class provides access to all the operations defined in BackupShortTermRetentionPoliciesClient. + */ +public interface BackupShortTermRetentionPoliciesClient { + /** + * 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 policyName The policy name. Should always be "default". + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's short term retention policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + Context context); + + /** + * 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 policyName The policy name. Should always be "default". + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BackupShortTermRetentionPolicyInner get( + String resourceGroupName, String serverName, String databaseName, ShortTermRetentionPolicyName policyName); + + /** + * 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 policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, BackupShortTermRetentionPolicyInner> + beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + BackupShortTermRetentionPolicyInner parameters); + + /** + * 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 policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, BackupShortTermRetentionPolicyInner> + beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + BackupShortTermRetentionPolicyInner parameters, + Context context); + + /** + * 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 policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BackupShortTermRetentionPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + BackupShortTermRetentionPolicyInner parameters); + + /** + * 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 policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BackupShortTermRetentionPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + BackupShortTermRetentionPolicyInner parameters, + Context context); + + /** + * 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 policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, BackupShortTermRetentionPolicyInner> beginUpdate( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + BackupShortTermRetentionPolicyInner parameters); + + /** + * 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 policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, BackupShortTermRetentionPolicyInner> beginUpdate( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + BackupShortTermRetentionPolicyInner parameters, + Context context); + + /** + * 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 policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BackupShortTermRetentionPolicyInner update( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + BackupShortTermRetentionPolicyInner parameters); + + /** + * 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 policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BackupShortTermRetentionPolicyInner update( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + BackupShortTermRetentionPolicyInner parameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's short term retention policy as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's short term retention policy as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/CapabilitiesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/CapabilitiesClient.java new file mode 100644 index 0000000000000..50ca36527f284 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/CapabilitiesClient.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.LocationCapabilitiesInner; +import com.azure.resourcemanager.sql.generated.models.CapabilityGroup; + +/** An instance of this class provides access to all the operations defined in CapabilitiesClient. */ +public interface CapabilitiesClient { + /** + * 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the subscription capabilities available for the specified location along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listByLocationWithResponse( + String locationName, CapabilityGroup include, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the subscription capabilities available for the specified location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LocationCapabilitiesInner listByLocation(String locationName); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DataMaskingPoliciesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DataMaskingPoliciesClient.java new file mode 100644 index 0000000000000..c2a765d858fe2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DataMaskingPoliciesClient.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DataMaskingPolicyInner; + +/** An instance of this class provides access to all the operations defined in DataMaskingPoliciesClient. */ +public interface DataMaskingPoliciesClient { + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a database data masking policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + DataMaskingPolicyInner parameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a database data masking policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DataMaskingPolicyInner createOrUpdate( + String resourceGroupName, String serverName, String databaseName, DataMaskingPolicyInner parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database data masking policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database data masking policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DataMaskingPolicyInner get(String resourceGroupName, String serverName, String databaseName); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DataMaskingRulesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DataMaskingRulesClient.java new file mode 100644 index 0000000000000..cfc54cc83b78c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DataMaskingRulesClient.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DataMaskingRuleInner; + +/** An instance of this class provides access to all the operations defined in DataMaskingRulesClient. */ +public interface DataMaskingRulesClient { + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a database data masking rule along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String dataMaskingRuleName, + DataMaskingRuleInner parameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a database data masking rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DataMaskingRuleInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String dataMaskingRuleName, + DataMaskingRuleInner parameters); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database data masking rules as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database data masking rules as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DataWarehouseUserActivitiesOperationsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DataWarehouseUserActivitiesOperationsClient.java new file mode 100644 index 0000000000000..2867adb35ef6d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DataWarehouseUserActivitiesOperationsClient.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DataWarehouseUserActivitiesInner; +import com.azure.resourcemanager.sql.generated.models.DataWarehouseUserActivityName; + +/** + * An instance of this class provides access to all the operations defined in + * DataWarehouseUserActivitiesOperationsClient. + */ +public interface DataWarehouseUserActivitiesOperationsClient { + /** + * 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 dataWarehouseUserActivityName The activity name of the data warehouse. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the user activities of a data warehouse which includes running and suspended queries along with {@link + * Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + DataWarehouseUserActivityName dataWarehouseUserActivityName, + Context context); + + /** + * 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 dataWarehouseUserActivityName The activity name of the data warehouse. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the user activities of a data warehouse which includes running and suspended queries. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DataWarehouseUserActivitiesInner get( + String resourceGroupName, + String serverName, + String databaseName, + DataWarehouseUserActivityName dataWarehouseUserActivityName); + + /** + * List 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return user activities of a data warehouse as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName); + + /** + * List 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return user activities of a data warehouse as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseAdvancedThreatProtectionSettingsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseAdvancedThreatProtectionSettingsClient.java new file mode 100644 index 0000000000000..22153b67e505f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseAdvancedThreatProtectionSettingsClient.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseAdvancedThreatProtectionInner; +import com.azure.resourcemanager.sql.generated.models.AdvancedThreatProtectionName; + +/** + * An instance of this class provides access to all the operations defined in + * DatabaseAdvancedThreatProtectionSettingsClient. + */ +public interface DatabaseAdvancedThreatProtectionSettingsClient { + /** + * Gets a list of database's Advanced Threat Protection states. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's Advanced Threat Protection states as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName); + + /** + * Gets a list of database's Advanced Threat Protection states. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's Advanced Threat Protection states as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Gets a database's Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's Advanced Threat Protection state along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + AdvancedThreatProtectionName advancedThreatProtectionName, + Context context); + + /** + * Gets a database's Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's Advanced Threat Protection state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseAdvancedThreatProtectionInner get( + String resourceGroupName, + String serverName, + String databaseName, + AdvancedThreatProtectionName advancedThreatProtectionName); + + /** + * Creates or updates a database's Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @param parameters The database Advanced Threat Protection state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database Advanced Threat Protection along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + AdvancedThreatProtectionName advancedThreatProtectionName, + DatabaseAdvancedThreatProtectionInner parameters, + Context context); + + /** + * Creates or updates a database's Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @param parameters The database Advanced Threat Protection state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database Advanced Threat Protection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseAdvancedThreatProtectionInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + AdvancedThreatProtectionName advancedThreatProtectionName, + DatabaseAdvancedThreatProtectionInner parameters); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseAdvisorsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseAdvisorsClient.java new file mode 100644 index 0000000000000..45a437e806ab3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseAdvisorsClient.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.AdvisorInner; +import java.util.List; + +/** An instance of this class provides access to all the operations defined in DatabaseAdvisorsClient. */ +public interface DatabaseAdvisorsClient { + /** + * 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 expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database advisors along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response> listByDatabaseWithResponse( + String resourceGroupName, String serverName, String databaseName, String expand, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database advisors. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + List listByDatabase(String resourceGroupName, String serverName, String databaseName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database advisor along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, String advisorName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database advisor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AdvisorInner get(String resourceGroupName, String serverName, String databaseName, String advisorName); + + /** + * 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 parameters The requested advisor resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database, Server or Elastic Pool Advisor along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String advisorName, + AdvisorInner parameters, + Context context); + + /** + * 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 parameters The requested advisor resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database, Server or Elastic Pool Advisor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AdvisorInner update( + String resourceGroupName, String serverName, String databaseName, String advisorName, AdvisorInner parameters); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseAutomaticTuningsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseAutomaticTuningsClient.java new file mode 100644 index 0000000000000..dbad516b6f40d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseAutomaticTuningsClient.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseAutomaticTuningInner; + +/** An instance of this class provides access to all the operations defined in DatabaseAutomaticTuningsClient. */ +public interface DatabaseAutomaticTuningsClient { + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's automatic tuning along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's automatic tuning. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseAutomaticTuningInner get(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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database-level Automatic Tuning along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + DatabaseAutomaticTuningInner parameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database-level Automatic Tuning. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseAutomaticTuningInner update( + String resourceGroupName, String serverName, String databaseName, DatabaseAutomaticTuningInner parameters); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseBlobAuditingPoliciesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseBlobAuditingPoliciesClient.java new file mode 100644 index 0000000000000..4830c37fa4b1b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseBlobAuditingPoliciesClient.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseBlobAuditingPolicyInner; + +/** An instance of this class provides access to all the operations defined in DatabaseBlobAuditingPoliciesClient. */ +public interface DatabaseBlobAuditingPoliciesClient { + /** + * Lists auditing settings 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database auditing settings as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName); + + /** + * Lists auditing settings 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database auditing settings as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's blob auditing policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseBlobAuditingPolicyInner get(String resourceGroupName, String serverName, String databaseName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database blob auditing policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + DatabaseBlobAuditingPolicyInner parameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseBlobAuditingPolicyInner createOrUpdate( + String resourceGroupName, String serverName, String databaseName, DatabaseBlobAuditingPolicyInner parameters); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseColumnsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseColumnsClient.java new file mode 100644 index 0000000000000..9fe30eea4894b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseColumnsClient.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseColumnInner; +import java.util.List; + +/** An instance of this class provides access to all the operations defined in DatabaseColumnsClient. */ +public interface DatabaseColumnsClient { + /** + * List database columns. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database columns as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase(String resourceGroupName, String serverName, String databaseName); + + /** + * List database columns. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schema Array of Get3ItemsItem. + * @param table Array of Get4ItemsItem. + * @param column Array of Get5ItemsItem. + * @param orderBy Array of Get6ItemsItem. + * @param skiptoken An opaque token that identifies a starting point in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database columns as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, + String serverName, + String databaseName, + List schema, + List table, + List column, + List orderBy, + String skiptoken, + Context context); + + /** + * List database columns. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database columns as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByTable( + String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName); + + /** + * List database columns. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param 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 filter An OData filter expression that filters elements in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database columns as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByTable( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String filter, + Context context); + + /** + * Get database 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database column along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context); + + /** + * Get database 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database column. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseColumnInner get( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseExtensionsOperationsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseExtensionsOperationsClient.java new file mode 100644 index 0000000000000..3a9d96c3df6d6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseExtensionsOperationsClient.java @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.ImportExportExtensionsOperationResultInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseExtensions; + +/** An instance of this class provides access to all the operations defined in DatabaseExtensionsOperationsClient. */ +public interface DatabaseExtensionsOperationsClient { + /** + * Gets a database extension. This will return resource not found as it is not supported. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param extensionName The extensionName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database extension along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, String extensionName, Context context); + + /** + * Gets a database extension. This will return resource not found as it is not supported. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param extensionName The extensionName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void get(String resourceGroupName, String serverName, String databaseName, String extensionName); + + /** + * Perform a database extension operation, like polybase import. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param extensionName The extensionName parameter. + * @param parameters The database import request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Extension operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ImportExportExtensionsOperationResultInner> + beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String extensionName, + DatabaseExtensions parameters); + + /** + * Perform a database extension operation, like polybase import. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param extensionName The extensionName parameter. + * @param parameters The database import request parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Extension operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ImportExportExtensionsOperationResultInner> + beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String extensionName, + DatabaseExtensions parameters, + Context context); + + /** + * Perform a database extension operation, like polybase import. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param extensionName The extensionName parameter. + * @param parameters The database import request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Extension operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ImportExportExtensionsOperationResultInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String extensionName, + DatabaseExtensions parameters); + + /** + * Perform a database extension operation, like polybase import. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param extensionName The extensionName parameter. + * @param parameters The database import request parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Extension operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ImportExportExtensionsOperationResultInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String extensionName, + DatabaseExtensions parameters, + Context context); + + /** + * List database extension. This will return an empty list as it is not supported. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return import export operation extensions list as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName); + + /** + * List database extension. This will return an empty list as it is not supported. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return import export operation extensions list as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseOperationsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseOperationsClient.java new file mode 100644 index 0000000000000..9f1f9346f81ac --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseOperationsClient.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseOperationInner; +import java.util.UUID; + +/** An instance of this class provides access to all the operations defined in DatabaseOperationsClient. */ +public interface DatabaseOperationsClient { + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response cancelWithResponse( + String resourceGroupName, String serverName, String databaseName, UUID operationId, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void cancel(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. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of operations performed on the database as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of operations performed on the database as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseRecommendedActionsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseRecommendedActionsClient.java new file mode 100644 index 0000000000000..605ff2fab04f4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseRecommendedActionsClient.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.RecommendedActionInner; +import java.util.List; + +/** An instance of this class provides access to all the operations defined in DatabaseRecommendedActionsClient. */ +public interface DatabaseRecommendedActionsClient { + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Database Recommended Actions along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response> listByDatabaseAdvisorWithResponse( + String resourceGroupName, String serverName, String databaseName, String advisorName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Database Recommended Actions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + List listByDatabaseAdvisor( + String resourceGroupName, String serverName, String databaseName, String advisorName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database recommended action along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String advisorName, + String recommendedActionName, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database recommended action. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RecommendedActionInner get( + String resourceGroupName, + String serverName, + String databaseName, + String advisorName, + String recommendedActionName); + + /** + * 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 parameters The requested recommended action resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database, Server or Elastic Pool Recommended Action along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String advisorName, + String recommendedActionName, + RecommendedActionInner parameters, + Context context); + + /** + * 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 parameters The requested recommended action resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database, Server or Elastic Pool Recommended Action. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RecommendedActionInner update( + String resourceGroupName, + String serverName, + String databaseName, + String advisorName, + String recommendedActionName, + RecommendedActionInner parameters); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseSchemasClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseSchemasClient.java new file mode 100644 index 0000000000000..f8736a2fe5c8f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseSchemasClient.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseSchemaInner; + +/** An instance of this class provides access to all the operations defined in DatabaseSchemasClient. */ +public interface DatabaseSchemasClient { + /** + * List 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database schemas as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase(String resourceGroupName, String serverName, String databaseName); + + /** + * List 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. + * @param filter An OData filter expression that filters elements in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database schemas as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, String filter, Context context); + + /** + * Get 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. + * @param schemaName The name of the schema. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database schema along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, String schemaName, Context context); + + /** + * Get 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. + * @param schemaName The name of the schema. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database schema. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseSchemaInner get(String resourceGroupName, String serverName, String databaseName, String schemaName); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseSecurityAlertPoliciesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseSecurityAlertPoliciesClient.java new file mode 100644 index 0000000000000..59f68cce7645a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseSecurityAlertPoliciesClient.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseSecurityAlertPolicyInner; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyName; + +/** An instance of this class provides access to all the operations defined in DatabaseSecurityAlertPoliciesClient. */ +public interface DatabaseSecurityAlertPoliciesClient { + /** + * Gets a database's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the security alert policy is defined. + * @param securityAlertPolicyName The name of the security alert policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's security alert policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName, + Context context); + + /** + * Gets a database's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the security alert policy is defined. + * @param securityAlertPolicyName The name of the security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseSecurityAlertPolicyInner get( + String resourceGroupName, + String serverName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName); + + /** + * Creates or updates a database's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the security alert policy is defined. + * @param securityAlertPolicyName The name of the security alert policy. + * @param parameters The database security alert policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database security alert policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName, + DatabaseSecurityAlertPolicyInner parameters, + Context context); + + /** + * Creates or updates a database's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the security alert policy is defined. + * @param securityAlertPolicyName The name of the security alert policy. + * @param parameters The database security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseSecurityAlertPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName, + DatabaseSecurityAlertPolicyInner parameters); + + /** + * Gets a list of database's security alert policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the security alert policy is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's security alert policies as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName); + + /** + * Gets a list of database's security alert policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the security alert policy is defined. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's security alert policies as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseSqlVulnerabilityAssessmentBaselinesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseSqlVulnerabilityAssessmentBaselinesClient.java new file mode 100644 index 0000000000000..089782abb3477 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseSqlVulnerabilityAssessmentBaselinesClient.java @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseSqlVulnerabilityAssessmentBaselineSetInner; +import com.azure.resourcemanager.sql.generated.models.BaselineName; +import com.azure.resourcemanager.sql.generated.models.DatabaseSqlVulnerabilityAssessmentRuleBaselineListInput; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** + * An instance of this class provides access to all the operations defined in + * DatabaseSqlVulnerabilityAssessmentBaselinesClient. + */ +public interface DatabaseSqlVulnerabilityAssessmentBaselinesClient { + /** + * Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's sql vulnerability assessment rule baselines as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySqlVulnerabilityAssessment( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName); + + /** + * Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's sql vulnerability assessment rule baselines as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySqlVulnerabilityAssessment( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context); + + /** + * Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's sql vulnerability assessment rule baselines along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + Context context); + + /** + * Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's sql vulnerability assessment rule baselines. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseSqlVulnerabilityAssessmentBaselineSetInner get( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName); + + /** + * Add a database's vulnerability assessment rule baseline 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param parameters The requested rule baseline resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database sql vulnerability assessment baseline set along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + DatabaseSqlVulnerabilityAssessmentRuleBaselineListInput parameters, + Context context); + + /** + * Add a database's vulnerability assessment rule baseline 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param parameters The requested rule baseline resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database sql vulnerability assessment baseline set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseSqlVulnerabilityAssessmentBaselineSetInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + DatabaseSqlVulnerabilityAssessmentRuleBaselineListInput parameters); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseSqlVulnerabilityAssessmentExecuteScansClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseSqlVulnerabilityAssessmentExecuteScansClient.java new file mode 100644 index 0000000000000..695323cb6bafc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseSqlVulnerabilityAssessmentExecuteScansClient.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** + * An instance of this class provides access to all the operations defined in + * DatabaseSqlVulnerabilityAssessmentExecuteScansClient. + */ +public interface DatabaseSqlVulnerabilityAssessmentExecuteScansClient { + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginExecute( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginExecute( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void execute( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void execute( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseSqlVulnerabilityAssessmentRuleBaselinesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseSqlVulnerabilityAssessmentRuleBaselinesClient.java new file mode 100644 index 0000000000000..a94228c5c8044 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseSqlVulnerabilityAssessmentRuleBaselinesClient.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseSqlVulnerabilityAssessmentRuleBaselineInner; +import com.azure.resourcemanager.sql.generated.models.BaselineName; +import com.azure.resourcemanager.sql.generated.models.DatabaseSqlVulnerabilityAssessmentRuleBaselineInput; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** + * An instance of this class provides access to all the operations defined in + * DatabaseSqlVulnerabilityAssessmentRuleBaselinesClient. + */ +public interface DatabaseSqlVulnerabilityAssessmentRuleBaselinesClient { + /** + * Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's sql vulnerability assessment rule baselines as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBaseline( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName); + + /** + * Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's sql vulnerability assessment rule baselines as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBaseline( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + Context context); + + /** + * Gets a database's sql 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. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param ruleId The vulnerability assessment rule ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's sql vulnerability assessment rule baseline along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId, + Context context); + + /** + * Gets a database's sql 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. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param ruleId The vulnerability assessment rule ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's sql vulnerability assessment rule baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseSqlVulnerabilityAssessmentRuleBaselineInner get( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId); + + /** + * 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. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param ruleId The vulnerability assessment rule ID. + * @param parameters The requested rule baseline resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database sql vulnerability assessment rule baseline along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId, + DatabaseSqlVulnerabilityAssessmentRuleBaselineInput parameters, + Context context); + + /** + * 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. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param ruleId The vulnerability assessment rule ID. + * @param parameters The requested rule baseline resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database sql vulnerability assessment rule baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseSqlVulnerabilityAssessmentRuleBaselineInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId, + DatabaseSqlVulnerabilityAssessmentRuleBaselineInput parameters); + + /** + * 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. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param ruleId The vulnerability assessment rule ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId, + Context context); + + /** + * 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. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param ruleId The vulnerability assessment rule ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseSqlVulnerabilityAssessmentScanResultsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseSqlVulnerabilityAssessmentScanResultsClient.java new file mode 100644 index 0000000000000..83d14dfdcf7f7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseSqlVulnerabilityAssessmentScanResultsClient.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.SqlVulnerabilityAssessmentScanResultsInner; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentName; + +/** + * An instance of this class provides access to all the operations defined in + * DatabaseSqlVulnerabilityAssessmentScanResultsClient. + */ +public interface DatabaseSqlVulnerabilityAssessmentScanResultsClient { + /** + * 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 vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @param scanId The scan id of the SQL Vulnerability Assessment scan to retrieve result from. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a vulnerability assessment scan record of a database as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByScan( + String resourceGroupName, + String serverName, + String databaseName, + SqlVulnerabilityAssessmentName vulnerabilityAssessmentName, + 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @param scanId The scan id of the SQL Vulnerability Assessment scan to retrieve result from. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a vulnerability assessment scan record of a database as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByScan( + String resourceGroupName, + String serverName, + String databaseName, + SqlVulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @param scanId The scan id of the SQL Vulnerability Assessment scan to retrieve result from. + * @param scanResultId The scan result id of the specific result to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a vulnerability assessment scan record of a database along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + SqlVulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + String scanResultId, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @param scanId The scan id of the SQL Vulnerability Assessment scan to retrieve result from. + * @param scanResultId The scan result id of the specific result to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a vulnerability assessment scan record of a database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlVulnerabilityAssessmentScanResultsInner get( + String resourceGroupName, + String serverName, + String databaseName, + SqlVulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + String scanResultId); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseSqlVulnerabilityAssessmentScansClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseSqlVulnerabilityAssessmentScansClient.java new file mode 100644 index 0000000000000..31d369bf5fbfb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseSqlVulnerabilityAssessmentScansClient.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.SqlVulnerabilityAssessmentScanRecordInner; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** + * An instance of this class provides access to all the operations defined in + * DatabaseSqlVulnerabilityAssessmentScansClient. + */ +public interface DatabaseSqlVulnerabilityAssessmentScansClient { + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan records as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySqlVulnerabilityAssessments( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan records as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySqlVulnerabilityAssessments( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context); + + /** + * Get a database vulnerability assessment scan 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. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database vulnerability assessment scan result along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context); + + /** + * Get a database vulnerability assessment scan 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. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database vulnerability assessment scan result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlVulnerabilityAssessmentScanRecordInner get( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseSqlVulnerabilityAssessmentsSettingsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseSqlVulnerabilityAssessmentsSettingsClient.java new file mode 100644 index 0000000000000..3ec88fd06072e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseSqlVulnerabilityAssessmentsSettingsClient.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.SqlVulnerabilityAssessmentInner; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentNameAutoGenerated; + +/** + * An instance of this class provides access to all the operations defined in + * DatabaseSqlVulnerabilityAssessmentsSettingsClient. + */ +public interface DatabaseSqlVulnerabilityAssessmentsSettingsClient { + /** + * Lists SQL 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Vulnerability Assessments as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName); + + /** + * Lists SQL 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Vulnerability Assessments as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Gets SQL Vulnerability Assessment policy for database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return sQL Vulnerability Assessment policy for database along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + SqlVulnerabilityAssessmentNameAutoGenerated vulnerabilityAssessmentName, + Context context); + + /** + * Gets SQL Vulnerability Assessment policy for database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return sQL Vulnerability Assessment policy for database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlVulnerabilityAssessmentInner get( + String resourceGroupName, + String serverName, + String databaseName, + SqlVulnerabilityAssessmentNameAutoGenerated vulnerabilityAssessmentName); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseTablesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseTablesClient.java new file mode 100644 index 0000000000000..b9f579fc4f591 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseTablesClient.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseTableInner; + +/** An instance of this class provides access to all the operations defined in DatabaseTablesClient. */ +public interface DatabaseTablesClient { + /** + * List database tables. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database tables as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySchema( + String resourceGroupName, String serverName, String databaseName, String schemaName); + + /** + * List database tables. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 filter An OData filter expression that filters elements in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database tables as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySchema( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String filter, + Context context); + + /** + * Get database table. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database table along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + Context context); + + /** + * Get database table. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseTableInner get( + String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseUsagesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseUsagesClient.java new file mode 100644 index 0000000000000..04273f936c575 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseUsagesClient.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseUsageInner; + +/** An instance of this class provides access to all the operations defined in DatabaseUsagesClient. */ +public interface DatabaseUsagesClient { + /** + * Gets 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database usages as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase(String resourceGroupName, String serverName, String databaseName); + + /** + * Gets 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database usages as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseVulnerabilityAssessmentRuleBaselinesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseVulnerabilityAssessmentRuleBaselinesClient.java new file mode 100644 index 0000000000000..8057a206c2982 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseVulnerabilityAssessmentRuleBaselinesClient.java @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentRuleBaselineInner; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentPolicyBaselineName; + +/** + * An instance of this class provides access to all the operations defined in + * DatabaseVulnerabilityAssessmentRuleBaselinesClient. + */ +public interface DatabaseVulnerabilityAssessmentRuleBaselinesClient { + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's vulnerability assessment rule baseline along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's vulnerability assessment rule baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseVulnerabilityAssessmentRuleBaselineInner get( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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). + * @param parameters The requested rule baseline resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database vulnerability assessment rule baseline along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + DatabaseVulnerabilityAssessmentRuleBaselineInner parameters, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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). + * @param parameters The requested rule baseline resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database vulnerability assessment rule baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseVulnerabilityAssessmentRuleBaselineInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + DatabaseVulnerabilityAssessmentRuleBaselineInner parameters); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseVulnerabilityAssessmentScansClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseVulnerabilityAssessmentScansClient.java new file mode 100644 index 0000000000000..9642b4945e36d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseVulnerabilityAssessmentScansClient.java @@ -0,0 +1,246 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentScansExportInner; +import com.azure.resourcemanager.sql.generated.fluent.models.VulnerabilityAssessmentScanRecordInner; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** + * An instance of this class provides access to all the operations defined in + * DatabaseVulnerabilityAssessmentScansClient. + */ +public interface DatabaseVulnerabilityAssessmentScansClient { + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginInitiateScan( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginInitiateScan( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void initiateScan( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void initiateScan( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan records as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan records as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a vulnerability assessment scan record of a database along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a vulnerability assessment scan record of a database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VulnerabilityAssessmentScanRecordInner get( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database Vulnerability Assessment scan export resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response exportWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database Vulnerability Assessment scan export resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseVulnerabilityAssessmentScansExportInner export( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseVulnerabilityAssessmentsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseVulnerabilityAssessmentsClient.java new file mode 100644 index 0000000000000..8c139b3962257 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabaseVulnerabilityAssessmentsClient.java @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentInner; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** + * An instance of this class provides access to all the operations defined in DatabaseVulnerabilityAssessmentsClient. + */ +public interface DatabaseVulnerabilityAssessmentsClient { + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the database's vulnerability assessment along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the database's vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseVulnerabilityAssessmentInner get( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database vulnerability assessment along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + DatabaseVulnerabilityAssessmentInner parameters, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseVulnerabilityAssessmentInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + DatabaseVulnerabilityAssessmentInner parameters); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the database's vulnerability assessments as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the database's vulnerability assessments as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabasesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabasesClient.java new file mode 100644 index 0000000000000..0548c8773f2c4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DatabasesClient.java @@ -0,0 +1,866 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseInner; +import com.azure.resourcemanager.sql.generated.fluent.models.ImportExportOperationResultInner; +import com.azure.resourcemanager.sql.generated.fluent.models.MetricDefinitionInner; +import com.azure.resourcemanager.sql.generated.fluent.models.MetricInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseUpdate; +import com.azure.resourcemanager.sql.generated.models.ExportDatabaseDefinition; +import com.azure.resourcemanager.sql.generated.models.ImportExistingDatabaseDefinition; +import com.azure.resourcemanager.sql.generated.models.ReplicaType; +import com.azure.resourcemanager.sql.generated.models.ResourceMoveDefinition; + +/** An instance of this class provides access to all the operations defined in DatabasesClient. */ +public interface DatabasesClient { + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list database metrics request as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetrics( + String resourceGroupName, String serverName, String databaseName, String filter); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list database metrics request as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetrics( + String resourceGroupName, String serverName, String databaseName, String filter, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list database metric definitions request as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetricDefinitions( + String resourceGroupName, String serverName, String databaseName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list database metric definitions request as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetricDefinitions( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of databases as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * 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 skipToken The skipToken parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of databases as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String resourceGroupName, String serverName, String skipToken, Context context); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseInner get(String resourceGroupName, String serverName, String databaseName); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DatabaseInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DatabaseInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseInner createOrUpdate( + String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseInner createOrUpdate( + String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String serverName, String databaseName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String databaseName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DatabaseInner> beginUpdate( + String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DatabaseInner> beginUpdate( + String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseInner update(String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseInner update( + String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ImportExportOperationResultInner> beginExport( + String resourceGroupName, String serverName, String databaseName, ExportDatabaseDefinition parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ImportExportOperationResultInner> beginExport( + String resourceGroupName, + String serverName, + String databaseName, + ExportDatabaseDefinition parameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ImportExportOperationResultInner export( + String resourceGroupName, String serverName, String databaseName, ExportDatabaseDefinition parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ImportExportOperationResultInner export( + String resourceGroupName, + String serverName, + String databaseName, + ExportDatabaseDefinition parameters, + Context context); + + /** + * Failovers a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to failover. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginFailover(String resourceGroupName, String serverName, String databaseName); + + /** + * Failovers a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to failover. + * @param replicaType The type of replica to be failed over. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginFailover( + String resourceGroupName, String serverName, String databaseName, ReplicaType replicaType, Context context); + + /** + * Failovers a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to failover. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void failover(String resourceGroupName, String serverName, String databaseName); + + /** + * Failovers a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to failover. + * @param replicaType The type of replica to be failed over. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void failover( + String resourceGroupName, String serverName, String databaseName, ReplicaType replicaType, Context context); + + /** + * 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 databaseName The name of the database. + * @param parameters The database import request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ImportExportOperationResultInner> beginImportMethod( + String resourceGroupName, String serverName, String databaseName, ImportExistingDatabaseDefinition 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 databaseName The name of the database. + * @param parameters The database import request parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ImportExportOperationResultInner> beginImportMethod( + String resourceGroupName, + String serverName, + String databaseName, + ImportExistingDatabaseDefinition parameters, + Context context); + + /** + * 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 databaseName The name of the database. + * @param parameters The database import request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ImportExportOperationResultInner importMethod( + String resourceGroupName, String serverName, String databaseName, ImportExistingDatabaseDefinition 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 databaseName The name of the database. + * @param parameters The database import request parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ImportExportOperationResultInner importMethod( + String resourceGroupName, + String serverName, + String databaseName, + ImportExistingDatabaseDefinition parameters, + Context context); + + /** + * 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 parameters The resource move definition for renaming this database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response renameWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + ResourceMoveDefinition parameters, + Context context); + + /** + * 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 parameters The resource move definition for renaming this database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void rename(String resourceGroupName, String serverName, String databaseName, ResourceMoveDefinition 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. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DatabaseInner> beginPause( + String resourceGroupName, String serverName, String databaseName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DatabaseInner> beginPause( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseInner pause(String resourceGroupName, String serverName, String databaseName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseInner pause(String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DatabaseInner> beginResume( + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DatabaseInner> beginResume( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseInner resume(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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseInner resume(String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginUpgradeDataWarehouse( + String resourceGroupName, String serverName, String databaseName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginUpgradeDataWarehouse( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void upgradeDataWarehouse(String resourceGroupName, String serverName, String databaseName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void upgradeDataWarehouse(String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of databases in an elastic pool as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByElasticPool(String resourceGroupName, String serverName, String elasticPoolName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of databases in an elastic pool as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName, Context context); + + /** + * Gets a list of inaccessible databases in a logical server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of inaccessible databases in a logical server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listInaccessibleByServer(String resourceGroupName, String serverName); + + /** + * Gets a list of inaccessible databases in a logical server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of inaccessible databases in a logical server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listInaccessibleByServer(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DeletedServersClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DeletedServersClient.java new file mode 100644 index 0000000000000..ef59abf555f90 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DeletedServersClient.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.DeletedServerInner; + +/** An instance of this class provides access to all the operations defined in DeletedServersClient. */ +public interface DeletedServersClient { + /** + * Gets a list of all deleted servers in a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all deleted servers in a subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets a list of all deleted servers in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all deleted servers in a subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Gets a deleted server. + * + * @param locationName The name of the region where the resource is located. + * @param deletedServerName The name of the deleted server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deleted server along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String locationName, String deletedServerName, Context context); + + /** + * Gets a deleted server. + * + * @param locationName The name of the region where the resource is located. + * @param deletedServerName The name of the deleted server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deleted server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeletedServerInner get(String locationName, String deletedServerName); + + /** + * Gets a list of deleted servers for a location. + * + * @param locationName The name of the region where the resource is located. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of deleted servers for a location as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByLocation(String locationName); + + /** + * Gets a list of deleted servers for a location. + * + * @param locationName The name of the region where the resource is located. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of deleted servers for a location as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByLocation(String locationName, Context context); + + /** + * Recovers a deleted server. + * + * @param locationName The name of the region where the resource is located. + * @param deletedServerName The name of the deleted server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a deleted server. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DeletedServerInner> beginRecover( + String locationName, String deletedServerName); + + /** + * Recovers a deleted server. + * + * @param locationName The name of the region where the resource is located. + * @param deletedServerName The name of the deleted server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a deleted server. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DeletedServerInner> beginRecover( + String locationName, String deletedServerName, Context context); + + /** + * Recovers a deleted server. + * + * @param locationName The name of the region where the resource is located. + * @param deletedServerName The name of the deleted server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deleted server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeletedServerInner recover(String locationName, String deletedServerName); + + /** + * Recovers a deleted server. + * + * @param locationName The name of the region where the resource is located. + * @param deletedServerName The name of the deleted server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deleted server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeletedServerInner recover(String locationName, String deletedServerName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DistributedAvailabilityGroupsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DistributedAvailabilityGroupsClient.java new file mode 100644 index 0000000000000..fb2c1fe04d264 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/DistributedAvailabilityGroupsClient.java @@ -0,0 +1,316 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.DistributedAvailabilityGroupInner; + +/** An instance of this class provides access to all the operations defined in DistributedAvailabilityGroupsClient. */ +public interface DistributedAvailabilityGroupsClient { + /** + * Gets a list of a distributed availability groups in 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of a distributed availability groups in instance as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName); + + /** + * Gets a list of a distributed availability groups in 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of a distributed availability groups in instance as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * Gets a distributed availability group info. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param distributedAvailabilityGroupName The distributed availability group name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a distributed availability group info along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String managedInstanceName, String distributedAvailabilityGroupName, Context context); + + /** + * Gets a distributed availability group info. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param distributedAvailabilityGroupName The distributed availability group name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a distributed availability group info. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DistributedAvailabilityGroupInner get( + String resourceGroupName, String managedInstanceName, String distributedAvailabilityGroupName); + + /** + * Creates a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group name. + * @param parameters The distributed availability group info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of distributed availability group between box and Sql Managed + * Instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DistributedAvailabilityGroupInner> beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + DistributedAvailabilityGroupInner parameters); + + /** + * Creates a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group name. + * @param parameters The distributed availability group info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of distributed availability group between box and Sql Managed + * Instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DistributedAvailabilityGroupInner> beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + DistributedAvailabilityGroupInner parameters, + Context context); + + /** + * Creates a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group name. + * @param parameters The distributed availability group info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return distributed availability group between box and Sql Managed Instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DistributedAvailabilityGroupInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + DistributedAvailabilityGroupInner parameters); + + /** + * Creates a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group name. + * @param parameters The distributed availability group info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return distributed availability group between box and Sql Managed Instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DistributedAvailabilityGroupInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + DistributedAvailabilityGroupInner parameters, + Context context); + + /** + * Drops a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, String distributedAvailabilityGroupName); + + /** + * Drops a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, String distributedAvailabilityGroupName, Context context); + + /** + * Drops a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String managedInstanceName, String distributedAvailabilityGroupName); + + /** + * Drops a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete( + String resourceGroupName, String managedInstanceName, String distributedAvailabilityGroupName, Context context); + + /** + * Updates a distributed availability group replication mode. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param distributedAvailabilityGroupName The distributed availability group name. + * @param parameters The distributed availability group info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of distributed availability group between box and Sql Managed + * Instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DistributedAvailabilityGroupInner> beginUpdate( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + DistributedAvailabilityGroupInner parameters); + + /** + * Updates a distributed availability group replication mode. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param distributedAvailabilityGroupName The distributed availability group name. + * @param parameters The distributed availability group info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of distributed availability group between box and Sql Managed + * Instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DistributedAvailabilityGroupInner> beginUpdate( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + DistributedAvailabilityGroupInner parameters, + Context context); + + /** + * Updates a distributed availability group replication mode. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param distributedAvailabilityGroupName The distributed availability group name. + * @param parameters The distributed availability group info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return distributed availability group between box and Sql Managed Instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DistributedAvailabilityGroupInner update( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + DistributedAvailabilityGroupInner parameters); + + /** + * Updates a distributed availability group replication mode. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param distributedAvailabilityGroupName The distributed availability group name. + * @param parameters The distributed availability group info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return distributed availability group between box and Sql Managed Instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DistributedAvailabilityGroupInner update( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + DistributedAvailabilityGroupInner parameters, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ElasticPoolActivitiesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ElasticPoolActivitiesClient.java new file mode 100644 index 0000000000000..1025f3cec9c95 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ElasticPoolActivitiesClient.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ElasticPoolActivityInner; + +/** An instance of this class provides access to all the operations defined in ElasticPoolActivitiesClient. */ +public interface ElasticPoolActivitiesClient { + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a list elastic pool activity request as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a list elastic pool activity request as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ElasticPoolDatabaseActivitiesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ElasticPoolDatabaseActivitiesClient.java new file mode 100644 index 0000000000000..f3af192a3eb97 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ElasticPoolDatabaseActivitiesClient.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ElasticPoolDatabaseActivityInner; + +/** An instance of this class provides access to all the operations defined in ElasticPoolDatabaseActivitiesClient. */ +public interface ElasticPoolDatabaseActivitiesClient { + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a list elastic pool database activity request as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a list elastic pool database activity request as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ElasticPoolOperationsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ElasticPoolOperationsClient.java new file mode 100644 index 0000000000000..cfa476ba448b0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ElasticPoolOperationsClient.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ElasticPoolOperationInner; +import java.util.UUID; + +/** An instance of this class provides access to all the operations defined in ElasticPoolOperationsClient. */ +public interface ElasticPoolOperationsClient { + /** + * 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 elasticPoolName parameter. + * @param operationId The operation identifier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response cancelWithResponse( + String resourceGroupName, String serverName, String elasticPoolName, UUID operationId, Context context); + + /** + * 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 elasticPoolName parameter. + * @param operationId The operation identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void cancel(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 elasticPoolName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of operations performed on the elastic pool as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName); + + /** + * 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 elasticPoolName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of operations performed on the elastic pool as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ElasticPoolsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ElasticPoolsClient.java new file mode 100644 index 0000000000000..8ca32a5864042 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ElasticPoolsClient.java @@ -0,0 +1,432 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.ElasticPoolInner; +import com.azure.resourcemanager.sql.generated.fluent.models.MetricDefinitionInner; +import com.azure.resourcemanager.sql.generated.fluent.models.MetricInner; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolUpdate; + +/** An instance of this class provides access to all the operations defined in ElasticPoolsClient. */ +public interface ElasticPoolsClient { + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list database metrics request as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetrics( + String resourceGroupName, String serverName, String elasticPoolName, String filter); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list database metrics request as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetrics( + String resourceGroupName, String serverName, String elasticPoolName, String filter, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list database metric definitions request as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetricDefinitions( + String resourceGroupName, String serverName, String elasticPoolName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list database metric definitions request as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMetricDefinitions( + String resourceGroupName, String serverName, String elasticPoolName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all elastic pools in a server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all elastic pools in a server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String resourceGroupName, String serverName, Long skip, Context context); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String elasticPoolName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ElasticPoolInner get(String resourceGroupName, String serverName, String elasticPoolName); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an elastic pool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ElasticPoolInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an elastic pool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ElasticPoolInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String elasticPoolName, + ElasticPoolInner parameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ElasticPoolInner createOrUpdate( + String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ElasticPoolInner createOrUpdate( + String resourceGroupName, + String serverName, + String elasticPoolName, + ElasticPoolInner parameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String serverName, String elasticPoolName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String elasticPoolName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String elasticPoolName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String elasticPoolName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an elastic pool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ElasticPoolInner> beginUpdate( + String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdate parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an elastic pool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ElasticPoolInner> beginUpdate( + String resourceGroupName, + String serverName, + String elasticPoolName, + ElasticPoolUpdate parameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ElasticPoolInner update( + String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdate parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ElasticPoolInner update( + String resourceGroupName, + String serverName, + String elasticPoolName, + ElasticPoolUpdate parameters, + Context context); + + /** + * Failovers an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool to failover. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginFailover( + String resourceGroupName, String serverName, String elasticPoolName); + + /** + * Failovers an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool to failover. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginFailover( + String resourceGroupName, String serverName, String elasticPoolName, Context context); + + /** + * Failovers an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool to failover. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void failover(String resourceGroupName, String serverName, String elasticPoolName); + + /** + * Failovers an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool to failover. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void failover(String resourceGroupName, String serverName, String elasticPoolName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/EncryptionProtectorsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/EncryptionProtectorsClient.java new file mode 100644 index 0000000000000..725cfdfbe710e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/EncryptionProtectorsClient.java @@ -0,0 +1,227 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.EncryptionProtectorInner; +import com.azure.resourcemanager.sql.generated.models.EncryptionProtectorName; + +/** An instance of this class provides access to all the operations defined in EncryptionProtectorsClient. */ +public interface EncryptionProtectorsClient { + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server encryption protectors as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server encryption protectors as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * 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 encryptionProtectorName The name of the encryption protector to be retrieved. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server encryption protector along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, EncryptionProtectorName encryptionProtectorName, Context context); + + /** + * 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 encryptionProtectorName The name of the encryption protector to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server encryption protector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EncryptionProtectorInner get( + String resourceGroupName, String serverName, EncryptionProtectorName encryptionProtectorName); + + /** + * 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 encryptionProtectorName The name of the encryption protector to be updated. + * @param parameters The requested encryption protector resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the server encryption protector. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, EncryptionProtectorInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + EncryptionProtectorName encryptionProtectorName, + EncryptionProtectorInner parameters); + + /** + * 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 encryptionProtectorName The name of the encryption protector to be updated. + * @param parameters The requested encryption protector resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the server encryption protector. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, EncryptionProtectorInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + EncryptionProtectorName encryptionProtectorName, + EncryptionProtectorInner parameters, + Context context); + + /** + * 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 encryptionProtectorName The name of the encryption protector to be updated. + * @param parameters The requested encryption protector resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the server encryption protector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EncryptionProtectorInner createOrUpdate( + String resourceGroupName, + String serverName, + EncryptionProtectorName encryptionProtectorName, + EncryptionProtectorInner parameters); + + /** + * 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 encryptionProtectorName The name of the encryption protector to be updated. + * @param parameters The requested encryption protector resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the server encryption protector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EncryptionProtectorInner createOrUpdate( + String resourceGroupName, + String serverName, + EncryptionProtectorName encryptionProtectorName, + EncryptionProtectorInner parameters, + Context context); + + /** + * Revalidates 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 encryptionProtectorName The name of the encryption protector to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRevalidate( + String resourceGroupName, String serverName, EncryptionProtectorName encryptionProtectorName); + + /** + * Revalidates 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 encryptionProtectorName The name of the encryption protector to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRevalidate( + String resourceGroupName, String serverName, EncryptionProtectorName encryptionProtectorName, Context context); + + /** + * Revalidates 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 encryptionProtectorName The name of the encryption protector to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void revalidate(String resourceGroupName, String serverName, EncryptionProtectorName encryptionProtectorName); + + /** + * Revalidates 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 encryptionProtectorName The name of the encryption protector to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void revalidate( + String resourceGroupName, String serverName, EncryptionProtectorName encryptionProtectorName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/EndpointCertificatesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/EndpointCertificatesClient.java new file mode 100644 index 0000000000000..8461cbfb5a87d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/EndpointCertificatesClient.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.EndpointCertificateInner; + +/** An instance of this class provides access to all the operations defined in EndpointCertificatesClient. */ +public interface EndpointCertificatesClient { + /** + * List certificates used on endpoints on the target 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of endpoint certificates on the target instance as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstance(String resourceGroupName, String managedInstanceName); + + /** + * List certificates used on endpoints on the target 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of endpoint certificates on the target instance as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * Gets a certificate used on the endpoint with the given id. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param endpointType Type of the endpoint whose certificate the customer is looking for. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a certificate used on the endpoint with the given id along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String managedInstanceName, String endpointType, Context context); + + /** + * Gets a certificate used on the endpoint with the given id. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param endpointType Type of the endpoint whose certificate the customer is looking for. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a certificate used on the endpoint with the given id. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EndpointCertificateInner get(String resourceGroupName, String managedInstanceName, String endpointType); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ExtendedDatabaseBlobAuditingPoliciesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ExtendedDatabaseBlobAuditingPoliciesClient.java new file mode 100644 index 0000000000000..ef65735e04642 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ExtendedDatabaseBlobAuditingPoliciesClient.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ExtendedDatabaseBlobAuditingPolicyInner; + +/** + * An instance of this class provides access to all the operations defined in + * ExtendedDatabaseBlobAuditingPoliciesClient. + */ +public interface ExtendedDatabaseBlobAuditingPoliciesClient { + /** + * Lists extended auditing settings 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database extended auditing settings as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName); + + /** + * Lists extended auditing settings 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database extended auditing settings as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an extended database's blob auditing policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an extended database's blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ExtendedDatabaseBlobAuditingPolicyInner get(String resourceGroupName, String serverName, String databaseName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an extended database blob auditing policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + ExtendedDatabaseBlobAuditingPolicyInner parameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an extended database blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ExtendedDatabaseBlobAuditingPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + ExtendedDatabaseBlobAuditingPolicyInner parameters); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ExtendedServerBlobAuditingPoliciesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ExtendedServerBlobAuditingPoliciesClient.java new file mode 100644 index 0000000000000..d47a064aeaa85 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ExtendedServerBlobAuditingPoliciesClient.java @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.ExtendedServerBlobAuditingPolicyInner; + +/** + * An instance of this class provides access to all the operations defined in ExtendedServerBlobAuditingPoliciesClient. + */ +public interface ExtendedServerBlobAuditingPoliciesClient { + /** + * Lists extended auditing settings of 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server extended auditing settings as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Lists extended auditing settings of 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server extended auditing settings as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String resourceGroupName, String serverName, Context context); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an extended server's blob auditing policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an extended server's blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ExtendedServerBlobAuditingPolicyInner get(String resourceGroupName, String serverName); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an extended server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ExtendedServerBlobAuditingPolicyInner> + beginCreateOrUpdate( + String resourceGroupName, String serverName, ExtendedServerBlobAuditingPolicyInner parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an extended server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ExtendedServerBlobAuditingPolicyInner> + beginCreateOrUpdate( + String resourceGroupName, + String serverName, + ExtendedServerBlobAuditingPolicyInner parameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an extended server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ExtendedServerBlobAuditingPolicyInner createOrUpdate( + String resourceGroupName, String serverName, ExtendedServerBlobAuditingPolicyInner parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an extended server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ExtendedServerBlobAuditingPolicyInner createOrUpdate( + String resourceGroupName, String serverName, ExtendedServerBlobAuditingPolicyInner parameters, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/FailoverGroupsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/FailoverGroupsClient.java new file mode 100644 index 0000000000000..ff827d8b33487 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/FailoverGroupsClient.java @@ -0,0 +1,427 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.FailoverGroupInner; +import com.azure.resourcemanager.sql.generated.models.FailoverGroupUpdate; + +/** An instance of this class provides access to all the operations defined in FailoverGroupsClient. */ +public interface FailoverGroupsClient { + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String failoverGroupName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FailoverGroupInner get(String resourceGroupName, String serverName, String failoverGroupName); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, FailoverGroupInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupInner parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, FailoverGroupInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String failoverGroupName, + FailoverGroupInner parameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FailoverGroupInner createOrUpdate( + String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupInner parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FailoverGroupInner createOrUpdate( + String resourceGroupName, + String serverName, + String failoverGroupName, + FailoverGroupInner parameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String failoverGroupName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String failoverGroupName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String failoverGroupName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String failoverGroupName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, FailoverGroupInner> beginUpdate( + String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupUpdate parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, FailoverGroupInner> beginUpdate( + String resourceGroupName, + String serverName, + String failoverGroupName, + FailoverGroupUpdate parameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FailoverGroupInner update( + String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupUpdate parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FailoverGroupInner update( + String resourceGroupName, + String serverName, + String failoverGroupName, + FailoverGroupUpdate parameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of failover groups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of failover groups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, FailoverGroupInner> beginFailover( + String resourceGroupName, String serverName, String failoverGroupName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, FailoverGroupInner> beginFailover( + String resourceGroupName, String serverName, String failoverGroupName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FailoverGroupInner failover(String resourceGroupName, String serverName, String failoverGroupName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FailoverGroupInner failover(String resourceGroupName, String serverName, String failoverGroupName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, FailoverGroupInner> beginForceFailoverAllowDataLoss( + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, FailoverGroupInner> beginForceFailoverAllowDataLoss( + String resourceGroupName, String serverName, String failoverGroupName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FailoverGroupInner forceFailoverAllowDataLoss( + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FailoverGroupInner forceFailoverAllowDataLoss( + String resourceGroupName, String serverName, String failoverGroupName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/FirewallRulesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/FirewallRulesClient.java new file mode 100644 index 0000000000000..926abaa123be9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/FirewallRulesClient.java @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.FirewallRuleInner; +import com.azure.resourcemanager.sql.generated.models.FirewallRuleList; + +/** An instance of this class provides access to all the operations defined in FirewallRulesClient. */ +public interface FirewallRulesClient { + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a firewall rule along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String firewallRuleName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FirewallRuleInner get(String resourceGroupName, String serverName, String firewallRuleName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server firewall rule along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String firewallRuleName, + FirewallRuleInner parameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FirewallRuleInner createOrUpdate( + String resourceGroupName, String serverName, String firewallRuleName, FirewallRuleInner parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse( + String resourceGroupName, String serverName, String firewallRuleName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String 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. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of firewall rules as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of firewall rules as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * 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 parameters A list of server firewall rules. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server firewall rule along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response replaceWithResponse( + String resourceGroupName, String serverName, FirewallRuleList parameters, Context context); + + /** + * 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 parameters A list of server firewall rules. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FirewallRuleInner replace(String resourceGroupName, String serverName, FirewallRuleList parameters); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/GeoBackupPoliciesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/GeoBackupPoliciesClient.java new file mode 100644 index 0000000000000..8af91d8a0e1ef --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/GeoBackupPoliciesClient.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.GeoBackupPolicyInner; +import com.azure.resourcemanager.sql.generated.models.GeoBackupPolicyName; + +/** An instance of this class provides access to all the operations defined in GeoBackupPoliciesClient. */ +public interface GeoBackupPoliciesClient { + /** + * 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 geoBackupPolicyName The name of the geo backup policy. + * @param parameters The required parameters for creating or updating the geo backup policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database geo backup policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + GeoBackupPolicyName geoBackupPolicyName, + GeoBackupPolicyInner parameters, + Context context); + + /** + * 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 geoBackupPolicyName The name of the geo backup policy. + * @param parameters The required parameters for creating or updating the geo backup policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database geo backup policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GeoBackupPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + GeoBackupPolicyName geoBackupPolicyName, + GeoBackupPolicyInner parameters); + + /** + * 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 geoBackupPolicyName The name of the geo backup policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a geo backup policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + GeoBackupPolicyName geoBackupPolicyName, + Context context); + + /** + * 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 geoBackupPolicyName The name of the geo backup policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a geo backup policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GeoBackupPolicyInner get( + String resourceGroupName, String serverName, String databaseName, GeoBackupPolicyName geoBackupPolicyName); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list geo backup policies request as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list geo backup policies request as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/IPv6FirewallRulesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/IPv6FirewallRulesClient.java new file mode 100644 index 0000000000000..9f62a765020c6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/IPv6FirewallRulesClient.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.IPv6FirewallRuleInner; + +/** An instance of this class provides access to all the operations defined in IPv6FirewallRulesClient. */ +public interface IPv6FirewallRulesClient { + /** + * Gets a list of IPv6 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of IPv6 firewall rules as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets a list of IPv6 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of IPv6 firewall rules as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * Gets an IPv6 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an IPv6 firewall rule along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String firewallRuleName, Context context); + + /** + * Gets an IPv6 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an IPv6 firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + IPv6FirewallRuleInner get(String resourceGroupName, String serverName, String firewallRuleName); + + /** + * Creates or updates an IPv6 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 an IPv6 firewall rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an IPv6 server firewall rule along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String firewallRuleName, + IPv6FirewallRuleInner parameters, + Context context); + + /** + * Creates or updates an IPv6 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 an IPv6 firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an IPv6 server firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + IPv6FirewallRuleInner createOrUpdate( + String resourceGroupName, String serverName, String firewallRuleName, IPv6FirewallRuleInner parameters); + + /** + * Deletes an IPv6 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse( + String resourceGroupName, String serverName, String firewallRuleName, Context context); + + /** + * Deletes an IPv6 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String firewallRuleName); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/InstanceFailoverGroupsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/InstanceFailoverGroupsClient.java new file mode 100644 index 0000000000000..c27dbf5299acc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/InstanceFailoverGroupsClient.java @@ -0,0 +1,354 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.InstanceFailoverGroupInner; + +/** An instance of this class provides access to all the operations defined in InstanceFailoverGroupsClient. */ +public interface InstanceFailoverGroupsClient { + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String locationName, String failoverGroupName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + InstanceFailoverGroupInner get(String resourceGroupName, String locationName, String failoverGroupName); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an instance failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, InstanceFailoverGroupInner> beginCreateOrUpdate( + String resourceGroupName, String locationName, String failoverGroupName, InstanceFailoverGroupInner parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an instance failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, InstanceFailoverGroupInner> beginCreateOrUpdate( + String resourceGroupName, + String locationName, + String failoverGroupName, + InstanceFailoverGroupInner parameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + InstanceFailoverGroupInner createOrUpdate( + String resourceGroupName, String locationName, String failoverGroupName, InstanceFailoverGroupInner parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + InstanceFailoverGroupInner createOrUpdate( + String resourceGroupName, + String locationName, + String failoverGroupName, + InstanceFailoverGroupInner parameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String locationName, String failoverGroupName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String locationName, String failoverGroupName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String locationName, String failoverGroupName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String locationName, String failoverGroupName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of instance failover groups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByLocation(String resourceGroupName, String locationName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of instance failover groups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByLocation( + String resourceGroupName, String locationName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an instance failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, InstanceFailoverGroupInner> beginFailover( + String resourceGroupName, String locationName, String failoverGroupName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an instance failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, InstanceFailoverGroupInner> beginFailover( + String resourceGroupName, String locationName, String failoverGroupName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + InstanceFailoverGroupInner failover(String resourceGroupName, String locationName, String failoverGroupName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + InstanceFailoverGroupInner failover( + String resourceGroupName, String locationName, String failoverGroupName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an instance failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, InstanceFailoverGroupInner> beginForceFailoverAllowDataLoss( + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an instance failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, InstanceFailoverGroupInner> beginForceFailoverAllowDataLoss( + String resourceGroupName, String locationName, String failoverGroupName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + InstanceFailoverGroupInner forceFailoverAllowDataLoss( + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + InstanceFailoverGroupInner forceFailoverAllowDataLoss( + String resourceGroupName, String locationName, String failoverGroupName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/InstancePoolsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/InstancePoolsClient.java new file mode 100644 index 0000000000000..65ae9b1cd8dc7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/InstancePoolsClient.java @@ -0,0 +1,283 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.InstancePoolInner; +import com.azure.resourcemanager.sql.generated.models.InstancePoolUpdate; + +/** An instance of this class provides access to all the operations defined in InstancePoolsClient. */ +public interface InstancePoolsClient { + /** + * Gets an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance pool along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String instancePoolName, Context context); + + /** + * Gets an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + InstancePoolInner getByResourceGroup(String resourceGroupName, String instancePoolName); + + /** + * Creates or updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be created or updated. + * @param parameters The requested instance pool resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, InstancePoolInner> beginCreateOrUpdate( + String resourceGroupName, String instancePoolName, InstancePoolInner parameters); + + /** + * Creates or updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be created or updated. + * @param parameters The requested instance pool resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, InstancePoolInner> beginCreateOrUpdate( + String resourceGroupName, String instancePoolName, InstancePoolInner parameters, Context context); + + /** + * Creates or updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be created or updated. + * @param parameters The requested instance pool resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + InstancePoolInner createOrUpdate(String resourceGroupName, String instancePoolName, InstancePoolInner parameters); + + /** + * Creates or updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be created or updated. + * @param parameters The requested instance pool resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + InstancePoolInner createOrUpdate( + String resourceGroupName, String instancePoolName, InstancePoolInner parameters, Context context); + + /** + * Deletes an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String instancePoolName); + + /** + * Deletes an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String instancePoolName, Context context); + + /** + * Deletes an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String instancePoolName); + + /** + * Deletes an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String instancePoolName, Context context); + + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @param parameters The requested instance pool resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, InstancePoolInner> beginUpdate( + String resourceGroupName, String instancePoolName, InstancePoolUpdate parameters); + + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @param parameters The requested instance pool resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, InstancePoolInner> beginUpdate( + String resourceGroupName, String instancePoolName, InstancePoolUpdate parameters, Context context); + + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @param parameters The requested instance pool resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + InstancePoolInner update(String resourceGroupName, String instancePoolName, InstancePoolUpdate parameters); + + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @param parameters The requested instance pool resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + InstancePoolInner update( + String resourceGroupName, String instancePoolName, InstancePoolUpdate parameters, Context context); + + /** + * Gets a list of instance pools in the resource group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of instance pools in the resource group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets a list of instance pools in the resource group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of instance pools in the resource group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets a list of all instance pools in the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all instance pools in the subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets a list of all instance pools in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all instance pools in the subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobAgentsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobAgentsClient.java new file mode 100644 index 0000000000000..2f520d12e6174 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobAgentsClient.java @@ -0,0 +1,279 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.JobAgentInner; +import com.azure.resourcemanager.sql.generated.models.JobAgentUpdate; + +/** An instance of this class provides access to all the operations defined in JobAgentsClient. */ +public interface JobAgentsClient { + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job agents in a server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job agents in a server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job agent along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String jobAgentName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobAgentInner get(String resourceGroupName, String serverName, String jobAgentName); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, JobAgentInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String jobAgentName, JobAgentInner parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, JobAgentInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String jobAgentName, JobAgentInner parameters, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobAgentInner createOrUpdate( + String resourceGroupName, String serverName, String jobAgentName, JobAgentInner parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobAgentInner createOrUpdate( + String resourceGroupName, String serverName, String jobAgentName, JobAgentInner parameters, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String serverName, String jobAgentName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String jobAgentName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String jobAgentName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String jobAgentName, Context context); + + /** + * 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 parameters The update to the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, JobAgentInner> beginUpdate( + String resourceGroupName, String serverName, String jobAgentName, JobAgentUpdate parameters); + + /** + * 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 parameters The update to the job agent. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, JobAgentInner> beginUpdate( + String resourceGroupName, String serverName, String jobAgentName, JobAgentUpdate parameters, Context context); + + /** + * 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 parameters The update to the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobAgentInner update(String resourceGroupName, String serverName, String jobAgentName, JobAgentUpdate parameters); + + /** + * 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 parameters The update to the job agent. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobAgentInner update( + String resourceGroupName, String serverName, String jobAgentName, JobAgentUpdate parameters, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobCredentialsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobCredentialsClient.java new file mode 100644 index 0000000000000..25df496075deb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobCredentialsClient.java @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.JobCredentialInner; + +/** An instance of this class provides access to all the operations defined in JobCredentialsClient. */ +public interface JobCredentialsClient { + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of jobs credentials as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByAgent(String resourceGroupName, String serverName, String jobAgentName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of jobs credentials as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByAgent( + String resourceGroupName, String serverName, String jobAgentName, Context context); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a jobs credential along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String jobAgentName, String credentialName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a jobs credential. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobCredentialInner get(String resourceGroupName, String serverName, String jobAgentName, String credentialName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a stored credential that can be used by a job to connect to target databases along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String credentialName, + JobCredentialInner parameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a stored credential that can be used by a job to connect to target databases. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobCredentialInner createOrUpdate( + String resourceGroupName, + String serverName, + String jobAgentName, + String credentialName, + JobCredentialInner parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse( + String resourceGroupName, String serverName, String jobAgentName, String credentialName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String jobAgentName, String credentialName); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobExecutionsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobExecutionsClient.java new file mode 100644 index 0000000000000..a458e06d08fcf --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobExecutionsClient.java @@ -0,0 +1,356 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.JobExecutionInner; +import java.time.OffsetDateTime; +import java.util.UUID; + +/** An instance of this class provides access to all the operations defined in JobExecutionsClient. */ +public interface JobExecutionsClient { + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByAgent(String resourceGroupName, String serverName, String jobAgentName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByAgent( + String resourceGroupName, + String serverName, + String jobAgentName, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + Context context); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response cancelWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void cancel(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. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an execution of a job. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, JobExecutionInner> beginCreate( + String resourceGroupName, String serverName, String jobAgentName, String jobName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an execution of a job. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, JobExecutionInner> beginCreate( + String resourceGroupName, String serverName, String jobAgentName, String jobName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an execution of a job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobExecutionInner create(String resourceGroupName, String serverName, String jobAgentName, String jobName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an execution of a job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobExecutionInner create( + String resourceGroupName, String serverName, String jobAgentName, String jobName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByJob( + String resourceGroupName, String serverName, String jobAgentName, String jobName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByJob( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + Context context); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job execution along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job execution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobExecutionInner get( + String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId); + + /** + * 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. + * @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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an execution of a job. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, JobExecutionInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId); + + /** + * 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. + * @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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an execution of a job. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, JobExecutionInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + Context context); + + /** + * 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. + * @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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an execution of a job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobExecutionInner createOrUpdate( + String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId); + + /** + * 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. + * @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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an execution of a job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobExecutionInner createOrUpdate( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobStepExecutionsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobStepExecutionsClient.java new file mode 100644 index 0000000000000..3b9618d3bee16 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobStepExecutionsClient.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.JobExecutionInner; +import java.time.OffsetDateTime; +import java.util.UUID; + +/** An instance of this class provides access to all the operations defined in JobStepExecutionsClient. */ +public interface JobStepExecutionsClient { + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByJobExecution( + String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByJobExecution( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + Context context); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a step execution of a job execution along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a step execution of a job execution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobExecutionInner get( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobStepsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobStepsClient.java new file mode 100644 index 0000000000000..c256a0bfbed22 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobStepsClient.java @@ -0,0 +1,273 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.JobStepInner; + +/** An instance of this class provides access to all the operations defined in JobStepsClient. */ +public interface JobStepsClient { + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all job steps in the specified job version as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByVersion( + String resourceGroupName, String serverName, String jobAgentName, String jobName, int jobVersion); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all job steps in the specified job version as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByVersion( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + int jobVersion, + Context context); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified version of a job step along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByVersionWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + int jobVersion, + String stepName, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified version of a job step. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobStepInner getByVersion( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + int jobVersion, + String stepName); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all job steps for a job's current version as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByJob( + String resourceGroupName, String serverName, String jobAgentName, String jobName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all job steps for a job's current version as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByJob( + String resourceGroupName, String serverName, String jobAgentName, String jobName, Context context); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job step in a job's current version along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + String stepName, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job step in a job's current version. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobStepInner get(String resourceGroupName, String serverName, String jobAgentName, String jobName, String stepName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job step along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + String stepName, + JobStepInner parameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job step. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobStepInner createOrUpdate( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + String stepName, + JobStepInner parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + String stepName, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String jobAgentName, String jobName, String stepName); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobTargetExecutionsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobTargetExecutionsClient.java new file mode 100644 index 0000000000000..1f817e52ac3de --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobTargetExecutionsClient.java @@ -0,0 +1,191 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.JobExecutionInner; +import java.time.OffsetDateTime; +import java.util.UUID; + +/** An instance of this class provides access to all the operations defined in JobTargetExecutionsClient. */ +public interface JobTargetExecutionsClient { + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByJobExecution( + String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByJobExecution( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByStep( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByStep( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + Context context); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a target execution along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName, + UUID targetId, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a target execution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobExecutionInner get( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName, + UUID targetId); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobTargetGroupsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobTargetGroupsClient.java new file mode 100644 index 0000000000000..67ea21c294458 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobTargetGroupsClient.java @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.JobTargetGroupInner; + +/** An instance of this class provides access to all the operations defined in JobTargetGroupsClient. */ +public interface JobTargetGroupsClient { + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all target groups in an agent as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByAgent(String resourceGroupName, String serverName, String jobAgentName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all target groups in an agent as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByAgent( + String resourceGroupName, String serverName, String jobAgentName, Context context); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a target group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String jobAgentName, String targetGroupName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a target group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobTargetGroupInner get(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName); + + /** + * 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 parameters The requested state of the target group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a group of job targets along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String targetGroupName, + JobTargetGroupInner parameters, + Context context); + + /** + * 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 parameters The requested state of the target group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a group of job targets. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobTargetGroupInner createOrUpdate( + String resourceGroupName, + String serverName, + String jobAgentName, + String targetGroupName, + JobTargetGroupInner parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse( + String resourceGroupName, String serverName, String jobAgentName, String targetGroupName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobVersionsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobVersionsClient.java new file mode 100644 index 0000000000000..a0069c55ff41e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobVersionsClient.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.JobVersionInner; + +/** An instance of this class provides access to all the operations defined in JobVersionsClient. */ +public interface JobVersionsClient { + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all versions of a job as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByJob( + String resourceGroupName, String serverName, String jobAgentName, String jobName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all versions of a job as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByJob( + String resourceGroupName, String serverName, String jobAgentName, String jobName, Context context); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job version along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + int jobVersion, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job version. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobVersionInner get( + String resourceGroupName, String serverName, String jobAgentName, String jobName, int jobVersion); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobsClient.java new file mode 100644 index 0000000000000..a56ac1768a1e5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/JobsClient.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.JobInner; + +/** An instance of this class provides access to all the operations defined in JobsClient. */ +public interface JobsClient { + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of jobs as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByAgent(String resourceGroupName, String serverName, String jobAgentName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of jobs as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByAgent( + String resourceGroupName, String serverName, String jobAgentName, Context context); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String jobAgentName, String jobName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobInner get(String resourceGroupName, String serverName, String jobAgentName, String jobName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + JobInner parameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobInner createOrUpdate( + String resourceGroupName, String serverName, String jobAgentName, String jobName, JobInner parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse( + String resourceGroupName, String serverName, String jobAgentName, String jobName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String jobAgentName, String jobName); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/LedgerDigestUploadsOperationsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/LedgerDigestUploadsOperationsClient.java new file mode 100644 index 0000000000000..d380166d13f49 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/LedgerDigestUploadsOperationsClient.java @@ -0,0 +1,260 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.LedgerDigestUploadsInner; +import com.azure.resourcemanager.sql.generated.models.LedgerDigestUploadsName; + +/** An instance of this class provides access to all the operations defined in LedgerDigestUploadsOperationsClient. */ +public interface LedgerDigestUploadsOperationsClient { + /** + * Gets the current ledger digest upload configuration for 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 ledgerDigestUploads The ledgerDigestUploads parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current ledger digest upload configuration for a database along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + LedgerDigestUploadsName ledgerDigestUploads, + Context context); + + /** + * Gets the current ledger digest upload configuration for 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 ledgerDigestUploads The ledgerDigestUploads parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current ledger digest upload configuration for a database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LedgerDigestUploadsInner get( + String resourceGroupName, String serverName, String databaseName, LedgerDigestUploadsName ledgerDigestUploads); + + /** + * Enables upload ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads parameter. + * @param parameters Azure SQL Database ledger digest upload settings. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of azure SQL Database ledger digest upload settings. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, LedgerDigestUploadsInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + LedgerDigestUploadsName ledgerDigestUploads, + LedgerDigestUploadsInner parameters); + + /** + * Enables upload ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads parameter. + * @param parameters Azure SQL Database ledger digest upload settings. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of azure SQL Database ledger digest upload settings. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, LedgerDigestUploadsInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + LedgerDigestUploadsName ledgerDigestUploads, + LedgerDigestUploadsInner parameters, + Context context); + + /** + * Enables upload ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads parameter. + * @param parameters Azure SQL Database ledger digest upload settings. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure SQL Database ledger digest upload settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LedgerDigestUploadsInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + LedgerDigestUploadsName ledgerDigestUploads, + LedgerDigestUploadsInner parameters); + + /** + * Enables upload ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads parameter. + * @param parameters Azure SQL Database ledger digest upload settings. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure SQL Database ledger digest upload settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LedgerDigestUploadsInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + LedgerDigestUploadsName ledgerDigestUploads, + LedgerDigestUploadsInner parameters, + Context context); + + /** + * Gets all ledger digest upload settings on 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all ledger digest upload settings on a database as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName); + + /** + * Gets all ledger digest upload settings on 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all ledger digest upload settings on a database as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Disables uploading ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of azure SQL Database ledger digest upload settings. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, LedgerDigestUploadsInner> beginDisable( + String resourceGroupName, String serverName, String databaseName, LedgerDigestUploadsName ledgerDigestUploads); + + /** + * Disables uploading ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of azure SQL Database ledger digest upload settings. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, LedgerDigestUploadsInner> beginDisable( + String resourceGroupName, + String serverName, + String databaseName, + LedgerDigestUploadsName ledgerDigestUploads, + Context context); + + /** + * Disables uploading ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure SQL Database ledger digest upload settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LedgerDigestUploadsInner disable( + String resourceGroupName, String serverName, String databaseName, LedgerDigestUploadsName ledgerDigestUploads); + + /** + * Disables uploading ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure SQL Database ledger digest upload settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LedgerDigestUploadsInner disable( + String resourceGroupName, + String serverName, + String databaseName, + LedgerDigestUploadsName ledgerDigestUploads, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/LongTermRetentionBackupsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/LongTermRetentionBackupsClient.java new file mode 100644 index 0000000000000..61a4b0adf3a16 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/LongTermRetentionBackupsClient.java @@ -0,0 +1,882 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.LongTermRetentionBackupInner; +import com.azure.resourcemanager.sql.generated.fluent.models.LongTermRetentionBackupOperationResultInner; +import com.azure.resourcemanager.sql.generated.models.CopyLongTermRetentionBackupParameters; +import com.azure.resourcemanager.sql.generated.models.DatabaseState; +import com.azure.resourcemanager.sql.generated.models.UpdateLongTermRetentionBackupParameters; + +/** An instance of this class provides access to all the operations defined in LongTermRetentionBackupsClient. */ +public interface LongTermRetentionBackupsClient { + /** + * Copy an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, LongTermRetentionBackupOperationResultInner> + beginCopy( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters); + + /** + * Copy an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, LongTermRetentionBackupOperationResultInner> + beginCopy( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters, + Context context); + + /** + * Copy an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LongTermRetentionBackupOperationResultInner copy( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters); + + /** + * Copy an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LongTermRetentionBackupOperationResultInner copy( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters, + Context context); + + /** + * Updates an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, LongTermRetentionBackupOperationResultInner> + beginUpdate( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters); + + /** + * Updates an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, LongTermRetentionBackupOperationResultInner> + beginUpdate( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters, + Context context); + + /** + * Updates an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LongTermRetentionBackupOperationResultInner update( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters); + + /** + * Updates an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LongTermRetentionBackupOperationResultInner update( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters, + Context context); + + /** + * Gets a long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + Context context); + + /** + * Gets a long term retention backup. + * + * @param locationName The location of the database. + * @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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LongTermRetentionBackupInner get( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName); + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName); + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + Context context); + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName); + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + Context context); + + /** + * Lists all long term retention backups for a database. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName); + + /** + * Lists all long term retention backups for a database. + * + * @param locationName The location of the database. + * @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByLocation(String locationName); + + /** + * 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByLocation( + String locationName, Boolean onlyLatestPerDatabase, DatabaseState databaseState, Context context); + + /** + * Lists the long term retention backups for a given server. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String locationName, String longTermRetentionServerName); + + /** + * Lists the long term retention backups for a given server. + * + * @param locationName The location of the database. + * @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String locationName, + String longTermRetentionServerName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context); + + /** + * Copy an existing long term retention backup to a different server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, LongTermRetentionBackupOperationResultInner> + beginCopyByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters); + + /** + * Copy an existing long term retention backup to a different server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, LongTermRetentionBackupOperationResultInner> + beginCopyByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters, + Context context); + + /** + * Copy an existing long term retention backup to a different server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LongTermRetentionBackupOperationResultInner copyByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters); + + /** + * Copy an existing long term retention backup to a different server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LongTermRetentionBackupOperationResultInner copyByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters, + Context context); + + /** + * Updates an existing long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, LongTermRetentionBackupOperationResultInner> + beginUpdateByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters); + + /** + * Updates an existing long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, LongTermRetentionBackupOperationResultInner> + beginUpdateByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters, + Context context); + + /** + * Updates an existing long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LongTermRetentionBackupOperationResultInner updateByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters); + + /** + * Updates an existing long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LongTermRetentionBackupOperationResultInner updateByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters, + Context context); + + /** + * Gets a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + Context context); + + /** + * Gets a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LongTermRetentionBackupInner getByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName); + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName); + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + Context context); + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName); + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + Context context); + + /** + * Lists all long term retention backups for 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 locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroupDatabase( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName); + + /** + * Lists all long term retention backups for 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 locationName The location of the database. + * @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroupDatabase( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context); + + /** + * Lists the long term retention backups for a given location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroupLocation( + String resourceGroupName, String locationName); + + /** + * Lists the long term retention backups for a given location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroupLocation( + String resourceGroupName, + String locationName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context); + + /** + * Lists the long term retention backups 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 locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroupServer( + String resourceGroupName, String locationName, String longTermRetentionServerName); + + /** + * Lists the long term retention backups 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 locationName The location of the database. + * @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroupServer( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/LongTermRetentionManagedInstanceBackupsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/LongTermRetentionManagedInstanceBackupsClient.java new file mode 100644 index 0000000000000..7ede83052f64b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/LongTermRetentionManagedInstanceBackupsClient.java @@ -0,0 +1,486 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceLongTermRetentionBackupInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseState; + +/** + * An instance of this class provides access to all the operations defined in + * LongTermRetentionManagedInstanceBackupsClient. + */ +public interface LongTermRetentionManagedInstanceBackupsClient { + /** + * Gets a long term retention backup for a managed database. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup for a managed database along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String locationName, String managedInstanceName, String databaseName, String backupName, Context context); + + /** + * Gets a long term retention backup for a managed database. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup for a managed database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceLongTermRetentionBackupInner get( + String locationName, String managedInstanceName, String databaseName, String backupName); + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String locationName, String managedInstanceName, String databaseName, String backupName); + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String locationName, String managedInstanceName, String databaseName, String backupName, Context context); + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String locationName, String managedInstanceName, String databaseName, String backupName); + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete( + String locationName, String managedInstanceName, String databaseName, String backupName, Context context); + + /** + * Lists all long term retention backups for a managed database. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String locationName, String managedInstanceName, String databaseName); + + /** + * Lists all long term retention backups for a managed database. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String locationName, + String managedInstanceName, + String databaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context); + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstance( + String locationName, String managedInstanceName); + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstance( + String locationName, + String managedInstanceName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context); + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param locationName The location of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByLocation(String locationName); + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param locationName The location of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByLocation( + String locationName, Boolean onlyLatestPerDatabase, DatabaseState databaseState, Context context); + + /** + * Gets a long term retention backup for a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup for a managed database along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + String backupName, + Context context); + + /** + * Gets a long term retention backup for a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup for a managed database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceLongTermRetentionBackupInner getByResourceGroup( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + String backupName); + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteByResourceGroup( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + String backupName); + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDeleteByResourceGroup( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + String backupName, + Context context); + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteByResourceGroup( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + String backupName); + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void deleteByResourceGroup( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + String backupName, + Context context); + + /** + * Lists all long term retention backups for a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroupDatabase( + String resourceGroupName, String locationName, String managedInstanceName, String databaseName); + + /** + * Lists all long term retention backups for a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroupDatabase( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context); + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroupInstance( + String resourceGroupName, String locationName, String managedInstanceName); + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroupInstance( + String resourceGroupName, + String locationName, + String managedInstanceName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context); + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroupLocation( + String resourceGroupName, String locationName); + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroupLocation( + String resourceGroupName, + String locationName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/LongTermRetentionPoliciesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/LongTermRetentionPoliciesClient.java new file mode 100644 index 0000000000000..cd8505c5a5814 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/LongTermRetentionPoliciesClient.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.LongTermRetentionPolicyInner; +import com.azure.resourcemanager.sql.generated.models.LongTermRetentionPolicyName; + +/** An instance of this class provides access to all the operations defined in LongTermRetentionPoliciesClient. */ +public interface LongTermRetentionPoliciesClient { + /** + * 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 policyName The policy name. Should always be Default. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's long term retention policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + LongTermRetentionPolicyName policyName, + Context context); + + /** + * 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 policyName The policy name. Should always be Default. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's long term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LongTermRetentionPolicyInner get( + String resourceGroupName, String serverName, String databaseName, LongTermRetentionPolicyName policyName); + + /** + * 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 policyName The policy name. Should always be Default. + * @param parameters The long term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a long term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, LongTermRetentionPolicyInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + LongTermRetentionPolicyName policyName, + LongTermRetentionPolicyInner parameters); + + /** + * 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 policyName The policy name. Should always be Default. + * @param parameters The long term retention policy info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a long term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, LongTermRetentionPolicyInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + LongTermRetentionPolicyName policyName, + LongTermRetentionPolicyInner parameters, + Context context); + + /** + * 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 policyName The policy name. Should always be Default. + * @param parameters The long term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LongTermRetentionPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + LongTermRetentionPolicyName policyName, + LongTermRetentionPolicyInner parameters); + + /** + * 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 policyName The policy name. Should always be Default. + * @param parameters The long term retention policy info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LongTermRetentionPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + LongTermRetentionPolicyName policyName, + LongTermRetentionPolicyInner parameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's long term retention policy as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's long term retention policy as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/MaintenanceWindowOptionsOperationsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/MaintenanceWindowOptionsOperationsClient.java new file mode 100644 index 0000000000000..8d3f880b78f12 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/MaintenanceWindowOptionsOperationsClient.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.MaintenanceWindowOptionsInner; + +/** + * An instance of this class provides access to all the operations defined in MaintenanceWindowOptionsOperationsClient. + */ +public interface MaintenanceWindowOptionsOperationsClient { + /** + * Gets a list of available maintenance windows. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 maintenance windows options for. + * @param maintenanceWindowOptionsName Maintenance window options name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of available maintenance windows along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String maintenanceWindowOptionsName, + Context context); + + /** + * Gets a list of available maintenance windows. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 maintenance windows options for. + * @param maintenanceWindowOptionsName Maintenance window options name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of available maintenance windows. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MaintenanceWindowOptionsInner get( + String resourceGroupName, String serverName, String databaseName, String maintenanceWindowOptionsName); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/MaintenanceWindowsOperationsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/MaintenanceWindowsOperationsClient.java new file mode 100644 index 0000000000000..90fe2ffddc063 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/MaintenanceWindowsOperationsClient.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.MaintenanceWindowsInner; + +/** An instance of this class provides access to all the operations defined in MaintenanceWindowsOperationsClient. */ +public interface MaintenanceWindowsOperationsClient { + /** + * Gets maintenance windows settings for 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 get maintenance windows for. + * @param maintenanceWindowName Maintenance window name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return maintenance windows settings for a database along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String maintenanceWindowName, + Context context); + + /** + * Gets maintenance windows settings for 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 get maintenance windows for. + * @param maintenanceWindowName Maintenance window name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return maintenance windows settings for a database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MaintenanceWindowsInner get( + String resourceGroupName, String serverName, String databaseName, String maintenanceWindowName); + + /** + * Sets maintenance windows settings for 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 set maintenance windows for. + * @param maintenanceWindowName Maintenance window name. + * @param parameters Maintenance windows. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String maintenanceWindowName, + MaintenanceWindowsInner parameters, + Context context); + + /** + * Sets maintenance windows settings for 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 set maintenance windows for. + * @param maintenanceWindowName Maintenance window name. + * @param parameters Maintenance windows. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String maintenanceWindowName, + MaintenanceWindowsInner parameters); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedBackupShortTermRetentionPoliciesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedBackupShortTermRetentionPoliciesClient.java new file mode 100644 index 0000000000000..c7992fb68063d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedBackupShortTermRetentionPoliciesClient.java @@ -0,0 +1,284 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedBackupShortTermRetentionPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ManagedShortTermRetentionPolicyName; + +/** + * An instance of this class provides access to all the operations defined in + * ManagedBackupShortTermRetentionPoliciesClient. + */ +public interface ManagedBackupShortTermRetentionPoliciesClient { + /** + * 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 policyName The policy name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's short term retention policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + Context context); + + /** + * 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 policyName The policy name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedBackupShortTermRetentionPolicyInner get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName); + + /** + * 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 policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagedBackupShortTermRetentionPolicyInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters); + + /** + * 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 policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagedBackupShortTermRetentionPolicyInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context); + + /** + * 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 policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedBackupShortTermRetentionPolicyInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters); + + /** + * 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 policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedBackupShortTermRetentionPolicyInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context); + + /** + * 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 policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagedBackupShortTermRetentionPolicyInner> + beginUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters); + + /** + * 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 policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagedBackupShortTermRetentionPolicyInner> + beginUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context); + + /** + * 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 policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedBackupShortTermRetentionPolicyInner update( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters); + + /** + * 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 policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedBackupShortTermRetentionPolicyInner update( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's short term retention policy list as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's short term retention policy list as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseAdvancedThreatProtectionSettingsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseAdvancedThreatProtectionSettingsClient.java new file mode 100644 index 0000000000000..0d48e77f6f93f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseAdvancedThreatProtectionSettingsClient.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedDatabaseAdvancedThreatProtectionInner; +import com.azure.resourcemanager.sql.generated.models.AdvancedThreatProtectionName; + +/** + * An instance of this class provides access to all the operations defined in + * ManagedDatabaseAdvancedThreatProtectionSettingsClient. + */ +public interface ManagedDatabaseAdvancedThreatProtectionSettingsClient { + /** + * Gets a list of managed database's Advanced Threat Protection states. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed database's Advanced Threat Protection states as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName); + + /** + * Gets a list of managed database's Advanced Threat Protection states. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed database's Advanced Threat Protection states as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName, Context context); + + /** + * Gets a managed database's Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's Advanced Threat Protection state along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + AdvancedThreatProtectionName advancedThreatProtectionName, + Context context); + + /** + * Gets a managed database's Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's Advanced Threat Protection state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedDatabaseAdvancedThreatProtectionInner get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + AdvancedThreatProtectionName advancedThreatProtectionName); + + /** + * Creates or updates a managed database's Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @param parameters The managed database Advanced Threat Protection state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database Advanced Threat Protection along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + AdvancedThreatProtectionName advancedThreatProtectionName, + ManagedDatabaseAdvancedThreatProtectionInner parameters, + Context context); + + /** + * Creates or updates a managed database's Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @param parameters The managed database Advanced Threat Protection state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database Advanced Threat Protection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedDatabaseAdvancedThreatProtectionInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + AdvancedThreatProtectionName advancedThreatProtectionName, + ManagedDatabaseAdvancedThreatProtectionInner parameters); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseColumnsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseColumnsClient.java new file mode 100644 index 0000000000000..ab9587400a8f3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseColumnsClient.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseColumnInner; +import java.util.List; + +/** An instance of this class provides access to all the operations defined in ManagedDatabaseColumnsClient. */ +public interface ManagedDatabaseColumnsClient { + /** + * List managed database columns. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database columns as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName); + + /** + * List managed database columns. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schema Array of Get3ItemsItem. + * @param table Array of Get4ItemsItem. + * @param column Array of Get5ItemsItem. + * @param orderBy Array of Get6ItemsItem. + * @param skiptoken An opaque token that identifies a starting point in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database columns as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, + String managedInstanceName, + String databaseName, + List schema, + List table, + List column, + List orderBy, + String skiptoken, + Context context); + + /** + * List managed database columns. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database columns as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByTable( + String resourceGroupName, String managedInstanceName, String databaseName, String schemaName, String tableName); + + /** + * List managed database columns. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param filter An OData filter expression that filters elements in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database columns as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByTable( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String filter, + Context context); + + /** + * Get managed database column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return managed database column along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context); + + /** + * Get managed database column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return managed database column. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseColumnInner get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseMoveOperationsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseMoveOperationsClient.java new file mode 100644 index 0000000000000..189a4814a8995 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseMoveOperationsClient.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedDatabaseMoveOperationResultInner; +import java.util.UUID; + +/** An instance of this class provides access to all the operations defined in ManagedDatabaseMoveOperationsClient. */ +public interface ManagedDatabaseMoveOperationsClient { + /** + * Lists managed database move operations. + * + * @param resourceGroupName The 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 locationName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed database move operations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByLocation( + String resourceGroupName, String locationName); + + /** + * Lists managed database move operations. + * + * @param resourceGroupName The 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 locationName parameter. + * @param onlyLatestPerDatabase Whether or not to only get the latest operation for each database. Has higher + * priority than $filter. + * @param filter An OData filter expression that filters elements in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed database move operations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByLocation( + String resourceGroupName, String locationName, Boolean onlyLatestPerDatabase, String filter, Context context); + + /** + * Gets a managed database move operation. + * + * @param resourceGroupName The 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 locationName parameter. + * @param operationId The operationId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database move operation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String locationName, UUID operationId, Context context); + + /** + * Gets a managed database move operation. + * + * @param resourceGroupName The 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 locationName parameter. + * @param operationId The operationId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database move operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedDatabaseMoveOperationResultInner get(String resourceGroupName, String locationName, UUID operationId); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseQueriesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseQueriesClient.java new file mode 100644 index 0000000000000..4d7ab0f78e4b7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseQueriesClient.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceQueryInner; +import com.azure.resourcemanager.sql.generated.fluent.models.QueryStatisticsInner; +import com.azure.resourcemanager.sql.generated.models.QueryTimeGrainType; + +/** An instance of this class provides access to all the operations defined in ManagedDatabaseQueriesClient. */ +public interface ManagedDatabaseQueriesClient { + /** + * Get query by query id. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 queryId The queryId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query by query id along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String managedInstanceName, String databaseName, String queryId, Context context); + + /** + * Get query by query id. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 queryId The queryId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query by query id. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceQueryInner get( + String resourceGroupName, String managedInstanceName, String databaseName, String queryId); + + /** + * Get query execution statistics by query id. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 queryId The queryId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query execution statistics by query id as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByQuery( + String resourceGroupName, String managedInstanceName, String databaseName, String queryId); + + /** + * Get query execution statistics by query id. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 queryId The queryId parameter. + * @param startTime Start time for observed period. + * @param endTime End time for observed period. + * @param interval The time step to be used to summarize the metric values. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query execution statistics by query id as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByQuery( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String queryId, + String startTime, + String endTime, + QueryTimeGrainType interval, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseRecommendedSensitivityLabelsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseRecommendedSensitivityLabelsClient.java new file mode 100644 index 0000000000000..f539f771a0e59 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseRecommendedSensitivityLabelsClient.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.RecommendedSensitivityLabelUpdateList; + +/** + * An instance of this class provides access to all the operations defined in + * ManagedDatabaseRecommendedSensitivityLabelsClient. + */ +public interface ManagedDatabaseRecommendedSensitivityLabelsClient { + /** + * Update recommended sensitivity labels states of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of recommended sensitivity label update operations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + RecommendedSensitivityLabelUpdateList parameters, + Context context); + + /** + * Update recommended sensitivity labels states of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of recommended sensitivity label update operations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void update( + String resourceGroupName, + String managedInstanceName, + String databaseName, + RecommendedSensitivityLabelUpdateList parameters); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseRestoreDetailsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseRestoreDetailsClient.java new file mode 100644 index 0000000000000..7e5068eb132dc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseRestoreDetailsClient.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedDatabaseRestoreDetailsResultInner; +import com.azure.resourcemanager.sql.generated.models.RestoreDetailsName; + +/** An instance of this class provides access to all the operations defined in ManagedDatabaseRestoreDetailsClient. */ +public interface ManagedDatabaseRestoreDetailsClient { + /** + * Gets managed database restore details. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param restoreDetailsName The name of the restore details to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return managed database restore details along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + RestoreDetailsName restoreDetailsName, + Context context); + + /** + * Gets managed database restore details. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param restoreDetailsName The name of the restore details to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return managed database restore details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedDatabaseRestoreDetailsResultInner get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + RestoreDetailsName restoreDetailsName); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseSchemasClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseSchemasClient.java new file mode 100644 index 0000000000000..f12a0a566c340 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseSchemasClient.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseSchemaInner; + +/** An instance of this class provides access to all the operations defined in ManagedDatabaseSchemasClient. */ +public interface ManagedDatabaseSchemasClient { + /** + * List managed 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database schemas as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName); + + /** + * List managed 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param filter An OData filter expression that filters elements in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database schemas as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName, String filter, Context context); + + /** + * Get managed 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return managed database schema along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String managedInstanceName, String databaseName, String schemaName, Context context); + + /** + * Get managed 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return managed database schema. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseSchemaInner get( + String resourceGroupName, String managedInstanceName, String databaseName, String schemaName); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseSecurityAlertPoliciesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseSecurityAlertPoliciesClient.java new file mode 100644 index 0000000000000..a23018465c2bb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseSecurityAlertPoliciesClient.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedDatabaseSecurityAlertPolicyInner; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyName; + +/** + * An instance of this class provides access to all the operations defined in + * ManagedDatabaseSecurityAlertPoliciesClient. + */ +public interface ManagedDatabaseSecurityAlertPoliciesClient { + /** + * 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 securityAlertPolicyName The name of the security alert policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's security alert policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName, + Context context); + + /** + * 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 securityAlertPolicyName The name of the security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedDatabaseSecurityAlertPolicyInner get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName); + + /** + * 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 securityAlertPolicyName The name of the security alert policy. + * @param parameters The database security alert policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database security alert policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName, + ManagedDatabaseSecurityAlertPolicyInner parameters, + Context context); + + /** + * 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 securityAlertPolicyName The name of the security alert policy. + * @param parameters The database security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedDatabaseSecurityAlertPolicyInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName, + ManagedDatabaseSecurityAlertPolicyInner parameters); + + /** + * Gets a list of managed database's security alert policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policies are defined. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed database's security alert policies as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName); + + /** + * Gets a list of managed database's security alert policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policies are defined. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed database's security alert policies as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseSecurityEventsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseSecurityEventsClient.java new file mode 100644 index 0000000000000..27b80a7285833 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseSecurityEventsClient.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.SecurityEventInner; + +/** An instance of this class provides access to all the operations defined in ManagedDatabaseSecurityEventsClient. */ +public interface ManagedDatabaseSecurityEventsClient { + /** + * Gets a list of security events. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 events are retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of security events as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName); + + /** + * Gets a list of security events. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 events are retrieved. + * @param filter An OData filter expression that filters elements in the collection. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param skiptoken An opaque token that identifies a starting point in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of security events as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String filter, + Integer skip, + Integer top, + String skiptoken, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseSensitivityLabelsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseSensitivityLabelsClient.java new file mode 100644 index 0000000000000..6774d8fcd3a50 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseSensitivityLabelsClient.java @@ -0,0 +1,399 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.SensitivityLabelInner; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelSource; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelUpdateList; + +/** + * An instance of this class provides access to all the operations defined in ManagedDatabaseSensitivityLabelsClient. + */ +public interface ManagedDatabaseSensitivityLabelsClient { + /** + * Gets the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param sensitivityLabelSource The source of the sensitivity label. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity label of a given column along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelSource sensitivityLabelSource, + Context context); + + /** + * Gets the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param sensitivityLabelSource The source of the sensitivity label. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity label of a given column. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SensitivityLabelInner get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelSource sensitivityLabelSource); + + /** + * Creates or updates the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param parameters The column sensitivity label resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sensitivity label along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelInner parameters, + Context context); + + /** + * Creates or updates the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param parameters The column sensitivity label resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sensitivity label. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SensitivityLabelInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelInner parameters); + + /** + * Deletes the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context); + + /** + * Deletes the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName); + + /** + * Disables sensitivity recommendations on a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response disableRecommendationWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context); + + /** + * Disables sensitivity recommendations on a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void disableRecommendation( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName); + + /** + * Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response enableRecommendationWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context); + + /** + * Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void enableRecommendation( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName); + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity labels of a given database as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listCurrentByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName); + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param skipToken The skipToken parameter. + * @param count The count parameter. + * @param filter An OData filter expression that filters elements in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity labels of a given database as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listCurrentByDatabase( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String skipToken, + Boolean count, + String filter, + Context context); + + /** + * Update sensitivity labels of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of sensitivity label update operations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + SensitivityLabelUpdateList parameters, + Context context); + + /** + * Update sensitivity labels of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of sensitivity label update operations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void update( + String resourceGroupName, + String managedInstanceName, + String databaseName, + SensitivityLabelUpdateList parameters); + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity labels of a given database as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listRecommendedByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName); + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param skipToken The skipToken parameter. + * @param includeDisabledRecommendations Specifies whether to include disabled recommendations or not. + * @param filter An OData filter expression that filters elements in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity labels of a given database as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listRecommendedByDatabase( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String skipToken, + Boolean includeDisabledRecommendations, + String filter, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseTablesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseTablesClient.java new file mode 100644 index 0000000000000..5e003024ba6d2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseTablesClient.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseTableInner; + +/** An instance of this class provides access to all the operations defined in ManagedDatabaseTablesClient. */ +public interface ManagedDatabaseTablesClient { + /** + * List managed database tables. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database tables as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySchema( + String resourceGroupName, String managedInstanceName, String databaseName, String schemaName); + + /** + * List managed database tables. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param filter An OData filter expression that filters elements in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database tables as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySchema( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String filter, + Context context); + + /** + * Get managed database table. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return managed database table along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + Context context); + + /** + * Get managed database table. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return managed database table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseTableInner get( + String resourceGroupName, String managedInstanceName, String databaseName, String schemaName, String tableName); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseTransparentDataEncryptionsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseTransparentDataEncryptionsClient.java new file mode 100644 index 0000000000000..d25685d443f02 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseTransparentDataEncryptionsClient.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedTransparentDataEncryptionInner; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionName; + +/** + * An instance of this class provides access to all the operations defined in + * ManagedDatabaseTransparentDataEncryptionsClient. + */ +public interface ManagedDatabaseTransparentDataEncryptionsClient { + /** + * Gets a managed database's transparent data encryption. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 transparent data encryption is defined. + * @param tdeName The name of the transparent data encryption configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's transparent data encryption along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + TransparentDataEncryptionName tdeName, + Context context); + + /** + * Gets a managed database's transparent data encryption. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 transparent data encryption is defined. + * @param tdeName The name of the transparent data encryption configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's transparent data encryption. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedTransparentDataEncryptionInner get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + TransparentDataEncryptionName tdeName); + + /** + * 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policy is defined. + * @param tdeName The name of the transparent data encryption configuration. + * @param parameters The database transparent data encryption. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database transparent data encryption state along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + TransparentDataEncryptionName tdeName, + ManagedTransparentDataEncryptionInner parameters, + Context context); + + /** + * 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policy is defined. + * @param tdeName The name of the transparent data encryption configuration. + * @param parameters The database transparent data encryption. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database transparent data encryption state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedTransparentDataEncryptionInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + TransparentDataEncryptionName tdeName, + ManagedTransparentDataEncryptionInner parameters); + + /** + * Gets a list of managed database's transparent data encryptions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 transparent data encryption is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed database's transparent data encryptions as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName); + + /** + * Gets a list of managed database's transparent data encryptions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 transparent data encryption is defined. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed database's transparent data encryptions as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient.java new file mode 100644 index 0000000000000..419a4fc8283e1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient.java @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentRuleBaselineInner; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentPolicyBaselineName; + +/** + * An instance of this class provides access to all the operations defined in + * ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient. + */ +public interface ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient { + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's vulnerability assessment rule baseline along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's vulnerability assessment rule baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseVulnerabilityAssessmentRuleBaselineInner get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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). + * @param parameters The requested rule baseline resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database vulnerability assessment rule baseline along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + DatabaseVulnerabilityAssessmentRuleBaselineInner parameters, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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). + * @param parameters The requested rule baseline resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database vulnerability assessment rule baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseVulnerabilityAssessmentRuleBaselineInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + DatabaseVulnerabilityAssessmentRuleBaselineInner parameters); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseVulnerabilityAssessmentScansClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseVulnerabilityAssessmentScansClient.java new file mode 100644 index 0000000000000..7a9f3c6b77f53 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseVulnerabilityAssessmentScansClient.java @@ -0,0 +1,246 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentScansExportInner; +import com.azure.resourcemanager.sql.generated.fluent.models.VulnerabilityAssessmentScanRecordInner; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** + * An instance of this class provides access to all the operations defined in + * ManagedDatabaseVulnerabilityAssessmentScansClient. + */ +public interface ManagedDatabaseVulnerabilityAssessmentScansClient { + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginInitiateScan( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginInitiateScan( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void initiateScan( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void initiateScan( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database Vulnerability Assessment scan export resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response exportWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database Vulnerability Assessment scan export resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseVulnerabilityAssessmentScansExportInner export( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + 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. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan records as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan records as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a vulnerability assessment scan record of a database along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a vulnerability assessment scan record of a database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VulnerabilityAssessmentScanRecordInner get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseVulnerabilityAssessmentsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseVulnerabilityAssessmentsClient.java new file mode 100644 index 0000000000000..5204d391b86ea --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabaseVulnerabilityAssessmentsClient.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentInner; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** + * An instance of this class provides access to all the operations defined in + * ManagedDatabaseVulnerabilityAssessmentsClient. + */ +public interface ManagedDatabaseVulnerabilityAssessmentsClient { + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the database's vulnerability assessment along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the database's vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseVulnerabilityAssessmentInner get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database vulnerability assessment along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + DatabaseVulnerabilityAssessmentInner parameters, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseVulnerabilityAssessmentInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + DatabaseVulnerabilityAssessmentInner parameters); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the database's vulnerability assessments as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the database's vulnerability assessments as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabasesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabasesClient.java new file mode 100644 index 0000000000000..f848a60d7ce31 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedDatabasesClient.java @@ -0,0 +1,662 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedDatabaseInner; +import com.azure.resourcemanager.sql.generated.models.CompleteDatabaseRestoreDefinition; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseMoveDefinition; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseStartMoveDefinition; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseUpdate; + +/** An instance of this class provides access to all the operations defined in ManagedDatabasesClient. */ +public interface ManagedDatabasesClient { + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed databases as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstance(String resourceGroupName, String managedInstanceName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed databases as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String managedInstanceName, String databaseName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedDatabaseInner get(String resourceGroupName, String managedInstanceName, String databaseName); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a managed database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagedDatabaseInner> beginCreateOrUpdate( + String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseInner parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a managed database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagedDatabaseInner> beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseInner parameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedDatabaseInner createOrUpdate( + String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseInner parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedDatabaseInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseInner parameters, + Context context); + + /** + * Deletes a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, String databaseName); + + /** + * Deletes a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, String databaseName, Context context); + + /** + * Deletes a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String managedInstanceName, String databaseName); + + /** + * Deletes a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String managedInstanceName, String databaseName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a managed database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagedDatabaseInner> beginUpdate( + String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseUpdate parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a managed database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagedDatabaseInner> beginUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseUpdate parameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedDatabaseInner update( + String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseUpdate parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedDatabaseInner update( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseUpdate parameters, + Context context); + + /** + * Cancels a managed database move operation. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 Parameters of the cancel managed database move operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginCancelMove( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseMoveDefinition parameters); + + /** + * Cancels a managed database move operation. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 Parameters of the cancel managed database move operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginCancelMove( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseMoveDefinition parameters, + Context context); + + /** + * Cancels a managed database move operation. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 Parameters of the cancel managed database move operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void cancelMove( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseMoveDefinition parameters); + + /** + * Cancels a managed database move operation. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 Parameters of the cancel managed database move operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void cancelMove( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseMoveDefinition parameters, + Context context); + + /** + * Completes a managed database move operation. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 Parameters of the complete managed database move operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginCompleteMove( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseMoveDefinition parameters); + + /** + * Completes a managed database move operation. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 Parameters of the complete managed database move operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginCompleteMove( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseMoveDefinition parameters, + Context context); + + /** + * Completes a managed database move operation. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 Parameters of the complete managed database move operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void completeMove( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseMoveDefinition parameters); + + /** + * Completes a managed database move operation. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 Parameters of the complete managed database move operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void completeMove( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseMoveDefinition parameters, + Context context); + + /** + * Completes the restore operation on a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The definition for completing the restore of this managed database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginCompleteRestore( + String resourceGroupName, + String managedInstanceName, + String databaseName, + CompleteDatabaseRestoreDefinition parameters); + + /** + * Completes the restore operation on a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The definition for completing the restore of this managed database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginCompleteRestore( + String resourceGroupName, + String managedInstanceName, + String databaseName, + CompleteDatabaseRestoreDefinition parameters, + Context context); + + /** + * Completes the restore operation on a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The definition for completing the restore of this managed database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void completeRestore( + String resourceGroupName, + String managedInstanceName, + String databaseName, + CompleteDatabaseRestoreDefinition parameters); + + /** + * Completes the restore operation on a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The definition for completing the restore of this managed database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void completeRestore( + String resourceGroupName, + String managedInstanceName, + String databaseName, + CompleteDatabaseRestoreDefinition parameters, + Context context); + + /** + * Starts a managed database move operation. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 Parameters of the start managed database move operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginStartMove( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseStartMoveDefinition parameters); + + /** + * Starts a managed database move operation. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 Parameters of the start managed database move operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginStartMove( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseStartMoveDefinition parameters, + Context context); + + /** + * Starts a managed database move operation. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 Parameters of the start managed database move operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void startMove( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseStartMoveDefinition parameters); + + /** + * Starts a managed database move operation. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 Parameters of the start managed database move operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void startMove( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseStartMoveDefinition parameters, + Context context); + + /** + * Gets a list of inaccessible managed databases in 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of inaccessible managed databases in a managed instance as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listInaccessibleByInstance( + String resourceGroupName, String managedInstanceName); + + /** + * Gets a list of inaccessible managed databases in 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of inaccessible managed databases in a managed instance as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listInaccessibleByInstance( + String resourceGroupName, String managedInstanceName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceAdministratorsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceAdministratorsClient.java new file mode 100644 index 0000000000000..75eb4a758fa33 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceAdministratorsClient.java @@ -0,0 +1,229 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceAdministratorInner; +import com.azure.resourcemanager.sql.generated.models.AdministratorName; + +/** An instance of this class provides access to all the operations defined in ManagedInstanceAdministratorsClient. */ +public interface ManagedInstanceAdministratorsClient { + /** + * Gets a list of managed instance 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 managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance administrators as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName); + + /** + * Gets a list of managed instance 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 managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance administrators as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * Gets a managed instance 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 managedInstanceName The name of the managed instance. + * @param administratorName The administratorName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance administrator along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String managedInstanceName, AdministratorName administratorName, Context context); + + /** + * Gets a managed instance 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 managedInstanceName The name of the managed instance. + * @param administratorName The administratorName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceAdministratorInner get( + String resourceGroupName, String managedInstanceName, AdministratorName administratorName); + + /** + * Creates or updates a managed instance 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 managedInstanceName The name of the managed instance. + * @param administratorName The administratorName parameter. + * @param parameters The requested administrator parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL managed instance administrator. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagedInstanceAdministratorInner> beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + AdministratorName administratorName, + ManagedInstanceAdministratorInner parameters); + + /** + * Creates or updates a managed instance 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 managedInstanceName The name of the managed instance. + * @param administratorName The administratorName parameter. + * @param parameters The requested administrator parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL managed instance administrator. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagedInstanceAdministratorInner> beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + AdministratorName administratorName, + ManagedInstanceAdministratorInner parameters, + Context context); + + /** + * Creates or updates a managed instance 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 managedInstanceName The name of the managed instance. + * @param administratorName The administratorName parameter. + * @param parameters The requested administrator parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL managed instance administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceAdministratorInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + AdministratorName administratorName, + ManagedInstanceAdministratorInner parameters); + + /** + * Creates or updates a managed instance 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 managedInstanceName The name of the managed instance. + * @param administratorName The administratorName parameter. + * @param parameters The requested administrator parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL managed instance administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceAdministratorInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + AdministratorName administratorName, + ManagedInstanceAdministratorInner parameters, + Context context); + + /** + * Deletes a managed instance 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 managedInstanceName The name of the managed instance. + * @param administratorName The administratorName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, AdministratorName administratorName); + + /** + * Deletes a managed instance 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 managedInstanceName The name of the managed instance. + * @param administratorName The administratorName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, AdministratorName administratorName, Context context); + + /** + * Deletes a managed instance 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 managedInstanceName The name of the managed instance. + * @param administratorName The administratorName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String managedInstanceName, AdministratorName administratorName); + + /** + * Deletes a managed instance 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 managedInstanceName The name of the managed instance. + * @param administratorName The administratorName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete( + String resourceGroupName, String managedInstanceName, AdministratorName administratorName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceAdvancedThreatProtectionSettingsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceAdvancedThreatProtectionSettingsClient.java new file mode 100644 index 0000000000000..4f4890ecc16eb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceAdvancedThreatProtectionSettingsClient.java @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceAdvancedThreatProtectionInner; +import com.azure.resourcemanager.sql.generated.models.AdvancedThreatProtectionName; + +/** + * An instance of this class provides access to all the operations defined in + * ManagedInstanceAdvancedThreatProtectionSettingsClient. + */ +public interface ManagedInstanceAdvancedThreatProtectionSettingsClient { + /** + * Get the managed instance's Advanced Threat Protection settings. + * + * @param resourceGroupName The name of the resource group that contains 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed instance's Advanced Threat Protection settings as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName); + + /** + * Get the managed instance's Advanced Threat Protection settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed instance's Advanced Threat Protection settings as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * Get a managed instance's Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance's Advanced Threat Protection state along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + AdvancedThreatProtectionName advancedThreatProtectionName, + Context context); + + /** + * Get a managed instance's Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance's Advanced Threat Protection state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceAdvancedThreatProtectionInner get( + String resourceGroupName, + String managedInstanceName, + AdvancedThreatProtectionName advancedThreatProtectionName); + + /** + * Creates or updates Advanced Threat Protection settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @param parameters The managed instance Advanced Threat Protection state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a managed instance Advanced Threat Protection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagedInstanceAdvancedThreatProtectionInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + AdvancedThreatProtectionName advancedThreatProtectionName, + ManagedInstanceAdvancedThreatProtectionInner parameters); + + /** + * Creates or updates Advanced Threat Protection settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @param parameters The managed instance Advanced Threat Protection state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a managed instance Advanced Threat Protection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagedInstanceAdvancedThreatProtectionInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + AdvancedThreatProtectionName advancedThreatProtectionName, + ManagedInstanceAdvancedThreatProtectionInner parameters, + Context context); + + /** + * Creates or updates Advanced Threat Protection settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @param parameters The managed instance Advanced Threat Protection state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance Advanced Threat Protection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceAdvancedThreatProtectionInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + AdvancedThreatProtectionName advancedThreatProtectionName, + ManagedInstanceAdvancedThreatProtectionInner parameters); + + /** + * Creates or updates Advanced Threat Protection settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @param parameters The managed instance Advanced Threat Protection state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance Advanced Threat Protection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceAdvancedThreatProtectionInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + AdvancedThreatProtectionName advancedThreatProtectionName, + ManagedInstanceAdvancedThreatProtectionInner parameters, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceAzureADOnlyAuthenticationsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceAzureADOnlyAuthenticationsClient.java new file mode 100644 index 0000000000000..7506ccd8f2adf --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceAzureADOnlyAuthenticationsClient.java @@ -0,0 +1,244 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceAzureADOnlyAuthenticationInner; +import com.azure.resourcemanager.sql.generated.models.AuthenticationName; + +/** + * An instance of this class provides access to all the operations defined in + * ManagedInstanceAzureADOnlyAuthenticationsClient. + */ +public interface ManagedInstanceAzureADOnlyAuthenticationsClient { + /** + * Gets a specific Azure Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific Azure Active Directory only authentication property along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String managedInstanceName, AuthenticationName authenticationName, Context context); + + /** + * Gets a specific Azure Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific Azure Active Directory only authentication property. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceAzureADOnlyAuthenticationInner get( + String resourceGroupName, String managedInstanceName, AuthenticationName authenticationName); + + /** + * Sets Server Active Directory only authentication property or updates an existing server Active Directory only + * authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @param parameters The required parameters for creating or updating an Active Directory only authentication + * property. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagedInstanceAzureADOnlyAuthenticationInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + AuthenticationName authenticationName, + ManagedInstanceAzureADOnlyAuthenticationInner parameters); + + /** + * Sets Server Active Directory only authentication property or updates an existing server Active Directory only + * authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @param parameters The required parameters for creating or updating an Active Directory only authentication + * property. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagedInstanceAzureADOnlyAuthenticationInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + AuthenticationName authenticationName, + ManagedInstanceAzureADOnlyAuthenticationInner parameters, + Context context); + + /** + * Sets Server Active Directory only authentication property or updates an existing server Active Directory only + * authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @param parameters The required parameters for creating or updating an Active Directory only authentication + * property. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceAzureADOnlyAuthenticationInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + AuthenticationName authenticationName, + ManagedInstanceAzureADOnlyAuthenticationInner parameters); + + /** + * Sets Server Active Directory only authentication property or updates an existing server Active Directory only + * authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @param parameters The required parameters for creating or updating an Active Directory only authentication + * property. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceAzureADOnlyAuthenticationInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + AuthenticationName authenticationName, + ManagedInstanceAzureADOnlyAuthenticationInner parameters, + Context context); + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, AuthenticationName authenticationName); + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, AuthenticationName authenticationName, Context context); + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String managedInstanceName, AuthenticationName authenticationName); + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete( + String resourceGroupName, String managedInstanceName, AuthenticationName authenticationName, Context context); + + /** + * Gets a list of server Azure Active Directory only authentications. + * + * @param resourceGroupName The name of the resource group that contains 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server Azure Active Directory only authentications as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName); + + /** + * Gets a list of server Azure Active Directory only authentications. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server Azure Active Directory only authentications as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceDtcsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceDtcsClient.java new file mode 100644 index 0000000000000..5ac6b725fc898 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceDtcsClient.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceDtcInner; +import com.azure.resourcemanager.sql.generated.models.DtcName; + +/** An instance of this class provides access to all the operations defined in ManagedInstanceDtcsClient. */ +public interface ManagedInstanceDtcsClient { + /** + * Gets a list of managed instance DTC settings. + * + * @param resourceGroupName The name of the resource group that contains 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance DTC settings as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByManagedInstance(String resourceGroupName, String managedInstanceName); + + /** + * Gets a list of managed instance DTC settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance DTC settings as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByManagedInstance( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * Gets managed instance DTC settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param dtcName The name of the managed instance DTC. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return managed instance DTC settings along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String managedInstanceName, DtcName dtcName, Context context); + + /** + * Gets managed instance DTC settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param dtcName The name of the managed instance DTC. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return managed instance DTC settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceDtcInner get(String resourceGroupName, String managedInstanceName, DtcName dtcName); + + /** + * Updates managed instance DTC settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param dtcName The name of the managed instance DTC. + * @param parameters Managed instance DTC settings. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of sQL Managed Instance DTC. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagedInstanceDtcInner> beginCreateOrUpdate( + String resourceGroupName, String managedInstanceName, DtcName dtcName, ManagedInstanceDtcInner parameters); + + /** + * Updates managed instance DTC settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param dtcName The name of the managed instance DTC. + * @param parameters Managed instance DTC settings. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of sQL Managed Instance DTC. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagedInstanceDtcInner> beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + DtcName dtcName, + ManagedInstanceDtcInner parameters, + Context context); + + /** + * Updates managed instance DTC settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param dtcName The name of the managed instance DTC. + * @param parameters Managed instance DTC settings. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return sQL Managed Instance DTC. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceDtcInner createOrUpdate( + String resourceGroupName, String managedInstanceName, DtcName dtcName, ManagedInstanceDtcInner parameters); + + /** + * Updates managed instance DTC settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param dtcName The name of the managed instance DTC. + * @param parameters Managed instance DTC settings. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return sQL Managed Instance DTC. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceDtcInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + DtcName dtcName, + ManagedInstanceDtcInner parameters, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceEncryptionProtectorsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceEncryptionProtectorsClient.java new file mode 100644 index 0000000000000..67eaceb1cf26b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceEncryptionProtectorsClient.java @@ -0,0 +1,243 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceEncryptionProtectorInner; +import com.azure.resourcemanager.sql.generated.models.EncryptionProtectorName; + +/** + * An instance of this class provides access to all the operations defined in ManagedInstanceEncryptionProtectorsClient. + */ +public interface ManagedInstanceEncryptionProtectorsClient { + /** + * Revalidates 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 encryptionProtectorName The name of the encryption protector to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRevalidate( + String resourceGroupName, String managedInstanceName, EncryptionProtectorName encryptionProtectorName); + + /** + * Revalidates 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 encryptionProtectorName The name of the encryption protector to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRevalidate( + String resourceGroupName, + String managedInstanceName, + EncryptionProtectorName encryptionProtectorName, + Context context); + + /** + * Revalidates 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 encryptionProtectorName The name of the encryption protector to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void revalidate( + String resourceGroupName, String managedInstanceName, EncryptionProtectorName encryptionProtectorName); + + /** + * Revalidates 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 encryptionProtectorName The name of the encryption protector to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void revalidate( + String resourceGroupName, + String managedInstanceName, + EncryptionProtectorName encryptionProtectorName, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance encryption protectors as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance encryption protectors as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * 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 encryptionProtectorName The name of the encryption protector to be retrieved. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance encryption protector along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + EncryptionProtectorName encryptionProtectorName, + Context context); + + /** + * 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 encryptionProtectorName The name of the encryption protector to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance encryption protector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceEncryptionProtectorInner get( + String resourceGroupName, String managedInstanceName, EncryptionProtectorName encryptionProtectorName); + + /** + * 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 encryptionProtectorName The name of the encryption protector to be updated. + * @param parameters The requested encryption protector resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the managed instance encryption protector. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagedInstanceEncryptionProtectorInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + EncryptionProtectorName encryptionProtectorName, + ManagedInstanceEncryptionProtectorInner parameters); + + /** + * 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 encryptionProtectorName The name of the encryption protector to be updated. + * @param parameters The requested encryption protector resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the managed instance encryption protector. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagedInstanceEncryptionProtectorInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + EncryptionProtectorName encryptionProtectorName, + ManagedInstanceEncryptionProtectorInner parameters, + Context context); + + /** + * 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 encryptionProtectorName The name of the encryption protector to be updated. + * @param parameters The requested encryption protector resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed instance encryption protector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceEncryptionProtectorInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + EncryptionProtectorName encryptionProtectorName, + ManagedInstanceEncryptionProtectorInner parameters); + + /** + * 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 encryptionProtectorName The name of the encryption protector to be updated. + * @param parameters The requested encryption protector resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed instance encryption protector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceEncryptionProtectorInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + EncryptionProtectorName encryptionProtectorName, + ManagedInstanceEncryptionProtectorInner parameters, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceKeysClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceKeysClient.java new file mode 100644 index 0000000000000..1a8505fe7bc29 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceKeysClient.java @@ -0,0 +1,220 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceKeyInner; + +/** An instance of this class provides access to all the operations defined in ManagedInstanceKeysClient. */ +public interface ManagedInstanceKeysClient { + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance keys as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstance(String resourceGroupName, String managedInstanceName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance keys as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, String filter, Context context); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance key along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String managedInstanceName, String keyName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceKeyInner get(String resourceGroupName, String managedInstanceName, String keyName); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a managed instance key. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagedInstanceKeyInner> beginCreateOrUpdate( + String resourceGroupName, String managedInstanceName, String keyName, ManagedInstanceKeyInner parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a managed instance key. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagedInstanceKeyInner> beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String keyName, + ManagedInstanceKeyInner parameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceKeyInner createOrUpdate( + String resourceGroupName, String managedInstanceName, String keyName, ManagedInstanceKeyInner parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceKeyInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String keyName, + ManagedInstanceKeyInner parameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, String keyName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, String keyName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String managedInstanceName, String keyName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String managedInstanceName, String keyName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceLongTermRetentionPoliciesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceLongTermRetentionPoliciesClient.java new file mode 100644 index 0000000000000..da44a4ed33631 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceLongTermRetentionPoliciesClient.java @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceLongTermRetentionPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceLongTermRetentionPolicyName; + +/** + * An instance of this class provides access to all the operations defined in + * ManagedInstanceLongTermRetentionPoliciesClient. + */ +public interface ManagedInstanceLongTermRetentionPoliciesClient { + /** + * Gets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's long term retention policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedInstanceLongTermRetentionPolicyName policyName, + Context context); + + /** + * Gets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's long term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceLongTermRetentionPolicyInner get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedInstanceLongTermRetentionPolicyName policyName); + + /** + * Sets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @param parameters The long term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a long term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagedInstanceLongTermRetentionPolicyInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedInstanceLongTermRetentionPolicyName policyName, + ManagedInstanceLongTermRetentionPolicyInner parameters); + + /** + * Sets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @param parameters The long term retention policy info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a long term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagedInstanceLongTermRetentionPolicyInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedInstanceLongTermRetentionPolicyName policyName, + ManagedInstanceLongTermRetentionPolicyInner parameters, + Context context); + + /** + * Sets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @param parameters The long term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceLongTermRetentionPolicyInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedInstanceLongTermRetentionPolicyName policyName, + ManagedInstanceLongTermRetentionPolicyInner parameters); + + /** + * Sets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @param parameters The long term retention policy info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceLongTermRetentionPolicyInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedInstanceLongTermRetentionPolicyName policyName, + ManagedInstanceLongTermRetentionPolicyInner parameters, + Context context); + + /** + * Gets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's long term retention policy as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName); + + /** + * Gets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's long term retention policy as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceOperationsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceOperationsClient.java new file mode 100644 index 0000000000000..60d56444eec3e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceOperationsClient.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceOperationInner; +import java.util.UUID; + +/** An instance of this class provides access to all the operations defined in ManagedInstanceOperationsClient. */ +public interface ManagedInstanceOperationsClient { + /** + * Gets a list of operations performed on the managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of operations performed on the managed instance as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByManagedInstance( + String resourceGroupName, String managedInstanceName); + + /** + * Gets a list of operations performed on the managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of operations performed on the managed instance as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByManagedInstance( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * Gets a management operation on a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param operationId The operationId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a management operation on a managed instance along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String managedInstanceName, UUID operationId, Context context); + + /** + * Gets a management operation on a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param operationId The operationId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a management operation on a managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceOperationInner get(String resourceGroupName, String managedInstanceName, UUID operationId); + + /** + * Cancels the asynchronous operation on the managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param operationId The operationId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response cancelWithResponse( + String resourceGroupName, String managedInstanceName, UUID operationId, Context context); + + /** + * Cancels the asynchronous operation on the managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param operationId The operationId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void cancel(String resourceGroupName, String managedInstanceName, UUID operationId); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstancePrivateEndpointConnectionsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstancePrivateEndpointConnectionsClient.java new file mode 100644 index 0000000000000..977d07fa2f63e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstancePrivateEndpointConnectionsClient.java @@ -0,0 +1,233 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstancePrivateEndpointConnectionInner; + +/** + * An instance of this class provides access to all the operations defined in + * ManagedInstancePrivateEndpointConnectionsClient. + */ +public interface ManagedInstancePrivateEndpointConnectionsClient { + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String managedInstanceName, String privateEndpointConnectionName, Context context); + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstancePrivateEndpointConnectionInner get( + String resourceGroupName, String managedInstanceName, String privateEndpointConnectionName); + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagedInstancePrivateEndpointConnectionInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String privateEndpointConnectionName, + ManagedInstancePrivateEndpointConnectionInner parameters); + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagedInstancePrivateEndpointConnectionInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String privateEndpointConnectionName, + ManagedInstancePrivateEndpointConnectionInner parameters, + Context context); + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstancePrivateEndpointConnectionInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String privateEndpointConnectionName, + ManagedInstancePrivateEndpointConnectionInner parameters); + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstancePrivateEndpointConnectionInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String privateEndpointConnectionName, + ManagedInstancePrivateEndpointConnectionInner parameters, + Context context); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, String privateEndpointConnectionName); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, String privateEndpointConnectionName, Context context); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String managedInstanceName, String privateEndpointConnectionName); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete( + String resourceGroupName, String managedInstanceName, String privateEndpointConnectionName, Context context); + + /** + * Gets all private endpoint connections on a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all private endpoint connections on a server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByManagedInstance( + String resourceGroupName, String managedInstanceName); + + /** + * Gets all private endpoint connections on a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all private endpoint connections on a server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByManagedInstance( + String resourceGroupName, String managedInstanceName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstancePrivateLinkResourcesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstancePrivateLinkResourcesClient.java new file mode 100644 index 0000000000000..48f56e4b9db84 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstancePrivateLinkResourcesClient.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstancePrivateLinkInner; + +/** + * An instance of this class provides access to all the operations defined in ManagedInstancePrivateLinkResourcesClient. + */ +public interface ManagedInstancePrivateLinkResourcesClient { + /** + * Gets the private link resources for 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 managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources for SQL server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByManagedInstance( + String resourceGroupName, String managedInstanceName); + + /** + * Gets the private link resources for 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 managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources for SQL server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByManagedInstance( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * Gets a private link resource for 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 managedInstanceName The name of the managed instance. + * @param groupName The name of the private link resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private link resource for SQL server along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String managedInstanceName, String groupName, Context context); + + /** + * Gets a private link resource for 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 managedInstanceName The name of the managed instance. + * @param groupName The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private link resource for SQL server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstancePrivateLinkInner get(String resourceGroupName, String managedInstanceName, String groupName); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceTdeCertificatesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceTdeCertificatesClient.java new file mode 100644 index 0000000000000..bff91f2c10f47 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceTdeCertificatesClient.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.models.TdeCertificate; + +/** An instance of this class provides access to all the operations defined in ManagedInstanceTdeCertificatesClient. */ +public interface ManagedInstanceTdeCertificatesClient { + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginCreate( + String resourceGroupName, String managedInstanceName, TdeCertificate parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginCreate( + String resourceGroupName, String managedInstanceName, TdeCertificate parameters, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void create(String resourceGroupName, String managedInstanceName, TdeCertificate parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void create(String resourceGroupName, String managedInstanceName, TdeCertificate parameters, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceVulnerabilityAssessmentsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceVulnerabilityAssessmentsClient.java new file mode 100644 index 0000000000000..ae99d0b141abb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstanceVulnerabilityAssessmentsClient.java @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceVulnerabilityAssessmentInner; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** + * An instance of this class provides access to all the operations defined in + * ManagedInstanceVulnerabilityAssessmentsClient. + */ +public interface ManagedInstanceVulnerabilityAssessmentsClient { + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed instance's vulnerability assessment along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed instance's vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceVulnerabilityAssessmentInner get( + String resourceGroupName, String managedInstanceName, VulnerabilityAssessmentName vulnerabilityAssessmentName); + + /** + * Creates or updates the managed instance's vulnerability assessment. Learn more about setting SQL vulnerability + * assessment with managed identity - + * https://docs.microsoft.com/azure/azure-sql/database/sql-database-vulnerability-assessment-storage. + * + * @param resourceGroupName The name of the resource group that contains 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance vulnerability assessment along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String managedInstanceName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + ManagedInstanceVulnerabilityAssessmentInner parameters, + Context context); + + /** + * Creates or updates the managed instance's vulnerability assessment. Learn more about setting SQL vulnerability + * assessment with managed identity - + * https://docs.microsoft.com/azure/azure-sql/database/sql-database-vulnerability-assessment-storage. + * + * @param resourceGroupName The name of the resource group that contains 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceVulnerabilityAssessmentInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + ManagedInstanceVulnerabilityAssessmentInner parameters); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse( + String resourceGroupName, + String managedInstanceName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete( + String resourceGroupName, String managedInstanceName, VulnerabilityAssessmentName vulnerabilityAssessmentName); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed instance's vulnerability assessment policies as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstance( + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed instance's vulnerability assessment policies as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstancesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstancesClient.java new file mode 100644 index 0000000000000..a1accd369b914 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedInstancesClient.java @@ -0,0 +1,430 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceInner; +import com.azure.resourcemanager.sql.generated.fluent.models.TopQueriesInner; +import com.azure.resourcemanager.sql.generated.models.AggregationFunctionType; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceUpdate; +import com.azure.resourcemanager.sql.generated.models.MetricType; +import com.azure.resourcemanager.sql.generated.models.QueryTimeGrainType; +import com.azure.resourcemanager.sql.generated.models.ReplicaType; + +/** An instance of this class provides access to all the operations defined in ManagedInstancesClient. */ +public interface ManagedInstancesClient { + /** + * Gets a list of all managed instances in an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The instance pool name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all managed instances in an instance pool as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstancePool(String resourceGroupName, String instancePoolName); + + /** + * Gets a list of all managed instances in an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The instance pool name. + * @param expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all managed instances in an instance pool as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstancePool( + String resourceGroupName, String instancePoolName, String expand, Context context); + + /** + * Gets a list of all managed instances in the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all managed instances in the subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets a list of all managed instances in the subscription. + * + * @param expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all managed instances in the subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String expand, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instances in a resource group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * 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 expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instances in a resource group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, String expand, Context context); + + /** + * 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 expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String managedInstanceName, String expand, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceInner getByResourceGroup(String resourceGroupName, String managedInstanceName); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagedInstanceInner> beginCreateOrUpdate( + String resourceGroupName, String managedInstanceName, ManagedInstanceInner parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagedInstanceInner> beginCreateOrUpdate( + String resourceGroupName, String managedInstanceName, ManagedInstanceInner parameters, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceInner createOrUpdate( + String resourceGroupName, String managedInstanceName, ManagedInstanceInner parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceInner createOrUpdate( + String resourceGroupName, String managedInstanceName, ManagedInstanceInner parameters, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String managedInstanceName); + + /** + * Deletes a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String managedInstanceName); + + /** + * Deletes a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String managedInstanceName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagedInstanceInner> beginUpdate( + String resourceGroupName, String managedInstanceName, ManagedInstanceUpdate parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagedInstanceInner> beginUpdate( + String resourceGroupName, String managedInstanceName, ManagedInstanceUpdate parameters, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceInner update(String resourceGroupName, String managedInstanceName, ManagedInstanceUpdate parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedInstanceInner update( + String resourceGroupName, String managedInstanceName, ManagedInstanceUpdate parameters, Context context); + + /** + * Get top resource consuming queries of 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return top resource consuming queries of a managed instance as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByManagedInstance(String resourceGroupName, String managedInstanceName); + + /** + * Get top resource consuming queries of 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 numberOfQueries How many 'top queries' to return. Default is 5. + * @param databases Comma separated list of databases to be included into search. All DB's are included if this + * parameter is not specified. + * @param startTime Start time for observed period. + * @param endTime End time for observed period. + * @param interval The time step to be used to summarize the metric values. Default value is PT1H. + * @param aggregationFunction Aggregation function to be used, default value is 'sum'. + * @param observationMetric Metric to be used for ranking top queries. Default is 'cpu'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return top resource consuming queries of a managed instance as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByManagedInstance( + String resourceGroupName, + String managedInstanceName, + Integer numberOfQueries, + String databases, + String startTime, + String endTime, + QueryTimeGrainType interval, + AggregationFunctionType aggregationFunction, + MetricType observationMetric, + Context context); + + /** + * Failovers 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 to failover. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginFailover(String resourceGroupName, String managedInstanceName); + + /** + * Failovers 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 to failover. + * @param replicaType The type of replica to be failed over. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginFailover( + String resourceGroupName, String managedInstanceName, ReplicaType replicaType, Context context); + + /** + * Failovers 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 to failover. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void failover(String resourceGroupName, String managedInstanceName); + + /** + * Failovers 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 to failover. + * @param replicaType The type of replica to be failed over. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void failover(String resourceGroupName, String managedInstanceName, ReplicaType replicaType, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient.java new file mode 100644 index 0000000000000..149b386c946fc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient.java @@ -0,0 +1,284 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedBackupShortTermRetentionPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ManagedShortTermRetentionPolicyName; + +/** + * An instance of this class provides access to all the operations defined in + * ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient. + */ +public interface ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient { + /** + * 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 restorableDroppedDatabaseId parameter. + * @param policyName The policy name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a dropped database's short term retention policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + Context context); + + /** + * 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 restorableDroppedDatabaseId parameter. + * @param policyName The policy name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a dropped database's short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedBackupShortTermRetentionPolicyInner get( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName); + + /** + * Sets 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagedBackupShortTermRetentionPolicyInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters); + + /** + * Sets 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagedBackupShortTermRetentionPolicyInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context); + + /** + * Sets 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedBackupShortTermRetentionPolicyInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters); + + /** + * Sets 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedBackupShortTermRetentionPolicyInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context); + + /** + * Sets 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagedBackupShortTermRetentionPolicyInner> + beginUpdate( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters); + + /** + * Sets 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagedBackupShortTermRetentionPolicyInner> + beginUpdate( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context); + + /** + * Sets 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedBackupShortTermRetentionPolicyInner update( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters); + + /** + * Sets 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedBackupShortTermRetentionPolicyInner update( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context); + + /** + * 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 restorableDroppedDatabaseId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a dropped database's short term retention policy list as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByRestorableDroppedDatabase( + 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 restorableDroppedDatabaseId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a dropped database's short term retention policy list as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByRestorableDroppedDatabase( + String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedServerDnsAliasesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedServerDnsAliasesClient.java new file mode 100644 index 0000000000000..d1e6c6e2e9c14 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedServerDnsAliasesClient.java @@ -0,0 +1,314 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedServerDnsAliasInner; +import com.azure.resourcemanager.sql.generated.models.ManagedServerDnsAliasAcquisition; +import com.azure.resourcemanager.sql.generated.models.ManagedServerDnsAliasCreation; + +/** An instance of this class provides access to all the operations defined in ManagedServerDnsAliasesClient. */ +public interface ManagedServerDnsAliasesClient { + /** + * Gets a list of managed server DNS aliases for a managed server. + * + * @param resourceGroupName The name of the resource group that contains 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed server DNS aliases for a managed server as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByManagedInstance( + String resourceGroupName, String managedInstanceName); + + /** + * Gets a list of managed server DNS aliases for a managed server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed server DNS aliases for a managed server as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByManagedInstance( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * 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 managedInstanceName The name of the managed instance. + * @param dnsAliasName The dnsAliasName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server DNS alias along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String managedInstanceName, String dnsAliasName, Context context); + + /** + * 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 managedInstanceName The name of the managed instance. + * @param dnsAliasName The dnsAliasName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server DNS alias. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedServerDnsAliasInner get(String resourceGroupName, String managedInstanceName, String dnsAliasName); + + /** + * Creates a managed 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 managedInstanceName The name of the managed instance. + * @param dnsAliasName The dnsAliasName parameter. + * @param parameters A managed server dns alias creation request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a managed server DNS alias. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagedServerDnsAliasInner> beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String dnsAliasName, + ManagedServerDnsAliasCreation parameters); + + /** + * Creates a managed 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 managedInstanceName The name of the managed instance. + * @param dnsAliasName The dnsAliasName parameter. + * @param parameters A managed server dns alias creation request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a managed server DNS alias. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagedServerDnsAliasInner> beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String dnsAliasName, + ManagedServerDnsAliasCreation parameters, + Context context); + + /** + * Creates a managed 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 managedInstanceName The name of the managed instance. + * @param dnsAliasName The dnsAliasName parameter. + * @param parameters A managed server dns alias creation request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed server DNS alias. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedServerDnsAliasInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String dnsAliasName, + ManagedServerDnsAliasCreation parameters); + + /** + * Creates a managed 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 managedInstanceName The name of the managed instance. + * @param dnsAliasName The dnsAliasName parameter. + * @param parameters A managed server dns alias creation request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed server DNS alias. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedServerDnsAliasInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String dnsAliasName, + ManagedServerDnsAliasCreation parameters, + Context context); + + /** + * Deletes the managed 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 managedInstanceName The name of the managed instance. + * @param dnsAliasName The dnsAliasName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, String dnsAliasName); + + /** + * Deletes the managed 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 managedInstanceName The name of the managed instance. + * @param dnsAliasName The dnsAliasName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, String dnsAliasName, Context context); + + /** + * Deletes the managed 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 managedInstanceName The name of the managed instance. + * @param dnsAliasName The dnsAliasName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String managedInstanceName, String dnsAliasName); + + /** + * Deletes the managed 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 managedInstanceName The name of the managed instance. + * @param dnsAliasName The dnsAliasName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String managedInstanceName, String dnsAliasName, Context context); + + /** + * Acquires managed server DNS alias from another managed server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param dnsAliasName The dnsAliasName parameter. + * @param parameters A managed server DNS alias acquisition request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a managed server DNS alias. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagedServerDnsAliasInner> beginAcquire( + String resourceGroupName, + String managedInstanceName, + String dnsAliasName, + ManagedServerDnsAliasAcquisition parameters); + + /** + * Acquires managed server DNS alias from another managed server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param dnsAliasName The dnsAliasName parameter. + * @param parameters A managed server DNS alias acquisition request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a managed server DNS alias. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagedServerDnsAliasInner> beginAcquire( + String resourceGroupName, + String managedInstanceName, + String dnsAliasName, + ManagedServerDnsAliasAcquisition parameters, + Context context); + + /** + * Acquires managed server DNS alias from another managed server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param dnsAliasName The dnsAliasName parameter. + * @param parameters A managed server DNS alias acquisition request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed server DNS alias. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedServerDnsAliasInner acquire( + String resourceGroupName, + String managedInstanceName, + String dnsAliasName, + ManagedServerDnsAliasAcquisition parameters); + + /** + * Acquires managed server DNS alias from another managed server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param dnsAliasName The dnsAliasName parameter. + * @param parameters A managed server DNS alias acquisition request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed server DNS alias. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedServerDnsAliasInner acquire( + String resourceGroupName, + String managedInstanceName, + String dnsAliasName, + ManagedServerDnsAliasAcquisition parameters, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedServerSecurityAlertPoliciesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedServerSecurityAlertPoliciesClient.java new file mode 100644 index 0000000000000..f64663e7fd8ed --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ManagedServerSecurityAlertPoliciesClient.java @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedServerSecurityAlertPolicyInner; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyName; + +/** + * An instance of this class provides access to all the operations defined in ManagedServerSecurityAlertPoliciesClient. + */ +public interface ManagedServerSecurityAlertPoliciesClient { + /** + * 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 securityAlertPolicyName The name of the security alert policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed server's threat detection policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + SecurityAlertPolicyName securityAlertPolicyName, + Context context); + + /** + * 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 securityAlertPolicyName The name of the security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed server's threat detection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedServerSecurityAlertPolicyInner get( + String resourceGroupName, String managedInstanceName, SecurityAlertPolicyName securityAlertPolicyName); + + /** + * 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 securityAlertPolicyName The name of the security alert policy. + * @param parameters The managed server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a managed server security alert policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagedServerSecurityAlertPolicyInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + SecurityAlertPolicyName securityAlertPolicyName, + ManagedServerSecurityAlertPolicyInner parameters); + + /** + * 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 securityAlertPolicyName The name of the security alert policy. + * @param parameters The managed server security alert policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a managed server security alert policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ManagedServerSecurityAlertPolicyInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + SecurityAlertPolicyName securityAlertPolicyName, + ManagedServerSecurityAlertPolicyInner parameters, + Context context); + + /** + * 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 securityAlertPolicyName The name of the security alert policy. + * @param parameters The managed server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedServerSecurityAlertPolicyInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + SecurityAlertPolicyName securityAlertPolicyName, + ManagedServerSecurityAlertPolicyInner parameters); + + /** + * 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 securityAlertPolicyName The name of the security alert policy. + * @param parameters The managed server security alert policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ManagedServerSecurityAlertPolicyInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + SecurityAlertPolicyName securityAlertPolicyName, + ManagedServerSecurityAlertPolicyInner parameters, + Context context); + + /** + * Get the managed server's threat detection 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed server's threat detection policies as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName); + + /** + * Get the managed server's threat detection 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed server's threat detection policies as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/OperationsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/OperationsClient.java new file mode 100644 index 0000000000000..498a7c825a66d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/OperationsClient.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.OperationInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * Lists all of the available SQL Rest API operations. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list SQL operations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all of the available SQL Rest API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list SQL operations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/OutboundFirewallRulesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/OutboundFirewallRulesClient.java new file mode 100644 index 0000000000000..e38eaca14b8b7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/OutboundFirewallRulesClient.java @@ -0,0 +1,218 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.OutboundFirewallRuleInner; + +/** An instance of this class provides access to all the operations defined in OutboundFirewallRulesClient. */ +public interface OutboundFirewallRulesClient { + /** + * Gets an outbound 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 outboundRuleFqdn The outboundRuleFqdn parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an outbound firewall rule along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String outboundRuleFqdn, Context context); + + /** + * Gets an outbound 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 outboundRuleFqdn The outboundRuleFqdn parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an outbound firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OutboundFirewallRuleInner get(String resourceGroupName, String serverName, String outboundRuleFqdn); + + /** + * Create a outbound firewall rule with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param outboundRuleFqdn The outboundRuleFqdn parameter. + * @param parameters An Azure SQL DB Server Outbound Firewall Rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL DB Server Outbound Firewall Rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, OutboundFirewallRuleInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String outboundRuleFqdn, OutboundFirewallRuleInner parameters); + + /** + * Create a outbound firewall rule with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param outboundRuleFqdn The outboundRuleFqdn parameter. + * @param parameters An Azure SQL DB Server Outbound Firewall Rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL DB Server Outbound Firewall Rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, OutboundFirewallRuleInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String outboundRuleFqdn, + OutboundFirewallRuleInner parameters, + Context context); + + /** + * Create a outbound firewall rule with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param outboundRuleFqdn The outboundRuleFqdn parameter. + * @param parameters An Azure SQL DB Server Outbound Firewall Rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL DB Server Outbound Firewall Rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OutboundFirewallRuleInner createOrUpdate( + String resourceGroupName, String serverName, String outboundRuleFqdn, OutboundFirewallRuleInner parameters); + + /** + * Create a outbound firewall rule with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param outboundRuleFqdn The outboundRuleFqdn parameter. + * @param parameters An Azure SQL DB Server Outbound Firewall Rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL DB Server Outbound Firewall Rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OutboundFirewallRuleInner createOrUpdate( + String resourceGroupName, + String serverName, + String outboundRuleFqdn, + OutboundFirewallRuleInner parameters, + Context context); + + /** + * Deletes a outbound firewall rule with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param outboundRuleFqdn The outboundRuleFqdn parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String outboundRuleFqdn); + + /** + * Deletes a outbound firewall rule with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param outboundRuleFqdn The outboundRuleFqdn parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String outboundRuleFqdn, Context context); + + /** + * Deletes a outbound firewall rule with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param outboundRuleFqdn The outboundRuleFqdn parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String outboundRuleFqdn); + + /** + * Deletes a outbound firewall rule with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param outboundRuleFqdn The outboundRuleFqdn parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String outboundRuleFqdn, Context context); + + /** + * Gets all outbound firewall rules on a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all outbound firewall rules on a server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets all outbound firewall rules on a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all outbound firewall rules on a server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/PrivateEndpointConnectionsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/PrivateEndpointConnectionsClient.java new file mode 100644 index 0000000000000..426b557cb62a2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/PrivateEndpointConnectionsClient.java @@ -0,0 +1,226 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.PrivateEndpointConnectionInner; + +/** An instance of this class provides access to all the operations defined in PrivateEndpointConnectionsClient. */ +public interface PrivateEndpointConnectionsClient { + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context); + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner get( + String resourceGroupName, String serverName, String privateEndpointConnectionName); + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, PrivateEndpointConnectionInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters); + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, PrivateEndpointConnectionInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context); + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner createOrUpdate( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters); + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner createOrUpdate( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String privateEndpointConnectionName); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String privateEndpointConnectionName); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context); + + /** + * Gets all private endpoint connections on a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all private endpoint connections on a server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets all private endpoint connections on a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all private endpoint connections on a server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/PrivateLinkResourcesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/PrivateLinkResourcesClient.java new file mode 100644 index 0000000000000..27ec80bd3ad8d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/PrivateLinkResourcesClient.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.PrivateLinkResourceInner; + +/** An instance of this class provides access to all the operations defined in PrivateLinkResourcesClient. */ +public interface PrivateLinkResourcesClient { + /** + * Gets the private link resources for 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources for SQL server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets the private link resources for 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources for SQL server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * Gets a private link resource for 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 groupName The name of the private link resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private link resource for SQL server along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String groupName, Context context); + + /** + * Gets a private link resource for 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 groupName The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private link resource for SQL server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateLinkResourceInner get(String resourceGroupName, String serverName, String groupName); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/RecommendedSensitivityLabelsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/RecommendedSensitivityLabelsClient.java new file mode 100644 index 0000000000000..d33bc492e4b79 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/RecommendedSensitivityLabelsClient.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.RecommendedSensitivityLabelUpdateList; + +/** An instance of this class provides access to all the operations defined in RecommendedSensitivityLabelsClient. */ +public interface RecommendedSensitivityLabelsClient { + /** + * Update recommended sensitivity labels states of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of recommended sensitivity label update operations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + RecommendedSensitivityLabelUpdateList parameters, + Context context); + + /** + * Update recommended sensitivity labels states of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of recommended sensitivity label update operations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void update( + String resourceGroupName, + String serverName, + String databaseName, + RecommendedSensitivityLabelUpdateList parameters); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/RecoverableDatabasesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/RecoverableDatabasesClient.java new file mode 100644 index 0000000000000..187a4016a0d25 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/RecoverableDatabasesClient.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.RecoverableDatabaseInner; + +/** An instance of this class provides access to all the operations defined in RecoverableDatabasesClient. */ +public interface RecoverableDatabasesClient { + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a recoverable database, which is a resource representing a database's geo backup along with {@link + * Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a recoverable database, which is a resource representing a database's geo backup. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RecoverableDatabaseInner get(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. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of recoverable databases as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of recoverable databases as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/RecoverableManagedDatabasesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/RecoverableManagedDatabasesClient.java new file mode 100644 index 0000000000000..95806ccb705e5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/RecoverableManagedDatabasesClient.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.RecoverableManagedDatabaseInner; + +/** An instance of this class provides access to all the operations defined in RecoverableManagedDatabasesClient. */ +public interface RecoverableManagedDatabasesClient { + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of recoverable managed databases as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstance(String resourceGroupName, String managedInstanceName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of recoverable managed databases as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * 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 recoverableDatabaseName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a recoverable managed database along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String managedInstanceName, String recoverableDatabaseName, Context context); + + /** + * 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 recoverableDatabaseName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a recoverable managed database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RecoverableManagedDatabaseInner get( + String resourceGroupName, String managedInstanceName, String recoverableDatabaseName); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ReplicationLinksClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ReplicationLinksClient.java new file mode 100644 index 0000000000000..ffd9a1aab5db9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ReplicationLinksClient.java @@ -0,0 +1,318 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.ReplicationLinkInner; + +/** An instance of this class provides access to all the operations defined in ReplicationLinksClient. */ +public interface ReplicationLinksClient { + /** + * Gets a list of replication links on database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of replication links on database as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName); + + /** + * Gets a list of replication links on database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of replication links on database as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Gets a 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. + * @param linkId The name of the replication link. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a replication link along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, String linkId, Context context); + + /** + * Gets a 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. + * @param linkId The name of the replication link. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a replication link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ReplicationLinkInner get(String resourceGroupName, String serverName, String databaseName, String linkId); + + /** + * Deletes the 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. + * @param linkId The linkId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String databaseName, String linkId); + + /** + * Deletes the 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. + * @param linkId The linkId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String databaseName, String linkId, Context context); + + /** + * Deletes the 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. + * @param linkId The linkId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String databaseName, String linkId); + + /** + * Deletes the 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. + * @param linkId The linkId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String databaseName, String linkId, Context context); + + /** + * 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 databaseName The name of the database. + * @param linkId The name of the replication link. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a replication link. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ReplicationLinkInner> beginFailover( + String resourceGroupName, String serverName, String databaseName, String linkId); + + /** + * 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 databaseName The name of the database. + * @param linkId The name of the replication link. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a replication link. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ReplicationLinkInner> beginFailover( + String resourceGroupName, String serverName, String databaseName, String linkId, Context context); + + /** + * 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 databaseName The name of the database. + * @param linkId The name of the replication link. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a replication link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ReplicationLinkInner failover(String resourceGroupName, String serverName, String databaseName, String linkId); + + /** + * 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 databaseName The name of the database. + * @param linkId The name of the replication link. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a replication link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ReplicationLinkInner failover( + String resourceGroupName, String serverName, String databaseName, String linkId, Context context); + + /** + * Fails over from the current primary server to this server allowing 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. + * @param linkId The name of the replication link. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a replication link. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ReplicationLinkInner> beginFailoverAllowDataLoss( + String resourceGroupName, String serverName, String databaseName, String linkId); + + /** + * Fails over from the current primary server to this server allowing 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. + * @param linkId The name of the replication link. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a replication link. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ReplicationLinkInner> beginFailoverAllowDataLoss( + String resourceGroupName, String serverName, String databaseName, String linkId, Context context); + + /** + * Fails over from the current primary server to this server allowing 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. + * @param linkId The name of the replication link. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a replication link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ReplicationLinkInner failoverAllowDataLoss( + String resourceGroupName, String serverName, String databaseName, String linkId); + + /** + * Fails over from the current primary server to this server allowing 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. + * @param linkId The name of the replication link. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a replication link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ReplicationLinkInner failoverAllowDataLoss( + String resourceGroupName, String serverName, String databaseName, String linkId, Context context); + + /** + * Gets a list of 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of replication links as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets a list of 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of replication links as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/RestorableDroppedDatabasesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/RestorableDroppedDatabasesClient.java new file mode 100644 index 0000000000000..a8230fda25df0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/RestorableDroppedDatabasesClient.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.RestorableDroppedDatabaseInner; + +/** An instance of this class provides access to all the operations defined in RestorableDroppedDatabasesClient. */ +public interface RestorableDroppedDatabasesClient { + /** + * Gets a list of restorable dropped 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of restorable dropped databases as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets a list of restorable dropped 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of restorable dropped databases as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String resourceGroupName, String serverName, Context context); + + /** + * Gets a restorable dropped database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a restorable dropped database along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String restorableDroppedDatabaseId, Context context); + + /** + * Gets a restorable dropped database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a restorable dropped database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RestorableDroppedDatabaseInner get(String resourceGroupName, String serverName, String restorableDroppedDatabaseId); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/RestorableDroppedManagedDatabasesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/RestorableDroppedManagedDatabasesClient.java new file mode 100644 index 0000000000000..7dc142377b869 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/RestorableDroppedManagedDatabasesClient.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.RestorableDroppedManagedDatabaseInner; + +/** + * An instance of this class provides access to all the operations defined in RestorableDroppedManagedDatabasesClient. + */ +public interface RestorableDroppedManagedDatabasesClient { + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of restorable dropped managed databases as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of restorable dropped managed databases as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * 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 restorableDroppedDatabaseId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a restorable dropped managed database along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, Context context); + + /** + * 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 restorableDroppedDatabaseId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a restorable dropped managed database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RestorableDroppedManagedDatabaseInner get( + String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/RestorePointsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/RestorePointsClient.java new file mode 100644 index 0000000000000..6ebfbb8068444 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/RestorePointsClient.java @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.RestorePointInner; +import com.azure.resourcemanager.sql.generated.models.CreateDatabaseRestorePointDefinition; + +/** An instance of this class provides access to all the operations defined in RestorePointsClient. */ +public interface RestorePointsClient { + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database restore points as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase(String resourceGroupName, String serverName, String databaseName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database restore points as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * 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 parameters The definition for creating the restore point of this database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of database restore points. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, RestorePointInner> beginCreate( + String resourceGroupName, + String serverName, + String databaseName, + CreateDatabaseRestorePointDefinition parameters); + + /** + * 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 parameters The definition for creating the restore point of this database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of database restore points. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, RestorePointInner> beginCreate( + String resourceGroupName, + String serverName, + String databaseName, + CreateDatabaseRestorePointDefinition parameters, + Context context); + + /** + * 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 parameters The definition for creating the restore point of this database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database restore points. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RestorePointInner create( + String resourceGroupName, + String serverName, + String databaseName, + CreateDatabaseRestorePointDefinition parameters); + + /** + * 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 parameters The definition for creating the restore point of this database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database restore points. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RestorePointInner create( + String resourceGroupName, + String serverName, + String databaseName, + CreateDatabaseRestorePointDefinition parameters, + Context context); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a restore point along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, String restorePointName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a restore point. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RestorePointInner get(String resourceGroupName, String serverName, String databaseName, String restorePointName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse( + String resourceGroupName, String serverName, String databaseName, String restorePointName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String databaseName, String restorePointName); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SensitivityLabelsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SensitivityLabelsClient.java new file mode 100644 index 0000000000000..28225932034e7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SensitivityLabelsClient.java @@ -0,0 +1,394 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.SensitivityLabelInner; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelSource; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelUpdateList; + +/** An instance of this class provides access to all the operations defined in SensitivityLabelsClient. */ +public interface SensitivityLabelsClient { + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity labels of a given database as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listCurrentByDatabase( + String resourceGroupName, String serverName, String databaseName); + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param skipToken The skipToken parameter. + * @param count The count parameter. + * @param filter An OData filter expression that filters elements in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity labels of a given database as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listCurrentByDatabase( + String resourceGroupName, + String serverName, + String databaseName, + String skipToken, + Boolean count, + String filter, + Context context); + + /** + * Update sensitivity labels of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of sensitivity label update operations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + SensitivityLabelUpdateList parameters, + Context context); + + /** + * Update sensitivity labels of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of sensitivity label update operations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void update( + String resourceGroupName, String serverName, String databaseName, SensitivityLabelUpdateList parameters); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity labels of a given database as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listRecommendedByDatabase( + String resourceGroupName, String serverName, String databaseName); + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param skipToken The skipToken parameter. + * @param includeDisabledRecommendations Specifies whether to include disabled recommendations or not. + * @param filter An OData filter expression that filters elements in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity labels of a given database as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listRecommendedByDatabase( + String resourceGroupName, + String serverName, + String databaseName, + String skipToken, + Boolean includeDisabledRecommendations, + String filter, + Context context); + + /** + * Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response enableRecommendationWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context); + + /** + * Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void enableRecommendation( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName); + + /** + * Disables sensitivity recommendations on a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response disableRecommendationWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context); + + /** + * Disables sensitivity recommendations on a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void disableRecommendation( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName); + + /** + * 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity label of a given column along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelSource sensitivityLabelSource, + Context context); + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity label of a given column. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SensitivityLabelInner get( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelSource sensitivityLabelSource); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sensitivity label along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelInner parameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sensitivity label. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SensitivityLabelInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelInner parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerAdvancedThreatProtectionSettingsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerAdvancedThreatProtectionSettingsClient.java new file mode 100644 index 0000000000000..066c4b4157b5f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerAdvancedThreatProtectionSettingsClient.java @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerAdvancedThreatProtectionInner; +import com.azure.resourcemanager.sql.generated.models.AdvancedThreatProtectionName; + +/** + * An instance of this class provides access to all the operations defined in + * ServerAdvancedThreatProtectionSettingsClient. + */ +public interface ServerAdvancedThreatProtectionSettingsClient { + /** + * Get a list of the server's Advanced Threat Protection states. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the server's Advanced Threat Protection states as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Get a list of the server's Advanced Threat Protection states. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the server's Advanced Threat Protection states as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String resourceGroupName, String serverName, Context context); + + /** + * Get a server's Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's Advanced Threat Protection state along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + AdvancedThreatProtectionName advancedThreatProtectionName, + Context context); + + /** + * Get a server's Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's Advanced Threat Protection state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerAdvancedThreatProtectionInner get( + String resourceGroupName, String serverName, AdvancedThreatProtectionName advancedThreatProtectionName); + + /** + * Creates or updates an Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @param parameters The server Advanced Threat Protection state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a server Advanced Threat Protection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServerAdvancedThreatProtectionInner> + beginCreateOrUpdate( + String resourceGroupName, + String serverName, + AdvancedThreatProtectionName advancedThreatProtectionName, + ServerAdvancedThreatProtectionInner parameters); + + /** + * Creates or updates an Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @param parameters The server Advanced Threat Protection state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a server Advanced Threat Protection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServerAdvancedThreatProtectionInner> + beginCreateOrUpdate( + String resourceGroupName, + String serverName, + AdvancedThreatProtectionName advancedThreatProtectionName, + ServerAdvancedThreatProtectionInner parameters, + Context context); + + /** + * Creates or updates an Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @param parameters The server Advanced Threat Protection state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server Advanced Threat Protection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerAdvancedThreatProtectionInner createOrUpdate( + String resourceGroupName, + String serverName, + AdvancedThreatProtectionName advancedThreatProtectionName, + ServerAdvancedThreatProtectionInner parameters); + + /** + * Creates or updates an Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @param parameters The server Advanced Threat Protection state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server Advanced Threat Protection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerAdvancedThreatProtectionInner createOrUpdate( + String resourceGroupName, + String serverName, + AdvancedThreatProtectionName advancedThreatProtectionName, + ServerAdvancedThreatProtectionInner parameters, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerAdvisorsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerAdvisorsClient.java new file mode 100644 index 0000000000000..f62d8c16fa858 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerAdvisorsClient.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.AdvisorInner; +import java.util.List; + +/** An instance of this class provides access to all the operations defined in ServerAdvisorsClient. */ +public interface ServerAdvisorsClient { + /** + * 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 expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server advisors along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response> listByServerWithResponse( + String resourceGroupName, String serverName, String expand, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server advisors. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + List listByServer(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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server advisor along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String advisorName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server advisor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AdvisorInner get(String resourceGroupName, String serverName, String advisorName); + + /** + * 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 parameters The requested advisor resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database, Server or Elastic Pool Advisor along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String serverName, String advisorName, AdvisorInner parameters, Context context); + + /** + * 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 parameters The requested advisor resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database, Server or Elastic Pool Advisor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AdvisorInner update(String resourceGroupName, String serverName, String advisorName, AdvisorInner parameters); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerAutomaticTuningsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerAutomaticTuningsClient.java new file mode 100644 index 0000000000000..104228be9e205 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerAutomaticTuningsClient.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerAutomaticTuningInner; + +/** An instance of this class provides access to all the operations defined in ServerAutomaticTuningsClient. */ +public interface ServerAutomaticTuningsClient { + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return server-level Automatic Tuning along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String serverName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return server-level Automatic Tuning. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerAutomaticTuningInner get(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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return server-level Automatic Tuning along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String serverName, ServerAutomaticTuningInner parameters, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return server-level Automatic Tuning. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerAutomaticTuningInner update( + String resourceGroupName, String serverName, ServerAutomaticTuningInner parameters); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerAzureADAdministratorsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerAzureADAdministratorsClient.java new file mode 100644 index 0000000000000..810ab41027d69 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerAzureADAdministratorsClient.java @@ -0,0 +1,229 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerAzureADAdministratorInner; +import com.azure.resourcemanager.sql.generated.models.AdministratorName; + +/** An instance of this class provides access to all the operations defined in ServerAzureADAdministratorsClient. */ +public interface ServerAzureADAdministratorsClient { + /** + * Gets a Azure 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 administratorName The name of server active directory administrator. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Azure Active Directory administrator along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, AdministratorName administratorName, Context context); + + /** + * Gets a Azure 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 administratorName The name of server active directory administrator. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Azure Active Directory administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerAzureADAdministratorInner get( + String resourceGroupName, String serverName, AdministratorName administratorName); + + /** + * Creates or updates an existing Azure 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 administratorName The name of server active directory administrator. + * @param parameters The requested Azure Active Directory administrator Resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of azure Active Directory administrator. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServerAzureADAdministratorInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + AdministratorName administratorName, + ServerAzureADAdministratorInner parameters); + + /** + * Creates or updates an existing Azure 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 administratorName The name of server active directory administrator. + * @param parameters The requested Azure Active Directory administrator Resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of azure Active Directory administrator. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServerAzureADAdministratorInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + AdministratorName administratorName, + ServerAzureADAdministratorInner parameters, + Context context); + + /** + * Creates or updates an existing Azure 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 administratorName The name of server active directory administrator. + * @param parameters The requested Azure Active Directory administrator Resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure Active Directory administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerAzureADAdministratorInner createOrUpdate( + String resourceGroupName, + String serverName, + AdministratorName administratorName, + ServerAzureADAdministratorInner parameters); + + /** + * Creates or updates an existing Azure 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 administratorName The name of server active directory administrator. + * @param parameters The requested Azure Active Directory administrator Resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure Active Directory administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerAzureADAdministratorInner createOrUpdate( + String resourceGroupName, + String serverName, + AdministratorName administratorName, + ServerAzureADAdministratorInner parameters, + Context context); + + /** + * Deletes the Azure Active Directory administrator 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 administratorName The name of server active directory administrator. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, AdministratorName administratorName); + + /** + * Deletes the Azure Active Directory administrator 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 administratorName The name of server active directory administrator. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, AdministratorName administratorName, Context context); + + /** + * Deletes the Azure Active Directory administrator 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 administratorName The name of server active directory administrator. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, AdministratorName administratorName); + + /** + * Deletes the Azure Active Directory administrator 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 administratorName The name of server active directory administrator. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, AdministratorName administratorName, Context context); + + /** + * Gets a list of Azure Active Directory administrators 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Azure Active Directory administrators in a server as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets a list of Azure Active Directory administrators 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Azure Active Directory administrators in a server as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerAzureADOnlyAuthenticationsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerAzureADOnlyAuthenticationsClient.java new file mode 100644 index 0000000000000..26d44f68c7500 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerAzureADOnlyAuthenticationsClient.java @@ -0,0 +1,241 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerAzureADOnlyAuthenticationInner; +import com.azure.resourcemanager.sql.generated.models.AuthenticationName; + +/** + * An instance of this class provides access to all the operations defined in ServerAzureADOnlyAuthenticationsClient. + */ +public interface ServerAzureADOnlyAuthenticationsClient { + /** + * Gets a specific Azure Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific Azure Active Directory only authentication property along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, AuthenticationName authenticationName, Context context); + + /** + * Gets a specific Azure Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific Azure Active Directory only authentication property. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerAzureADOnlyAuthenticationInner get( + String resourceGroupName, String serverName, AuthenticationName authenticationName); + + /** + * Sets Server Active Directory only authentication property or updates an existing server Active Directory only + * authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @param parameters The required parameters for creating or updating an Active Directory only authentication + * property. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServerAzureADOnlyAuthenticationInner> + beginCreateOrUpdate( + String resourceGroupName, + String serverName, + AuthenticationName authenticationName, + ServerAzureADOnlyAuthenticationInner parameters); + + /** + * Sets Server Active Directory only authentication property or updates an existing server Active Directory only + * authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @param parameters The required parameters for creating or updating an Active Directory only authentication + * property. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServerAzureADOnlyAuthenticationInner> + beginCreateOrUpdate( + String resourceGroupName, + String serverName, + AuthenticationName authenticationName, + ServerAzureADOnlyAuthenticationInner parameters, + Context context); + + /** + * Sets Server Active Directory only authentication property or updates an existing server Active Directory only + * authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @param parameters The required parameters for creating or updating an Active Directory only authentication + * property. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerAzureADOnlyAuthenticationInner createOrUpdate( + String resourceGroupName, + String serverName, + AuthenticationName authenticationName, + ServerAzureADOnlyAuthenticationInner parameters); + + /** + * Sets Server Active Directory only authentication property or updates an existing server Active Directory only + * authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @param parameters The required parameters for creating or updating an Active Directory only authentication + * property. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerAzureADOnlyAuthenticationInner createOrUpdate( + String resourceGroupName, + String serverName, + AuthenticationName authenticationName, + ServerAzureADOnlyAuthenticationInner parameters, + Context context); + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, AuthenticationName authenticationName); + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, AuthenticationName authenticationName, Context context); + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, AuthenticationName authenticationName); + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, AuthenticationName authenticationName, Context context); + + /** + * Gets a list of server Azure Active Directory only authentications. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server Azure Active Directory only authentications as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets a list of server Azure Active Directory only authentications. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server Azure Active Directory only authentications as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerBlobAuditingPoliciesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerBlobAuditingPoliciesClient.java new file mode 100644 index 0000000000000..114134100e70e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerBlobAuditingPoliciesClient.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerBlobAuditingPolicyInner; + +/** An instance of this class provides access to all the operations defined in ServerBlobAuditingPoliciesClient. */ +public interface ServerBlobAuditingPoliciesClient { + /** + * Lists auditing settings of 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server auditing settings as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Lists auditing settings of 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server auditing settings as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String resourceGroupName, String serverName, Context context); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's blob auditing policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerBlobAuditingPolicyInner get(String resourceGroupName, String serverName); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServerBlobAuditingPolicyInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, ServerBlobAuditingPolicyInner parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServerBlobAuditingPolicyInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, ServerBlobAuditingPolicyInner parameters, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerBlobAuditingPolicyInner createOrUpdate( + String resourceGroupName, String serverName, ServerBlobAuditingPolicyInner parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerBlobAuditingPolicyInner createOrUpdate( + String resourceGroupName, String serverName, ServerBlobAuditingPolicyInner parameters, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerCommunicationLinksClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerCommunicationLinksClient.java new file mode 100644 index 0000000000000..ac65ab40f07c4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerCommunicationLinksClient.java @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerCommunicationLinkInner; + +/** An instance of this class provides access to all the operations defined in ServerCommunicationLinksClient. */ +public interface ServerCommunicationLinksClient { + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse( + String resourceGroupName, String serverName, String communicationLinkName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String communicationLinkName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return server communication link along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String communicationLinkName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return server communication link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerCommunicationLinkInner get(String resourceGroupName, String serverName, String communicationLinkName); + + /** + * 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 parameters The required parameters for creating a server communication link. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of server communication link. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServerCommunicationLinkInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String communicationLinkName, + ServerCommunicationLinkInner parameters); + + /** + * 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 parameters The required parameters for creating a server communication link. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of server communication link. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServerCommunicationLinkInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String communicationLinkName, + ServerCommunicationLinkInner parameters, + Context context); + + /** + * 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 parameters The required parameters for creating a server communication link. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return server communication link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerCommunicationLinkInner createOrUpdate( + String resourceGroupName, + String serverName, + String communicationLinkName, + ServerCommunicationLinkInner parameters); + + /** + * 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 parameters The required parameters for creating a server communication link. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return server communication link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerCommunicationLinkInner createOrUpdate( + String resourceGroupName, + String serverName, + String communicationLinkName, + ServerCommunicationLinkInner parameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server communication links as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server communication links as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerConnectionPoliciesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerConnectionPoliciesClient.java new file mode 100644 index 0000000000000..98eea1ecdd36c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerConnectionPoliciesClient.java @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerConnectionPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ConnectionPolicyName; + +/** An instance of this class provides access to all the operations defined in ServerConnectionPoliciesClient. */ +public interface ServerConnectionPoliciesClient { + /** + * Gets a server 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 connectionPolicyName The name of the connection policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server connection policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, ConnectionPolicyName connectionPolicyName, Context context); + + /** + * Gets a server 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 connectionPolicyName The name of the connection policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server connection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerConnectionPolicyInner get( + String resourceGroupName, String serverName, ConnectionPolicyName connectionPolicyName); + + /** + * Updates a server 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 connectionPolicyName The name of the connection policy. + * @param parameters The required parameters for updating a server connection policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a server connection policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServerConnectionPolicyInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + ConnectionPolicyName connectionPolicyName, + ServerConnectionPolicyInner parameters); + + /** + * Updates a server 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 connectionPolicyName The name of the connection policy. + * @param parameters The required parameters for updating a server connection policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a server connection policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServerConnectionPolicyInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + ConnectionPolicyName connectionPolicyName, + ServerConnectionPolicyInner parameters, + Context context); + + /** + * Updates a server 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 connectionPolicyName The name of the connection policy. + * @param parameters The required parameters for updating a server connection policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server connection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerConnectionPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + ConnectionPolicyName connectionPolicyName, + ServerConnectionPolicyInner parameters); + + /** + * Updates a server 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 connectionPolicyName The name of the connection policy. + * @param parameters The required parameters for updating a server connection policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server connection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerConnectionPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + ConnectionPolicyName connectionPolicyName, + ServerConnectionPolicyInner parameters, + Context context); + + /** + * Lists 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server connection policy objects as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Lists 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server connection policy objects as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerDevOpsAuditSettingsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerDevOpsAuditSettingsClient.java new file mode 100644 index 0000000000000..0dc84e0683a8a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerDevOpsAuditSettingsClient.java @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerDevOpsAuditingSettingsInner; +import com.azure.resourcemanager.sql.generated.models.DevOpsAuditingSettingsName; + +/** An instance of this class provides access to all the operations defined in ServerDevOpsAuditSettingsClient. */ +public interface ServerDevOpsAuditSettingsClient { + /** + * Lists DevOps audit settings of 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server DevOps audit settings as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Lists DevOps audit settings of 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server DevOps audit settings as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String resourceGroupName, String serverName, Context context); + + /** + * Gets a server's DevOps audit settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param devOpsAuditingSettingsName The devOpsAuditingSettingsName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's DevOps audit settings along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + DevOpsAuditingSettingsName devOpsAuditingSettingsName, + Context context); + + /** + * Gets a server's DevOps audit settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param devOpsAuditingSettingsName The devOpsAuditingSettingsName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's DevOps audit settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerDevOpsAuditingSettingsInner get( + String resourceGroupName, String serverName, DevOpsAuditingSettingsName devOpsAuditingSettingsName); + + /** + * Creates or updates a server's DevOps audit settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param devOpsAuditingSettingsName The devOpsAuditingSettingsName parameter. + * @param parameters Properties of DevOps audit settings. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a server DevOps auditing settings. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServerDevOpsAuditingSettingsInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + DevOpsAuditingSettingsName devOpsAuditingSettingsName, + ServerDevOpsAuditingSettingsInner parameters); + + /** + * Creates or updates a server's DevOps audit settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param devOpsAuditingSettingsName The devOpsAuditingSettingsName parameter. + * @param parameters Properties of DevOps audit settings. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a server DevOps auditing settings. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServerDevOpsAuditingSettingsInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + DevOpsAuditingSettingsName devOpsAuditingSettingsName, + ServerDevOpsAuditingSettingsInner parameters, + Context context); + + /** + * Creates or updates a server's DevOps audit settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param devOpsAuditingSettingsName The devOpsAuditingSettingsName parameter. + * @param parameters Properties of DevOps audit settings. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server DevOps auditing settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerDevOpsAuditingSettingsInner createOrUpdate( + String resourceGroupName, + String serverName, + DevOpsAuditingSettingsName devOpsAuditingSettingsName, + ServerDevOpsAuditingSettingsInner parameters); + + /** + * Creates or updates a server's DevOps audit settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param devOpsAuditingSettingsName The devOpsAuditingSettingsName parameter. + * @param parameters Properties of DevOps audit settings. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server DevOps auditing settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerDevOpsAuditingSettingsInner createOrUpdate( + String resourceGroupName, + String serverName, + DevOpsAuditingSettingsName devOpsAuditingSettingsName, + ServerDevOpsAuditingSettingsInner parameters, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerDnsAliasesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerDnsAliasesClient.java new file mode 100644 index 0000000000000..724d390f1cc73 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerDnsAliasesClient.java @@ -0,0 +1,283 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerDnsAliasInner; +import com.azure.resourcemanager.sql.generated.models.ServerDnsAliasAcquisition; + +/** An instance of this class provides access to all the operations defined in ServerDnsAliasesClient. */ +public interface ServerDnsAliasesClient { + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server DNS alias along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String dnsAliasName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server DNS alias. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerDnsAliasInner get(String resourceGroupName, String serverName, String dnsAliasName); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a server DNS alias. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServerDnsAliasInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String dnsAliasName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a server DNS alias. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServerDnsAliasInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String dnsAliasName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server DNS alias. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerDnsAliasInner createOrUpdate(String resourceGroupName, String serverName, String dnsAliasName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server DNS alias. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerDnsAliasInner createOrUpdate( + String resourceGroupName, String serverName, String dnsAliasName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String serverName, String dnsAliasName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String dnsAliasName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String dnsAliasName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String dnsAliasName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server DNS aliases for a server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server DNS aliases for a server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * 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 parameters A server dns alias acquisition request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a server DNS alias. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServerDnsAliasInner> beginAcquire( + String resourceGroupName, String serverName, String dnsAliasName, ServerDnsAliasAcquisition parameters); + + /** + * 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 parameters A server dns alias acquisition request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a server DNS alias. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServerDnsAliasInner> beginAcquire( + String resourceGroupName, + String serverName, + String dnsAliasName, + ServerDnsAliasAcquisition parameters, + Context context); + + /** + * 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 parameters A server dns alias acquisition request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server DNS alias. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerDnsAliasInner acquire( + String resourceGroupName, String serverName, String dnsAliasName, ServerDnsAliasAcquisition parameters); + + /** + * 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 parameters A server dns alias acquisition request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server DNS alias. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerDnsAliasInner acquire( + String resourceGroupName, + String serverName, + String dnsAliasName, + ServerDnsAliasAcquisition parameters, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerKeysClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerKeysClient.java new file mode 100644 index 0000000000000..8ee929281ea5d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerKeysClient.java @@ -0,0 +1,221 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerKeyInner; + +/** An instance of this class provides access to all the operations defined in ServerKeysClient. */ +public interface ServerKeysClient { + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server keys as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server keys as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server key along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String keyName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerKeyInner get(String resourceGroupName, String serverName, String keyName); + + /** + * 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/YourKeyVersion, then the server key name should be + * formatted as: YourVaultName_YourKeyName_YourKeyVersion. + * @param parameters The requested server key resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a server key. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServerKeyInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String keyName, ServerKeyInner parameters); + + /** + * 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/YourKeyVersion, then the server key name should be + * formatted as: YourVaultName_YourKeyName_YourKeyVersion. + * @param parameters The requested server key resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a server key. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServerKeyInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String keyName, ServerKeyInner parameters, Context context); + + /** + * 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/YourKeyVersion, then the server key name should be + * formatted as: YourVaultName_YourKeyName_YourKeyVersion. + * @param parameters The requested server key resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerKeyInner createOrUpdate( + String resourceGroupName, String serverName, String keyName, ServerKeyInner parameters); + + /** + * 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/YourKeyVersion, then the server key name should be + * formatted as: YourVaultName_YourKeyName_YourKeyVersion. + * @param parameters The requested server key resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerKeyInner createOrUpdate( + String resourceGroupName, String serverName, String keyName, ServerKeyInner parameters, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String serverName, String keyName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String keyName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String keyName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String keyName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerOperationsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerOperationsClient.java new file mode 100644 index 0000000000000..2f4e755e64886 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerOperationsClient.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerOperationInner; + +/** An instance of this class provides access to all the operations defined in ServerOperationsClient. */ +public interface ServerOperationsClient { + /** + * Gets a list of operations performed 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of operations performed on the server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets a list of operations performed 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of operations performed on the server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerSecurityAlertPoliciesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerSecurityAlertPoliciesClient.java new file mode 100644 index 0000000000000..34e0005d0f775 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerSecurityAlertPoliciesClient.java @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerSecurityAlertPolicyInner; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyName; + +/** An instance of this class provides access to all the operations defined in ServerSecurityAlertPoliciesClient. */ +public interface ServerSecurityAlertPoliciesClient { + /** + * 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 securityAlertPolicyName The name of the security alert policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's security alert policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, SecurityAlertPolicyName securityAlertPolicyName, Context context); + + /** + * 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 securityAlertPolicyName The name of the security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerSecurityAlertPolicyInner get( + String resourceGroupName, String serverName, SecurityAlertPolicyName securityAlertPolicyName); + + /** + * 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 securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a server security alert policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServerSecurityAlertPolicyInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters); + + /** + * 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 securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a server security alert policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServerSecurityAlertPolicyInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters, + Context context); + + /** + * 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 securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerSecurityAlertPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters); + + /** + * 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 securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerSecurityAlertPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters, + Context context); + + /** + * Get the server's threat detection 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the server's threat detection policies as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Get the server's threat detection 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the server's threat detection policies as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerTrustCertificatesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerTrustCertificatesClient.java new file mode 100644 index 0000000000000..a346f2695b544 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerTrustCertificatesClient.java @@ -0,0 +1,230 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerTrustCertificateInner; + +/** An instance of this class provides access to all the operations defined in ServerTrustCertificatesClient. */ +public interface ServerTrustCertificatesClient { + /** + * Gets a list of server trust certificates that were uploaded from box to the given Sql 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server trust certificates that were uploaded from box to the given Sql Managed Instance as + * paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstance(String resourceGroupName, String managedInstanceName); + + /** + * Gets a list of server trust certificates that were uploaded from box to the given Sql 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server trust certificates that were uploaded from box to the given Sql Managed Instance as + * paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * Gets a server trust certificate that was uploaded from box to Sql 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 certificateName Name of of the certificate to get. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust certificate that was uploaded from box to Sql Managed Instance along with {@link + * Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String managedInstanceName, String certificateName, Context context); + + /** + * Gets a server trust certificate that was uploaded from box to Sql 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 certificateName Name of of the certificate to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust certificate that was uploaded from box to Sql Managed Instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerTrustCertificateInner get(String resourceGroupName, String managedInstanceName, String certificateName); + + /** + * Uploads a server trust certificate from box to Sql 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 certificateName Name of of the certificate to upload. + * @param parameters The server trust certificate info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of server trust certificate imported from box to enable connection + * between box and Sql Managed Instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServerTrustCertificateInner> beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String certificateName, + ServerTrustCertificateInner parameters); + + /** + * Uploads a server trust certificate from box to Sql 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 certificateName Name of of the certificate to upload. + * @param parameters The server trust certificate info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of server trust certificate imported from box to enable connection + * between box and Sql Managed Instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServerTrustCertificateInner> beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String certificateName, + ServerTrustCertificateInner parameters, + Context context); + + /** + * Uploads a server trust certificate from box to Sql 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 certificateName Name of of the certificate to upload. + * @param parameters The server trust certificate info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return server trust certificate imported from box to enable connection between box and Sql Managed Instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerTrustCertificateInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String certificateName, + ServerTrustCertificateInner parameters); + + /** + * Uploads a server trust certificate from box to Sql 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 certificateName Name of of the certificate to upload. + * @param parameters The server trust certificate info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return server trust certificate imported from box to enable connection between box and Sql Managed Instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerTrustCertificateInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String certificateName, + ServerTrustCertificateInner parameters, + Context context); + + /** + * Deletes a server trust certificate that was uploaded from box to Sql 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 certificateName Name of of the certificate to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, String certificateName); + + /** + * Deletes a server trust certificate that was uploaded from box to Sql 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 certificateName Name of of the certificate to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, String certificateName, Context context); + + /** + * Deletes a server trust certificate that was uploaded from box to Sql 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 certificateName Name of of the certificate to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String managedInstanceName, String certificateName); + + /** + * Deletes a server trust certificate that was uploaded from box to Sql 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 certificateName Name of of the certificate to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String managedInstanceName, String certificateName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerTrustGroupsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerTrustGroupsClient.java new file mode 100644 index 0000000000000..8448f6cbbdb32 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerTrustGroupsClient.java @@ -0,0 +1,248 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerTrustGroupInner; + +/** An instance of this class provides access to all the operations defined in ServerTrustGroupsClient. */ +public interface ServerTrustGroupsClient { + /** + * Gets a server trust 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 serverTrustGroupName The name of the server trust group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String locationName, String serverTrustGroupName, Context context); + + /** + * Gets a server trust 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 serverTrustGroupName The name of the server trust group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerTrustGroupInner get(String resourceGroupName, String locationName, String serverTrustGroupName); + + /** + * Creates or updates a server trust 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 serverTrustGroupName The name of the server trust group. + * @param parameters The server trust group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a server trust group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServerTrustGroupInner> beginCreateOrUpdate( + String resourceGroupName, String locationName, String serverTrustGroupName, ServerTrustGroupInner parameters); + + /** + * Creates or updates a server trust 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 serverTrustGroupName The name of the server trust group. + * @param parameters The server trust group parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a server trust group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServerTrustGroupInner> beginCreateOrUpdate( + String resourceGroupName, + String locationName, + String serverTrustGroupName, + ServerTrustGroupInner parameters, + Context context); + + /** + * Creates or updates a server trust 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 serverTrustGroupName The name of the server trust group. + * @param parameters The server trust group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerTrustGroupInner createOrUpdate( + String resourceGroupName, String locationName, String serverTrustGroupName, ServerTrustGroupInner parameters); + + /** + * Creates or updates a server trust 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 serverTrustGroupName The name of the server trust group. + * @param parameters The server trust group parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerTrustGroupInner createOrUpdate( + String resourceGroupName, + String locationName, + String serverTrustGroupName, + ServerTrustGroupInner parameters, + Context context); + + /** + * Deletes a server trust 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 serverTrustGroupName The name of the server trust group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String locationName, String serverTrustGroupName); + + /** + * Deletes a server trust 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 serverTrustGroupName The name of the server trust group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String locationName, String serverTrustGroupName, Context context); + + /** + * Deletes a server trust 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 serverTrustGroupName The name of the server trust group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String locationName, String serverTrustGroupName); + + /** + * Deletes a server trust 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 serverTrustGroupName The name of the server trust group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String locationName, String serverTrustGroupName, Context context); + + /** + * Lists a server trust 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server trust groups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByLocation(String resourceGroupName, String locationName); + + /** + * Lists a server trust 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server trust groups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByLocation(String resourceGroupName, String locationName, Context context); + + /** + * Gets a server trust groups by instance 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust groups by instance name as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstance(String resourceGroupName, String managedInstanceName); + + /** + * Gets a server trust groups by instance 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust groups by instance name as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerUsagesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerUsagesClient.java new file mode 100644 index 0000000000000..dfaa3e6ea957b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerUsagesClient.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerUsageInner; + +/** An instance of this class provides access to all the operations defined in ServerUsagesClient. */ +public interface ServerUsagesClient { + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a list server metrics request as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a list server metrics request as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerVulnerabilityAssessmentsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerVulnerabilityAssessmentsClient.java new file mode 100644 index 0000000000000..9798dc0c02051 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServerVulnerabilityAssessmentsClient.java @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerVulnerabilityAssessmentInner; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** An instance of this class provides access to all the operations defined in ServerVulnerabilityAssessmentsClient. */ +public interface ServerVulnerabilityAssessmentsClient { + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the server's vulnerability assessment along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the server's vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerVulnerabilityAssessmentInner get( + String resourceGroupName, String serverName, VulnerabilityAssessmentName vulnerabilityAssessmentName); + + /** + * Creates or updates the server's vulnerability assessment. Learn more about setting SQL vulnerability assessment + * with managed identity - + * https://docs.microsoft.com/azure/azure-sql/database/sql-database-vulnerability-assessment-storage. + * + * @param resourceGroupName The name of the resource group that 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server vulnerability assessment along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + ServerVulnerabilityAssessmentInner parameters, + Context context); + + /** + * Creates or updates the server's vulnerability assessment. Learn more about setting SQL vulnerability assessment + * with managed identity - + * https://docs.microsoft.com/azure/azure-sql/database/sql-database-vulnerability-assessment-storage. + * + * @param resourceGroupName The name of the resource group that 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerVulnerabilityAssessmentInner createOrUpdate( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + ServerVulnerabilityAssessmentInner parameters); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, VulnerabilityAssessmentName vulnerabilityAssessmentName); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the server's vulnerability assessments as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the server's vulnerability assessments as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServersClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServersClient.java new file mode 100644 index 0000000000000..28578a171aabd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServersClient.java @@ -0,0 +1,380 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.CheckNameAvailabilityResponseInner; +import com.azure.resourcemanager.sql.generated.fluent.models.ImportExportOperationResultInner; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerInner; +import com.azure.resourcemanager.sql.generated.models.CheckNameAvailabilityRequest; +import com.azure.resourcemanager.sql.generated.models.ImportNewDatabaseDefinition; +import com.azure.resourcemanager.sql.generated.models.ServerUpdate; + +/** An instance of this class provides access to all the operations defined in ServersClient. */ +public interface ServersClient { + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of servers in a resource groups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * 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 expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of servers in a resource groups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, String expand, Context context); + + /** + * 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 expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String serverName, String expand, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerInner getByResourceGroup(String resourceGroupName, String serverName); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServerInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, ServerInner parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServerInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, ServerInner parameters, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerInner createOrUpdate(String resourceGroupName, String serverName, ServerInner parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerInner createOrUpdate(String resourceGroupName, String serverName, ServerInner parameters, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String serverName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String serverName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServerInner> beginUpdate( + String resourceGroupName, String serverName, ServerUpdate parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ServerInner> beginUpdate( + String resourceGroupName, String serverName, ServerUpdate parameters, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerInner update(String resourceGroupName, String serverName, ServerUpdate parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerInner update(String resourceGroupName, String serverName, ServerUpdate parameters, Context context); + + /** + * Gets a list of all servers in the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all servers in the subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets a list of all servers in the subscription. + * + * @param expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all servers in the subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String expand, Context context); + + /** + * 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 database import request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ImportExportOperationResultInner> beginImportDatabase( + String resourceGroupName, String serverName, ImportNewDatabaseDefinition 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 database import request parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ImportExportOperationResultInner> beginImportDatabase( + String resourceGroupName, String serverName, ImportNewDatabaseDefinition parameters, Context context); + + /** + * 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 database import request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ImportExportOperationResultInner importDatabase( + String resourceGroupName, String serverName, ImportNewDatabaseDefinition 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 database import request parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ImportExportOperationResultInner importDatabase( + String resourceGroupName, String serverName, ImportNewDatabaseDefinition parameters, Context context); + + /** + * Determines whether a resource can be created with the specified name. + * + * @param parameters The name availability request parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a name availability check along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkNameAvailabilityWithResponse( + CheckNameAvailabilityRequest parameters, Context context); + + /** + * Determines whether a resource can be created with the specified name. + * + * @param parameters The name availability request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a name availability check. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CheckNameAvailabilityResponseInner checkNameAvailability(CheckNameAvailabilityRequest parameters); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServiceObjectivesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServiceObjectivesClient.java new file mode 100644 index 0000000000000..e2600b69ea233 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/ServiceObjectivesClient.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServiceObjectiveInner; + +/** An instance of this class provides access to all the operations defined in ServiceObjectivesClient. */ +public interface ServiceObjectivesClient { + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database service objective along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String serviceObjectiveName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database service objective. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServiceObjectiveInner get(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. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a get database service objectives request as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a get database service objectives request as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SqlAgentsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SqlAgentsClient.java new file mode 100644 index 0000000000000..0bc4e28b56102 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SqlAgentsClient.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.SqlAgentConfigurationInner; + +/** An instance of this class provides access to all the operations defined in SqlAgentsClient. */ +public interface SqlAgentsClient { + /** + * Gets current instance sql agent 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 managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return current instance sql agent configuration along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * Gets current instance sql agent 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 managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return current instance sql agent configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlAgentConfigurationInner get(String resourceGroupName, String managedInstanceName); + + /** + * Puts new sql agent configuration to 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 A recoverable managed database resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a recoverable managed database resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, String managedInstanceName, SqlAgentConfigurationInner parameters, Context context); + + /** + * Puts new sql agent configuration to 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 A recoverable managed database resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a recoverable managed database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlAgentConfigurationInner createOrUpdate( + String resourceGroupName, String managedInstanceName, SqlAgentConfigurationInner parameters); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SqlManagementClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SqlManagementClient.java new file mode 100644 index 0000000000000..cc25af79d4e17 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SqlManagementClient.java @@ -0,0 +1,1055 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for SqlManagementClient class. */ +public interface SqlManagementClient { + /** + * Gets The subscription ID that identifies an Azure subscription. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the RecoverableDatabasesClient object to access its operations. + * + * @return the RecoverableDatabasesClient object. + */ + RecoverableDatabasesClient getRecoverableDatabases(); + + /** + * Gets the DataMaskingPoliciesClient object to access its operations. + * + * @return the DataMaskingPoliciesClient object. + */ + DataMaskingPoliciesClient getDataMaskingPolicies(); + + /** + * Gets the DataMaskingRulesClient object to access its operations. + * + * @return the DataMaskingRulesClient object. + */ + DataMaskingRulesClient getDataMaskingRules(); + + /** + * Gets the GeoBackupPoliciesClient object to access its operations. + * + * @return the GeoBackupPoliciesClient object. + */ + GeoBackupPoliciesClient getGeoBackupPolicies(); + + /** + * Gets the DatabasesClient object to access its operations. + * + * @return the DatabasesClient object. + */ + DatabasesClient getDatabases(); + + /** + * Gets the ElasticPoolsClient object to access its operations. + * + * @return the ElasticPoolsClient object. + */ + ElasticPoolsClient getElasticPools(); + + /** + * Gets the ServerCommunicationLinksClient object to access its operations. + * + * @return the ServerCommunicationLinksClient object. + */ + ServerCommunicationLinksClient getServerCommunicationLinks(); + + /** + * Gets the ServiceObjectivesClient object to access its operations. + * + * @return the ServiceObjectivesClient object. + */ + ServiceObjectivesClient getServiceObjectives(); + + /** + * Gets the ElasticPoolActivitiesClient object to access its operations. + * + * @return the ElasticPoolActivitiesClient object. + */ + ElasticPoolActivitiesClient getElasticPoolActivities(); + + /** + * Gets the ElasticPoolDatabaseActivitiesClient object to access its operations. + * + * @return the ElasticPoolDatabaseActivitiesClient object. + */ + ElasticPoolDatabaseActivitiesClient getElasticPoolDatabaseActivities(); + + /** + * Gets the ServerUsagesClient object to access its operations. + * + * @return the ServerUsagesClient object. + */ + ServerUsagesClient getServerUsages(); + + /** + * Gets the DatabaseAdvisorsClient object to access its operations. + * + * @return the DatabaseAdvisorsClient object. + */ + DatabaseAdvisorsClient getDatabaseAdvisors(); + + /** + * Gets the DatabaseAutomaticTuningsClient object to access its operations. + * + * @return the DatabaseAutomaticTuningsClient object. + */ + DatabaseAutomaticTuningsClient getDatabaseAutomaticTunings(); + + /** + * Gets the DatabaseColumnsClient object to access its operations. + * + * @return the DatabaseColumnsClient object. + */ + DatabaseColumnsClient getDatabaseColumns(); + + /** + * Gets the DatabaseRecommendedActionsClient object to access its operations. + * + * @return the DatabaseRecommendedActionsClient object. + */ + DatabaseRecommendedActionsClient getDatabaseRecommendedActions(); + + /** + * Gets the DatabaseSchemasClient object to access its operations. + * + * @return the DatabaseSchemasClient object. + */ + DatabaseSchemasClient getDatabaseSchemas(); + + /** + * Gets the DatabaseSecurityAlertPoliciesClient object to access its operations. + * + * @return the DatabaseSecurityAlertPoliciesClient object. + */ + DatabaseSecurityAlertPoliciesClient getDatabaseSecurityAlertPolicies(); + + /** + * Gets the DatabaseTablesClient object to access its operations. + * + * @return the DatabaseTablesClient object. + */ + DatabaseTablesClient getDatabaseTables(); + + /** + * Gets the DatabaseVulnerabilityAssessmentRuleBaselinesClient object to access its operations. + * + * @return the DatabaseVulnerabilityAssessmentRuleBaselinesClient object. + */ + DatabaseVulnerabilityAssessmentRuleBaselinesClient getDatabaseVulnerabilityAssessmentRuleBaselines(); + + /** + * Gets the DatabaseVulnerabilityAssessmentsClient object to access its operations. + * + * @return the DatabaseVulnerabilityAssessmentsClient object. + */ + DatabaseVulnerabilityAssessmentsClient getDatabaseVulnerabilityAssessments(); + + /** + * Gets the DatabaseVulnerabilityAssessmentScansClient object to access its operations. + * + * @return the DatabaseVulnerabilityAssessmentScansClient object. + */ + DatabaseVulnerabilityAssessmentScansClient getDatabaseVulnerabilityAssessmentScans(); + + /** + * Gets the DataWarehouseUserActivitiesOperationsClient object to access its operations. + * + * @return the DataWarehouseUserActivitiesOperationsClient object. + */ + DataWarehouseUserActivitiesOperationsClient getDataWarehouseUserActivitiesOperations(); + + /** + * Gets the DeletedServersClient object to access its operations. + * + * @return the DeletedServersClient object. + */ + DeletedServersClient getDeletedServers(); + + /** + * Gets the ElasticPoolOperationsClient object to access its operations. + * + * @return the ElasticPoolOperationsClient object. + */ + ElasticPoolOperationsClient getElasticPoolOperations(); + + /** + * Gets the EncryptionProtectorsClient object to access its operations. + * + * @return the EncryptionProtectorsClient object. + */ + EncryptionProtectorsClient getEncryptionProtectors(); + + /** + * Gets the FailoverGroupsClient object to access its operations. + * + * @return the FailoverGroupsClient object. + */ + FailoverGroupsClient getFailoverGroups(); + + /** + * Gets the FirewallRulesClient object to access its operations. + * + * @return the FirewallRulesClient object. + */ + FirewallRulesClient getFirewallRules(); + + /** + * Gets the InstanceFailoverGroupsClient object to access its operations. + * + * @return the InstanceFailoverGroupsClient object. + */ + InstanceFailoverGroupsClient getInstanceFailoverGroups(); + + /** + * Gets the InstancePoolsClient object to access its operations. + * + * @return the InstancePoolsClient object. + */ + InstancePoolsClient getInstancePools(); + + /** + * Gets the JobAgentsClient object to access its operations. + * + * @return the JobAgentsClient object. + */ + JobAgentsClient getJobAgents(); + + /** + * Gets the JobCredentialsClient object to access its operations. + * + * @return the JobCredentialsClient object. + */ + JobCredentialsClient getJobCredentials(); + + /** + * Gets the JobExecutionsClient object to access its operations. + * + * @return the JobExecutionsClient object. + */ + JobExecutionsClient getJobExecutions(); + + /** + * Gets the JobsClient object to access its operations. + * + * @return the JobsClient object. + */ + JobsClient getJobs(); + + /** + * Gets the JobStepExecutionsClient object to access its operations. + * + * @return the JobStepExecutionsClient object. + */ + JobStepExecutionsClient getJobStepExecutions(); + + /** + * Gets the JobStepsClient object to access its operations. + * + * @return the JobStepsClient object. + */ + JobStepsClient getJobSteps(); + + /** + * Gets the JobTargetExecutionsClient object to access its operations. + * + * @return the JobTargetExecutionsClient object. + */ + JobTargetExecutionsClient getJobTargetExecutions(); + + /** + * Gets the JobTargetGroupsClient object to access its operations. + * + * @return the JobTargetGroupsClient object. + */ + JobTargetGroupsClient getJobTargetGroups(); + + /** + * Gets the JobVersionsClient object to access its operations. + * + * @return the JobVersionsClient object. + */ + JobVersionsClient getJobVersions(); + + /** + * Gets the CapabilitiesClient object to access its operations. + * + * @return the CapabilitiesClient object. + */ + CapabilitiesClient getCapabilities(); + + /** + * Gets the LongTermRetentionPoliciesClient object to access its operations. + * + * @return the LongTermRetentionPoliciesClient object. + */ + LongTermRetentionPoliciesClient getLongTermRetentionPolicies(); + + /** + * Gets the MaintenanceWindowOptionsOperationsClient object to access its operations. + * + * @return the MaintenanceWindowOptionsOperationsClient object. + */ + MaintenanceWindowOptionsOperationsClient getMaintenanceWindowOptionsOperations(); + + /** + * Gets the MaintenanceWindowsOperationsClient object to access its operations. + * + * @return the MaintenanceWindowsOperationsClient object. + */ + MaintenanceWindowsOperationsClient getMaintenanceWindowsOperations(); + + /** + * Gets the ManagedBackupShortTermRetentionPoliciesClient object to access its operations. + * + * @return the ManagedBackupShortTermRetentionPoliciesClient object. + */ + ManagedBackupShortTermRetentionPoliciesClient getManagedBackupShortTermRetentionPolicies(); + + /** + * Gets the ManagedDatabaseColumnsClient object to access its operations. + * + * @return the ManagedDatabaseColumnsClient object. + */ + ManagedDatabaseColumnsClient getManagedDatabaseColumns(); + + /** + * Gets the ManagedDatabaseQueriesClient object to access its operations. + * + * @return the ManagedDatabaseQueriesClient object. + */ + ManagedDatabaseQueriesClient getManagedDatabaseQueries(); + + /** + * Gets the ManagedDatabaseSchemasClient object to access its operations. + * + * @return the ManagedDatabaseSchemasClient object. + */ + ManagedDatabaseSchemasClient getManagedDatabaseSchemas(); + + /** + * Gets the ManagedDatabaseSecurityAlertPoliciesClient object to access its operations. + * + * @return the ManagedDatabaseSecurityAlertPoliciesClient object. + */ + ManagedDatabaseSecurityAlertPoliciesClient getManagedDatabaseSecurityAlertPolicies(); + + /** + * Gets the ManagedDatabaseSecurityEventsClient object to access its operations. + * + * @return the ManagedDatabaseSecurityEventsClient object. + */ + ManagedDatabaseSecurityEventsClient getManagedDatabaseSecurityEvents(); + + /** + * Gets the ManagedDatabaseTablesClient object to access its operations. + * + * @return the ManagedDatabaseTablesClient object. + */ + ManagedDatabaseTablesClient getManagedDatabaseTables(); + + /** + * Gets the ManagedDatabaseTransparentDataEncryptionsClient object to access its operations. + * + * @return the ManagedDatabaseTransparentDataEncryptionsClient object. + */ + ManagedDatabaseTransparentDataEncryptionsClient getManagedDatabaseTransparentDataEncryptions(); + + /** + * Gets the ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient object to access its operations. + * + * @return the ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient object. + */ + ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient getManagedDatabaseVulnerabilityAssessmentRuleBaselines(); + + /** + * Gets the ManagedDatabaseVulnerabilityAssessmentsClient object to access its operations. + * + * @return the ManagedDatabaseVulnerabilityAssessmentsClient object. + */ + ManagedDatabaseVulnerabilityAssessmentsClient getManagedDatabaseVulnerabilityAssessments(); + + /** + * Gets the ManagedDatabaseVulnerabilityAssessmentScansClient object to access its operations. + * + * @return the ManagedDatabaseVulnerabilityAssessmentScansClient object. + */ + ManagedDatabaseVulnerabilityAssessmentScansClient getManagedDatabaseVulnerabilityAssessmentScans(); + + /** + * Gets the ManagedInstanceAdministratorsClient object to access its operations. + * + * @return the ManagedInstanceAdministratorsClient object. + */ + ManagedInstanceAdministratorsClient getManagedInstanceAdministrators(); + + /** + * Gets the ManagedInstanceAzureADOnlyAuthenticationsClient object to access its operations. + * + * @return the ManagedInstanceAzureADOnlyAuthenticationsClient object. + */ + ManagedInstanceAzureADOnlyAuthenticationsClient getManagedInstanceAzureADOnlyAuthentications(); + + /** + * Gets the ManagedInstanceEncryptionProtectorsClient object to access its operations. + * + * @return the ManagedInstanceEncryptionProtectorsClient object. + */ + ManagedInstanceEncryptionProtectorsClient getManagedInstanceEncryptionProtectors(); + + /** + * Gets the ManagedInstanceKeysClient object to access its operations. + * + * @return the ManagedInstanceKeysClient object. + */ + ManagedInstanceKeysClient getManagedInstanceKeys(); + + /** + * Gets the ManagedInstanceLongTermRetentionPoliciesClient object to access its operations. + * + * @return the ManagedInstanceLongTermRetentionPoliciesClient object. + */ + ManagedInstanceLongTermRetentionPoliciesClient getManagedInstanceLongTermRetentionPolicies(); + + /** + * Gets the ManagedInstanceOperationsClient object to access its operations. + * + * @return the ManagedInstanceOperationsClient object. + */ + ManagedInstanceOperationsClient getManagedInstanceOperations(); + + /** + * Gets the ManagedInstancePrivateEndpointConnectionsClient object to access its operations. + * + * @return the ManagedInstancePrivateEndpointConnectionsClient object. + */ + ManagedInstancePrivateEndpointConnectionsClient getManagedInstancePrivateEndpointConnections(); + + /** + * Gets the ManagedInstancePrivateLinkResourcesClient object to access its operations. + * + * @return the ManagedInstancePrivateLinkResourcesClient object. + */ + ManagedInstancePrivateLinkResourcesClient getManagedInstancePrivateLinkResources(); + + /** + * Gets the ManagedInstanceTdeCertificatesClient object to access its operations. + * + * @return the ManagedInstanceTdeCertificatesClient object. + */ + ManagedInstanceTdeCertificatesClient getManagedInstanceTdeCertificates(); + + /** + * Gets the ManagedInstanceVulnerabilityAssessmentsClient object to access its operations. + * + * @return the ManagedInstanceVulnerabilityAssessmentsClient object. + */ + ManagedInstanceVulnerabilityAssessmentsClient getManagedInstanceVulnerabilityAssessments(); + + /** + * Gets the ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient object to access its operations. + * + * @return the ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient object. + */ + ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient + getManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies(); + + /** + * Gets the ManagedServerSecurityAlertPoliciesClient object to access its operations. + * + * @return the ManagedServerSecurityAlertPoliciesClient object. + */ + ManagedServerSecurityAlertPoliciesClient getManagedServerSecurityAlertPolicies(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the PrivateEndpointConnectionsClient object to access its operations. + * + * @return the PrivateEndpointConnectionsClient object. + */ + PrivateEndpointConnectionsClient getPrivateEndpointConnections(); + + /** + * Gets the PrivateLinkResourcesClient object to access its operations. + * + * @return the PrivateLinkResourcesClient object. + */ + PrivateLinkResourcesClient getPrivateLinkResources(); + + /** + * Gets the RecoverableManagedDatabasesClient object to access its operations. + * + * @return the RecoverableManagedDatabasesClient object. + */ + RecoverableManagedDatabasesClient getRecoverableManagedDatabases(); + + /** + * Gets the RestorePointsClient object to access its operations. + * + * @return the RestorePointsClient object. + */ + RestorePointsClient getRestorePoints(); + + /** + * Gets the ServerAdvisorsClient object to access its operations. + * + * @return the ServerAdvisorsClient object. + */ + ServerAdvisorsClient getServerAdvisors(); + + /** + * Gets the ServerAutomaticTuningsClient object to access its operations. + * + * @return the ServerAutomaticTuningsClient object. + */ + ServerAutomaticTuningsClient getServerAutomaticTunings(); + + /** + * Gets the ServerAzureADAdministratorsClient object to access its operations. + * + * @return the ServerAzureADAdministratorsClient object. + */ + ServerAzureADAdministratorsClient getServerAzureADAdministrators(); + + /** + * Gets the ServerAzureADOnlyAuthenticationsClient object to access its operations. + * + * @return the ServerAzureADOnlyAuthenticationsClient object. + */ + ServerAzureADOnlyAuthenticationsClient getServerAzureADOnlyAuthentications(); + + /** + * Gets the ServerDevOpsAuditSettingsClient object to access its operations. + * + * @return the ServerDevOpsAuditSettingsClient object. + */ + ServerDevOpsAuditSettingsClient getServerDevOpsAuditSettings(); + + /** + * Gets the ServerDnsAliasesClient object to access its operations. + * + * @return the ServerDnsAliasesClient object. + */ + ServerDnsAliasesClient getServerDnsAliases(); + + /** + * Gets the ServerKeysClient object to access its operations. + * + * @return the ServerKeysClient object. + */ + ServerKeysClient getServerKeys(); + + /** + * Gets the ServerOperationsClient object to access its operations. + * + * @return the ServerOperationsClient object. + */ + ServerOperationsClient getServerOperations(); + + /** + * Gets the ServerSecurityAlertPoliciesClient object to access its operations. + * + * @return the ServerSecurityAlertPoliciesClient object. + */ + ServerSecurityAlertPoliciesClient getServerSecurityAlertPolicies(); + + /** + * Gets the ServerTrustGroupsClient object to access its operations. + * + * @return the ServerTrustGroupsClient object. + */ + ServerTrustGroupsClient getServerTrustGroups(); + + /** + * Gets the ServerVulnerabilityAssessmentsClient object to access its operations. + * + * @return the ServerVulnerabilityAssessmentsClient object. + */ + ServerVulnerabilityAssessmentsClient getServerVulnerabilityAssessments(); + + /** + * Gets the SqlAgentsClient object to access its operations. + * + * @return the SqlAgentsClient object. + */ + SqlAgentsClient getSqlAgents(); + + /** + * Gets the SubscriptionUsagesClient object to access its operations. + * + * @return the SubscriptionUsagesClient object. + */ + SubscriptionUsagesClient getSubscriptionUsages(); + + /** + * Gets the SyncAgentsClient object to access its operations. + * + * @return the SyncAgentsClient object. + */ + SyncAgentsClient getSyncAgents(); + + /** + * Gets the SyncGroupsClient object to access its operations. + * + * @return the SyncGroupsClient object. + */ + SyncGroupsClient getSyncGroups(); + + /** + * Gets the SyncMembersClient object to access its operations. + * + * @return the SyncMembersClient object. + */ + SyncMembersClient getSyncMembers(); + + /** + * Gets the TdeCertificatesClient object to access its operations. + * + * @return the TdeCertificatesClient object. + */ + TdeCertificatesClient getTdeCertificates(); + + /** + * Gets the TimeZonesClient object to access its operations. + * + * @return the TimeZonesClient object. + */ + TimeZonesClient getTimeZones(); + + /** + * Gets the VirtualNetworkRulesClient object to access its operations. + * + * @return the VirtualNetworkRulesClient object. + */ + VirtualNetworkRulesClient getVirtualNetworkRules(); + + /** + * Gets the WorkloadClassifiersClient object to access its operations. + * + * @return the WorkloadClassifiersClient object. + */ + WorkloadClassifiersClient getWorkloadClassifiers(); + + /** + * Gets the WorkloadGroupsClient object to access its operations. + * + * @return the WorkloadGroupsClient object. + */ + WorkloadGroupsClient getWorkloadGroups(); + + /** + * Gets the TransparentDataEncryptionsClient object to access its operations. + * + * @return the TransparentDataEncryptionsClient object. + */ + TransparentDataEncryptionsClient getTransparentDataEncryptions(); + + /** + * Gets the BackupShortTermRetentionPoliciesClient object to access its operations. + * + * @return the BackupShortTermRetentionPoliciesClient object. + */ + BackupShortTermRetentionPoliciesClient getBackupShortTermRetentionPolicies(); + + /** + * Gets the DatabaseExtensionsOperationsClient object to access its operations. + * + * @return the DatabaseExtensionsOperationsClient object. + */ + DatabaseExtensionsOperationsClient getDatabaseExtensionsOperations(); + + /** + * Gets the DatabaseOperationsClient object to access its operations. + * + * @return the DatabaseOperationsClient object. + */ + DatabaseOperationsClient getDatabaseOperations(); + + /** + * Gets the DatabaseUsagesClient object to access its operations. + * + * @return the DatabaseUsagesClient object. + */ + DatabaseUsagesClient getDatabaseUsages(); + + /** + * Gets the LedgerDigestUploadsOperationsClient object to access its operations. + * + * @return the LedgerDigestUploadsOperationsClient object. + */ + LedgerDigestUploadsOperationsClient getLedgerDigestUploadsOperations(); + + /** + * Gets the OutboundFirewallRulesClient object to access its operations. + * + * @return the OutboundFirewallRulesClient object. + */ + OutboundFirewallRulesClient getOutboundFirewallRules(); + + /** + * Gets the ServersClient object to access its operations. + * + * @return the ServersClient object. + */ + ServersClient getServers(); + + /** + * Gets the UsagesClient object to access its operations. + * + * @return the UsagesClient object. + */ + UsagesClient getUsages(); + + /** + * Gets the LongTermRetentionBackupsClient object to access its operations. + * + * @return the LongTermRetentionBackupsClient object. + */ + LongTermRetentionBackupsClient getLongTermRetentionBackups(); + + /** + * Gets the LongTermRetentionManagedInstanceBackupsClient object to access its operations. + * + * @return the LongTermRetentionManagedInstanceBackupsClient object. + */ + LongTermRetentionManagedInstanceBackupsClient getLongTermRetentionManagedInstanceBackups(); + + /** + * Gets the ManagedInstancesClient object to access its operations. + * + * @return the ManagedInstancesClient object. + */ + ManagedInstancesClient getManagedInstances(); + + /** + * Gets the RestorableDroppedDatabasesClient object to access its operations. + * + * @return the RestorableDroppedDatabasesClient object. + */ + RestorableDroppedDatabasesClient getRestorableDroppedDatabases(); + + /** + * Gets the RestorableDroppedManagedDatabasesClient object to access its operations. + * + * @return the RestorableDroppedManagedDatabasesClient object. + */ + RestorableDroppedManagedDatabasesClient getRestorableDroppedManagedDatabases(); + + /** + * Gets the ServerConnectionPoliciesClient object to access its operations. + * + * @return the ServerConnectionPoliciesClient object. + */ + ServerConnectionPoliciesClient getServerConnectionPolicies(); + + /** + * Gets the DistributedAvailabilityGroupsClient object to access its operations. + * + * @return the DistributedAvailabilityGroupsClient object. + */ + DistributedAvailabilityGroupsClient getDistributedAvailabilityGroups(); + + /** + * Gets the ServerTrustCertificatesClient object to access its operations. + * + * @return the ServerTrustCertificatesClient object. + */ + ServerTrustCertificatesClient getServerTrustCertificates(); + + /** + * Gets the IPv6FirewallRulesClient object to access its operations. + * + * @return the IPv6FirewallRulesClient object. + */ + IPv6FirewallRulesClient getIPv6FirewallRules(); + + /** + * Gets the EndpointCertificatesClient object to access its operations. + * + * @return the EndpointCertificatesClient object. + */ + EndpointCertificatesClient getEndpointCertificates(); + + /** + * Gets the ManagedDatabaseSensitivityLabelsClient object to access its operations. + * + * @return the ManagedDatabaseSensitivityLabelsClient object. + */ + ManagedDatabaseSensitivityLabelsClient getManagedDatabaseSensitivityLabels(); + + /** + * Gets the ManagedDatabaseRecommendedSensitivityLabelsClient object to access its operations. + * + * @return the ManagedDatabaseRecommendedSensitivityLabelsClient object. + */ + ManagedDatabaseRecommendedSensitivityLabelsClient getManagedDatabaseRecommendedSensitivityLabels(); + + /** + * Gets the SensitivityLabelsClient object to access its operations. + * + * @return the SensitivityLabelsClient object. + */ + SensitivityLabelsClient getSensitivityLabels(); + + /** + * Gets the RecommendedSensitivityLabelsClient object to access its operations. + * + * @return the RecommendedSensitivityLabelsClient object. + */ + RecommendedSensitivityLabelsClient getRecommendedSensitivityLabels(); + + /** + * Gets the ServerBlobAuditingPoliciesClient object to access its operations. + * + * @return the ServerBlobAuditingPoliciesClient object. + */ + ServerBlobAuditingPoliciesClient getServerBlobAuditingPolicies(); + + /** + * Gets the DatabaseBlobAuditingPoliciesClient object to access its operations. + * + * @return the DatabaseBlobAuditingPoliciesClient object. + */ + DatabaseBlobAuditingPoliciesClient getDatabaseBlobAuditingPolicies(); + + /** + * Gets the ExtendedDatabaseBlobAuditingPoliciesClient object to access its operations. + * + * @return the ExtendedDatabaseBlobAuditingPoliciesClient object. + */ + ExtendedDatabaseBlobAuditingPoliciesClient getExtendedDatabaseBlobAuditingPolicies(); + + /** + * Gets the ExtendedServerBlobAuditingPoliciesClient object to access its operations. + * + * @return the ExtendedServerBlobAuditingPoliciesClient object. + */ + ExtendedServerBlobAuditingPoliciesClient getExtendedServerBlobAuditingPolicies(); + + /** + * Gets the DatabaseAdvancedThreatProtectionSettingsClient object to access its operations. + * + * @return the DatabaseAdvancedThreatProtectionSettingsClient object. + */ + DatabaseAdvancedThreatProtectionSettingsClient getDatabaseAdvancedThreatProtectionSettings(); + + /** + * Gets the ServerAdvancedThreatProtectionSettingsClient object to access its operations. + * + * @return the ServerAdvancedThreatProtectionSettingsClient object. + */ + ServerAdvancedThreatProtectionSettingsClient getServerAdvancedThreatProtectionSettings(); + + /** + * Gets the ManagedServerDnsAliasesClient object to access its operations. + * + * @return the ManagedServerDnsAliasesClient object. + */ + ManagedServerDnsAliasesClient getManagedServerDnsAliases(); + + /** + * Gets the DatabaseSqlVulnerabilityAssessmentBaselinesClient object to access its operations. + * + * @return the DatabaseSqlVulnerabilityAssessmentBaselinesClient object. + */ + DatabaseSqlVulnerabilityAssessmentBaselinesClient getDatabaseSqlVulnerabilityAssessmentBaselines(); + + /** + * Gets the DatabaseSqlVulnerabilityAssessmentExecuteScansClient object to access its operations. + * + * @return the DatabaseSqlVulnerabilityAssessmentExecuteScansClient object. + */ + DatabaseSqlVulnerabilityAssessmentExecuteScansClient getDatabaseSqlVulnerabilityAssessmentExecuteScans(); + + /** + * Gets the DatabaseSqlVulnerabilityAssessmentRuleBaselinesClient object to access its operations. + * + * @return the DatabaseSqlVulnerabilityAssessmentRuleBaselinesClient object. + */ + DatabaseSqlVulnerabilityAssessmentRuleBaselinesClient getDatabaseSqlVulnerabilityAssessmentRuleBaselines(); + + /** + * Gets the DatabaseSqlVulnerabilityAssessmentScanResultsClient object to access its operations. + * + * @return the DatabaseSqlVulnerabilityAssessmentScanResultsClient object. + */ + DatabaseSqlVulnerabilityAssessmentScanResultsClient getDatabaseSqlVulnerabilityAssessmentScanResults(); + + /** + * Gets the DatabaseSqlVulnerabilityAssessmentScansClient object to access its operations. + * + * @return the DatabaseSqlVulnerabilityAssessmentScansClient object. + */ + DatabaseSqlVulnerabilityAssessmentScansClient getDatabaseSqlVulnerabilityAssessmentScans(); + + /** + * Gets the DatabaseSqlVulnerabilityAssessmentsSettingsClient object to access its operations. + * + * @return the DatabaseSqlVulnerabilityAssessmentsSettingsClient object. + */ + DatabaseSqlVulnerabilityAssessmentsSettingsClient getDatabaseSqlVulnerabilityAssessmentsSettings(); + + /** + * Gets the ManagedDatabaseAdvancedThreatProtectionSettingsClient object to access its operations. + * + * @return the ManagedDatabaseAdvancedThreatProtectionSettingsClient object. + */ + ManagedDatabaseAdvancedThreatProtectionSettingsClient getManagedDatabaseAdvancedThreatProtectionSettings(); + + /** + * Gets the ManagedDatabaseRestoreDetailsClient object to access its operations. + * + * @return the ManagedDatabaseRestoreDetailsClient object. + */ + ManagedDatabaseRestoreDetailsClient getManagedDatabaseRestoreDetails(); + + /** + * Gets the ManagedDatabasesClient object to access its operations. + * + * @return the ManagedDatabasesClient object. + */ + ManagedDatabasesClient getManagedDatabases(); + + /** + * Gets the ManagedInstanceAdvancedThreatProtectionSettingsClient object to access its operations. + * + * @return the ManagedInstanceAdvancedThreatProtectionSettingsClient object. + */ + ManagedInstanceAdvancedThreatProtectionSettingsClient getManagedInstanceAdvancedThreatProtectionSettings(); + + /** + * Gets the ReplicationLinksClient object to access its operations. + * + * @return the ReplicationLinksClient object. + */ + ReplicationLinksClient getReplicationLinks(); + + /** + * Gets the SqlVulnerabilityAssessmentBaselinesClient object to access its operations. + * + * @return the SqlVulnerabilityAssessmentBaselinesClient object. + */ + SqlVulnerabilityAssessmentBaselinesClient getSqlVulnerabilityAssessmentBaselines(); + + /** + * Gets the SqlVulnerabilityAssessmentBaselinesOperationsClient object to access its operations. + * + * @return the SqlVulnerabilityAssessmentBaselinesOperationsClient object. + */ + SqlVulnerabilityAssessmentBaselinesOperationsClient getSqlVulnerabilityAssessmentBaselinesOperations(); + + /** + * Gets the SqlVulnerabilityAssessmentExecuteScansClient object to access its operations. + * + * @return the SqlVulnerabilityAssessmentExecuteScansClient object. + */ + SqlVulnerabilityAssessmentExecuteScansClient getSqlVulnerabilityAssessmentExecuteScans(); + + /** + * Gets the SqlVulnerabilityAssessmentRuleBaselinesClient object to access its operations. + * + * @return the SqlVulnerabilityAssessmentRuleBaselinesClient object. + */ + SqlVulnerabilityAssessmentRuleBaselinesClient getSqlVulnerabilityAssessmentRuleBaselines(); + + /** + * Gets the SqlVulnerabilityAssessmentRuleBaselinesOperationsClient object to access its operations. + * + * @return the SqlVulnerabilityAssessmentRuleBaselinesOperationsClient object. + */ + SqlVulnerabilityAssessmentRuleBaselinesOperationsClient getSqlVulnerabilityAssessmentRuleBaselinesOperations(); + + /** + * Gets the SqlVulnerabilityAssessmentScanResultOperationsClient object to access its operations. + * + * @return the SqlVulnerabilityAssessmentScanResultOperationsClient object. + */ + SqlVulnerabilityAssessmentScanResultOperationsClient getSqlVulnerabilityAssessmentScanResultOperations(); + + /** + * Gets the SqlVulnerabilityAssessmentScansClient object to access its operations. + * + * @return the SqlVulnerabilityAssessmentScansClient object. + */ + SqlVulnerabilityAssessmentScansClient getSqlVulnerabilityAssessmentScans(); + + /** + * Gets the SqlVulnerabilityAssessmentsSettingsClient object to access its operations. + * + * @return the SqlVulnerabilityAssessmentsSettingsClient object. + */ + SqlVulnerabilityAssessmentsSettingsClient getSqlVulnerabilityAssessmentsSettings(); + + /** + * Gets the SqlVulnerabilityAssessmentsClient object to access its operations. + * + * @return the SqlVulnerabilityAssessmentsClient object. + */ + SqlVulnerabilityAssessmentsClient getSqlVulnerabilityAssessments(); + + /** + * Gets the ManagedDatabaseMoveOperationsClient object to access its operations. + * + * @return the ManagedDatabaseMoveOperationsClient object. + */ + ManagedDatabaseMoveOperationsClient getManagedDatabaseMoveOperations(); + + /** + * Gets the ManagedInstanceDtcsClient object to access its operations. + * + * @return the ManagedInstanceDtcsClient object. + */ + ManagedInstanceDtcsClient getManagedInstanceDtcs(); + + /** + * Gets the SynapseLinkWorkspacesClient object to access its operations. + * + * @return the SynapseLinkWorkspacesClient object. + */ + SynapseLinkWorkspacesClient getSynapseLinkWorkspaces(); + + /** + * Gets the VirtualClustersClient object to access its operations. + * + * @return the VirtualClustersClient object. + */ + VirtualClustersClient getVirtualClusters(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SqlVulnerabilityAssessmentBaselinesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SqlVulnerabilityAssessmentBaselinesClient.java new file mode 100644 index 0000000000000..b94536f69f32f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SqlVulnerabilityAssessmentBaselinesClient.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseSqlVulnerabilityAssessmentBaselineSetInner; +import com.azure.resourcemanager.sql.generated.models.BaselineName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** + * An instance of this class provides access to all the operations defined in SqlVulnerabilityAssessmentBaselinesClient. + */ +public interface SqlVulnerabilityAssessmentBaselinesClient { + /** + * Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's sql vulnerability assessment rule baselines as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySqlVulnerabilityAssessment( + String resourceGroupName, String serverName, VulnerabilityAssessmentName vulnerabilityAssessmentName); + + /** + * Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's sql vulnerability assessment rule baselines as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySqlVulnerabilityAssessment( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context); + + /** + * Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's sql vulnerability assessment rule baselines along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + Context context); + + /** + * Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's sql vulnerability assessment rule baselines. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseSqlVulnerabilityAssessmentBaselineSetInner get( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SqlVulnerabilityAssessmentBaselinesOperationsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SqlVulnerabilityAssessmentBaselinesOperationsClient.java new file mode 100644 index 0000000000000..2a0be1a3399f6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SqlVulnerabilityAssessmentBaselinesOperationsClient.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseSqlVulnerabilityAssessmentBaselineSetInner; +import com.azure.resourcemanager.sql.generated.models.BaselineName; +import com.azure.resourcemanager.sql.generated.models.DatabaseSqlVulnerabilityAssessmentRuleBaselineListInput; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** + * An instance of this class provides access to all the operations defined in + * SqlVulnerabilityAssessmentBaselinesOperationsClient. + */ +public interface SqlVulnerabilityAssessmentBaselinesOperationsClient { + /** + * Add a database's vulnerability assessment rule baseline 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 serverName The name of the server. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param parameters The requested rule baseline resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database sql vulnerability assessment baseline set along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + DatabaseSqlVulnerabilityAssessmentRuleBaselineListInput parameters, + Context context); + + /** + * Add a database's vulnerability assessment rule baseline 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 serverName The name of the server. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param parameters The requested rule baseline resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database sql vulnerability assessment baseline set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseSqlVulnerabilityAssessmentBaselineSetInner createOrUpdate( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + DatabaseSqlVulnerabilityAssessmentRuleBaselineListInput parameters); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SqlVulnerabilityAssessmentExecuteScansClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SqlVulnerabilityAssessmentExecuteScansClient.java new file mode 100644 index 0000000000000..ac23e5580960d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SqlVulnerabilityAssessmentExecuteScansClient.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** + * An instance of this class provides access to all the operations defined in + * SqlVulnerabilityAssessmentExecuteScansClient. + */ +public interface SqlVulnerabilityAssessmentExecuteScansClient { + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginExecute( + String resourceGroupName, String serverName, VulnerabilityAssessmentName vulnerabilityAssessmentName); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginExecute( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void execute(String resourceGroupName, String serverName, VulnerabilityAssessmentName vulnerabilityAssessmentName); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void execute( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SqlVulnerabilityAssessmentRuleBaselinesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SqlVulnerabilityAssessmentRuleBaselinesClient.java new file mode 100644 index 0000000000000..23902d82daa6c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SqlVulnerabilityAssessmentRuleBaselinesClient.java @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseSqlVulnerabilityAssessmentRuleBaselineInner; +import com.azure.resourcemanager.sql.generated.models.BaselineName; +import com.azure.resourcemanager.sql.generated.models.DatabaseSqlVulnerabilityAssessmentRuleBaselineInput; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** + * An instance of this class provides access to all the operations defined in + * SqlVulnerabilityAssessmentRuleBaselinesClient. + */ +public interface SqlVulnerabilityAssessmentRuleBaselinesClient { + /** + * Gets a system database's sql 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a system database's sql vulnerability assessment rule baseline as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBaseline( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName); + + /** + * Gets a system database's sql 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a system database's sql vulnerability assessment rule baseline as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBaseline( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + Context context); + + /** + * Gets a system database's sql 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param ruleId The vulnerability assessment rule ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a system database's sql vulnerability assessment rule baseline along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId, + Context context); + + /** + * Gets a system database's sql 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param ruleId The vulnerability assessment rule ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a system database's sql vulnerability assessment rule baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseSqlVulnerabilityAssessmentRuleBaselineInner get( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param ruleId The vulnerability assessment rule ID. + * @param parameters The requested rule baseline resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database sql vulnerability assessment rule baseline along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId, + DatabaseSqlVulnerabilityAssessmentRuleBaselineInput parameters, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param ruleId The vulnerability assessment rule ID. + * @param parameters The requested rule baseline resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database sql vulnerability assessment rule baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseSqlVulnerabilityAssessmentRuleBaselineInner createOrUpdate( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId, + DatabaseSqlVulnerabilityAssessmentRuleBaselineInput parameters); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SqlVulnerabilityAssessmentRuleBaselinesOperationsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SqlVulnerabilityAssessmentRuleBaselinesOperationsClient.java new file mode 100644 index 0000000000000..e2e13b325e1a5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SqlVulnerabilityAssessmentRuleBaselinesOperationsClient.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.BaselineName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** + * An instance of this class provides access to all the operations defined in + * SqlVulnerabilityAssessmentRuleBaselinesOperationsClient. + */ +public interface SqlVulnerabilityAssessmentRuleBaselinesOperationsClient { + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param ruleId The vulnerability assessment rule ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param ruleId The vulnerability assessment rule ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SqlVulnerabilityAssessmentScanResultOperationsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SqlVulnerabilityAssessmentScanResultOperationsClient.java new file mode 100644 index 0000000000000..42192324b7aa5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SqlVulnerabilityAssessmentScanResultOperationsClient.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.SqlVulnerabilityAssessmentScanResultsInner; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentName; + +/** + * An instance of this class provides access to all the operations defined in + * SqlVulnerabilityAssessmentScanResultOperationsClient. + */ +public interface SqlVulnerabilityAssessmentScanResultOperationsClient { + /** + * 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 vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @param scanId The scan id of the SQL Vulnerability Assessment scan to retrieve result from. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a vulnerability assessment scan record of a database as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByScan( + String resourceGroupName, + String serverName, + SqlVulnerabilityAssessmentName vulnerabilityAssessmentName, + 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 serverName The name of the server. + * @param vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @param scanId The scan id of the SQL Vulnerability Assessment scan to retrieve result from. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a vulnerability assessment scan record of a database as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByScan( + String resourceGroupName, + String serverName, + SqlVulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @param scanId The scan id of the SQL Vulnerability Assessment scan to retrieve result from. + * @param scanResultId The scan result id of the specific result to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a vulnerability assessment scan record of a database along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + SqlVulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + String scanResultId, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @param scanId The scan id of the SQL Vulnerability Assessment scan to retrieve result from. + * @param scanResultId The scan result id of the specific result to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a vulnerability assessment scan record of a database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlVulnerabilityAssessmentScanResultsInner get( + String resourceGroupName, + String serverName, + SqlVulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + String scanResultId); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SqlVulnerabilityAssessmentScansClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SqlVulnerabilityAssessmentScansClient.java new file mode 100644 index 0000000000000..20db6162fb193 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SqlVulnerabilityAssessmentScansClient.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.SqlVulnerabilityAssessmentScanRecordInner; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** An instance of this class provides access to all the operations defined in SqlVulnerabilityAssessmentScansClient. */ +public interface SqlVulnerabilityAssessmentScansClient { + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan records as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySqlVulnerabilityAssessments( + String resourceGroupName, String serverName, VulnerabilityAssessmentName vulnerabilityAssessmentName); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan records as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySqlVulnerabilityAssessments( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context); + + /** + * Get a system database vulnerability assessment scan record. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The scanId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a system database vulnerability assessment scan record along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context); + + /** + * Get a system database vulnerability assessment scan record. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The scanId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a system database vulnerability assessment scan record. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlVulnerabilityAssessmentScanRecordInner get( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SqlVulnerabilityAssessmentsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SqlVulnerabilityAssessmentsClient.java new file mode 100644 index 0000000000000..3abdf2dc4e461 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SqlVulnerabilityAssessmentsClient.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** An instance of this class provides access to all the operations defined in SqlVulnerabilityAssessmentsClient. */ +public interface SqlVulnerabilityAssessmentsClient { + /** + * Removes SQL 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 vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context); + + /** + * Removes SQL 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 vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, VulnerabilityAssessmentName vulnerabilityAssessmentName); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SqlVulnerabilityAssessmentsSettingsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SqlVulnerabilityAssessmentsSettingsClient.java new file mode 100644 index 0000000000000..4d958a2491746 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SqlVulnerabilityAssessmentsSettingsClient.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.SqlVulnerabilityAssessmentInner; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentNameAutoGenerated; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** + * An instance of this class provides access to all the operations defined in SqlVulnerabilityAssessmentsSettingsClient. + */ +public interface SqlVulnerabilityAssessmentsSettingsClient { + /** + * Lists SQL 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Vulnerability Assessments as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Lists SQL 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Vulnerability Assessments as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String resourceGroupName, String serverName, Context context); + + /** + * Gets SQL Vulnerability Assessment policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return sQL Vulnerability Assessment policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + SqlVulnerabilityAssessmentNameAutoGenerated vulnerabilityAssessmentName, + Context context); + + /** + * Gets SQL Vulnerability Assessment policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return sQL Vulnerability Assessment policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlVulnerabilityAssessmentInner get( + String resourceGroupName, + String serverName, + SqlVulnerabilityAssessmentNameAutoGenerated vulnerabilityAssessmentName); + + /** + * Creates or updates SQL Vulnerability Assessment policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @param parameters The requested resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL Vulnerability Assessment along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + SqlVulnerabilityAssessmentInner parameters, + Context context); + + /** + * Creates or updates SQL Vulnerability Assessment policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @param parameters The requested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL Vulnerability Assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SqlVulnerabilityAssessmentInner createOrUpdate( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + SqlVulnerabilityAssessmentInner parameters); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SubscriptionUsagesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SubscriptionUsagesClient.java new file mode 100644 index 0000000000000..24fb6f4cf9f74 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SubscriptionUsagesClient.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.SubscriptionUsageInner; + +/** An instance of this class provides access to all the operations defined in SubscriptionUsagesClient. */ +public interface SubscriptionUsagesClient { + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all subscription usage metrics in a given location as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByLocation(String locationName); + + /** + * Gets all subscription usage metrics in a given location. + * + * @param locationName The name of the region where the resource is located. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all subscription usage metrics in a given location as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByLocation(String locationName, Context context); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a subscription usage metric along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String locationName, String usageName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a subscription usage metric. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SubscriptionUsageInner get(String locationName, String usageName); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SynapseLinkWorkspacesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SynapseLinkWorkspacesClient.java new file mode 100644 index 0000000000000..036d001f66bc1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SynapseLinkWorkspacesClient.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.SynapseLinkWorkspaceInner; + +/** An instance of this class provides access to all the operations defined in SynapseLinkWorkspacesClient. */ +public interface SynapseLinkWorkspacesClient { + /** + * Gets all synapselink workspaces for 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all synapselink workspaces for a database as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName); + + /** + * Gets all synapselink workspaces for 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all synapselink workspaces for a database as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SyncAgentsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SyncAgentsClient.java new file mode 100644 index 0000000000000..d740988759824 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SyncAgentsClient.java @@ -0,0 +1,276 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncAgentInner; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncAgentKeyPropertiesInner; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncAgentLinkedDatabaseInner; + +/** An instance of this class provides access to all the operations defined in SyncAgentsClient. */ +public interface SyncAgentsClient { + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sync agent along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String syncAgentName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sync agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncAgentInner get(String resourceGroupName, String serverName, String syncAgentName); + + /** + * 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 parameters The requested sync agent resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL Database sync agent. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SyncAgentInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String syncAgentName, SyncAgentInner parameters); + + /** + * 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 parameters The requested sync agent resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL Database sync agent. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SyncAgentInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String syncAgentName, SyncAgentInner parameters, Context context); + + /** + * 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 parameters The requested sync agent resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncAgentInner createOrUpdate( + String resourceGroupName, String serverName, String syncAgentName, SyncAgentInner parameters); + + /** + * 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 parameters The requested sync agent resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncAgentInner createOrUpdate( + String resourceGroupName, String serverName, String syncAgentName, SyncAgentInner parameters, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String serverName, String syncAgentName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String syncAgentName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String syncAgentName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String syncAgentName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync agents as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync agents as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of an Azure SQL Database sync agent key along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response generateKeyWithResponse( + String resourceGroupName, String serverName, String syncAgentName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of an Azure SQL Database sync agent key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncAgentKeyPropertiesInner generateKey(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. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync agent linked databases as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listLinkedDatabases( + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync agent linked databases as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listLinkedDatabases( + String resourceGroupName, String serverName, String syncAgentName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SyncGroupsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SyncGroupsClient.java new file mode 100644 index 0000000000000..bea1c4525af94 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SyncGroupsClient.java @@ -0,0 +1,587 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncDatabaseIdPropertiesInner; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncFullSchemaPropertiesInner; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncGroupInner; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncGroupLogPropertiesInner; +import com.azure.resourcemanager.sql.generated.models.SyncGroupsType; + +/** An instance of this class provides access to all the operations defined in SyncGroupsClient. */ +public interface SyncGroupsClient { + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a collection of sync database ids as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listSyncDatabaseIds(String locationName); + + /** + * Gets a collection of sync database ids. + * + * @param locationName The name of the region where the resource is located. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a collection of sync database ids as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listSyncDatabaseIds(String locationName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRefreshHubSchema( + String resourceGroupName, String serverName, String databaseName, String syncGroupName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRefreshHubSchema( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void refreshHubSchema(String resourceGroupName, String serverName, String databaseName, String syncGroupName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void refreshHubSchema( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a collection of hub database schemas as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listHubSchemas( + String resourceGroupName, String serverName, String databaseName, String syncGroupName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a collection of hub database schemas as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listHubSchemas( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context); + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a collection of sync group logs as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listLogs( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String startTime, + String endTime, + SyncGroupsType type); + + /** + * 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. + * @param continuationToken The continuation token for this operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a collection of sync group logs as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listLogs( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String startTime, + String endTime, + SyncGroupsType type, + String continuationToken, + Context context); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response cancelSyncWithResponse( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void cancelSync(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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response triggerSyncWithResponse( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void triggerSync(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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sync group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sync group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncGroupInner get(String resourceGroupName, String serverName, String databaseName, String syncGroupName); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SyncGroupInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + SyncGroupInner parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SyncGroupInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + SyncGroupInner parameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncGroupInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + SyncGroupInner parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncGroupInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + SyncGroupInner parameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String databaseName, String syncGroupName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String databaseName, String syncGroupName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SyncGroupInner> beginUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + SyncGroupInner parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SyncGroupInner> beginUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + SyncGroupInner parameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncGroupInner update( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + SyncGroupInner parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncGroupInner update( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + SyncGroupInner parameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync groups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase(String resourceGroupName, String serverName, String databaseName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync groups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SyncMembersClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SyncMembersClient.java new file mode 100644 index 0000000000000..584e6d719dd7f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/SyncMembersClient.java @@ -0,0 +1,501 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncFullSchemaPropertiesInner; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncMemberInner; + +/** An instance of this class provides access to all the operations defined in SyncMembersClient. */ +public interface SyncMembersClient { + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sync member along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sync member. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncMemberInner get( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SyncMemberInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + SyncMemberInner parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SyncMemberInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + SyncMemberInner parameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncMemberInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + SyncMemberInner parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncMemberInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + SyncMemberInner parameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SyncMemberInner> beginUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + SyncMemberInner parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SyncMemberInner> beginUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + SyncMemberInner parameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncMemberInner update( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + SyncMemberInner parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncMemberInner update( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + SyncMemberInner parameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Azure SQL Database sync members as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySyncGroup( + String resourceGroupName, String serverName, String databaseName, String syncGroupName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Azure SQL Database sync members as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySyncGroup( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sync member database schema as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMemberSchemas( + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sync member database schema as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMemberSchemas( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRefreshMemberSchema( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRefreshMemberSchema( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void refreshMemberSchema( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void refreshMemberSchema( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/TdeCertificatesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/TdeCertificatesClient.java new file mode 100644 index 0000000000000..e2886410c33e7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/TdeCertificatesClient.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.models.TdeCertificate; + +/** An instance of this class provides access to all the operations defined in TdeCertificatesClient. */ +public interface TdeCertificatesClient { + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginCreate( + String resourceGroupName, String serverName, TdeCertificate parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginCreate( + String resourceGroupName, String serverName, TdeCertificate parameters, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void create(String resourceGroupName, String serverName, TdeCertificate parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void create(String resourceGroupName, String serverName, TdeCertificate parameters, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/TimeZonesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/TimeZonesClient.java new file mode 100644 index 0000000000000..e39aef25c8382 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/TimeZonesClient.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.TimeZoneInner; + +/** An instance of this class provides access to all the operations defined in TimeZonesClient. */ +public interface TimeZonesClient { + /** + * Gets a list of managed instance time zones by location. + * + * @param locationName The locationName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance time zones by location as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByLocation(String locationName); + + /** + * Gets a list of managed instance time zones by location. + * + * @param locationName The locationName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance time zones by location as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByLocation(String locationName, Context context); + + /** + * Gets a managed instance time zone. + * + * @param locationName The locationName parameter. + * @param timeZoneId The timeZoneId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance time zone along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String locationName, String timeZoneId, Context context); + + /** + * Gets a managed instance time zone. + * + * @param locationName The locationName parameter. + * @param timeZoneId The timeZoneId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance time zone. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TimeZoneInner get(String locationName, String timeZoneId); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/TransparentDataEncryptionsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/TransparentDataEncryptionsClient.java new file mode 100644 index 0000000000000..9bd2102fe64af --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/TransparentDataEncryptionsClient.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.LogicalDatabaseTransparentDataEncryptionInner; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionName; + +/** An instance of this class provides access to all the operations defined in TransparentDataEncryptionsClient. */ +public interface TransparentDataEncryptionsClient { + /** + * Gets a logical database's transparent data encryption. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the logical database for which the transparent data encryption is defined. + * @param tdeName The name of the transparent data encryption configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a logical database's transparent data encryption along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + TransparentDataEncryptionName tdeName, + Context context); + + /** + * Gets a logical database's transparent data encryption. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the logical database for which the transparent data encryption is defined. + * @param tdeName The name of the transparent data encryption configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a logical database's transparent data encryption. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LogicalDatabaseTransparentDataEncryptionInner get( + String resourceGroupName, String serverName, String databaseName, TransparentDataEncryptionName tdeName); + + /** + * Updates a logical 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 logical database for which the security alert policy is defined. + * @param tdeName The name of the transparent data encryption configuration. + * @param parameters The database transparent data encryption. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a logical database transparent data encryption state along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + TransparentDataEncryptionName tdeName, + LogicalDatabaseTransparentDataEncryptionInner parameters, + Context context); + + /** + * Updates a logical 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 logical database for which the security alert policy is defined. + * @param tdeName The name of the transparent data encryption configuration. + * @param parameters The database transparent data encryption. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a logical database transparent data encryption state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LogicalDatabaseTransparentDataEncryptionInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + TransparentDataEncryptionName tdeName, + LogicalDatabaseTransparentDataEncryptionInner parameters); + + /** + * Gets a list of the logical database's transparent data encryption. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the logical database for which the transparent data encryption is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the logical database's transparent data encryption as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName); + + /** + * Gets a list of the logical database's transparent data encryption. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the logical database for which the transparent data encryption is defined. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the logical database's transparent data encryption as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/UsagesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/UsagesClient.java new file mode 100644 index 0000000000000..a2a3fa5bb5572 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/UsagesClient.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.UsageInner; + +/** An instance of this class provides access to all the operations defined in UsagesClient. */ +public interface UsagesClient { + /** + * Gets all instance pool usage metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all instance pool usage metrics as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstancePool(String resourceGroupName, String instancePoolName); + + /** + * Gets all instance pool usage metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @param expandChildren Optional request parameter to include managed instance usages within the instance pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all instance pool usage metrics as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInstancePool( + String resourceGroupName, String instancePoolName, Boolean expandChildren, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/VirtualClustersClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/VirtualClustersClient.java new file mode 100644 index 0000000000000..05bab3a33e860 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/VirtualClustersClient.java @@ -0,0 +1,281 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.UpdateVirtualClusterDnsServersOperationInner; +import com.azure.resourcemanager.sql.generated.fluent.models.VirtualClusterInner; +import com.azure.resourcemanager.sql.generated.models.VirtualClusterUpdate; + +/** An instance of this class provides access to all the operations defined in VirtualClustersClient. */ +public interface VirtualClustersClient { + /** + * Gets a list of all virtualClusters in the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all virtualClusters in the subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets a list of all virtualClusters in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all virtualClusters in the subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual clusters in a resource group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual clusters in a resource group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual cluster along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String virtualClusterName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualClusterInner getByResourceGroup(String resourceGroupName, String virtualClusterName); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String virtualClusterName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String virtualClusterName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String virtualClusterName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String virtualClusterName, Context context); + + /** + * Updates an existing 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 virtual cluster resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL virtual cluster. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualClusterInner> beginUpdate( + String resourceGroupName, String virtualClusterName, VirtualClusterUpdate parameters); + + /** + * Updates an existing 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 virtual cluster resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL virtual cluster. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualClusterInner> beginUpdate( + String resourceGroupName, String virtualClusterName, VirtualClusterUpdate parameters, Context context); + + /** + * Updates an existing 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 virtual cluster resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL virtual cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualClusterInner update(String resourceGroupName, String virtualClusterName, VirtualClusterUpdate parameters); + + /** + * Updates an existing 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 virtual cluster resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL virtual cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualClusterInner update( + String resourceGroupName, String virtualClusterName, VirtualClusterUpdate parameters, Context context); + + /** + * Synchronizes the DNS server settings used by the managed instances inside the given 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a refresh DNS servers operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, UpdateVirtualClusterDnsServersOperationInner> + beginUpdateDnsServers(String resourceGroupName, String virtualClusterName); + + /** + * Synchronizes the DNS server settings used by the managed instances inside the given 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a refresh DNS servers operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, UpdateVirtualClusterDnsServersOperationInner> + beginUpdateDnsServers(String resourceGroupName, String virtualClusterName, Context context); + + /** + * Synchronizes the DNS server settings used by the managed instances inside the given 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a refresh DNS servers operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + UpdateVirtualClusterDnsServersOperationInner updateDnsServers(String resourceGroupName, String virtualClusterName); + + /** + * Synchronizes the DNS server settings used by the managed instances inside the given 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a refresh DNS servers operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + UpdateVirtualClusterDnsServersOperationInner updateDnsServers( + String resourceGroupName, String virtualClusterName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/VirtualNetworkRulesClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/VirtualNetworkRulesClient.java new file mode 100644 index 0000000000000..f46362a7b600c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/VirtualNetworkRulesClient.java @@ -0,0 +1,218 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.VirtualNetworkRuleInner; + +/** An instance of this class provides access to all the operations defined in VirtualNetworkRulesClient. */ +public interface VirtualNetworkRulesClient { + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualNetworkRuleInner get(String resourceGroupName, String serverName, String virtualNetworkRuleName); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualNetworkRuleInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String virtualNetworkRuleName, VirtualNetworkRuleInner parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualNetworkRuleInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner parameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualNetworkRuleInner createOrUpdate( + String resourceGroupName, String serverName, String virtualNetworkRuleName, VirtualNetworkRuleInner parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualNetworkRuleInner createOrUpdate( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner parameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String virtualNetworkRuleName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String virtualNetworkRuleName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual network rules in a server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual network rules in a server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/WorkloadClassifiersClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/WorkloadClassifiersClient.java new file mode 100644 index 0000000000000..5d623f5ebde98 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/WorkloadClassifiersClient.java @@ -0,0 +1,288 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.WorkloadClassifierInner; + +/** An instance of this class provides access to all the operations defined in WorkloadClassifiersClient. */ +public interface WorkloadClassifiersClient { + /** + * Gets a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workload classifier along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName, + Context context); + + /** + * Gets a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workload classifier. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkloadClassifierInner get( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName); + + /** + * Creates or updates a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to create/update. + * @param parameters The properties of the workload classifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of workload classifier operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, WorkloadClassifierInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName, + WorkloadClassifierInner parameters); + + /** + * Creates or updates a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to create/update. + * @param parameters The properties of the workload classifier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of workload classifier operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, WorkloadClassifierInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName, + WorkloadClassifierInner parameters, + Context context); + + /** + * Creates or updates a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to create/update. + * @param parameters The properties of the workload classifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workload classifier operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkloadClassifierInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName, + WorkloadClassifierInner parameters); + + /** + * Creates or updates a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to create/update. + * @param parameters The properties of the workload classifier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workload classifier operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkloadClassifierInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName, + WorkloadClassifierInner parameters, + Context context); + + /** + * Deletes a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName); + + /** + * Deletes a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName, + Context context); + + /** + * Deletes a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName); + + /** + * Deletes a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName, + Context context); + + /** + * Gets the list of workload classifiers for a workload 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. + * @param workloadGroupName The name of the workload group from which to receive the classifiers from. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 of workload classifiers for a workload group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByWorkloadGroup( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName); + + /** + * Gets the list of workload classifiers for a workload 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. + * @param workloadGroupName The name of the workload group from which to receive the classifiers from. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 of workload classifiers for a workload group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByWorkloadGroup( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/WorkloadGroupsClient.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/WorkloadGroupsClient.java new file mode 100644 index 0000000000000..d35ada026cda8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/WorkloadGroupsClient.java @@ -0,0 +1,242 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.models.WorkloadGroupInner; + +/** An instance of this class provides access to all the operations defined in WorkloadGroupsClient. */ +public interface WorkloadGroupsClient { + /** + * Gets a workload 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. + * @param workloadGroupName The name of the workload group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workload group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName, Context context); + + /** + * Gets a workload 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. + * @param workloadGroupName The name of the workload group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workload group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkloadGroupInner get(String resourceGroupName, String serverName, String databaseName, String workloadGroupName); + + /** + * Creates or updates a workload 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. + * @param workloadGroupName The name of the workload group. + * @param parameters The requested workload group state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of workload group operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, WorkloadGroupInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + WorkloadGroupInner parameters); + + /** + * Creates or updates a workload 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. + * @param workloadGroupName The name of the workload group. + * @param parameters The requested workload group state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of workload group operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, WorkloadGroupInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + WorkloadGroupInner parameters, + Context context); + + /** + * Creates or updates a workload 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. + * @param workloadGroupName The name of the workload group. + * @param parameters The requested workload group state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workload group operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkloadGroupInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + WorkloadGroupInner parameters); + + /** + * Creates or updates a workload 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. + * @param workloadGroupName The name of the workload group. + * @param parameters The requested workload group state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workload group operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkloadGroupInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + WorkloadGroupInner parameters, + Context context); + + /** + * Deletes a workload 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. + * @param workloadGroupName The name of the workload group to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName); + + /** + * Deletes a workload 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. + * @param workloadGroupName The name of the workload group to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName, Context context); + + /** + * Deletes a workload 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. + * @param workloadGroupName The name of the workload group to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String databaseName, String workloadGroupName); + + /** + * Deletes a workload 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. + * @param workloadGroupName The name of the workload group to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName, Context context); + + /** + * Gets the list of workload 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 serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of workload groups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase(String resourceGroupName, String serverName, String databaseName); + + /** + * Gets the list of workload 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of workload groups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/AdministratorProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/AdministratorProperties.java new file mode 100644 index 0000000000000..4f99781061f11 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/AdministratorProperties.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.AdministratorType; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +/** Properties of a active directory administrator. */ +@Fluent +public final class AdministratorProperties { + /* + * Type of the sever administrator. + */ + @JsonProperty(value = "administratorType", required = true) + private AdministratorType administratorType; + + /* + * Login name of the server administrator. + */ + @JsonProperty(value = "login", required = true) + private String login; + + /* + * SID (object ID) of the server administrator. + */ + @JsonProperty(value = "sid", required = true) + private UUID sid; + + /* + * Tenant ID of the administrator. + */ + @JsonProperty(value = "tenantId") + private UUID tenantId; + + /* + * Azure Active Directory only Authentication enabled. + */ + @JsonProperty(value = "azureADOnlyAuthentication", access = JsonProperty.Access.WRITE_ONLY) + private Boolean azureADOnlyAuthentication; + + /** Creates an instance of AdministratorProperties class. */ + public AdministratorProperties() { + } + + /** + * Get the administratorType property: Type of the sever administrator. + * + * @return the administratorType value. + */ + public AdministratorType administratorType() { + return this.administratorType; + } + + /** + * Set the administratorType property: Type of the sever administrator. + * + * @param administratorType the administratorType value to set. + * @return the AdministratorProperties object itself. + */ + public AdministratorProperties withAdministratorType(AdministratorType administratorType) { + this.administratorType = administratorType; + return this; + } + + /** + * Get the login property: Login name of the server administrator. + * + * @return the login value. + */ + public String login() { + return this.login; + } + + /** + * Set the login property: Login name of the server administrator. + * + * @param login the login value to set. + * @return the AdministratorProperties object itself. + */ + public AdministratorProperties withLogin(String login) { + this.login = login; + return this; + } + + /** + * Get the sid property: SID (object ID) of the server administrator. + * + * @return the sid value. + */ + public UUID sid() { + return this.sid; + } + + /** + * Set the sid property: SID (object ID) of the server administrator. + * + * @param sid the sid value to set. + * @return the AdministratorProperties object itself. + */ + public AdministratorProperties withSid(UUID sid) { + this.sid = sid; + return this; + } + + /** + * Get the tenantId property: Tenant ID of the administrator. + * + * @return the tenantId value. + */ + public UUID tenantId() { + return this.tenantId; + } + + /** + * Set the tenantId property: Tenant ID of the administrator. + * + * @param tenantId the tenantId value to set. + * @return the AdministratorProperties object itself. + */ + public AdministratorProperties withTenantId(UUID tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Get the azureADOnlyAuthentication property: Azure Active Directory only Authentication enabled. + * + * @return the azureADOnlyAuthentication value. + */ + public Boolean azureADOnlyAuthentication() { + return this.azureADOnlyAuthentication; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (administratorType() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property administratorType in model AdministratorProperties")); + } + if (login() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property login in model AdministratorProperties")); + } + if (sid() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property sid in model AdministratorProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AdministratorProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/AdvancedThreatProtectionProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/AdvancedThreatProtectionProperties.java new file mode 100644 index 0000000000000..6e07e61cb8276 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/AdvancedThreatProtectionProperties.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.AdvancedThreatProtectionState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Properties of an Advanced Threat Protection state. */ +@Fluent +public final class AdvancedThreatProtectionProperties { + /* + * Specifies the state of the Advanced Threat Protection, whether it is enabled or disabled or a state has not been + * applied yet on the specific database or server. + */ + @JsonProperty(value = "state", required = true) + private AdvancedThreatProtectionState state; + + /* + * Specifies the UTC creation time of the policy. + */ + @JsonProperty(value = "creationTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime creationTime; + + /** Creates an instance of AdvancedThreatProtectionProperties class. */ + public AdvancedThreatProtectionProperties() { + } + + /** + * Get the state property: Specifies the state of the Advanced Threat Protection, whether it is enabled or disabled + * or a state has not been applied yet on the specific database or server. + * + * @return the state value. + */ + public AdvancedThreatProtectionState state() { + return this.state; + } + + /** + * Set the state property: Specifies the state of the Advanced Threat Protection, whether it is enabled or disabled + * or a state has not been applied yet on the specific database or server. + * + * @param state the state value to set. + * @return the AdvancedThreatProtectionProperties object itself. + */ + public AdvancedThreatProtectionProperties withState(AdvancedThreatProtectionState state) { + this.state = state; + return this; + } + + /** + * Get the creationTime property: Specifies the UTC creation time of the policy. + * + * @return the creationTime value. + */ + public OffsetDateTime creationTime() { + return this.creationTime; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (state() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property state in model AdvancedThreatProtectionProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AdvancedThreatProtectionProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/AdvisorInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/AdvisorInner.java new file mode 100644 index 0000000000000..88a4544ce62a4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/AdvisorInner.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.AdvisorStatus; +import com.azure.resourcemanager.sql.generated.models.AutoExecuteStatus; +import com.azure.resourcemanager.sql.generated.models.AutoExecuteStatusInheritedFrom; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Database, Server or Elastic Pool Advisor. */ +@Fluent +public final 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; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private AdvisorProperties innerProperties; + + /** Creates an instance of AdvisorInner class. */ + public AdvisorInner() { + } + + /** + * Get the kind property: Resource kind. + * + * @return the kind value. + */ + public String kind() { + return this.kind; + } + + /** + * Get the location property: Resource location. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private AdvisorProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the advisorStatus property: Gets the status of availability of this advisor to customers. Possible values are + * 'GA', 'PublicPreview', 'LimitedPublicPreview' and 'PrivatePreview'. + * + * @return the advisorStatus value. + */ + public AdvisorStatus advisorStatus() { + return this.innerProperties() == null ? null : this.innerProperties().advisorStatus(); + } + + /** + * Get the autoExecuteStatus property: Gets the auto-execute status (whether to let the system execute the + * recommendations) of this advisor. Possible values are 'Enabled' and 'Disabled'. + * + * @return the autoExecuteStatus value. + */ + public AutoExecuteStatus autoExecuteStatus() { + return this.innerProperties() == null ? null : this.innerProperties().autoExecuteStatus(); + } + + /** + * Set the autoExecuteStatus property: Gets the auto-execute status (whether to let the system execute the + * recommendations) of this advisor. Possible values are 'Enabled' and 'Disabled'. + * + * @param autoExecuteStatus the autoExecuteStatus value to set. + * @return the AdvisorInner object itself. + */ + public AdvisorInner withAutoExecuteStatus(AutoExecuteStatus autoExecuteStatus) { + if (this.innerProperties() == null) { + this.innerProperties = new AdvisorProperties(); + } + this.innerProperties().withAutoExecuteStatus(autoExecuteStatus); + return this; + } + + /** + * Get the autoExecuteStatusInheritedFrom property: Gets the resource from which current value of auto-execute + * status is inherited. Auto-execute status can be set on (and inherited from) different levels in the resource + * hierarchy. Possible values are 'Subscription', 'Server', 'ElasticPool', 'Database' and 'Default' (when status is + * not explicitly set on any level). + * + * @return the autoExecuteStatusInheritedFrom value. + */ + public AutoExecuteStatusInheritedFrom autoExecuteStatusInheritedFrom() { + return this.innerProperties() == null ? null : this.innerProperties().autoExecuteStatusInheritedFrom(); + } + + /** + * Get the recommendationsStatus property: 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.innerProperties() == null ? null : this.innerProperties().recommendationsStatus(); + } + + /** + * Get the lastChecked property: Gets the time when the current resource was analyzed for recommendations by this + * advisor. + * + * @return the lastChecked value. + */ + public OffsetDateTime lastChecked() { + return this.innerProperties() == null ? null : this.innerProperties().lastChecked(); + } + + /** + * Get the recommendedActions property: Gets the recommended actions for this advisor. + * + * @return the recommendedActions value. + */ + public List recommendedActions() { + return this.innerProperties() == null ? null : this.innerProperties().recommendedActions(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/AdvisorProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/AdvisorProperties.java new file mode 100644 index 0000000000000..9e554bb70f1ba --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/AdvisorProperties.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.AdvisorStatus; +import com.azure.resourcemanager.sql.generated.models.AutoExecuteStatus; +import com.azure.resourcemanager.sql.generated.models.AutoExecuteStatusInheritedFrom; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Properties for a Database, Server or Elastic Pool Advisor. */ +@Fluent +public final class AdvisorProperties { + /* + * Gets the status of availability of this advisor to customers. Possible values are 'GA', 'PublicPreview', + * 'LimitedPublicPreview' and 'PrivatePreview'. + */ + @JsonProperty(value = "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' + */ + @JsonProperty(value = "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 inherited from) different levels in the resource hierarchy. Possible values are 'Subscription', + * 'Server', 'ElasticPool', 'Database' and 'Default' (when status is not explicitly set on any level). + */ + @JsonProperty(value = "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 = "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 = "lastChecked", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastChecked; + + /* + * Gets the recommended actions for this advisor. + */ + @JsonProperty(value = "recommendedActions", access = JsonProperty.Access.WRITE_ONLY) + private List recommendedActions; + + /** Creates an instance of AdvisorProperties class. */ + public AdvisorProperties() { + } + + /** + * Get the advisorStatus property: Gets the status of availability of this advisor to customers. Possible values are + * 'GA', 'PublicPreview', 'LimitedPublicPreview' and 'PrivatePreview'. + * + * @return the advisorStatus value. + */ + public AdvisorStatus advisorStatus() { + return this.advisorStatus; + } + + /** + * Get the autoExecuteStatus property: Gets the auto-execute status (whether to let the system execute the + * recommendations) of this advisor. Possible values are 'Enabled' and 'Disabled'. + * + * @return the autoExecuteStatus value. + */ + public AutoExecuteStatus autoExecuteStatus() { + return this.autoExecuteStatus; + } + + /** + * Set the autoExecuteStatus property: Gets the auto-execute status (whether to let the system execute the + * recommendations) of this advisor. Possible values are 'Enabled' and 'Disabled'. + * + * @param autoExecuteStatus the autoExecuteStatus value to set. + * @return the AdvisorProperties object itself. + */ + public AdvisorProperties withAutoExecuteStatus(AutoExecuteStatus autoExecuteStatus) { + this.autoExecuteStatus = autoExecuteStatus; + return this; + } + + /** + * Get the autoExecuteStatusInheritedFrom property: Gets the resource from which current value of auto-execute + * status is inherited. Auto-execute status can be set on (and inherited from) different levels in the resource + * hierarchy. Possible values are 'Subscription', 'Server', 'ElasticPool', 'Database' and 'Default' (when status is + * not explicitly set on any level). + * + * @return the autoExecuteStatusInheritedFrom value. + */ + public AutoExecuteStatusInheritedFrom autoExecuteStatusInheritedFrom() { + return this.autoExecuteStatusInheritedFrom; + } + + /** + * Get the recommendationsStatus property: 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 the lastChecked property: Gets the time when the current resource was analyzed for recommendations by this + * advisor. + * + * @return the lastChecked value. + */ + public OffsetDateTime lastChecked() { + return this.lastChecked; + } + + /** + * Get the recommendedActions property: Gets the recommended actions for this advisor. + * + * @return the recommendedActions value. + */ + public List recommendedActions() { + return this.recommendedActions; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (autoExecuteStatus() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property autoExecuteStatus in model AdvisorProperties")); + } + if (recommendedActions() != null) { + recommendedActions().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AdvisorProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/AutomaticTuningServerProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/AutomaticTuningServerProperties.java new file mode 100644 index 0000000000000..9925e6c1770e1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/AutomaticTuningServerProperties.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.models.AutomaticTuningServerMode; +import com.azure.resourcemanager.sql.generated.models.AutomaticTuningServerOptions; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Server-level Automatic Tuning properties. */ +@Fluent +public final class AutomaticTuningServerProperties { + /* + * Automatic tuning desired state. + */ + @JsonProperty(value = "desiredState") + private AutomaticTuningServerMode desiredState; + + /* + * Automatic tuning actual state. + */ + @JsonProperty(value = "actualState", access = JsonProperty.Access.WRITE_ONLY) + private AutomaticTuningServerMode actualState; + + /* + * Automatic tuning options definition. + */ + @JsonProperty(value = "options") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map options; + + /** Creates an instance of AutomaticTuningServerProperties class. */ + public AutomaticTuningServerProperties() { + } + + /** + * Get the desiredState property: Automatic tuning desired state. + * + * @return the desiredState value. + */ + public AutomaticTuningServerMode desiredState() { + return this.desiredState; + } + + /** + * Set the desiredState property: Automatic tuning desired state. + * + * @param desiredState the desiredState value to set. + * @return the AutomaticTuningServerProperties object itself. + */ + public AutomaticTuningServerProperties withDesiredState(AutomaticTuningServerMode desiredState) { + this.desiredState = desiredState; + return this; + } + + /** + * Get the actualState property: Automatic tuning actual state. + * + * @return the actualState value. + */ + public AutomaticTuningServerMode actualState() { + return this.actualState; + } + + /** + * Get the options property: Automatic tuning options definition. + * + * @return the options value. + */ + public Map options() { + return this.options; + } + + /** + * Set the options property: Automatic tuning options definition. + * + * @param options the options value to set. + * @return the AutomaticTuningServerProperties object itself. + */ + public AutomaticTuningServerProperties withOptions(Map options) { + this.options = options; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (options() != null) { + options() + .values() + .forEach( + e -> { + if (e != null) { + e.validate(); + } + }); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/AzureADOnlyAuthProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/AzureADOnlyAuthProperties.java new file mode 100644 index 0000000000000..9fe340b7695db --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/AzureADOnlyAuthProperties.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a active directory only authentication. */ +@Fluent +public final class AzureADOnlyAuthProperties { + /* + * Azure Active Directory only Authentication enabled. + */ + @JsonProperty(value = "azureADOnlyAuthentication", required = true) + private boolean azureADOnlyAuthentication; + + /** Creates an instance of AzureADOnlyAuthProperties class. */ + public AzureADOnlyAuthProperties() { + } + + /** + * Get the azureADOnlyAuthentication property: Azure Active Directory only Authentication enabled. + * + * @return the azureADOnlyAuthentication value. + */ + public boolean azureADOnlyAuthentication() { + return this.azureADOnlyAuthentication; + } + + /** + * Set the azureADOnlyAuthentication property: Azure Active Directory only Authentication enabled. + * + * @param azureADOnlyAuthentication the azureADOnlyAuthentication value to set. + * @return the AzureADOnlyAuthProperties object itself. + */ + public AzureADOnlyAuthProperties withAzureADOnlyAuthentication(boolean azureADOnlyAuthentication) { + this.azureADOnlyAuthentication = azureADOnlyAuthentication; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/BackupShortTermRetentionPolicyInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/BackupShortTermRetentionPolicyInner.java new file mode 100644 index 0000000000000..fa7ad92a5857d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/BackupShortTermRetentionPolicyInner.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.DiffBackupIntervalInHours; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A short term retention policy. */ +@Fluent +public final class BackupShortTermRetentionPolicyInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private BackupShortTermRetentionPolicyProperties innerProperties; + + /** Creates an instance of BackupShortTermRetentionPolicyInner class. */ + public BackupShortTermRetentionPolicyInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private BackupShortTermRetentionPolicyProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the retentionDays property: 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.innerProperties() == null ? null : this.innerProperties().retentionDays(); + } + + /** + * Set the retentionDays property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new BackupShortTermRetentionPolicyProperties(); + } + this.innerProperties().withRetentionDays(retentionDays); + return this; + } + + /** + * Get the diffBackupIntervalInHours property: The differential backup interval in hours. This is how many interval + * hours between each differential backup will be supported. This is only applicable to live databases but not + * dropped databases. + * + * @return the diffBackupIntervalInHours value. + */ + public DiffBackupIntervalInHours diffBackupIntervalInHours() { + return this.innerProperties() == null ? null : this.innerProperties().diffBackupIntervalInHours(); + } + + /** + * Set the diffBackupIntervalInHours property: The differential backup interval in hours. This is how many interval + * hours between each differential backup will be supported. This is only applicable to live databases but not + * dropped databases. + * + * @param diffBackupIntervalInHours the diffBackupIntervalInHours value to set. + * @return the BackupShortTermRetentionPolicyInner object itself. + */ + public BackupShortTermRetentionPolicyInner withDiffBackupIntervalInHours( + DiffBackupIntervalInHours diffBackupIntervalInHours) { + if (this.innerProperties() == null) { + this.innerProperties = new BackupShortTermRetentionPolicyProperties(); + } + this.innerProperties().withDiffBackupIntervalInHours(diffBackupIntervalInHours); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/BackupShortTermRetentionPolicyProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/BackupShortTermRetentionPolicyProperties.java new file mode 100644 index 0000000000000..23777077b5e47 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/BackupShortTermRetentionPolicyProperties.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.models.DiffBackupIntervalInHours; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a short term retention policy. */ +@Fluent +public final class BackupShortTermRetentionPolicyProperties { + /* + * The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + */ + @JsonProperty(value = "retentionDays") + private Integer retentionDays; + + /* + * The differential backup interval in hours. This is how many interval hours between each differential backup will + * be supported. This is only applicable to live databases but not dropped databases. + */ + @JsonProperty(value = "diffBackupIntervalInHours") + private DiffBackupIntervalInHours diffBackupIntervalInHours; + + /** Creates an instance of BackupShortTermRetentionPolicyProperties class. */ + public BackupShortTermRetentionPolicyProperties() { + } + + /** + * Get the retentionDays property: 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 retentionDays property: 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 BackupShortTermRetentionPolicyProperties object itself. + */ + public BackupShortTermRetentionPolicyProperties withRetentionDays(Integer retentionDays) { + this.retentionDays = retentionDays; + return this; + } + + /** + * Get the diffBackupIntervalInHours property: The differential backup interval in hours. This is how many interval + * hours between each differential backup will be supported. This is only applicable to live databases but not + * dropped databases. + * + * @return the diffBackupIntervalInHours value. + */ + public DiffBackupIntervalInHours diffBackupIntervalInHours() { + return this.diffBackupIntervalInHours; + } + + /** + * Set the diffBackupIntervalInHours property: The differential backup interval in hours. This is how many interval + * hours between each differential backup will be supported. This is only applicable to live databases but not + * dropped databases. + * + * @param diffBackupIntervalInHours the diffBackupIntervalInHours value to set. + * @return the BackupShortTermRetentionPolicyProperties object itself. + */ + public BackupShortTermRetentionPolicyProperties withDiffBackupIntervalInHours( + DiffBackupIntervalInHours diffBackupIntervalInHours) { + this.diffBackupIntervalInHours = diffBackupIntervalInHours; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/BaseLongTermRetentionPolicyProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/BaseLongTermRetentionPolicyProperties.java new file mode 100644 index 0000000000000..87af204be3661 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/BaseLongTermRetentionPolicyProperties.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a long term retention policy. */ +@Fluent +public final class BaseLongTermRetentionPolicyProperties { + /* + * The weekly retention policy for an LTR backup in an ISO 8601 format. + */ + @JsonProperty(value = "weeklyRetention") + private String weeklyRetention; + + /* + * The monthly retention policy for an LTR backup in an ISO 8601 format. + */ + @JsonProperty(value = "monthlyRetention") + private String monthlyRetention; + + /* + * The yearly retention policy for an LTR backup in an ISO 8601 format. + */ + @JsonProperty(value = "yearlyRetention") + private String yearlyRetention; + + /* + * The week of year to take the yearly backup in an ISO 8601 format. + */ + @JsonProperty(value = "weekOfYear") + private Integer weekOfYear; + + /** Creates an instance of BaseLongTermRetentionPolicyProperties class. */ + public BaseLongTermRetentionPolicyProperties() { + } + + /** + * Get the weeklyRetention property: 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 weeklyRetention property: The weekly retention policy for an LTR backup in an ISO 8601 format. + * + * @param weeklyRetention the weeklyRetention value to set. + * @return the BaseLongTermRetentionPolicyProperties object itself. + */ + public BaseLongTermRetentionPolicyProperties withWeeklyRetention(String weeklyRetention) { + this.weeklyRetention = weeklyRetention; + return this; + } + + /** + * Get the monthlyRetention property: 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 monthlyRetention property: The monthly retention policy for an LTR backup in an ISO 8601 format. + * + * @param monthlyRetention the monthlyRetention value to set. + * @return the BaseLongTermRetentionPolicyProperties object itself. + */ + public BaseLongTermRetentionPolicyProperties withMonthlyRetention(String monthlyRetention) { + this.monthlyRetention = monthlyRetention; + return this; + } + + /** + * Get the yearlyRetention property: 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 yearlyRetention property: The yearly retention policy for an LTR backup in an ISO 8601 format. + * + * @param yearlyRetention the yearlyRetention value to set. + * @return the BaseLongTermRetentionPolicyProperties object itself. + */ + public BaseLongTermRetentionPolicyProperties withYearlyRetention(String yearlyRetention) { + this.yearlyRetention = yearlyRetention; + return this; + } + + /** + * Get the weekOfYear property: 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 weekOfYear property: The week of year to take the yearly backup in an ISO 8601 format. + * + * @param weekOfYear the weekOfYear value to set. + * @return the BaseLongTermRetentionPolicyProperties object itself. + */ + public BaseLongTermRetentionPolicyProperties withWeekOfYear(Integer weekOfYear) { + this.weekOfYear = weekOfYear; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/CheckNameAvailabilityResponseInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/CheckNameAvailabilityResponseInner.java new file mode 100644 index 0000000000000..4a5ac6c40cbd4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/CheckNameAvailabilityResponseInner.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.models.CheckNameAvailabilityReason; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The result of a name availability check. */ +@Immutable +public final class CheckNameAvailabilityResponseInner { + /* + * The name whose availability was checked. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * True if the name is available, otherwise false. + */ + @JsonProperty(value = "available", access = JsonProperty.Access.WRITE_ONLY) + private Boolean available; + + /* + * The reason code explaining why the name is unavailable. Will be undefined if the name is available. + */ + @JsonProperty(value = "reason", access = JsonProperty.Access.WRITE_ONLY) + private CheckNameAvailabilityReason reason; + + /* + * A message explaining why the name is unavailable. Will be undefined if the name is available. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** Creates an instance of CheckNameAvailabilityResponseInner class. */ + public CheckNameAvailabilityResponseInner() { + } + + /** + * Get the name property: The name whose availability was checked. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the available property: True if the name is available, otherwise false. + * + * @return the available value. + */ + public Boolean available() { + return this.available; + } + + /** + * Get the reason property: The reason code explaining why the name is unavailable. Will be undefined if the name is + * available. + * + * @return the reason value. + */ + public CheckNameAvailabilityReason reason() { + return this.reason; + } + + /** + * Get the message property: A message explaining why the name is unavailable. Will be undefined if the name is + * available. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/CopyLongTermRetentionBackupParametersProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/CopyLongTermRetentionBackupParametersProperties.java new file mode 100644 index 0000000000000..82b66541e91a0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/CopyLongTermRetentionBackupParametersProperties.java @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Contains the properties to perform long term retention backup copy operation. */ +@Fluent +public final class CopyLongTermRetentionBackupParametersProperties { + /* + * The subscription that owns the target server + */ + @JsonProperty(value = "targetSubscriptionId") + private String targetSubscriptionId; + + /* + * The resource group that owns the target server + */ + @JsonProperty(value = "targetResourceGroup") + private String targetResourceGroup; + + /* + * The resource Id of the target server that owns the database + */ + @JsonProperty(value = "targetServerResourceId") + private String targetServerResourceId; + + /* + * The fully qualified domain name of the target server + */ + @JsonProperty(value = "targetServerFullyQualifiedDomainName") + private String targetServerFullyQualifiedDomainName; + + /* + * The name of the database owns the copied backup. + */ + @JsonProperty(value = "targetDatabaseName") + private String targetDatabaseName; + + /* + * The storage redundancy type of the copied backup + */ + @JsonProperty(value = "targetBackupStorageRedundancy") + private BackupStorageRedundancy targetBackupStorageRedundancy; + + /** Creates an instance of CopyLongTermRetentionBackupParametersProperties class. */ + public CopyLongTermRetentionBackupParametersProperties() { + } + + /** + * Get the targetSubscriptionId property: The subscription that owns the target server. + * + * @return the targetSubscriptionId value. + */ + public String targetSubscriptionId() { + return this.targetSubscriptionId; + } + + /** + * Set the targetSubscriptionId property: The subscription that owns the target server. + * + * @param targetSubscriptionId the targetSubscriptionId value to set. + * @return the CopyLongTermRetentionBackupParametersProperties object itself. + */ + public CopyLongTermRetentionBackupParametersProperties withTargetSubscriptionId(String targetSubscriptionId) { + this.targetSubscriptionId = targetSubscriptionId; + return this; + } + + /** + * Get the targetResourceGroup property: The resource group that owns the target server. + * + * @return the targetResourceGroup value. + */ + public String targetResourceGroup() { + return this.targetResourceGroup; + } + + /** + * Set the targetResourceGroup property: The resource group that owns the target server. + * + * @param targetResourceGroup the targetResourceGroup value to set. + * @return the CopyLongTermRetentionBackupParametersProperties object itself. + */ + public CopyLongTermRetentionBackupParametersProperties withTargetResourceGroup(String targetResourceGroup) { + this.targetResourceGroup = targetResourceGroup; + return this; + } + + /** + * Get the targetServerResourceId property: The resource Id of the target server that owns the database. + * + * @return the targetServerResourceId value. + */ + public String targetServerResourceId() { + return this.targetServerResourceId; + } + + /** + * Set the targetServerResourceId property: The resource Id of the target server that owns the database. + * + * @param targetServerResourceId the targetServerResourceId value to set. + * @return the CopyLongTermRetentionBackupParametersProperties object itself. + */ + public CopyLongTermRetentionBackupParametersProperties withTargetServerResourceId(String targetServerResourceId) { + this.targetServerResourceId = targetServerResourceId; + return this; + } + + /** + * Get the targetServerFullyQualifiedDomainName property: The fully qualified domain name of the target server. + * + * @return the targetServerFullyQualifiedDomainName value. + */ + public String targetServerFullyQualifiedDomainName() { + return this.targetServerFullyQualifiedDomainName; + } + + /** + * Set the targetServerFullyQualifiedDomainName property: The fully qualified domain name of the target server. + * + * @param targetServerFullyQualifiedDomainName the targetServerFullyQualifiedDomainName value to set. + * @return the CopyLongTermRetentionBackupParametersProperties object itself. + */ + public CopyLongTermRetentionBackupParametersProperties withTargetServerFullyQualifiedDomainName( + String targetServerFullyQualifiedDomainName) { + this.targetServerFullyQualifiedDomainName = targetServerFullyQualifiedDomainName; + return this; + } + + /** + * Get the targetDatabaseName property: The name of the database owns the copied backup. + * + * @return the targetDatabaseName value. + */ + public String targetDatabaseName() { + return this.targetDatabaseName; + } + + /** + * Set the targetDatabaseName property: The name of the database owns the copied backup. + * + * @param targetDatabaseName the targetDatabaseName value to set. + * @return the CopyLongTermRetentionBackupParametersProperties object itself. + */ + public CopyLongTermRetentionBackupParametersProperties withTargetDatabaseName(String targetDatabaseName) { + this.targetDatabaseName = targetDatabaseName; + return this; + } + + /** + * Get the targetBackupStorageRedundancy property: The storage redundancy type of the copied backup. + * + * @return the targetBackupStorageRedundancy value. + */ + public BackupStorageRedundancy targetBackupStorageRedundancy() { + return this.targetBackupStorageRedundancy; + } + + /** + * Set the targetBackupStorageRedundancy property: The storage redundancy type of the copied backup. + * + * @param targetBackupStorageRedundancy the targetBackupStorageRedundancy value to set. + * @return the CopyLongTermRetentionBackupParametersProperties object itself. + */ + public CopyLongTermRetentionBackupParametersProperties withTargetBackupStorageRedundancy( + BackupStorageRedundancy targetBackupStorageRedundancy) { + this.targetBackupStorageRedundancy = targetBackupStorageRedundancy; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DataMaskingPolicyInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DataMaskingPolicyInner.java new file mode 100644 index 0000000000000..dc0946d8ae728 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DataMaskingPolicyInner.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.DataMaskingState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents a database data masking policy. */ +@Fluent +public final class DataMaskingPolicyInner extends ProxyResource { + /* + * The properties of the data masking policy. + */ + @JsonProperty(value = "properties") + private DataMaskingPolicyProperties innerProperties; + + /* + * 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; + + /** Creates an instance of DataMaskingPolicyInner class. */ + public DataMaskingPolicyInner() { + } + + /** + * Get the innerProperties property: The properties of the data masking policy. + * + * @return the innerProperties value. + */ + private DataMaskingPolicyProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the location property: The location of the data masking policy. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Get the kind property: The kind of data masking policy. Metadata, used for Azure portal. + * + * @return the kind value. + */ + public String kind() { + return this.kind; + } + + /** + * Get the dataMaskingState property: The state of the data masking policy. + * + * @return the dataMaskingState value. + */ + public DataMaskingState dataMaskingState() { + return this.innerProperties() == null ? null : this.innerProperties().dataMaskingState(); + } + + /** + * Set the dataMaskingState property: The state of the data masking policy. + * + * @param dataMaskingState the dataMaskingState value to set. + * @return the DataMaskingPolicyInner object itself. + */ + public DataMaskingPolicyInner withDataMaskingState(DataMaskingState dataMaskingState) { + if (this.innerProperties() == null) { + this.innerProperties = new DataMaskingPolicyProperties(); + } + this.innerProperties().withDataMaskingState(dataMaskingState); + return this; + } + + /** + * Get the exemptPrincipals property: 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.innerProperties() == null ? null : this.innerProperties().exemptPrincipals(); + } + + /** + * Set the exemptPrincipals property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new DataMaskingPolicyProperties(); + } + this.innerProperties().withExemptPrincipals(exemptPrincipals); + return this; + } + + /** + * Get the applicationPrincipals property: 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.innerProperties() == null ? null : this.innerProperties().applicationPrincipals(); + } + + /** + * Get the maskingLevel property: The masking level. This is a legacy parameter and is no longer used. + * + * @return the maskingLevel value. + */ + public String maskingLevel() { + return this.innerProperties() == null ? null : this.innerProperties().maskingLevel(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DataMaskingPolicyProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DataMaskingPolicyProperties.java new file mode 100644 index 0000000000000..e162c99fe2577 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DataMaskingPolicyProperties.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.DataMaskingState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of a database data masking policy. */ +@Fluent +public final class DataMaskingPolicyProperties { + /* + * The state of the data masking policy. + */ + @JsonProperty(value = "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 = "exemptPrincipals") + private String exemptPrincipals; + + /* + * The list of the application principals. This is a legacy parameter and is no longer used. + */ + @JsonProperty(value = "applicationPrincipals", access = JsonProperty.Access.WRITE_ONLY) + private String applicationPrincipals; + + /* + * The masking level. This is a legacy parameter and is no longer used. + */ + @JsonProperty(value = "maskingLevel", access = JsonProperty.Access.WRITE_ONLY) + private String maskingLevel; + + /** Creates an instance of DataMaskingPolicyProperties class. */ + public DataMaskingPolicyProperties() { + } + + /** + * Get the dataMaskingState property: The state of the data masking policy. + * + * @return the dataMaskingState value. + */ + public DataMaskingState dataMaskingState() { + return this.dataMaskingState; + } + + /** + * Set the dataMaskingState property: The state of the data masking policy. + * + * @param dataMaskingState the dataMaskingState value to set. + * @return the DataMaskingPolicyProperties object itself. + */ + public DataMaskingPolicyProperties withDataMaskingState(DataMaskingState dataMaskingState) { + this.dataMaskingState = dataMaskingState; + return this; + } + + /** + * Get the exemptPrincipals property: 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 exemptPrincipals property: 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 DataMaskingPolicyProperties object itself. + */ + public DataMaskingPolicyProperties withExemptPrincipals(String exemptPrincipals) { + this.exemptPrincipals = exemptPrincipals; + return this; + } + + /** + * Get the applicationPrincipals property: 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 maskingLevel property: The masking level. This is a legacy parameter and is no longer used. + * + * @return the maskingLevel value. + */ + public String maskingLevel() { + return this.maskingLevel; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (dataMaskingState() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property dataMaskingState in model DataMaskingPolicyProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DataMaskingPolicyProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DataMaskingRuleInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DataMaskingRuleInner.java new file mode 100644 index 0000000000000..6b9d06ae11a58 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DataMaskingRuleInner.java @@ -0,0 +1,353 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.DataMaskingFunction; +import com.azure.resourcemanager.sql.generated.models.DataMaskingRuleState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents a database data masking rule. */ +@Fluent +public final class DataMaskingRuleInner extends ProxyResource { + /* + * The properties of the resource. + */ + @JsonProperty(value = "properties") + private DataMaskingRuleProperties innerProperties; + + /* + * 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; + + /** Creates an instance of DataMaskingRuleInner class. */ + public DataMaskingRuleInner() { + } + + /** + * Get the innerProperties property: The properties of the resource. + * + * @return the innerProperties value. + */ + private DataMaskingRuleProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the location property: The location of the data masking rule. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Get the kind property: The kind of Data Masking Rule. Metadata, used for Azure portal. + * + * @return the kind value. + */ + public String kind() { + return this.kind; + } + + /** + * Get the id property: The rule Id. + * + * @return the id value. + */ + public String idPropertiesId() { + return this.innerProperties() == null ? null : this.innerProperties().id(); + } + + /** + * Get the aliasName property: The alias name. This is a legacy parameter and is no longer used. + * + * @return the aliasName value. + */ + public String aliasName() { + return this.innerProperties() == null ? null : this.innerProperties().aliasName(); + } + + /** + * Set the aliasName property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new DataMaskingRuleProperties(); + } + this.innerProperties().withAliasName(aliasName); + return this; + } + + /** + * Get the ruleState property: 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. + * + * @return the ruleState value. + */ + public DataMaskingRuleState ruleState() { + return this.innerProperties() == null ? null : this.innerProperties().ruleState(); + } + + /** + * Set the ruleState property: 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. + * + * @param ruleState the ruleState value to set. + * @return the DataMaskingRuleInner object itself. + */ + public DataMaskingRuleInner withRuleState(DataMaskingRuleState ruleState) { + if (this.innerProperties() == null) { + this.innerProperties = new DataMaskingRuleProperties(); + } + this.innerProperties().withRuleState(ruleState); + return this; + } + + /** + * Get the schemaName property: The schema name on which the data masking rule is applied. + * + * @return the schemaName value. + */ + public String schemaName() { + return this.innerProperties() == null ? null : this.innerProperties().schemaName(); + } + + /** + * Set the schemaName property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new DataMaskingRuleProperties(); + } + this.innerProperties().withSchemaName(schemaName); + return this; + } + + /** + * Get the tableName property: The table name on which the data masking rule is applied. + * + * @return the tableName value. + */ + public String tableName() { + return this.innerProperties() == null ? null : this.innerProperties().tableName(); + } + + /** + * Set the tableName property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new DataMaskingRuleProperties(); + } + this.innerProperties().withTableName(tableName); + return this; + } + + /** + * Get the columnName property: The column name on which the data masking rule is applied. + * + * @return the columnName value. + */ + public String columnName() { + return this.innerProperties() == null ? null : this.innerProperties().columnName(); + } + + /** + * Set the columnName property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new DataMaskingRuleProperties(); + } + this.innerProperties().withColumnName(columnName); + return this; + } + + /** + * Get the maskingFunction property: The masking function that is used for the data masking rule. + * + * @return the maskingFunction value. + */ + public DataMaskingFunction maskingFunction() { + return this.innerProperties() == null ? null : this.innerProperties().maskingFunction(); + } + + /** + * Set the maskingFunction property: The masking function that is used for the data masking rule. + * + * @param maskingFunction the maskingFunction value to set. + * @return the DataMaskingRuleInner object itself. + */ + public DataMaskingRuleInner withMaskingFunction(DataMaskingFunction maskingFunction) { + if (this.innerProperties() == null) { + this.innerProperties = new DataMaskingRuleProperties(); + } + this.innerProperties().withMaskingFunction(maskingFunction); + return this; + } + + /** + * Get the numberFrom property: 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.innerProperties() == null ? null : this.innerProperties().numberFrom(); + } + + /** + * Set the numberFrom property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new DataMaskingRuleProperties(); + } + this.innerProperties().withNumberFrom(numberFrom); + return this; + } + + /** + * Get the numberTo property: 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.innerProperties() == null ? null : this.innerProperties().numberTo(); + } + + /** + * Set the numberTo property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new DataMaskingRuleProperties(); + } + this.innerProperties().withNumberTo(numberTo); + return this; + } + + /** + * Get the prefixSize property: 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.innerProperties() == null ? null : this.innerProperties().prefixSize(); + } + + /** + * Set the prefixSize property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new DataMaskingRuleProperties(); + } + this.innerProperties().withPrefixSize(prefixSize); + return this; + } + + /** + * Get the suffixSize property: 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.innerProperties() == null ? null : this.innerProperties().suffixSize(); + } + + /** + * Set the suffixSize property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new DataMaskingRuleProperties(); + } + this.innerProperties().withSuffixSize(suffixSize); + return this; + } + + /** + * Get the replacementString property: 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.innerProperties() == null ? null : this.innerProperties().replacementString(); + } + + /** + * Set the replacementString property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new DataMaskingRuleProperties(); + } + this.innerProperties().withReplacementString(replacementString); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DataMaskingRuleProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DataMaskingRuleProperties.java new file mode 100644 index 0000000000000..3cc4cdb53e4b5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DataMaskingRuleProperties.java @@ -0,0 +1,377 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.DataMaskingFunction; +import com.azure.resourcemanager.sql.generated.models.DataMaskingRuleState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of a database data masking rule. */ +@Fluent +public final class DataMaskingRuleProperties { + /* + * The rule Id. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * The alias name. This is a legacy parameter and is no longer used. + */ + @JsonProperty(value = "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. + */ + @JsonProperty(value = "ruleState") + private DataMaskingRuleState ruleState; + + /* + * The schema name on which the data masking rule is applied. + */ + @JsonProperty(value = "schemaName", required = true) + private String schemaName; + + /* + * The table name on which the data masking rule is applied. + */ + @JsonProperty(value = "tableName", required = true) + private String tableName; + + /* + * The column name on which the data masking rule is applied. + */ + @JsonProperty(value = "columnName", required = true) + private String columnName; + + /* + * The masking function that is used for the data masking rule. + */ + @JsonProperty(value = "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 = "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 = "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 = "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 = "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 = "replacementString") + private String replacementString; + + /** Creates an instance of DataMaskingRuleProperties class. */ + public DataMaskingRuleProperties() { + } + + /** + * Get the id property: The rule Id. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the aliasName property: 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 aliasName property: The alias name. This is a legacy parameter and is no longer used. + * + * @param aliasName the aliasName value to set. + * @return the DataMaskingRuleProperties object itself. + */ + public DataMaskingRuleProperties withAliasName(String aliasName) { + this.aliasName = aliasName; + return this; + } + + /** + * Get the ruleState property: 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. + * + * @return the ruleState value. + */ + public DataMaskingRuleState ruleState() { + return this.ruleState; + } + + /** + * Set the ruleState property: 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. + * + * @param ruleState the ruleState value to set. + * @return the DataMaskingRuleProperties object itself. + */ + public DataMaskingRuleProperties withRuleState(DataMaskingRuleState ruleState) { + this.ruleState = ruleState; + return this; + } + + /** + * Get the schemaName property: The schema name on which the data masking rule is applied. + * + * @return the schemaName value. + */ + public String schemaName() { + return this.schemaName; + } + + /** + * Set the schemaName property: The schema name on which the data masking rule is applied. + * + * @param schemaName the schemaName value to set. + * @return the DataMaskingRuleProperties object itself. + */ + public DataMaskingRuleProperties withSchemaName(String schemaName) { + this.schemaName = schemaName; + return this; + } + + /** + * Get the tableName property: The table name on which the data masking rule is applied. + * + * @return the tableName value. + */ + public String tableName() { + return this.tableName; + } + + /** + * Set the tableName property: The table name on which the data masking rule is applied. + * + * @param tableName the tableName value to set. + * @return the DataMaskingRuleProperties object itself. + */ + public DataMaskingRuleProperties withTableName(String tableName) { + this.tableName = tableName; + return this; + } + + /** + * Get the columnName property: The column name on which the data masking rule is applied. + * + * @return the columnName value. + */ + public String columnName() { + return this.columnName; + } + + /** + * Set the columnName property: The column name on which the data masking rule is applied. + * + * @param columnName the columnName value to set. + * @return the DataMaskingRuleProperties object itself. + */ + public DataMaskingRuleProperties withColumnName(String columnName) { + this.columnName = columnName; + return this; + } + + /** + * Get the maskingFunction property: The masking function that is used for the data masking rule. + * + * @return the maskingFunction value. + */ + public DataMaskingFunction maskingFunction() { + return this.maskingFunction; + } + + /** + * Set the maskingFunction property: The masking function that is used for the data masking rule. + * + * @param maskingFunction the maskingFunction value to set. + * @return the DataMaskingRuleProperties object itself. + */ + public DataMaskingRuleProperties withMaskingFunction(DataMaskingFunction maskingFunction) { + this.maskingFunction = maskingFunction; + return this; + } + + /** + * Get the numberFrom property: 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: 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 DataMaskingRuleProperties object itself. + */ + public DataMaskingRuleProperties withNumberFrom(String numberFrom) { + this.numberFrom = numberFrom; + return this; + } + + /** + * Get the numberTo property: 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: 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 DataMaskingRuleProperties object itself. + */ + public DataMaskingRuleProperties withNumberTo(String numberTo) { + this.numberTo = numberTo; + return this; + } + + /** + * Get the prefixSize property: 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 the prefixSize property: 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 DataMaskingRuleProperties object itself. + */ + public DataMaskingRuleProperties withPrefixSize(String prefixSize) { + this.prefixSize = prefixSize; + return this; + } + + /** + * Get the suffixSize property: 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 the suffixSize property: 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 DataMaskingRuleProperties object itself. + */ + public DataMaskingRuleProperties withSuffixSize(String suffixSize) { + this.suffixSize = suffixSize; + return this; + } + + /** + * Get the replacementString property: 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 the replacementString property: 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 DataMaskingRuleProperties object itself. + */ + public DataMaskingRuleProperties withReplacementString(String replacementString) { + this.replacementString = replacementString; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (schemaName() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property schemaName in model DataMaskingRuleProperties")); + } + if (tableName() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property tableName in model DataMaskingRuleProperties")); + } + if (columnName() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property columnName in model DataMaskingRuleProperties")); + } + if (maskingFunction() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property maskingFunction in model DataMaskingRuleProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DataMaskingRuleProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DataWarehouseUserActivitiesInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DataWarehouseUserActivitiesInner.java new file mode 100644 index 0000000000000..46d628f1caf03 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DataWarehouseUserActivitiesInner.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** User activities of a data warehouse. */ +@Immutable +public final class DataWarehouseUserActivitiesInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private DataWarehouseUserActivitiesProperties innerProperties; + + /** Creates an instance of DataWarehouseUserActivitiesInner class. */ + public DataWarehouseUserActivitiesInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private DataWarehouseUserActivitiesProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the activeQueriesCount property: Count of running and suspended queries. + * + * @return the activeQueriesCount value. + */ + public Integer activeQueriesCount() { + return this.innerProperties() == null ? null : this.innerProperties().activeQueriesCount(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DataWarehouseUserActivitiesProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DataWarehouseUserActivitiesProperties.java new file mode 100644 index 0000000000000..4dd6e77f1b917 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DataWarehouseUserActivitiesProperties.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * User activities of a data warehouse. This currently includes the count of running or suspended queries. For more + * information, please view the sys.dm_pdw_exec_requests dynamic management view (DMV). + */ +@Immutable +public final class DataWarehouseUserActivitiesProperties { + /* + * Count of running and suspended queries. + */ + @JsonProperty(value = "activeQueriesCount", access = JsonProperty.Access.WRITE_ONLY) + private Integer activeQueriesCount; + + /** Creates an instance of DataWarehouseUserActivitiesProperties class. */ + public DataWarehouseUserActivitiesProperties() { + } + + /** + * Get the activeQueriesCount property: Count of running and suspended queries. + * + * @return the activeQueriesCount value. + */ + public Integer activeQueriesCount() { + return this.activeQueriesCount; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseAdvancedThreatProtectionInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseAdvancedThreatProtectionInner.java new file mode 100644 index 0000000000000..270f1ae950123 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseAdvancedThreatProtectionInner.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.sql.generated.models.AdvancedThreatProtectionState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** A database Advanced Threat Protection. */ +@Fluent +public final class DatabaseAdvancedThreatProtectionInner extends ProxyResource { + /* + * SystemData of AdvancedThreatProtectionResource. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private AdvancedThreatProtectionProperties innerProperties; + + /** Creates an instance of DatabaseAdvancedThreatProtectionInner class. */ + public DatabaseAdvancedThreatProtectionInner() { + } + + /** + * Get the systemData property: SystemData of AdvancedThreatProtectionResource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private AdvancedThreatProtectionProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the state property: Specifies the state of the Advanced Threat Protection, whether it is enabled or disabled + * or a state has not been applied yet on the specific database or server. + * + * @return the state value. + */ + public AdvancedThreatProtectionState state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Set the state property: Specifies the state of the Advanced Threat Protection, whether it is enabled or disabled + * or a state has not been applied yet on the specific database or server. + * + * @param state the state value to set. + * @return the DatabaseAdvancedThreatProtectionInner object itself. + */ + public DatabaseAdvancedThreatProtectionInner withState(AdvancedThreatProtectionState state) { + if (this.innerProperties() == null) { + this.innerProperties = new AdvancedThreatProtectionProperties(); + } + this.innerProperties().withState(state); + return this; + } + + /** + * Get the creationTime property: Specifies the UTC creation time of the policy. + * + * @return the creationTime value. + */ + public OffsetDateTime creationTime() { + return this.innerProperties() == null ? null : this.innerProperties().creationTime(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseAutomaticTuningInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseAutomaticTuningInner.java new file mode 100644 index 0000000000000..0ff167aac58bc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseAutomaticTuningInner.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.AutomaticTuningMode; +import com.azure.resourcemanager.sql.generated.models.AutomaticTuningOptions; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Database-level Automatic Tuning. */ +@Fluent +public final class DatabaseAutomaticTuningInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private DatabaseAutomaticTuningProperties innerProperties; + + /** Creates an instance of DatabaseAutomaticTuningInner class. */ + public DatabaseAutomaticTuningInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private DatabaseAutomaticTuningProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the desiredState property: Automatic tuning desired state. + * + * @return the desiredState value. + */ + public AutomaticTuningMode desiredState() { + return this.innerProperties() == null ? null : this.innerProperties().desiredState(); + } + + /** + * Set the desiredState property: Automatic tuning desired state. + * + * @param desiredState the desiredState value to set. + * @return the DatabaseAutomaticTuningInner object itself. + */ + public DatabaseAutomaticTuningInner withDesiredState(AutomaticTuningMode desiredState) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAutomaticTuningProperties(); + } + this.innerProperties().withDesiredState(desiredState); + return this; + } + + /** + * Get the actualState property: Automatic tuning actual state. + * + * @return the actualState value. + */ + public AutomaticTuningMode actualState() { + return this.innerProperties() == null ? null : this.innerProperties().actualState(); + } + + /** + * Get the options property: Automatic tuning options definition. + * + * @return the options value. + */ + public Map options() { + return this.innerProperties() == null ? null : this.innerProperties().options(); + } + + /** + * Set the options property: Automatic tuning options definition. + * + * @param options the options value to set. + * @return the DatabaseAutomaticTuningInner object itself. + */ + public DatabaseAutomaticTuningInner withOptions(Map options) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseAutomaticTuningProperties(); + } + this.innerProperties().withOptions(options); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseAutomaticTuningProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseAutomaticTuningProperties.java new file mode 100644 index 0000000000000..4a2475c406883 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseAutomaticTuningProperties.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.models.AutomaticTuningMode; +import com.azure.resourcemanager.sql.generated.models.AutomaticTuningOptions; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Database-level Automatic Tuning properties. */ +@Fluent +public final class DatabaseAutomaticTuningProperties { + /* + * Automatic tuning desired state. + */ + @JsonProperty(value = "desiredState") + private AutomaticTuningMode desiredState; + + /* + * Automatic tuning actual state. + */ + @JsonProperty(value = "actualState", access = JsonProperty.Access.WRITE_ONLY) + private AutomaticTuningMode actualState; + + /* + * Automatic tuning options definition. + */ + @JsonProperty(value = "options") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map options; + + /** Creates an instance of DatabaseAutomaticTuningProperties class. */ + public DatabaseAutomaticTuningProperties() { + } + + /** + * Get the desiredState property: Automatic tuning desired state. + * + * @return the desiredState value. + */ + public AutomaticTuningMode desiredState() { + return this.desiredState; + } + + /** + * Set the desiredState property: Automatic tuning desired state. + * + * @param desiredState the desiredState value to set. + * @return the DatabaseAutomaticTuningProperties object itself. + */ + public DatabaseAutomaticTuningProperties withDesiredState(AutomaticTuningMode desiredState) { + this.desiredState = desiredState; + return this; + } + + /** + * Get the actualState property: Automatic tuning actual state. + * + * @return the actualState value. + */ + public AutomaticTuningMode actualState() { + return this.actualState; + } + + /** + * Get the options property: Automatic tuning options definition. + * + * @return the options value. + */ + public Map options() { + return this.options; + } + + /** + * Set the options property: Automatic tuning options definition. + * + * @param options the options value to set. + * @return the DatabaseAutomaticTuningProperties object itself. + */ + public DatabaseAutomaticTuningProperties withOptions(Map options) { + this.options = options; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (options() != null) { + options() + .values() + .forEach( + e -> { + if (e != null) { + e.validate(); + } + }); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseBlobAuditingPolicyInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseBlobAuditingPolicyInner.java new file mode 100644 index 0000000000000..9055800d2de80 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseBlobAuditingPolicyInner.java @@ -0,0 +1,417 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.BlobAuditingPolicyState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.UUID; + +/** A database blob auditing policy. */ +@Fluent +public final class DatabaseBlobAuditingPolicyInner extends ProxyResource { + /* + * Resource kind. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private DatabaseBlobAuditingPolicyProperties innerProperties; + + /** Creates an instance of DatabaseBlobAuditingPolicyInner class. */ + public DatabaseBlobAuditingPolicyInner() { + } + + /** + * Get the kind property: Resource kind. + * + * @return the kind value. + */ + public String kind() { + return this.kind; + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private DatabaseBlobAuditingPolicyProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the retentionDays property: Specifies the number of days to keep in the audit logs in the storage account. + * + * @return the retentionDays value. + */ + public Integer retentionDays() { + return this.innerProperties() == null ? null : this.innerProperties().retentionDays(); + } + + /** + * Set the retentionDays property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseBlobAuditingPolicyProperties(); + } + this.innerProperties().withRetentionDays(retentionDays); + return this; + } + + /** + * Get the auditActionsAndGroups property: 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 + * DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP LEDGER_OPERATION_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.innerProperties() == null ? null : this.innerProperties().auditActionsAndGroups(); + } + + /** + * Set the auditActionsAndGroups property: 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 + * DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP LEDGER_OPERATION_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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseBlobAuditingPolicyProperties(); + } + this.innerProperties().withAuditActionsAndGroups(auditActionsAndGroups); + return this; + } + + /** + * Get the isStorageSecondaryKeyInUse property: Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + * + * @return the isStorageSecondaryKeyInUse value. + */ + public Boolean isStorageSecondaryKeyInUse() { + return this.innerProperties() == null ? null : this.innerProperties().isStorageSecondaryKeyInUse(); + } + + /** + * Set the isStorageSecondaryKeyInUse property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseBlobAuditingPolicyProperties(); + } + this.innerProperties().withIsStorageSecondaryKeyInUse(isStorageSecondaryKeyInUse); + return this; + } + + /** + * Get the isAzureMonitorTargetEnabled property: 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.innerProperties() == null ? null : this.innerProperties().isAzureMonitorTargetEnabled(); + } + + /** + * Set the isAzureMonitorTargetEnabled property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseBlobAuditingPolicyProperties(); + } + this.innerProperties().withIsAzureMonitorTargetEnabled(isAzureMonitorTargetEnabled); + return this; + } + + /** + * Get the queueDelayMs property: Specifies the amount of time in milliseconds that can elapse before audit actions + * are forced to be processed. The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + * + * @return the queueDelayMs value. + */ + public Integer queueDelayMs() { + return this.innerProperties() == null ? null : this.innerProperties().queueDelayMs(); + } + + /** + * Set the queueDelayMs property: Specifies the amount of time in milliseconds that can elapse before audit actions + * are forced to be processed. The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + * + * @param queueDelayMs the queueDelayMs value to set. + * @return the DatabaseBlobAuditingPolicyInner object itself. + */ + public DatabaseBlobAuditingPolicyInner withQueueDelayMs(Integer queueDelayMs) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseBlobAuditingPolicyProperties(); + } + this.innerProperties().withQueueDelayMs(queueDelayMs); + return this; + } + + /** + * Get the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob storage. + * + * @return the isManagedIdentityInUse value. + */ + public Boolean isManagedIdentityInUse() { + return this.innerProperties() == null ? null : this.innerProperties().isManagedIdentityInUse(); + } + + /** + * Set the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob storage. + * + * @param isManagedIdentityInUse the isManagedIdentityInUse value to set. + * @return the DatabaseBlobAuditingPolicyInner object itself. + */ + public DatabaseBlobAuditingPolicyInner withIsManagedIdentityInUse(Boolean isManagedIdentityInUse) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseBlobAuditingPolicyProperties(); + } + this.innerProperties().withIsManagedIdentityInUse(isManagedIdentityInUse); + return this; + } + + /** + * Get the state property: Specifies the state of the audit. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * + * @return the state value. + */ + public BlobAuditingPolicyState state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Set the state property: Specifies the state of the audit. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * + * @param state the state value to set. + * @return the DatabaseBlobAuditingPolicyInner object itself. + */ + public DatabaseBlobAuditingPolicyInner withState(BlobAuditingPolicyState state) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseBlobAuditingPolicyProperties(); + } + this.innerProperties().withState(state); + return this; + } + + /** + * Get the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is + * required. + * + * @return the storageEndpoint value. + */ + public String storageEndpoint() { + return this.innerProperties() == null ? null : this.innerProperties().storageEndpoint(); + } + + /** + * Set the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is + * required. + * + * @param storageEndpoint the storageEndpoint value to set. + * @return the DatabaseBlobAuditingPolicyInner object itself. + */ + public DatabaseBlobAuditingPolicyInner withStorageEndpoint(String storageEndpoint) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseBlobAuditingPolicyProperties(); + } + this.innerProperties().withStorageEndpoint(storageEndpoint); + return this; + } + + /** + * Get the storageAccountAccessKey property: Specifies the identifier key of the auditing storage account. If state + * is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server + * system-assigned managed identity to access the storage. Prerequisites for using managed identity authentication: + * 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). 2. Grant SQL Server + * identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server + * identity. For more information, see [Auditing to storage using Managed Identity + * authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @return the storageAccountAccessKey value. + */ + public String storageAccountAccessKey() { + return this.innerProperties() == null ? null : this.innerProperties().storageAccountAccessKey(); + } + + /** + * Set the storageAccountAccessKey property: Specifies the identifier key of the auditing storage account. If state + * is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server + * system-assigned managed identity to access the storage. Prerequisites for using managed identity authentication: + * 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). 2. Grant SQL Server + * identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server + * identity. For more information, see [Auditing to storage using Managed Identity + * authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set. + * @return the DatabaseBlobAuditingPolicyInner object itself. + */ + public DatabaseBlobAuditingPolicyInner withStorageAccountAccessKey(String storageAccountAccessKey) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseBlobAuditingPolicyProperties(); + } + this.innerProperties().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + /** + * Get the storageAccountSubscriptionId property: Specifies the blob storage subscription Id. + * + * @return the storageAccountSubscriptionId value. + */ + public UUID storageAccountSubscriptionId() { + return this.innerProperties() == null ? null : this.innerProperties().storageAccountSubscriptionId(); + } + + /** + * Set the storageAccountSubscriptionId property: Specifies the blob storage subscription Id. + * + * @param storageAccountSubscriptionId the storageAccountSubscriptionId value to set. + * @return the DatabaseBlobAuditingPolicyInner object itself. + */ + public DatabaseBlobAuditingPolicyInner withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseBlobAuditingPolicyProperties(); + } + this.innerProperties().withStorageAccountSubscriptionId(storageAccountSubscriptionId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseBlobAuditingPolicyProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseBlobAuditingPolicyProperties.java new file mode 100644 index 0000000000000..a4f327ebd4600 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseBlobAuditingPolicyProperties.java @@ -0,0 +1,516 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.BlobAuditingPolicyState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.UUID; + +/** Properties of a database blob auditing policy. */ +@Fluent +public final class DatabaseBlobAuditingPolicyProperties { + /* + * Specifies the number of days to keep in the audit logs in the storage account. + */ + @JsonProperty(value = "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 + * DBCC_GROUP + * DATABASE_OWNERSHIP_CHANGE_GROUP + * DATABASE_CHANGE_GROUP + * LEDGER_OPERATION_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 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 = "auditActionsAndGroups") + private List auditActionsAndGroups; + + /* + * Specifies whether storageAccountAccessKey value is the storage's secondary key. + */ + @JsonProperty(value = "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 = "isAzureMonitorTargetEnabled") + private Boolean isAzureMonitorTargetEnabled; + + /* + * Specifies the amount of time in milliseconds that can elapse before audit actions are forced to be processed. + * The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + */ + @JsonProperty(value = "queueDelayMs") + private Integer queueDelayMs; + + /* + * Specifies whether Managed Identity is used to access blob storage + */ + @JsonProperty(value = "isManagedIdentityInUse") + private Boolean isManagedIdentityInUse; + + /* + * Specifies the state of the audit. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are + * required. + */ + @JsonProperty(value = "state", required = true) + private BlobAuditingPolicyState state; + + /* + * Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, + * storageEndpoint or isAzureMonitorTargetEnabled is required. + */ + @JsonProperty(value = "storageEndpoint") + private String storageEndpoint; + + /* + * Specifies the identifier key of the auditing storage account. + * If state is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL + * server system-assigned managed identity to access the storage. + * Prerequisites for using managed identity authentication: + * 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). + * 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role + * to the server identity. + * For more information, see [Auditing to storage using Managed Identity + * authentication](https://go.microsoft.com/fwlink/?linkid=2114355) + */ + @JsonProperty(value = "storageAccountAccessKey") + private String storageAccountAccessKey; + + /* + * Specifies the blob storage subscription Id. + */ + @JsonProperty(value = "storageAccountSubscriptionId") + private UUID storageAccountSubscriptionId; + + /** Creates an instance of DatabaseBlobAuditingPolicyProperties class. */ + public DatabaseBlobAuditingPolicyProperties() { + } + + /** + * Get the retentionDays property: 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 the retentionDays property: Specifies the number of days to keep in the audit logs in the storage account. + * + * @param retentionDays the retentionDays value to set. + * @return the DatabaseBlobAuditingPolicyProperties object itself. + */ + public DatabaseBlobAuditingPolicyProperties withRetentionDays(Integer retentionDays) { + this.retentionDays = retentionDays; + return this; + } + + /** + * Get the auditActionsAndGroups property: 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 + * DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP LEDGER_OPERATION_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 the auditActionsAndGroups property: 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 + * DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP LEDGER_OPERATION_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 DatabaseBlobAuditingPolicyProperties object itself. + */ + public DatabaseBlobAuditingPolicyProperties withAuditActionsAndGroups(List auditActionsAndGroups) { + this.auditActionsAndGroups = auditActionsAndGroups; + return this; + } + + /** + * Get the isStorageSecondaryKeyInUse property: Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + * + * @return the isStorageSecondaryKeyInUse value. + */ + public Boolean isStorageSecondaryKeyInUse() { + return this.isStorageSecondaryKeyInUse; + } + + /** + * Set the isStorageSecondaryKeyInUse property: Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + * + * @param isStorageSecondaryKeyInUse the isStorageSecondaryKeyInUse value to set. + * @return the DatabaseBlobAuditingPolicyProperties object itself. + */ + public DatabaseBlobAuditingPolicyProperties withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse) { + this.isStorageSecondaryKeyInUse = isStorageSecondaryKeyInUse; + return this; + } + + /** + * Get the isAzureMonitorTargetEnabled property: 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 the isAzureMonitorTargetEnabled property: 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 DatabaseBlobAuditingPolicyProperties object itself. + */ + public DatabaseBlobAuditingPolicyProperties withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled) { + this.isAzureMonitorTargetEnabled = isAzureMonitorTargetEnabled; + return this; + } + + /** + * Get the queueDelayMs property: Specifies the amount of time in milliseconds that can elapse before audit actions + * are forced to be processed. The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + * + * @return the queueDelayMs value. + */ + public Integer queueDelayMs() { + return this.queueDelayMs; + } + + /** + * Set the queueDelayMs property: Specifies the amount of time in milliseconds that can elapse before audit actions + * are forced to be processed. The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + * + * @param queueDelayMs the queueDelayMs value to set. + * @return the DatabaseBlobAuditingPolicyProperties object itself. + */ + public DatabaseBlobAuditingPolicyProperties withQueueDelayMs(Integer queueDelayMs) { + this.queueDelayMs = queueDelayMs; + return this; + } + + /** + * Get the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob storage. + * + * @return the isManagedIdentityInUse value. + */ + public Boolean isManagedIdentityInUse() { + return this.isManagedIdentityInUse; + } + + /** + * Set the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob storage. + * + * @param isManagedIdentityInUse the isManagedIdentityInUse value to set. + * @return the DatabaseBlobAuditingPolicyProperties object itself. + */ + public DatabaseBlobAuditingPolicyProperties withIsManagedIdentityInUse(Boolean isManagedIdentityInUse) { + this.isManagedIdentityInUse = isManagedIdentityInUse; + return this; + } + + /** + * Get the state property: Specifies the state of the audit. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * + * @return the state value. + */ + public BlobAuditingPolicyState state() { + return this.state; + } + + /** + * Set the state property: Specifies the state of the audit. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * + * @param state the state value to set. + * @return the DatabaseBlobAuditingPolicyProperties object itself. + */ + public DatabaseBlobAuditingPolicyProperties withState(BlobAuditingPolicyState state) { + this.state = state; + return this; + } + + /** + * Get the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is + * required. + * + * @return the storageEndpoint value. + */ + public String storageEndpoint() { + return this.storageEndpoint; + } + + /** + * Set the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is + * required. + * + * @param storageEndpoint the storageEndpoint value to set. + * @return the DatabaseBlobAuditingPolicyProperties object itself. + */ + public DatabaseBlobAuditingPolicyProperties withStorageEndpoint(String storageEndpoint) { + this.storageEndpoint = storageEndpoint; + return this; + } + + /** + * Get the storageAccountAccessKey property: Specifies the identifier key of the auditing storage account. If state + * is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server + * system-assigned managed identity to access the storage. Prerequisites for using managed identity authentication: + * 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). 2. Grant SQL Server + * identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server + * identity. For more information, see [Auditing to storage using Managed Identity + * authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @return the storageAccountAccessKey value. + */ + public String storageAccountAccessKey() { + return this.storageAccountAccessKey; + } + + /** + * Set the storageAccountAccessKey property: Specifies the identifier key of the auditing storage account. If state + * is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server + * system-assigned managed identity to access the storage. Prerequisites for using managed identity authentication: + * 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). 2. Grant SQL Server + * identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server + * identity. For more information, see [Auditing to storage using Managed Identity + * authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set. + * @return the DatabaseBlobAuditingPolicyProperties object itself. + */ + public DatabaseBlobAuditingPolicyProperties withStorageAccountAccessKey(String storageAccountAccessKey) { + this.storageAccountAccessKey = storageAccountAccessKey; + return this; + } + + /** + * Get the storageAccountSubscriptionId property: Specifies the blob storage subscription Id. + * + * @return the storageAccountSubscriptionId value. + */ + public UUID storageAccountSubscriptionId() { + return this.storageAccountSubscriptionId; + } + + /** + * Set the storageAccountSubscriptionId property: Specifies the blob storage subscription Id. + * + * @param storageAccountSubscriptionId the storageAccountSubscriptionId value to set. + * @return the DatabaseBlobAuditingPolicyProperties object itself. + */ + public DatabaseBlobAuditingPolicyProperties withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId) { + this.storageAccountSubscriptionId = storageAccountSubscriptionId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (state() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property state in model DatabaseBlobAuditingPolicyProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DatabaseBlobAuditingPolicyProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseColumnInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseColumnInner.java new file mode 100644 index 0000000000000..fa3590f52fd1a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseColumnInner.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.ColumnDataType; +import com.azure.resourcemanager.sql.generated.models.TableTemporalType; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A database column resource. */ +@Fluent +public final class DatabaseColumnInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private DatabaseColumnProperties innerProperties; + + /** Creates an instance of DatabaseColumnInner class. */ + public DatabaseColumnInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private DatabaseColumnProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the columnType property: The column data type. + * + * @return the columnType value. + */ + public ColumnDataType columnType() { + return this.innerProperties() == null ? null : this.innerProperties().columnType(); + } + + /** + * Set the columnType property: The column data type. + * + * @param columnType the columnType value to set. + * @return the DatabaseColumnInner object itself. + */ + public DatabaseColumnInner withColumnType(ColumnDataType columnType) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseColumnProperties(); + } + this.innerProperties().withColumnType(columnType); + return this; + } + + /** + * Get the temporalType property: The table temporal type. + * + * @return the temporalType value. + */ + public TableTemporalType temporalType() { + return this.innerProperties() == null ? null : this.innerProperties().temporalType(); + } + + /** + * Set the temporalType property: The table temporal type. + * + * @param temporalType the temporalType value to set. + * @return the DatabaseColumnInner object itself. + */ + public DatabaseColumnInner withTemporalType(TableTemporalType temporalType) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseColumnProperties(); + } + this.innerProperties().withTemporalType(temporalType); + return this; + } + + /** + * Get the memoryOptimized property: Whether or not the column belongs to a memory optimized table. + * + * @return the memoryOptimized value. + */ + public Boolean memoryOptimized() { + return this.innerProperties() == null ? null : this.innerProperties().memoryOptimized(); + } + + /** + * Set the memoryOptimized property: Whether or not the column belongs to a memory optimized table. + * + * @param memoryOptimized the memoryOptimized value to set. + * @return the DatabaseColumnInner object itself. + */ + public DatabaseColumnInner withMemoryOptimized(Boolean memoryOptimized) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseColumnProperties(); + } + this.innerProperties().withMemoryOptimized(memoryOptimized); + return this; + } + + /** + * Get the isComputed property: Whether or not the column is computed. + * + * @return the isComputed value. + */ + public Boolean isComputed() { + return this.innerProperties() == null ? null : this.innerProperties().isComputed(); + } + + /** + * Set the isComputed property: Whether or not the column is computed. + * + * @param isComputed the isComputed value to set. + * @return the DatabaseColumnInner object itself. + */ + public DatabaseColumnInner withIsComputed(Boolean isComputed) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseColumnProperties(); + } + this.innerProperties().withIsComputed(isComputed); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseColumnProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseColumnProperties.java new file mode 100644 index 0000000000000..f66ed6df1f385 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseColumnProperties.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.models.ColumnDataType; +import com.azure.resourcemanager.sql.generated.models.TableTemporalType; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Database column properties. */ +@Fluent +public final class DatabaseColumnProperties { + /* + * The column data type. + */ + @JsonProperty(value = "columnType") + private ColumnDataType columnType; + + /* + * The table temporal type. + */ + @JsonProperty(value = "temporalType") + private TableTemporalType temporalType; + + /* + * Whether or not the column belongs to a memory optimized table. + */ + @JsonProperty(value = "memoryOptimized") + private Boolean memoryOptimized; + + /* + * Whether or not the column is computed. + */ + @JsonProperty(value = "isComputed") + private Boolean isComputed; + + /** Creates an instance of DatabaseColumnProperties class. */ + public DatabaseColumnProperties() { + } + + /** + * Get the columnType property: The column data type. + * + * @return the columnType value. + */ + public ColumnDataType columnType() { + return this.columnType; + } + + /** + * Set the columnType property: The column data type. + * + * @param columnType the columnType value to set. + * @return the DatabaseColumnProperties object itself. + */ + public DatabaseColumnProperties withColumnType(ColumnDataType columnType) { + this.columnType = columnType; + return this; + } + + /** + * Get the temporalType property: The table temporal type. + * + * @return the temporalType value. + */ + public TableTemporalType temporalType() { + return this.temporalType; + } + + /** + * Set the temporalType property: The table temporal type. + * + * @param temporalType the temporalType value to set. + * @return the DatabaseColumnProperties object itself. + */ + public DatabaseColumnProperties withTemporalType(TableTemporalType temporalType) { + this.temporalType = temporalType; + return this; + } + + /** + * Get the memoryOptimized property: Whether or not the column belongs to a memory optimized table. + * + * @return the memoryOptimized value. + */ + public Boolean memoryOptimized() { + return this.memoryOptimized; + } + + /** + * Set the memoryOptimized property: Whether or not the column belongs to a memory optimized table. + * + * @param memoryOptimized the memoryOptimized value to set. + * @return the DatabaseColumnProperties object itself. + */ + public DatabaseColumnProperties withMemoryOptimized(Boolean memoryOptimized) { + this.memoryOptimized = memoryOptimized; + return this; + } + + /** + * Get the isComputed property: Whether or not the column is computed. + * + * @return the isComputed value. + */ + public Boolean isComputed() { + return this.isComputed; + } + + /** + * Set the isComputed property: Whether or not the column is computed. + * + * @param isComputed the isComputed value to set. + * @return the DatabaseColumnProperties object itself. + */ + public DatabaseColumnProperties withIsComputed(Boolean isComputed) { + this.isComputed = isComputed; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseExtensionsProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseExtensionsProperties.java new file mode 100644 index 0000000000000..28f2fc2bef092 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseExtensionsProperties.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.OperationMode; +import com.azure.resourcemanager.sql.generated.models.StorageKeyType; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Contains the database information after successful export. */ +@Fluent +public final class DatabaseExtensionsProperties { + /* + * Operation Mode. + */ + @JsonProperty(value = "operationMode", required = true) + private OperationMode operationMode; + + /* + * Storage key type. + */ + @JsonProperty(value = "storageKeyType", required = true) + private StorageKeyType storageKeyType; + + /* + * Storage key. + */ + @JsonProperty(value = "storageKey", required = true) + private String storageKey; + + /* + * Storage Uri. + */ + @JsonProperty(value = "storageUri", required = true) + private String storageUri; + + /** Creates an instance of DatabaseExtensionsProperties class. */ + public DatabaseExtensionsProperties() { + } + + /** + * Get the operationMode property: Operation Mode. + * + * @return the operationMode value. + */ + public OperationMode operationMode() { + return this.operationMode; + } + + /** + * Set the operationMode property: Operation Mode. + * + * @param operationMode the operationMode value to set. + * @return the DatabaseExtensionsProperties object itself. + */ + public DatabaseExtensionsProperties withOperationMode(OperationMode operationMode) { + this.operationMode = operationMode; + return this; + } + + /** + * Get the storageKeyType property: Storage key type. + * + * @return the storageKeyType value. + */ + public StorageKeyType storageKeyType() { + return this.storageKeyType; + } + + /** + * Set the storageKeyType property: Storage key type. + * + * @param storageKeyType the storageKeyType value to set. + * @return the DatabaseExtensionsProperties object itself. + */ + public DatabaseExtensionsProperties withStorageKeyType(StorageKeyType storageKeyType) { + this.storageKeyType = storageKeyType; + return this; + } + + /** + * Get the storageKey property: Storage key. + * + * @return the storageKey value. + */ + public String storageKey() { + return this.storageKey; + } + + /** + * Set the storageKey property: Storage key. + * + * @param storageKey the storageKey value to set. + * @return the DatabaseExtensionsProperties object itself. + */ + public DatabaseExtensionsProperties withStorageKey(String storageKey) { + this.storageKey = storageKey; + return this; + } + + /** + * Get the storageUri property: Storage Uri. + * + * @return the storageUri value. + */ + public String storageUri() { + return this.storageUri; + } + + /** + * Set the storageUri property: Storage Uri. + * + * @param storageUri the storageUri value to set. + * @return the DatabaseExtensionsProperties object itself. + */ + public DatabaseExtensionsProperties withStorageUri(String storageUri) { + this.storageUri = storageUri; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (operationMode() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property operationMode in model DatabaseExtensionsProperties")); + } + if (storageKeyType() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property storageKeyType in model DatabaseExtensionsProperties")); + } + if (storageKey() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property storageKey in model DatabaseExtensionsProperties")); + } + if (storageUri() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property storageUri in model DatabaseExtensionsProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DatabaseExtensionsProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseInner.java new file mode 100644 index 0000000000000..3cf75ac8277ba --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseInner.java @@ -0,0 +1,1041 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.resourcemanager.sql.generated.models.AlwaysEncryptedEnclaveType; +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.azure.resourcemanager.sql.generated.models.CatalogCollationType; +import com.azure.resourcemanager.sql.generated.models.CreateMode; +import com.azure.resourcemanager.sql.generated.models.DatabaseIdentity; +import com.azure.resourcemanager.sql.generated.models.DatabaseLicenseType; +import com.azure.resourcemanager.sql.generated.models.DatabaseReadScale; +import com.azure.resourcemanager.sql.generated.models.DatabaseStatus; +import com.azure.resourcemanager.sql.generated.models.SampleName; +import com.azure.resourcemanager.sql.generated.models.SecondaryType; +import com.azure.resourcemanager.sql.generated.models.Sku; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.Map; +import java.util.UUID; + +/** A database resource. */ +@Fluent +public final class DatabaseInner extends Resource { + /* + * The database SKU. + * + * The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU name, + * tier/edition, family, and capacity) that are available to your subscription in an Azure region, use the + * `Capabilities_ListByLocation` REST API or one of the following commands: + * + * ```azurecli + * az sql db list-editions -l -o table + * ```` + * + * ```powershell + * Get-AzSqlServerServiceObjective -Location + * ```` + * + */ + @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; + + /* + * The Azure Active Directory identity of the database. + */ + @JsonProperty(value = "identity") + private DatabaseIdentity identity; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private DatabaseProperties innerProperties; + + /** Creates an instance of DatabaseInner class. */ + public DatabaseInner() { + } + + /** + * Get the sku property: The database SKU. + * + *

The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU name, + * tier/edition, family, and capacity) that are available to your subscription in an Azure region, use the + * `Capabilities_ListByLocation` REST API or one of the following commands: + * + *

```azurecli az sql db list-editions -l <location> -o table ```` + * + *

```powershell Get-AzSqlServerServiceObjective -Location <location> ````. + * + * @return the sku value. + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku property: The database SKU. + * + *

The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU name, + * tier/edition, family, and capacity) that are available to your subscription in an Azure region, use the + * `Capabilities_ListByLocation` REST API or one of the following commands: + * + *

```azurecli az sql db list-editions -l <location> -o table ```` + * + *

```powershell Get-AzSqlServerServiceObjective -Location <location> ````. + * + * @param sku the sku value to set. + * @return the DatabaseInner object itself. + */ + public DatabaseInner withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the kind property: Kind of database. This is metadata used for the Azure portal experience. + * + * @return the kind value. + */ + public String kind() { + return this.kind; + } + + /** + * Get the managedBy property: Resource that manages the database. + * + * @return the managedBy value. + */ + public String managedBy() { + return this.managedBy; + } + + /** + * Get the identity property: The Azure Active Directory identity of the database. + * + * @return the identity value. + */ + public DatabaseIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The Azure Active Directory identity of the database. + * + * @param identity the identity value to set. + * @return the DatabaseInner object itself. + */ + public DatabaseInner withIdentity(DatabaseIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private DatabaseProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public DatabaseInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public DatabaseInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the createMode property: 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. + * + * @return the createMode value. + */ + public CreateMode createMode() { + return this.innerProperties() == null ? null : this.innerProperties().createMode(); + } + + /** + * Set the createMode property: 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. + * + * @param createMode the createMode value to set. + * @return the DatabaseInner object itself. + */ + public DatabaseInner withCreateMode(CreateMode createMode) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseProperties(); + } + this.innerProperties().withCreateMode(createMode); + return this; + } + + /** + * Get the collation property: The collation of the database. + * + * @return the collation value. + */ + public String collation() { + return this.innerProperties() == null ? null : this.innerProperties().collation(); + } + + /** + * Set the collation property: The collation of the database. + * + * @param collation the collation value to set. + * @return the DatabaseInner object itself. + */ + public DatabaseInner withCollation(String collation) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseProperties(); + } + this.innerProperties().withCollation(collation); + return this; + } + + /** + * Get the maxSizeBytes property: The max size of the database expressed in bytes. + * + * @return the maxSizeBytes value. + */ + public Long maxSizeBytes() { + return this.innerProperties() == null ? null : this.innerProperties().maxSizeBytes(); + } + + /** + * Set the maxSizeBytes property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseProperties(); + } + this.innerProperties().withMaxSizeBytes(maxSizeBytes); + return this; + } + + /** + * Get the sampleName property: The name of the sample schema to apply when creating this database. + * + * @return the sampleName value. + */ + public SampleName sampleName() { + return this.innerProperties() == null ? null : this.innerProperties().sampleName(); + } + + /** + * Set the sampleName property: The name of the sample schema to apply when creating this database. + * + * @param sampleName the sampleName value to set. + * @return the DatabaseInner object itself. + */ + public DatabaseInner withSampleName(SampleName sampleName) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseProperties(); + } + this.innerProperties().withSampleName(sampleName); + return this; + } + + /** + * Get the elasticPoolId property: The resource identifier of the elastic pool containing this database. + * + * @return the elasticPoolId value. + */ + public String elasticPoolId() { + return this.innerProperties() == null ? null : this.innerProperties().elasticPoolId(); + } + + /** + * Set the elasticPoolId property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseProperties(); + } + this.innerProperties().withElasticPoolId(elasticPoolId); + return this; + } + + /** + * Get the sourceDatabaseId property: The resource identifier of the source database associated with create + * operation of this database. + * + * @return the sourceDatabaseId value. + */ + public String sourceDatabaseId() { + return this.innerProperties() == null ? null : this.innerProperties().sourceDatabaseId(); + } + + /** + * Set the sourceDatabaseId property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseProperties(); + } + this.innerProperties().withSourceDatabaseId(sourceDatabaseId); + return this; + } + + /** + * Get the status property: The status of the database. + * + * @return the status value. + */ + public DatabaseStatus status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); + } + + /** + * Get the databaseId property: The ID of the database. + * + * @return the databaseId value. + */ + public UUID databaseId() { + return this.innerProperties() == null ? null : this.innerProperties().databaseId(); + } + + /** + * Get the creationDate property: The creation date of the database (ISO8601 format). + * + * @return the creationDate value. + */ + public OffsetDateTime creationDate() { + return this.innerProperties() == null ? null : this.innerProperties().creationDate(); + } + + /** + * Get the currentServiceObjectiveName property: The current service level objective name of the database. + * + * @return the currentServiceObjectiveName value. + */ + public String currentServiceObjectiveName() { + return this.innerProperties() == null ? null : this.innerProperties().currentServiceObjectiveName(); + } + + /** + * Get the requestedServiceObjectiveName property: The requested service level objective name of the database. + * + * @return the requestedServiceObjectiveName value. + */ + public String requestedServiceObjectiveName() { + return this.innerProperties() == null ? null : this.innerProperties().requestedServiceObjectiveName(); + } + + /** + * Get the defaultSecondaryLocation property: The default secondary region for this database. + * + * @return the defaultSecondaryLocation value. + */ + public String defaultSecondaryLocation() { + return this.innerProperties() == null ? null : this.innerProperties().defaultSecondaryLocation(); + } + + /** + * Get the failoverGroupId property: Failover Group resource identifier that this database belongs to. + * + * @return the failoverGroupId value. + */ + public String failoverGroupId() { + return this.innerProperties() == null ? null : this.innerProperties().failoverGroupId(); + } + + /** + * Get the restorePointInTime property: Specifies the point in time (ISO8601 format) of the source database that + * will be restored to create the new database. + * + * @return the restorePointInTime value. + */ + public OffsetDateTime restorePointInTime() { + return this.innerProperties() == null ? null : this.innerProperties().restorePointInTime(); + } + + /** + * Set the restorePointInTime property: 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(OffsetDateTime restorePointInTime) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseProperties(); + } + this.innerProperties().withRestorePointInTime(restorePointInTime); + return this; + } + + /** + * Get the sourceDatabaseDeletionDate property: Specifies the time that the database was deleted. + * + * @return the sourceDatabaseDeletionDate value. + */ + public OffsetDateTime sourceDatabaseDeletionDate() { + return this.innerProperties() == null ? null : this.innerProperties().sourceDatabaseDeletionDate(); + } + + /** + * Set the sourceDatabaseDeletionDate property: Specifies the time that the database was deleted. + * + * @param sourceDatabaseDeletionDate the sourceDatabaseDeletionDate value to set. + * @return the DatabaseInner object itself. + */ + public DatabaseInner withSourceDatabaseDeletionDate(OffsetDateTime sourceDatabaseDeletionDate) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseProperties(); + } + this.innerProperties().withSourceDatabaseDeletionDate(sourceDatabaseDeletionDate); + return this; + } + + /** + * Get the recoveryServicesRecoveryPointId property: The resource identifier of the recovery point associated with + * create operation of this database. + * + * @return the recoveryServicesRecoveryPointId value. + */ + public String recoveryServicesRecoveryPointId() { + return this.innerProperties() == null ? null : this.innerProperties().recoveryServicesRecoveryPointId(); + } + + /** + * Set the recoveryServicesRecoveryPointId property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseProperties(); + } + this.innerProperties().withRecoveryServicesRecoveryPointId(recoveryServicesRecoveryPointId); + return this; + } + + /** + * Get the longTermRetentionBackupResourceId property: 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.innerProperties() == null ? null : this.innerProperties().longTermRetentionBackupResourceId(); + } + + /** + * Set the longTermRetentionBackupResourceId property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseProperties(); + } + this.innerProperties().withLongTermRetentionBackupResourceId(longTermRetentionBackupResourceId); + return this; + } + + /** + * Get the recoverableDatabaseId property: The resource identifier of the recoverable database associated with + * create operation of this database. + * + * @return the recoverableDatabaseId value. + */ + public String recoverableDatabaseId() { + return this.innerProperties() == null ? null : this.innerProperties().recoverableDatabaseId(); + } + + /** + * Set the recoverableDatabaseId property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseProperties(); + } + this.innerProperties().withRecoverableDatabaseId(recoverableDatabaseId); + return this; + } + + /** + * Get the restorableDroppedDatabaseId property: The resource identifier of the restorable dropped database + * associated with create operation of this database. + * + * @return the restorableDroppedDatabaseId value. + */ + public String restorableDroppedDatabaseId() { + return this.innerProperties() == null ? null : this.innerProperties().restorableDroppedDatabaseId(); + } + + /** + * Set the restorableDroppedDatabaseId property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseProperties(); + } + this.innerProperties().withRestorableDroppedDatabaseId(restorableDroppedDatabaseId); + return this; + } + + /** + * Get the catalogCollation property: Collation of the metadata catalog. + * + * @return the catalogCollation value. + */ + public CatalogCollationType catalogCollation() { + return this.innerProperties() == null ? null : this.innerProperties().catalogCollation(); + } + + /** + * Set the catalogCollation property: Collation of the metadata catalog. + * + * @param catalogCollation the catalogCollation value to set. + * @return the DatabaseInner object itself. + */ + public DatabaseInner withCatalogCollation(CatalogCollationType catalogCollation) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseProperties(); + } + this.innerProperties().withCatalogCollation(catalogCollation); + return this; + } + + /** + * Get the zoneRedundant property: 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.innerProperties() == null ? null : this.innerProperties().zoneRedundant(); + } + + /** + * Set the zoneRedundant property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseProperties(); + } + this.innerProperties().withZoneRedundant(zoneRedundant); + return this; + } + + /** + * Get the licenseType property: The license type to apply for this database. `LicenseIncluded` if you need a + * license, or `BasePrice` if you have a license and are eligible for the Azure Hybrid Benefit. + * + * @return the licenseType value. + */ + public DatabaseLicenseType licenseType() { + return this.innerProperties() == null ? null : this.innerProperties().licenseType(); + } + + /** + * Set the licenseType property: The license type to apply for this database. `LicenseIncluded` if you need a + * license, or `BasePrice` if you have a license and are eligible for the Azure Hybrid Benefit. + * + * @param licenseType the licenseType value to set. + * @return the DatabaseInner object itself. + */ + public DatabaseInner withLicenseType(DatabaseLicenseType licenseType) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseProperties(); + } + this.innerProperties().withLicenseType(licenseType); + return this; + } + + /** + * Get the maxLogSizeBytes property: The max log size for this database. + * + * @return the maxLogSizeBytes value. + */ + public Long maxLogSizeBytes() { + return this.innerProperties() == null ? null : this.innerProperties().maxLogSizeBytes(); + } + + /** + * Get the earliestRestoreDate property: This records the earliest start date and time that restore is available for + * this database (ISO8601 format). + * + * @return the earliestRestoreDate value. + */ + public OffsetDateTime earliestRestoreDate() { + return this.innerProperties() == null ? null : this.innerProperties().earliestRestoreDate(); + } + + /** + * Get the readScale property: 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. Not + * applicable to a Hyperscale database within an elastic pool. + * + * @return the readScale value. + */ + public DatabaseReadScale readScale() { + return this.innerProperties() == null ? null : this.innerProperties().readScale(); + } + + /** + * Set the readScale property: 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. Not + * applicable to a Hyperscale database within an elastic pool. + * + * @param readScale the readScale value to set. + * @return the DatabaseInner object itself. + */ + public DatabaseInner withReadScale(DatabaseReadScale readScale) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseProperties(); + } + this.innerProperties().withReadScale(readScale); + return this; + } + + /** + * Get the highAvailabilityReplicaCount property: The number of secondary replicas associated with the database that + * are used to provide high availability. Not applicable to a Hyperscale database within an elastic pool. + * + * @return the highAvailabilityReplicaCount value. + */ + public Integer highAvailabilityReplicaCount() { + return this.innerProperties() == null ? null : this.innerProperties().highAvailabilityReplicaCount(); + } + + /** + * Set the highAvailabilityReplicaCount property: The number of secondary replicas associated with the database that + * are used to provide high availability. Not applicable to a Hyperscale database within an elastic pool. + * + * @param highAvailabilityReplicaCount the highAvailabilityReplicaCount value to set. + * @return the DatabaseInner object itself. + */ + public DatabaseInner withHighAvailabilityReplicaCount(Integer highAvailabilityReplicaCount) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseProperties(); + } + this.innerProperties().withHighAvailabilityReplicaCount(highAvailabilityReplicaCount); + return this; + } + + /** + * Get the secondaryType property: The secondary type of the database if it is a secondary. Valid values are Geo, + * Named and Standby. + * + * @return the secondaryType value. + */ + public SecondaryType secondaryType() { + return this.innerProperties() == null ? null : this.innerProperties().secondaryType(); + } + + /** + * Set the secondaryType property: The secondary type of the database if it is a secondary. Valid values are Geo, + * Named and Standby. + * + * @param secondaryType the secondaryType value to set. + * @return the DatabaseInner object itself. + */ + public DatabaseInner withSecondaryType(SecondaryType secondaryType) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseProperties(); + } + this.innerProperties().withSecondaryType(secondaryType); + return this; + } + + /** + * Get the currentSku property: The name and tier of the SKU. + * + * @return the currentSku value. + */ + public Sku currentSku() { + return this.innerProperties() == null ? null : this.innerProperties().currentSku(); + } + + /** + * Get the autoPauseDelay property: Time in minutes after which database is automatically paused. A value of -1 + * means that automatic pause is disabled. + * + * @return the autoPauseDelay value. + */ + public Integer autoPauseDelay() { + return this.innerProperties() == null ? null : this.innerProperties().autoPauseDelay(); + } + + /** + * Set the autoPauseDelay property: Time in minutes after which database is automatically paused. A value of -1 + * means that automatic pause is disabled. + * + * @param autoPauseDelay the autoPauseDelay value to set. + * @return the DatabaseInner object itself. + */ + public DatabaseInner withAutoPauseDelay(Integer autoPauseDelay) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseProperties(); + } + this.innerProperties().withAutoPauseDelay(autoPauseDelay); + return this; + } + + /** + * Get the currentBackupStorageRedundancy property: The storage account type used to store backups for this + * database. + * + * @return the currentBackupStorageRedundancy value. + */ + public BackupStorageRedundancy currentBackupStorageRedundancy() { + return this.innerProperties() == null ? null : this.innerProperties().currentBackupStorageRedundancy(); + } + + /** + * Get the requestedBackupStorageRedundancy property: The storage account type to be used to store backups for this + * database. + * + * @return the requestedBackupStorageRedundancy value. + */ + public BackupStorageRedundancy requestedBackupStorageRedundancy() { + return this.innerProperties() == null ? null : this.innerProperties().requestedBackupStorageRedundancy(); + } + + /** + * Set the requestedBackupStorageRedundancy property: The storage account type to be used to store backups for this + * database. + * + * @param requestedBackupStorageRedundancy the requestedBackupStorageRedundancy value to set. + * @return the DatabaseInner object itself. + */ + public DatabaseInner withRequestedBackupStorageRedundancy( + BackupStorageRedundancy requestedBackupStorageRedundancy) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseProperties(); + } + this.innerProperties().withRequestedBackupStorageRedundancy(requestedBackupStorageRedundancy); + return this; + } + + /** + * Get the minCapacity property: Minimal capacity that database will always have allocated, if not paused. + * + * @return the minCapacity value. + */ + public Double minCapacity() { + return this.innerProperties() == null ? null : this.innerProperties().minCapacity(); + } + + /** + * Set the minCapacity property: Minimal capacity that database will always have allocated, if not paused. + * + * @param minCapacity the minCapacity value to set. + * @return the DatabaseInner object itself. + */ + public DatabaseInner withMinCapacity(Double minCapacity) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseProperties(); + } + this.innerProperties().withMinCapacity(minCapacity); + return this; + } + + /** + * Get the pausedDate property: The date when database was paused by user configuration or action(ISO8601 format). + * Null if the database is ready. + * + * @return the pausedDate value. + */ + public OffsetDateTime pausedDate() { + return this.innerProperties() == null ? null : this.innerProperties().pausedDate(); + } + + /** + * Get the resumedDate property: The date when database was resumed by user action or database login (ISO8601 + * format). Null if the database is paused. + * + * @return the resumedDate value. + */ + public OffsetDateTime resumedDate() { + return this.innerProperties() == null ? null : this.innerProperties().resumedDate(); + } + + /** + * Get the maintenanceConfigurationId property: Maintenance configuration id assigned to the database. This + * configuration defines the period when the maintenance updates will occur. + * + * @return the maintenanceConfigurationId value. + */ + public String maintenanceConfigurationId() { + return this.innerProperties() == null ? null : this.innerProperties().maintenanceConfigurationId(); + } + + /** + * Set the maintenanceConfigurationId property: Maintenance configuration id assigned to the database. This + * configuration defines the period when the maintenance updates will occur. + * + * @param maintenanceConfigurationId the maintenanceConfigurationId value to set. + * @return the DatabaseInner object itself. + */ + public DatabaseInner withMaintenanceConfigurationId(String maintenanceConfigurationId) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseProperties(); + } + this.innerProperties().withMaintenanceConfigurationId(maintenanceConfigurationId); + return this; + } + + /** + * Get the isLedgerOn property: Whether or not this database is a ledger database, which means all tables in the + * database are ledger tables. Note: the value of this property cannot be changed after the database has been + * created. + * + * @return the isLedgerOn value. + */ + public Boolean isLedgerOn() { + return this.innerProperties() == null ? null : this.innerProperties().isLedgerOn(); + } + + /** + * Set the isLedgerOn property: Whether or not this database is a ledger database, which means all tables in the + * database are ledger tables. Note: the value of this property cannot be changed after the database has been + * created. + * + * @param isLedgerOn the isLedgerOn value to set. + * @return the DatabaseInner object itself. + */ + public DatabaseInner withIsLedgerOn(Boolean isLedgerOn) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseProperties(); + } + this.innerProperties().withIsLedgerOn(isLedgerOn); + return this; + } + + /** + * Get the isInfraEncryptionEnabled property: Infra encryption is enabled for this database. + * + * @return the isInfraEncryptionEnabled value. + */ + public Boolean isInfraEncryptionEnabled() { + return this.innerProperties() == null ? null : this.innerProperties().isInfraEncryptionEnabled(); + } + + /** + * Get the federatedClientId property: The Client id used for cross tenant per database CMK scenario. + * + * @return the federatedClientId value. + */ + public UUID federatedClientId() { + return this.innerProperties() == null ? null : this.innerProperties().federatedClientId(); + } + + /** + * Set the federatedClientId property: The Client id used for cross tenant per database CMK scenario. + * + * @param federatedClientId the federatedClientId value to set. + * @return the DatabaseInner object itself. + */ + public DatabaseInner withFederatedClientId(UUID federatedClientId) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseProperties(); + } + this.innerProperties().withFederatedClientId(federatedClientId); + return this; + } + + /** + * Get the preferredEnclaveType property: Type of enclave requested on the database i.e. Default or VBS enclaves. + * + * @return the preferredEnclaveType value. + */ + public AlwaysEncryptedEnclaveType preferredEnclaveType() { + return this.innerProperties() == null ? null : this.innerProperties().preferredEnclaveType(); + } + + /** + * Set the preferredEnclaveType property: Type of enclave requested on the database i.e. Default or VBS enclaves. + * + * @param preferredEnclaveType the preferredEnclaveType value to set. + * @return the DatabaseInner object itself. + */ + public DatabaseInner withPreferredEnclaveType(AlwaysEncryptedEnclaveType preferredEnclaveType) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseProperties(); + } + this.innerProperties().withPreferredEnclaveType(preferredEnclaveType); + return this; + } + + /** + * Get the sourceResourceId property: The resource identifier of the source associated with the create operation of + * this database. + * + *

This property is only supported for DataWarehouse edition and allows to restore across subscriptions. + * + *

When sourceResourceId is specified, sourceDatabaseId, recoverableDatabaseId, restorableDroppedDatabaseId and + * sourceDatabaseDeletionDate must not be specified and CreateMode must be PointInTimeRestore, Restore or Recover. + * + *

When createMode is PointInTimeRestore, sourceResourceId must be the resource ID of the existing database or + * existing sql pool, and restorePointInTime must be specified. + * + *

When createMode is Restore, sourceResourceId must be the resource ID of restorable dropped database or + * restorable dropped sql pool. + * + *

When createMode is Recover, sourceResourceId must be the resource ID of recoverable database or recoverable + * sql pool. + * + *

When source subscription belongs to a different tenant than target subscription, + * “x-ms-authorization-auxiliary” header must contain authentication token for the source tenant. For more details + * about “x-ms-authorization-auxiliary” header see + * https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/authenticate-multi-tenant. + * + * @return the sourceResourceId value. + */ + public String sourceResourceId() { + return this.innerProperties() == null ? null : this.innerProperties().sourceResourceId(); + } + + /** + * Set the sourceResourceId property: The resource identifier of the source associated with the create operation of + * this database. + * + *

This property is only supported for DataWarehouse edition and allows to restore across subscriptions. + * + *

When sourceResourceId is specified, sourceDatabaseId, recoverableDatabaseId, restorableDroppedDatabaseId and + * sourceDatabaseDeletionDate must not be specified and CreateMode must be PointInTimeRestore, Restore or Recover. + * + *

When createMode is PointInTimeRestore, sourceResourceId must be the resource ID of the existing database or + * existing sql pool, and restorePointInTime must be specified. + * + *

When createMode is Restore, sourceResourceId must be the resource ID of restorable dropped database or + * restorable dropped sql pool. + * + *

When createMode is Recover, sourceResourceId must be the resource ID of recoverable database or recoverable + * sql pool. + * + *

When source subscription belongs to a different tenant than target subscription, + * “x-ms-authorization-auxiliary” header must contain authentication token for the source tenant. For more details + * about “x-ms-authorization-auxiliary” header see + * https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/authenticate-multi-tenant. + * + * @param sourceResourceId the sourceResourceId value to set. + * @return the DatabaseInner object itself. + */ + public DatabaseInner withSourceResourceId(String sourceResourceId) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseProperties(); + } + this.innerProperties().withSourceResourceId(sourceResourceId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + if (identity() != null) { + identity().validate(); + } + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseOperationInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseOperationInner.java new file mode 100644 index 0000000000000..2fb16f3a1f1e7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseOperationInner.java @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.ManagementOperationState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** A database operation. */ +@Immutable +public final class DatabaseOperationInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private DatabaseOperationProperties innerProperties; + + /** Creates an instance of DatabaseOperationInner class. */ + public DatabaseOperationInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private DatabaseOperationProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the databaseName property: The name of the database the operation is being performed on. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.innerProperties() == null ? null : this.innerProperties().databaseName(); + } + + /** + * Get the operation property: The name of operation. + * + * @return the operation value. + */ + public String operation() { + return this.innerProperties() == null ? null : this.innerProperties().operation(); + } + + /** + * Get the operationFriendlyName property: The friendly name of operation. + * + * @return the operationFriendlyName value. + */ + public String operationFriendlyName() { + return this.innerProperties() == null ? null : this.innerProperties().operationFriendlyName(); + } + + /** + * Get the percentComplete property: The percentage of the operation completed. + * + * @return the percentComplete value. + */ + public Integer percentComplete() { + return this.innerProperties() == null ? null : this.innerProperties().percentComplete(); + } + + /** + * Get the serverName property: The name of the server. + * + * @return the serverName value. + */ + public String serverName() { + return this.innerProperties() == null ? null : this.innerProperties().serverName(); + } + + /** + * Get the startTime property: The operation start time. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.innerProperties() == null ? null : this.innerProperties().startTime(); + } + + /** + * Get the state property: The operation state. + * + * @return the state value. + */ + public ManagementOperationState state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Get the errorCode property: The operation error code. + * + * @return the errorCode value. + */ + public Integer errorCode() { + return this.innerProperties() == null ? null : this.innerProperties().errorCode(); + } + + /** + * Get the errorDescription property: The operation error description. + * + * @return the errorDescription value. + */ + public String errorDescription() { + return this.innerProperties() == null ? null : this.innerProperties().errorDescription(); + } + + /** + * Get the errorSeverity property: The operation error severity. + * + * @return the errorSeverity value. + */ + public Integer errorSeverity() { + return this.innerProperties() == null ? null : this.innerProperties().errorSeverity(); + } + + /** + * Get the isUserError property: Whether or not the error is a user error. + * + * @return the isUserError value. + */ + public Boolean isUserError() { + return this.innerProperties() == null ? null : this.innerProperties().isUserError(); + } + + /** + * Get the estimatedCompletionTime property: The estimated completion time of the operation. + * + * @return the estimatedCompletionTime value. + */ + public OffsetDateTime estimatedCompletionTime() { + return this.innerProperties() == null ? null : this.innerProperties().estimatedCompletionTime(); + } + + /** + * Get the description property: The operation description. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Get the isCancellable property: Whether the operation can be cancelled. + * + * @return the isCancellable value. + */ + public Boolean isCancellable() { + return this.innerProperties() == null ? null : this.innerProperties().isCancellable(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseOperationProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseOperationProperties.java new file mode 100644 index 0000000000000..6b17fb7bf7a70 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseOperationProperties.java @@ -0,0 +1,236 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.models.ManagementOperationState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The properties of a database operation. */ +@Immutable +public final class DatabaseOperationProperties { + /* + * The name of the database the operation is being performed on. + */ + @JsonProperty(value = "databaseName", access = JsonProperty.Access.WRITE_ONLY) + private String databaseName; + + /* + * The name of operation. + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /* + * The friendly name of operation. + */ + @JsonProperty(value = "operationFriendlyName", access = JsonProperty.Access.WRITE_ONLY) + private String operationFriendlyName; + + /* + * The percentage of the operation completed. + */ + @JsonProperty(value = "percentComplete", access = JsonProperty.Access.WRITE_ONLY) + private Integer percentComplete; + + /* + * The name of the server. + */ + @JsonProperty(value = "serverName", access = JsonProperty.Access.WRITE_ONLY) + private String serverName; + + /* + * The operation start time. + */ + @JsonProperty(value = "startTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime startTime; + + /* + * The operation state. + */ + @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) + private ManagementOperationState state; + + /* + * The operation error code. + */ + @JsonProperty(value = "errorCode", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorCode; + + /* + * The operation error description. + */ + @JsonProperty(value = "errorDescription", access = JsonProperty.Access.WRITE_ONLY) + private String errorDescription; + + /* + * The operation error severity. + */ + @JsonProperty(value = "errorSeverity", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorSeverity; + + /* + * Whether or not the error is a user error. + */ + @JsonProperty(value = "isUserError", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isUserError; + + /* + * The estimated completion time of the operation. + */ + @JsonProperty(value = "estimatedCompletionTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime estimatedCompletionTime; + + /* + * The operation description. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /* + * Whether the operation can be cancelled. + */ + @JsonProperty(value = "isCancellable", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isCancellable; + + /** Creates an instance of DatabaseOperationProperties class. */ + public DatabaseOperationProperties() { + } + + /** + * Get the databaseName property: The name of the database the operation is being performed on. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Get the operation property: The name of operation. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the operationFriendlyName property: The friendly name of operation. + * + * @return the operationFriendlyName value. + */ + public String operationFriendlyName() { + return this.operationFriendlyName; + } + + /** + * Get the percentComplete property: The percentage of the operation completed. + * + * @return the percentComplete value. + */ + public Integer percentComplete() { + return this.percentComplete; + } + + /** + * Get the serverName property: The name of the server. + * + * @return the serverName value. + */ + public String serverName() { + return this.serverName; + } + + /** + * Get the startTime property: The operation start time. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Get the state property: The operation state. + * + * @return the state value. + */ + public ManagementOperationState state() { + return this.state; + } + + /** + * Get the errorCode property: The operation error code. + * + * @return the errorCode value. + */ + public Integer errorCode() { + return this.errorCode; + } + + /** + * Get the errorDescription property: The operation error description. + * + * @return the errorDescription value. + */ + public String errorDescription() { + return this.errorDescription; + } + + /** + * Get the errorSeverity property: The operation error severity. + * + * @return the errorSeverity value. + */ + public Integer errorSeverity() { + return this.errorSeverity; + } + + /** + * Get the isUserError property: Whether or not the error is a user error. + * + * @return the isUserError value. + */ + public Boolean isUserError() { + return this.isUserError; + } + + /** + * Get the estimatedCompletionTime property: The estimated completion time of the operation. + * + * @return the estimatedCompletionTime value. + */ + public OffsetDateTime estimatedCompletionTime() { + return this.estimatedCompletionTime; + } + + /** + * Get the description property: The operation description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the isCancellable property: Whether the operation can be cancelled. + * + * @return the isCancellable value. + */ + public Boolean isCancellable() { + return this.isCancellable; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseProperties.java new file mode 100644 index 0000000000000..e2ee27fd784f9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseProperties.java @@ -0,0 +1,1109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.models.AlwaysEncryptedEnclaveType; +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.azure.resourcemanager.sql.generated.models.CatalogCollationType; +import com.azure.resourcemanager.sql.generated.models.CreateMode; +import com.azure.resourcemanager.sql.generated.models.DatabaseLicenseType; +import com.azure.resourcemanager.sql.generated.models.DatabaseReadScale; +import com.azure.resourcemanager.sql.generated.models.DatabaseStatus; +import com.azure.resourcemanager.sql.generated.models.SampleName; +import com.azure.resourcemanager.sql.generated.models.SecondaryType; +import com.azure.resourcemanager.sql.generated.models.Sku; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.UUID; + +/** The database's properties. */ +@Fluent +public final class DatabaseProperties { + /* + * 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. + */ + @JsonProperty(value = "createMode") + private CreateMode createMode; + + /* + * The collation of the database. + */ + @JsonProperty(value = "collation") + private String collation; + + /* + * The max size of the database expressed in bytes. + */ + @JsonProperty(value = "maxSizeBytes") + private Long maxSizeBytes; + + /* + * The name of the sample schema to apply when creating this database. + */ + @JsonProperty(value = "sampleName") + private SampleName sampleName; + + /* + * The resource identifier of the elastic pool containing this database. + */ + @JsonProperty(value = "elasticPoolId") + private String elasticPoolId; + + /* + * The resource identifier of the source database associated with create operation of this database. + */ + @JsonProperty(value = "sourceDatabaseId") + private String sourceDatabaseId; + + /* + * The status of the database. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private DatabaseStatus status; + + /* + * The ID of the database. + */ + @JsonProperty(value = "databaseId", access = JsonProperty.Access.WRITE_ONLY) + private UUID databaseId; + + /* + * The creation date of the database (ISO8601 format). + */ + @JsonProperty(value = "creationDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime creationDate; + + /* + * The current service level objective name of the database. + */ + @JsonProperty(value = "currentServiceObjectiveName", access = JsonProperty.Access.WRITE_ONLY) + private String currentServiceObjectiveName; + + /* + * The requested service level objective name of the database. + */ + @JsonProperty(value = "requestedServiceObjectiveName", access = JsonProperty.Access.WRITE_ONLY) + private String requestedServiceObjectiveName; + + /* + * The default secondary region for this database. + */ + @JsonProperty(value = "defaultSecondaryLocation", access = JsonProperty.Access.WRITE_ONLY) + private String defaultSecondaryLocation; + + /* + * Failover Group resource identifier that this database belongs to. + */ + @JsonProperty(value = "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 = "restorePointInTime") + private OffsetDateTime restorePointInTime; + + /* + * Specifies the time that the database was deleted. + */ + @JsonProperty(value = "sourceDatabaseDeletionDate") + private OffsetDateTime sourceDatabaseDeletionDate; + + /* + * The resource identifier of the recovery point associated with create operation of this database. + */ + @JsonProperty(value = "recoveryServicesRecoveryPointId") + private String recoveryServicesRecoveryPointId; + + /* + * The resource identifier of the long term retention backup associated with create operation of this database. + */ + @JsonProperty(value = "longTermRetentionBackupResourceId") + private String longTermRetentionBackupResourceId; + + /* + * The resource identifier of the recoverable database associated with create operation of this database. + */ + @JsonProperty(value = "recoverableDatabaseId") + private String recoverableDatabaseId; + + /* + * The resource identifier of the restorable dropped database associated with create operation of this database. + */ + @JsonProperty(value = "restorableDroppedDatabaseId") + private String restorableDroppedDatabaseId; + + /* + * Collation of the metadata catalog. + */ + @JsonProperty(value = "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 = "zoneRedundant") + private Boolean zoneRedundant; + + /* + * The license type to apply for this database. `LicenseIncluded` if you need a license, or `BasePrice` if you have + * a license and are eligible for the Azure Hybrid Benefit. + */ + @JsonProperty(value = "licenseType") + private DatabaseLicenseType licenseType; + + /* + * The max log size for this database. + */ + @JsonProperty(value = "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 = "earliestRestoreDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime 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. Not applicable to a + * Hyperscale database within an elastic pool. + */ + @JsonProperty(value = "readScale") + private DatabaseReadScale readScale; + + /* + * The number of secondary replicas associated with the database that are used to provide high availability. Not + * applicable to a Hyperscale database within an elastic pool. + */ + @JsonProperty(value = "highAvailabilityReplicaCount") + private Integer highAvailabilityReplicaCount; + + /* + * The secondary type of the database if it is a secondary. Valid values are Geo, Named and Standby. + */ + @JsonProperty(value = "secondaryType") + private SecondaryType secondaryType; + + /* + * The name and tier of the SKU. + */ + @JsonProperty(value = "currentSku", access = JsonProperty.Access.WRITE_ONLY) + private Sku currentSku; + + /* + * Time in minutes after which database is automatically paused. A value of -1 means that automatic pause is + * disabled + */ + @JsonProperty(value = "autoPauseDelay") + private Integer autoPauseDelay; + + /* + * The storage account type used to store backups for this database. + */ + @JsonProperty(value = "currentBackupStorageRedundancy", access = JsonProperty.Access.WRITE_ONLY) + private BackupStorageRedundancy currentBackupStorageRedundancy; + + /* + * The storage account type to be used to store backups for this database. + */ + @JsonProperty(value = "requestedBackupStorageRedundancy") + private BackupStorageRedundancy requestedBackupStorageRedundancy; + + /* + * Minimal capacity that database will always have allocated, if not paused + */ + @JsonProperty(value = "minCapacity") + private Double minCapacity; + + /* + * The date when database was paused by user configuration or action(ISO8601 format). Null if the database is + * ready. + */ + @JsonProperty(value = "pausedDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime pausedDate; + + /* + * The date when database was resumed by user action or database login (ISO8601 format). Null if the database is + * paused. + */ + @JsonProperty(value = "resumedDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime resumedDate; + + /* + * Maintenance configuration id assigned to the database. This configuration defines the period when the + * maintenance updates will occur. + */ + @JsonProperty(value = "maintenanceConfigurationId") + private String maintenanceConfigurationId; + + /* + * Whether or not this database is a ledger database, which means all tables in the database are ledger tables. + * Note: the value of this property cannot be changed after the database has been created. + */ + @JsonProperty(value = "isLedgerOn") + private Boolean isLedgerOn; + + /* + * Infra encryption is enabled for this database. + */ + @JsonProperty(value = "isInfraEncryptionEnabled", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isInfraEncryptionEnabled; + + /* + * The Client id used for cross tenant per database CMK scenario + */ + @JsonProperty(value = "federatedClientId") + private UUID federatedClientId; + + /* + * Type of enclave requested on the database i.e. Default or VBS enclaves. + */ + @JsonProperty(value = "preferredEnclaveType") + private AlwaysEncryptedEnclaveType preferredEnclaveType; + + /* + * The resource identifier of the source associated with the create operation of this database. + * + * This property is only supported for DataWarehouse edition and allows to restore across subscriptions. + * + * When sourceResourceId is specified, sourceDatabaseId, recoverableDatabaseId, restorableDroppedDatabaseId and + * sourceDatabaseDeletionDate must not be specified and CreateMode must be PointInTimeRestore, Restore or Recover. + * + * When createMode is PointInTimeRestore, sourceResourceId must be the resource ID of the existing database or + * existing sql pool, and restorePointInTime must be specified. + * + * When createMode is Restore, sourceResourceId must be the resource ID of restorable dropped database or + * restorable dropped sql pool. + * + * When createMode is Recover, sourceResourceId must be the resource ID of recoverable database or recoverable sql + * pool. + * + * When source subscription belongs to a different tenant than target subscription, “x-ms-authorization-auxiliary” + * header must contain authentication token for the source tenant. For more details about + * “x-ms-authorization-auxiliary” header see + * https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/authenticate-multi-tenant + */ + @JsonProperty(value = "sourceResourceId") + private String sourceResourceId; + + /** Creates an instance of DatabaseProperties class. */ + public DatabaseProperties() { + } + + /** + * Get the createMode property: 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. + * + * @return the createMode value. + */ + public CreateMode createMode() { + return this.createMode; + } + + /** + * Set the createMode property: 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. + * + * @param createMode the createMode value to set. + * @return the DatabaseProperties object itself. + */ + public DatabaseProperties withCreateMode(CreateMode createMode) { + this.createMode = createMode; + return this; + } + + /** + * Get the collation property: The collation of the database. + * + * @return the collation value. + */ + public String collation() { + return this.collation; + } + + /** + * Set the collation property: The collation of the database. + * + * @param collation the collation value to set. + * @return the DatabaseProperties object itself. + */ + public DatabaseProperties withCollation(String collation) { + this.collation = collation; + return this; + } + + /** + * Get the maxSizeBytes property: The max size of the database expressed in bytes. + * + * @return the maxSizeBytes value. + */ + public Long maxSizeBytes() { + return this.maxSizeBytes; + } + + /** + * Set the maxSizeBytes property: The max size of the database expressed in bytes. + * + * @param maxSizeBytes the maxSizeBytes value to set. + * @return the DatabaseProperties object itself. + */ + public DatabaseProperties withMaxSizeBytes(Long maxSizeBytes) { + this.maxSizeBytes = maxSizeBytes; + return this; + } + + /** + * Get the sampleName property: The name of the sample schema to apply when creating this database. + * + * @return the sampleName value. + */ + public SampleName sampleName() { + return this.sampleName; + } + + /** + * Set the sampleName property: The name of the sample schema to apply when creating this database. + * + * @param sampleName the sampleName value to set. + * @return the DatabaseProperties object itself. + */ + public DatabaseProperties withSampleName(SampleName sampleName) { + this.sampleName = sampleName; + return this; + } + + /** + * Get the elasticPoolId property: The resource identifier of the elastic pool containing this database. + * + * @return the elasticPoolId value. + */ + public String elasticPoolId() { + return this.elasticPoolId; + } + + /** + * Set the elasticPoolId property: The resource identifier of the elastic pool containing this database. + * + * @param elasticPoolId the elasticPoolId value to set. + * @return the DatabaseProperties object itself. + */ + public DatabaseProperties withElasticPoolId(String elasticPoolId) { + this.elasticPoolId = elasticPoolId; + return this; + } + + /** + * Get the sourceDatabaseId property: 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 sourceDatabaseId property: The resource identifier of the source database associated with create + * operation of this database. + * + * @param sourceDatabaseId the sourceDatabaseId value to set. + * @return the DatabaseProperties object itself. + */ + public DatabaseProperties withSourceDatabaseId(String sourceDatabaseId) { + this.sourceDatabaseId = sourceDatabaseId; + return this; + } + + /** + * Get the status property: The status of the database. + * + * @return the status value. + */ + public DatabaseStatus status() { + return this.status; + } + + /** + * Get the databaseId property: The ID of the database. + * + * @return the databaseId value. + */ + public UUID databaseId() { + return this.databaseId; + } + + /** + * Get the creationDate property: The creation date of the database (ISO8601 format). + * + * @return the creationDate value. + */ + public OffsetDateTime creationDate() { + return this.creationDate; + } + + /** + * Get the currentServiceObjectiveName property: The current service level objective name of the database. + * + * @return the currentServiceObjectiveName value. + */ + public String currentServiceObjectiveName() { + return this.currentServiceObjectiveName; + } + + /** + * Get the requestedServiceObjectiveName property: The requested service level objective name of the database. + * + * @return the requestedServiceObjectiveName value. + */ + public String requestedServiceObjectiveName() { + return this.requestedServiceObjectiveName; + } + + /** + * Get the defaultSecondaryLocation property: The default secondary region for this database. + * + * @return the defaultSecondaryLocation value. + */ + public String defaultSecondaryLocation() { + return this.defaultSecondaryLocation; + } + + /** + * Get the failoverGroupId property: Failover Group resource identifier that this database belongs to. + * + * @return the failoverGroupId value. + */ + public String failoverGroupId() { + return this.failoverGroupId; + } + + /** + * Get the restorePointInTime property: Specifies the point in time (ISO8601 format) of the source database that + * will be restored to create the new database. + * + * @return the restorePointInTime value. + */ + public OffsetDateTime restorePointInTime() { + return this.restorePointInTime; + } + + /** + * Set the restorePointInTime property: 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 DatabaseProperties object itself. + */ + public DatabaseProperties withRestorePointInTime(OffsetDateTime restorePointInTime) { + this.restorePointInTime = restorePointInTime; + return this; + } + + /** + * Get the sourceDatabaseDeletionDate property: Specifies the time that the database was deleted. + * + * @return the sourceDatabaseDeletionDate value. + */ + public OffsetDateTime sourceDatabaseDeletionDate() { + return this.sourceDatabaseDeletionDate; + } + + /** + * Set the sourceDatabaseDeletionDate property: Specifies the time that the database was deleted. + * + * @param sourceDatabaseDeletionDate the sourceDatabaseDeletionDate value to set. + * @return the DatabaseProperties object itself. + */ + public DatabaseProperties withSourceDatabaseDeletionDate(OffsetDateTime sourceDatabaseDeletionDate) { + this.sourceDatabaseDeletionDate = sourceDatabaseDeletionDate; + return this; + } + + /** + * Get the recoveryServicesRecoveryPointId property: 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 recoveryServicesRecoveryPointId property: The resource identifier of the recovery point associated with + * create operation of this database. + * + * @param recoveryServicesRecoveryPointId the recoveryServicesRecoveryPointId value to set. + * @return the DatabaseProperties object itself. + */ + public DatabaseProperties withRecoveryServicesRecoveryPointId(String recoveryServicesRecoveryPointId) { + this.recoveryServicesRecoveryPointId = recoveryServicesRecoveryPointId; + return this; + } + + /** + * Get the longTermRetentionBackupResourceId property: 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 longTermRetentionBackupResourceId property: 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 DatabaseProperties object itself. + */ + public DatabaseProperties withLongTermRetentionBackupResourceId(String longTermRetentionBackupResourceId) { + this.longTermRetentionBackupResourceId = longTermRetentionBackupResourceId; + return this; + } + + /** + * Get the recoverableDatabaseId property: 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 recoverableDatabaseId property: The resource identifier of the recoverable database associated with + * create operation of this database. + * + * @param recoverableDatabaseId the recoverableDatabaseId value to set. + * @return the DatabaseProperties object itself. + */ + public DatabaseProperties withRecoverableDatabaseId(String recoverableDatabaseId) { + this.recoverableDatabaseId = recoverableDatabaseId; + return this; + } + + /** + * Get the restorableDroppedDatabaseId property: 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 restorableDroppedDatabaseId property: The resource identifier of the restorable dropped database + * associated with create operation of this database. + * + * @param restorableDroppedDatabaseId the restorableDroppedDatabaseId value to set. + * @return the DatabaseProperties object itself. + */ + public DatabaseProperties withRestorableDroppedDatabaseId(String restorableDroppedDatabaseId) { + this.restorableDroppedDatabaseId = restorableDroppedDatabaseId; + return this; + } + + /** + * Get the catalogCollation property: Collation of the metadata catalog. + * + * @return the catalogCollation value. + */ + public CatalogCollationType catalogCollation() { + return this.catalogCollation; + } + + /** + * Set the catalogCollation property: Collation of the metadata catalog. + * + * @param catalogCollation the catalogCollation value to set. + * @return the DatabaseProperties object itself. + */ + public DatabaseProperties withCatalogCollation(CatalogCollationType catalogCollation) { + this.catalogCollation = catalogCollation; + return this; + } + + /** + * Get the zoneRedundant property: 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 the zoneRedundant property: 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 DatabaseProperties object itself. + */ + public DatabaseProperties withZoneRedundant(Boolean zoneRedundant) { + this.zoneRedundant = zoneRedundant; + return this; + } + + /** + * Get the licenseType property: The license type to apply for this database. `LicenseIncluded` if you need a + * license, or `BasePrice` if you have a license and are eligible for the Azure Hybrid Benefit. + * + * @return the licenseType value. + */ + public DatabaseLicenseType licenseType() { + return this.licenseType; + } + + /** + * Set the licenseType property: The license type to apply for this database. `LicenseIncluded` if you need a + * license, or `BasePrice` if you have a license and are eligible for the Azure Hybrid Benefit. + * + * @param licenseType the licenseType value to set. + * @return the DatabaseProperties object itself. + */ + public DatabaseProperties withLicenseType(DatabaseLicenseType licenseType) { + this.licenseType = licenseType; + return this; + } + + /** + * Get the maxLogSizeBytes property: The max log size for this database. + * + * @return the maxLogSizeBytes value. + */ + public Long maxLogSizeBytes() { + return this.maxLogSizeBytes; + } + + /** + * Get the earliestRestoreDate property: This records the earliest start date and time that restore is available for + * this database (ISO8601 format). + * + * @return the earliestRestoreDate value. + */ + public OffsetDateTime earliestRestoreDate() { + return this.earliestRestoreDate; + } + + /** + * Get the readScale property: 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. Not + * applicable to a Hyperscale database within an elastic pool. + * + * @return the readScale value. + */ + public DatabaseReadScale readScale() { + return this.readScale; + } + + /** + * Set the readScale property: 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. Not + * applicable to a Hyperscale database within an elastic pool. + * + * @param readScale the readScale value to set. + * @return the DatabaseProperties object itself. + */ + public DatabaseProperties withReadScale(DatabaseReadScale readScale) { + this.readScale = readScale; + return this; + } + + /** + * Get the highAvailabilityReplicaCount property: The number of secondary replicas associated with the database that + * are used to provide high availability. Not applicable to a Hyperscale database within an elastic pool. + * + * @return the highAvailabilityReplicaCount value. + */ + public Integer highAvailabilityReplicaCount() { + return this.highAvailabilityReplicaCount; + } + + /** + * Set the highAvailabilityReplicaCount property: The number of secondary replicas associated with the database that + * are used to provide high availability. Not applicable to a Hyperscale database within an elastic pool. + * + * @param highAvailabilityReplicaCount the highAvailabilityReplicaCount value to set. + * @return the DatabaseProperties object itself. + */ + public DatabaseProperties withHighAvailabilityReplicaCount(Integer highAvailabilityReplicaCount) { + this.highAvailabilityReplicaCount = highAvailabilityReplicaCount; + return this; + } + + /** + * Get the secondaryType property: The secondary type of the database if it is a secondary. Valid values are Geo, + * Named and Standby. + * + * @return the secondaryType value. + */ + public SecondaryType secondaryType() { + return this.secondaryType; + } + + /** + * Set the secondaryType property: The secondary type of the database if it is a secondary. Valid values are Geo, + * Named and Standby. + * + * @param secondaryType the secondaryType value to set. + * @return the DatabaseProperties object itself. + */ + public DatabaseProperties withSecondaryType(SecondaryType secondaryType) { + this.secondaryType = secondaryType; + return this; + } + + /** + * Get the currentSku property: The name and tier of the SKU. + * + * @return the currentSku value. + */ + public Sku currentSku() { + return this.currentSku; + } + + /** + * Get the autoPauseDelay property: Time in minutes after which database is automatically paused. A value of -1 + * means that automatic pause is disabled. + * + * @return the autoPauseDelay value. + */ + public Integer autoPauseDelay() { + return this.autoPauseDelay; + } + + /** + * Set the autoPauseDelay property: Time in minutes after which database is automatically paused. A value of -1 + * means that automatic pause is disabled. + * + * @param autoPauseDelay the autoPauseDelay value to set. + * @return the DatabaseProperties object itself. + */ + public DatabaseProperties withAutoPauseDelay(Integer autoPauseDelay) { + this.autoPauseDelay = autoPauseDelay; + return this; + } + + /** + * Get the currentBackupStorageRedundancy property: The storage account type used to store backups for this + * database. + * + * @return the currentBackupStorageRedundancy value. + */ + public BackupStorageRedundancy currentBackupStorageRedundancy() { + return this.currentBackupStorageRedundancy; + } + + /** + * Get the requestedBackupStorageRedundancy property: The storage account type to be used to store backups for this + * database. + * + * @return the requestedBackupStorageRedundancy value. + */ + public BackupStorageRedundancy requestedBackupStorageRedundancy() { + return this.requestedBackupStorageRedundancy; + } + + /** + * Set the requestedBackupStorageRedundancy property: The storage account type to be used to store backups for this + * database. + * + * @param requestedBackupStorageRedundancy the requestedBackupStorageRedundancy value to set. + * @return the DatabaseProperties object itself. + */ + public DatabaseProperties withRequestedBackupStorageRedundancy( + BackupStorageRedundancy requestedBackupStorageRedundancy) { + this.requestedBackupStorageRedundancy = requestedBackupStorageRedundancy; + return this; + } + + /** + * Get the minCapacity property: Minimal capacity that database will always have allocated, if not paused. + * + * @return the minCapacity value. + */ + public Double minCapacity() { + return this.minCapacity; + } + + /** + * Set the minCapacity property: Minimal capacity that database will always have allocated, if not paused. + * + * @param minCapacity the minCapacity value to set. + * @return the DatabaseProperties object itself. + */ + public DatabaseProperties withMinCapacity(Double minCapacity) { + this.minCapacity = minCapacity; + return this; + } + + /** + * Get the pausedDate property: The date when database was paused by user configuration or action(ISO8601 format). + * Null if the database is ready. + * + * @return the pausedDate value. + */ + public OffsetDateTime pausedDate() { + return this.pausedDate; + } + + /** + * Get the resumedDate property: The date when database was resumed by user action or database login (ISO8601 + * format). Null if the database is paused. + * + * @return the resumedDate value. + */ + public OffsetDateTime resumedDate() { + return this.resumedDate; + } + + /** + * Get the maintenanceConfigurationId property: Maintenance configuration id assigned to the database. This + * configuration defines the period when the maintenance updates will occur. + * + * @return the maintenanceConfigurationId value. + */ + public String maintenanceConfigurationId() { + return this.maintenanceConfigurationId; + } + + /** + * Set the maintenanceConfigurationId property: Maintenance configuration id assigned to the database. This + * configuration defines the period when the maintenance updates will occur. + * + * @param maintenanceConfigurationId the maintenanceConfigurationId value to set. + * @return the DatabaseProperties object itself. + */ + public DatabaseProperties withMaintenanceConfigurationId(String maintenanceConfigurationId) { + this.maintenanceConfigurationId = maintenanceConfigurationId; + return this; + } + + /** + * Get the isLedgerOn property: Whether or not this database is a ledger database, which means all tables in the + * database are ledger tables. Note: the value of this property cannot be changed after the database has been + * created. + * + * @return the isLedgerOn value. + */ + public Boolean isLedgerOn() { + return this.isLedgerOn; + } + + /** + * Set the isLedgerOn property: Whether or not this database is a ledger database, which means all tables in the + * database are ledger tables. Note: the value of this property cannot be changed after the database has been + * created. + * + * @param isLedgerOn the isLedgerOn value to set. + * @return the DatabaseProperties object itself. + */ + public DatabaseProperties withIsLedgerOn(Boolean isLedgerOn) { + this.isLedgerOn = isLedgerOn; + return this; + } + + /** + * Get the isInfraEncryptionEnabled property: Infra encryption is enabled for this database. + * + * @return the isInfraEncryptionEnabled value. + */ + public Boolean isInfraEncryptionEnabled() { + return this.isInfraEncryptionEnabled; + } + + /** + * Get the federatedClientId property: The Client id used for cross tenant per database CMK scenario. + * + * @return the federatedClientId value. + */ + public UUID federatedClientId() { + return this.federatedClientId; + } + + /** + * Set the federatedClientId property: The Client id used for cross tenant per database CMK scenario. + * + * @param federatedClientId the federatedClientId value to set. + * @return the DatabaseProperties object itself. + */ + public DatabaseProperties withFederatedClientId(UUID federatedClientId) { + this.federatedClientId = federatedClientId; + return this; + } + + /** + * Get the preferredEnclaveType property: Type of enclave requested on the database i.e. Default or VBS enclaves. + * + * @return the preferredEnclaveType value. + */ + public AlwaysEncryptedEnclaveType preferredEnclaveType() { + return this.preferredEnclaveType; + } + + /** + * Set the preferredEnclaveType property: Type of enclave requested on the database i.e. Default or VBS enclaves. + * + * @param preferredEnclaveType the preferredEnclaveType value to set. + * @return the DatabaseProperties object itself. + */ + public DatabaseProperties withPreferredEnclaveType(AlwaysEncryptedEnclaveType preferredEnclaveType) { + this.preferredEnclaveType = preferredEnclaveType; + return this; + } + + /** + * Get the sourceResourceId property: The resource identifier of the source associated with the create operation of + * this database. + * + *

This property is only supported for DataWarehouse edition and allows to restore across subscriptions. + * + *

When sourceResourceId is specified, sourceDatabaseId, recoverableDatabaseId, restorableDroppedDatabaseId and + * sourceDatabaseDeletionDate must not be specified and CreateMode must be PointInTimeRestore, Restore or Recover. + * + *

When createMode is PointInTimeRestore, sourceResourceId must be the resource ID of the existing database or + * existing sql pool, and restorePointInTime must be specified. + * + *

When createMode is Restore, sourceResourceId must be the resource ID of restorable dropped database or + * restorable dropped sql pool. + * + *

When createMode is Recover, sourceResourceId must be the resource ID of recoverable database or recoverable + * sql pool. + * + *

When source subscription belongs to a different tenant than target subscription, + * “x-ms-authorization-auxiliary” header must contain authentication token for the source tenant. For more details + * about “x-ms-authorization-auxiliary” header see + * https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/authenticate-multi-tenant. + * + * @return the sourceResourceId value. + */ + public String sourceResourceId() { + return this.sourceResourceId; + } + + /** + * Set the sourceResourceId property: The resource identifier of the source associated with the create operation of + * this database. + * + *

This property is only supported for DataWarehouse edition and allows to restore across subscriptions. + * + *

When sourceResourceId is specified, sourceDatabaseId, recoverableDatabaseId, restorableDroppedDatabaseId and + * sourceDatabaseDeletionDate must not be specified and CreateMode must be PointInTimeRestore, Restore or Recover. + * + *

When createMode is PointInTimeRestore, sourceResourceId must be the resource ID of the existing database or + * existing sql pool, and restorePointInTime must be specified. + * + *

When createMode is Restore, sourceResourceId must be the resource ID of restorable dropped database or + * restorable dropped sql pool. + * + *

When createMode is Recover, sourceResourceId must be the resource ID of recoverable database or recoverable + * sql pool. + * + *

When source subscription belongs to a different tenant than target subscription, + * “x-ms-authorization-auxiliary” header must contain authentication token for the source tenant. For more details + * about “x-ms-authorization-auxiliary” header see + * https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/authenticate-multi-tenant. + * + * @param sourceResourceId the sourceResourceId value to set. + * @return the DatabaseProperties object itself. + */ + public DatabaseProperties withSourceResourceId(String sourceResourceId) { + this.sourceResourceId = sourceResourceId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (currentSku() != null) { + currentSku().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseSchemaInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseSchemaInner.java new file mode 100644 index 0000000000000..0fab50fea2988 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseSchemaInner.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; + +/** A database schema resource. */ +@Immutable +public final class DatabaseSchemaInner extends ProxyResource { + /** Creates an instance of DatabaseSchemaInner class. */ + public DatabaseSchemaInner() { + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseSecurityAlertPolicyInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseSecurityAlertPolicyInner.java new file mode 100644 index 0000000000000..7b426b5e95315 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseSecurityAlertPolicyInner.java @@ -0,0 +1,240 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertsPolicyState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** A database security alert policy. */ +@Fluent +public final class DatabaseSecurityAlertPolicyInner extends ProxyResource { + /* + * SystemData of SecurityAlertPolicyResource. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private SecurityAlertsPolicyProperties innerProperties; + + /** Creates an instance of DatabaseSecurityAlertPolicyInner class. */ + public DatabaseSecurityAlertPolicyInner() { + } + + /** + * Get the systemData property: SystemData of SecurityAlertPolicyResource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private SecurityAlertsPolicyProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the state property: Specifies the state of the policy, whether it is enabled or disabled or a policy has not + * been applied yet on the specific database. + * + * @return the state value. + */ + public SecurityAlertsPolicyState state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Set the state property: Specifies the state of the policy, whether it is enabled or disabled or a policy has not + * been applied yet on the specific database. + * + * @param state the state value to set. + * @return the DatabaseSecurityAlertPolicyInner object itself. + */ + public DatabaseSecurityAlertPolicyInner withState(SecurityAlertsPolicyState state) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertsPolicyProperties(); + } + this.innerProperties().withState(state); + return this; + } + + /** + * Get the disabledAlerts property: Specifies an array of alerts that are disabled. Allowed values are: + * Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action, Brute_Force. + * + * @return the disabledAlerts value. + */ + public List disabledAlerts() { + return this.innerProperties() == null ? null : this.innerProperties().disabledAlerts(); + } + + /** + * Set the disabledAlerts property: Specifies an array of alerts that are disabled. Allowed values are: + * Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action, Brute_Force. + * + * @param disabledAlerts the disabledAlerts value to set. + * @return the DatabaseSecurityAlertPolicyInner object itself. + */ + public DatabaseSecurityAlertPolicyInner withDisabledAlerts(List disabledAlerts) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertsPolicyProperties(); + } + this.innerProperties().withDisabledAlerts(disabledAlerts); + return this; + } + + /** + * Get the emailAddresses property: Specifies an array of e-mail addresses to which the alert is sent. + * + * @return the emailAddresses value. + */ + public List emailAddresses() { + return this.innerProperties() == null ? null : this.innerProperties().emailAddresses(); + } + + /** + * Set the emailAddresses property: Specifies an array of e-mail addresses to which the alert is sent. + * + * @param emailAddresses the emailAddresses value to set. + * @return the DatabaseSecurityAlertPolicyInner object itself. + */ + public DatabaseSecurityAlertPolicyInner withEmailAddresses(List emailAddresses) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertsPolicyProperties(); + } + this.innerProperties().withEmailAddresses(emailAddresses); + return this; + } + + /** + * Get the emailAccountAdmins property: Specifies that the alert is sent to the account administrators. + * + * @return the emailAccountAdmins value. + */ + public Boolean emailAccountAdmins() { + return this.innerProperties() == null ? null : this.innerProperties().emailAccountAdmins(); + } + + /** + * Set the emailAccountAdmins property: Specifies that the alert is sent to the account administrators. + * + * @param emailAccountAdmins the emailAccountAdmins value to set. + * @return the DatabaseSecurityAlertPolicyInner object itself. + */ + public DatabaseSecurityAlertPolicyInner withEmailAccountAdmins(Boolean emailAccountAdmins) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertsPolicyProperties(); + } + this.innerProperties().withEmailAccountAdmins(emailAccountAdmins); + return this; + } + + /** + * Get the storageEndpoint property: 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.innerProperties() == null ? null : this.innerProperties().storageEndpoint(); + } + + /** + * Set the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. + * + * @param storageEndpoint the storageEndpoint value to set. + * @return the DatabaseSecurityAlertPolicyInner object itself. + */ + public DatabaseSecurityAlertPolicyInner withStorageEndpoint(String storageEndpoint) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertsPolicyProperties(); + } + this.innerProperties().withStorageEndpoint(storageEndpoint); + return this; + } + + /** + * Get the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection audit storage + * account. + * + * @return the storageAccountAccessKey value. + */ + public String storageAccountAccessKey() { + return this.innerProperties() == null ? null : this.innerProperties().storageAccountAccessKey(); + } + + /** + * Set the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection audit storage + * account. + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set. + * @return the DatabaseSecurityAlertPolicyInner object itself. + */ + public DatabaseSecurityAlertPolicyInner withStorageAccountAccessKey(String storageAccountAccessKey) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertsPolicyProperties(); + } + this.innerProperties().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + /** + * Get the retentionDays property: Specifies the number of days to keep in the Threat Detection audit logs. + * + * @return the retentionDays value. + */ + public Integer retentionDays() { + return this.innerProperties() == null ? null : this.innerProperties().retentionDays(); + } + + /** + * Set the retentionDays property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertsPolicyProperties(); + } + this.innerProperties().withRetentionDays(retentionDays); + return this; + } + + /** + * Get the creationTime property: Specifies the UTC creation time of the policy. + * + * @return the creationTime value. + */ + public OffsetDateTime creationTime() { + return this.innerProperties() == null ? null : this.innerProperties().creationTime(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseSqlVulnerabilityAssessmentBaselineSetInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseSqlVulnerabilityAssessmentBaselineSetInner.java new file mode 100644 index 0000000000000..ace05e890cc10 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseSqlVulnerabilityAssessmentBaselineSetInner.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** A database sql vulnerability assessment baseline set. */ +@Fluent +public final class DatabaseSqlVulnerabilityAssessmentBaselineSetInner extends ProxyResource { + /* + * SystemData of DatabaseSqlVulnerabilityAssessmentBaselineSetResource. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private DatabaseSqlVulnerabilityAssessmentBaselineSetProperties innerProperties; + + /** Creates an instance of DatabaseSqlVulnerabilityAssessmentBaselineSetInner class. */ + public DatabaseSqlVulnerabilityAssessmentBaselineSetInner() { + } + + /** + * Get the systemData property: SystemData of DatabaseSqlVulnerabilityAssessmentBaselineSetResource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private DatabaseSqlVulnerabilityAssessmentBaselineSetProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the results property: The baseline set result. + * + * @return the results value. + */ + public Map>> results() { + return this.innerProperties() == null ? null : this.innerProperties().results(); + } + + /** + * Set the results property: The baseline set result. + * + * @param results the results value to set. + * @return the DatabaseSqlVulnerabilityAssessmentBaselineSetInner object itself. + */ + public DatabaseSqlVulnerabilityAssessmentBaselineSetInner withResults(Map>> results) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseSqlVulnerabilityAssessmentBaselineSetProperties(); + } + this.innerProperties().withResults(results); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseSqlVulnerabilityAssessmentBaselineSetProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseSqlVulnerabilityAssessmentBaselineSetProperties.java new file mode 100644 index 0000000000000..16c34d114bf0b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseSqlVulnerabilityAssessmentBaselineSetProperties.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Properties of a database Sql Vulnerability Assessment baseline set. */ +@Fluent +public final class DatabaseSqlVulnerabilityAssessmentBaselineSetProperties { + /* + * The baseline set result + */ + @JsonProperty(value = "results", required = true) + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map>> results; + + /** Creates an instance of DatabaseSqlVulnerabilityAssessmentBaselineSetProperties class. */ + public DatabaseSqlVulnerabilityAssessmentBaselineSetProperties() { + } + + /** + * Get the results property: The baseline set result. + * + * @return the results value. + */ + public Map>> results() { + return this.results; + } + + /** + * Set the results property: The baseline set result. + * + * @param results the results value to set. + * @return the DatabaseSqlVulnerabilityAssessmentBaselineSetProperties object itself. + */ + public DatabaseSqlVulnerabilityAssessmentBaselineSetProperties withResults( + Map>> results) { + this.results = results; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (results() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property results in model" + + " DatabaseSqlVulnerabilityAssessmentBaselineSetProperties")); + } + } + + private static final ClientLogger LOGGER = + new ClientLogger(DatabaseSqlVulnerabilityAssessmentBaselineSetProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseSqlVulnerabilityAssessmentRuleBaselineInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseSqlVulnerabilityAssessmentRuleBaselineInner.java new file mode 100644 index 0000000000000..51d045d9d3346 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseSqlVulnerabilityAssessmentRuleBaselineInner.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A database sql vulnerability assessment rule baseline. */ +@Fluent +public final class DatabaseSqlVulnerabilityAssessmentRuleBaselineInner extends ProxyResource { + /* + * SystemData of DatabaseSqlVulnerabilityAssessmentRuleBaselineResource. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private DatabaseSqlVulnerabilityAssessmentRuleBaselineProperties innerProperties; + + /** Creates an instance of DatabaseSqlVulnerabilityAssessmentRuleBaselineInner class. */ + public DatabaseSqlVulnerabilityAssessmentRuleBaselineInner() { + } + + /** + * Get the systemData property: SystemData of DatabaseSqlVulnerabilityAssessmentRuleBaselineResource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private DatabaseSqlVulnerabilityAssessmentRuleBaselineProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the results property: The rule baseline result. + * + * @return the results value. + */ + public List> results() { + return this.innerProperties() == null ? null : this.innerProperties().results(); + } + + /** + * Set the results property: The rule baseline result. + * + * @param results the results value to set. + * @return the DatabaseSqlVulnerabilityAssessmentRuleBaselineInner object itself. + */ + public DatabaseSqlVulnerabilityAssessmentRuleBaselineInner withResults(List> results) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseSqlVulnerabilityAssessmentRuleBaselineProperties(); + } + this.innerProperties().withResults(results); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseSqlVulnerabilityAssessmentRuleBaselineInputProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseSqlVulnerabilityAssessmentRuleBaselineInputProperties.java new file mode 100644 index 0000000000000..e885ccbd01269 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseSqlVulnerabilityAssessmentRuleBaselineInputProperties.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of a database Sql Vulnerability Assessment rule baseline. */ +@Fluent +public final class DatabaseSqlVulnerabilityAssessmentRuleBaselineInputProperties { + /* + * The latest scan flag + */ + @JsonProperty(value = "latestScan", required = true) + private boolean latestScan; + + /* + * The rule baseline result + */ + @JsonProperty(value = "results", required = true) + private List> results; + + /** Creates an instance of DatabaseSqlVulnerabilityAssessmentRuleBaselineInputProperties class. */ + public DatabaseSqlVulnerabilityAssessmentRuleBaselineInputProperties() { + } + + /** + * Get the latestScan property: The latest scan flag. + * + * @return the latestScan value. + */ + public boolean latestScan() { + return this.latestScan; + } + + /** + * Set the latestScan property: The latest scan flag. + * + * @param latestScan the latestScan value to set. + * @return the DatabaseSqlVulnerabilityAssessmentRuleBaselineInputProperties object itself. + */ + public DatabaseSqlVulnerabilityAssessmentRuleBaselineInputProperties withLatestScan(boolean latestScan) { + this.latestScan = latestScan; + return this; + } + + /** + * Get the results property: The rule baseline result. + * + * @return the results value. + */ + public List> results() { + return this.results; + } + + /** + * Set the results property: The rule baseline result. + * + * @param results the results value to set. + * @return the DatabaseSqlVulnerabilityAssessmentRuleBaselineInputProperties object itself. + */ + public DatabaseSqlVulnerabilityAssessmentRuleBaselineInputProperties withResults(List> results) { + this.results = results; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (results() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property results in model" + + " DatabaseSqlVulnerabilityAssessmentRuleBaselineInputProperties")); + } + } + + private static final ClientLogger LOGGER = + new ClientLogger(DatabaseSqlVulnerabilityAssessmentRuleBaselineInputProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseSqlVulnerabilityAssessmentRuleBaselineListInputProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseSqlVulnerabilityAssessmentRuleBaselineListInputProperties.java new file mode 100644 index 0000000000000..f5840e7b19ee5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseSqlVulnerabilityAssessmentRuleBaselineListInputProperties.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Properties of a database Sql Vulnerability Assessment rule baseline. */ +@Fluent +public final class DatabaseSqlVulnerabilityAssessmentRuleBaselineListInputProperties { + /* + * The latest scan flag + */ + @JsonProperty(value = "latestScan", required = true) + private boolean latestScan; + + /* + * The rule baseline result list + */ + @JsonProperty(value = "results", required = true) + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map>> results; + + /** Creates an instance of DatabaseSqlVulnerabilityAssessmentRuleBaselineListInputProperties class. */ + public DatabaseSqlVulnerabilityAssessmentRuleBaselineListInputProperties() { + } + + /** + * Get the latestScan property: The latest scan flag. + * + * @return the latestScan value. + */ + public boolean latestScan() { + return this.latestScan; + } + + /** + * Set the latestScan property: The latest scan flag. + * + * @param latestScan the latestScan value to set. + * @return the DatabaseSqlVulnerabilityAssessmentRuleBaselineListInputProperties object itself. + */ + public DatabaseSqlVulnerabilityAssessmentRuleBaselineListInputProperties withLatestScan(boolean latestScan) { + this.latestScan = latestScan; + return this; + } + + /** + * Get the results property: The rule baseline result list. + * + * @return the results value. + */ + public Map>> results() { + return this.results; + } + + /** + * Set the results property: The rule baseline result list. + * + * @param results the results value to set. + * @return the DatabaseSqlVulnerabilityAssessmentRuleBaselineListInputProperties object itself. + */ + public DatabaseSqlVulnerabilityAssessmentRuleBaselineListInputProperties withResults( + Map>> results) { + this.results = results; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (results() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property results in model" + + " DatabaseSqlVulnerabilityAssessmentRuleBaselineListInputProperties")); + } + } + + private static final ClientLogger LOGGER = + new ClientLogger(DatabaseSqlVulnerabilityAssessmentRuleBaselineListInputProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseSqlVulnerabilityAssessmentRuleBaselineProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseSqlVulnerabilityAssessmentRuleBaselineProperties.java new file mode 100644 index 0000000000000..42d4822dc8b20 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseSqlVulnerabilityAssessmentRuleBaselineProperties.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of a database Sql Vulnerability Assessment rule baseline. */ +@Fluent +public final class DatabaseSqlVulnerabilityAssessmentRuleBaselineProperties { + /* + * The rule baseline result + */ + @JsonProperty(value = "results", required = true) + private List> results; + + /** Creates an instance of DatabaseSqlVulnerabilityAssessmentRuleBaselineProperties class. */ + public DatabaseSqlVulnerabilityAssessmentRuleBaselineProperties() { + } + + /** + * Get the results property: The rule baseline result. + * + * @return the results value. + */ + public List> results() { + return this.results; + } + + /** + * Set the results property: The rule baseline result. + * + * @param results the results value to set. + * @return the DatabaseSqlVulnerabilityAssessmentRuleBaselineProperties object itself. + */ + public DatabaseSqlVulnerabilityAssessmentRuleBaselineProperties withResults(List> results) { + this.results = results; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (results() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property results in model" + + " DatabaseSqlVulnerabilityAssessmentRuleBaselineProperties")); + } + } + + private static final ClientLogger LOGGER = + new ClientLogger(DatabaseSqlVulnerabilityAssessmentRuleBaselineProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseTableInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseTableInner.java new file mode 100644 index 0000000000000..95af6e7398a07 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseTableInner.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.TableTemporalType; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A database table resource. */ +@Fluent +public final class DatabaseTableInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private DatabaseTableProperties innerProperties; + + /** Creates an instance of DatabaseTableInner class. */ + public DatabaseTableInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private DatabaseTableProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the temporalType property: The table temporal type. + * + * @return the temporalType value. + */ + public TableTemporalType temporalType() { + return this.innerProperties() == null ? null : this.innerProperties().temporalType(); + } + + /** + * Set the temporalType property: The table temporal type. + * + * @param temporalType the temporalType value to set. + * @return the DatabaseTableInner object itself. + */ + public DatabaseTableInner withTemporalType(TableTemporalType temporalType) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseTableProperties(); + } + this.innerProperties().withTemporalType(temporalType); + return this; + } + + /** + * Get the memoryOptimized property: Whether or not the table is memory optimized. + * + * @return the memoryOptimized value. + */ + public Boolean memoryOptimized() { + return this.innerProperties() == null ? null : this.innerProperties().memoryOptimized(); + } + + /** + * Set the memoryOptimized property: Whether or not the table is memory optimized. + * + * @param memoryOptimized the memoryOptimized value to set. + * @return the DatabaseTableInner object itself. + */ + public DatabaseTableInner withMemoryOptimized(Boolean memoryOptimized) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseTableProperties(); + } + this.innerProperties().withMemoryOptimized(memoryOptimized); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseTableProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseTableProperties.java new file mode 100644 index 0000000000000..9b6df9de23c47 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseTableProperties.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.models.TableTemporalType; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Database table properties. */ +@Fluent +public final class DatabaseTableProperties { + /* + * The table temporal type. + */ + @JsonProperty(value = "temporalType") + private TableTemporalType temporalType; + + /* + * Whether or not the table is memory optimized. + */ + @JsonProperty(value = "memoryOptimized") + private Boolean memoryOptimized; + + /** Creates an instance of DatabaseTableProperties class. */ + public DatabaseTableProperties() { + } + + /** + * Get the temporalType property: The table temporal type. + * + * @return the temporalType value. + */ + public TableTemporalType temporalType() { + return this.temporalType; + } + + /** + * Set the temporalType property: The table temporal type. + * + * @param temporalType the temporalType value to set. + * @return the DatabaseTableProperties object itself. + */ + public DatabaseTableProperties withTemporalType(TableTemporalType temporalType) { + this.temporalType = temporalType; + return this; + } + + /** + * Get the memoryOptimized property: Whether or not the table is memory optimized. + * + * @return the memoryOptimized value. + */ + public Boolean memoryOptimized() { + return this.memoryOptimized; + } + + /** + * Set the memoryOptimized property: Whether or not the table is memory optimized. + * + * @param memoryOptimized the memoryOptimized value to set. + * @return the DatabaseTableProperties object itself. + */ + public DatabaseTableProperties withMemoryOptimized(Boolean memoryOptimized) { + this.memoryOptimized = memoryOptimized; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseUpdateProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseUpdateProperties.java new file mode 100644 index 0000000000000..6d22f0a935491 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseUpdateProperties.java @@ -0,0 +1,1024 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.models.AlwaysEncryptedEnclaveType; +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.azure.resourcemanager.sql.generated.models.CatalogCollationType; +import com.azure.resourcemanager.sql.generated.models.CreateMode; +import com.azure.resourcemanager.sql.generated.models.DatabaseLicenseType; +import com.azure.resourcemanager.sql.generated.models.DatabaseReadScale; +import com.azure.resourcemanager.sql.generated.models.DatabaseStatus; +import com.azure.resourcemanager.sql.generated.models.SampleName; +import com.azure.resourcemanager.sql.generated.models.SecondaryType; +import com.azure.resourcemanager.sql.generated.models.Sku; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.UUID; + +/** A database update properties. */ +@Fluent +public final class DatabaseUpdateProperties { + /* + * 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. + */ + @JsonProperty(value = "createMode") + private CreateMode createMode; + + /* + * The collation of the database. + */ + @JsonProperty(value = "collation") + private String collation; + + /* + * The max size of the database expressed in bytes. + */ + @JsonProperty(value = "maxSizeBytes") + private Long maxSizeBytes; + + /* + * The name of the sample schema to apply when creating this database. + */ + @JsonProperty(value = "sampleName") + private SampleName sampleName; + + /* + * The resource identifier of the elastic pool containing this database. + */ + @JsonProperty(value = "elasticPoolId") + private String elasticPoolId; + + /* + * The resource identifier of the source database associated with create operation of this database. + */ + @JsonProperty(value = "sourceDatabaseId") + private String sourceDatabaseId; + + /* + * The status of the database. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private DatabaseStatus status; + + /* + * The ID of the database. + */ + @JsonProperty(value = "databaseId", access = JsonProperty.Access.WRITE_ONLY) + private UUID databaseId; + + /* + * The creation date of the database (ISO8601 format). + */ + @JsonProperty(value = "creationDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime creationDate; + + /* + * The current service level objective name of the database. + */ + @JsonProperty(value = "currentServiceObjectiveName", access = JsonProperty.Access.WRITE_ONLY) + private String currentServiceObjectiveName; + + /* + * The requested service level objective name of the database. + */ + @JsonProperty(value = "requestedServiceObjectiveName", access = JsonProperty.Access.WRITE_ONLY) + private String requestedServiceObjectiveName; + + /* + * The default secondary region for this database. + */ + @JsonProperty(value = "defaultSecondaryLocation", access = JsonProperty.Access.WRITE_ONLY) + private String defaultSecondaryLocation; + + /* + * Failover Group resource identifier that this database belongs to. + */ + @JsonProperty(value = "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 = "restorePointInTime") + private OffsetDateTime restorePointInTime; + + /* + * Specifies the time that the database was deleted. + */ + @JsonProperty(value = "sourceDatabaseDeletionDate") + private OffsetDateTime sourceDatabaseDeletionDate; + + /* + * The resource identifier of the recovery point associated with create operation of this database. + */ + @JsonProperty(value = "recoveryServicesRecoveryPointId") + private String recoveryServicesRecoveryPointId; + + /* + * The resource identifier of the long term retention backup associated with create operation of this database. + */ + @JsonProperty(value = "longTermRetentionBackupResourceId") + private String longTermRetentionBackupResourceId; + + /* + * The resource identifier of the recoverable database associated with create operation of this database. + */ + @JsonProperty(value = "recoverableDatabaseId") + private String recoverableDatabaseId; + + /* + * The resource identifier of the restorable dropped database associated with create operation of this database. + */ + @JsonProperty(value = "restorableDroppedDatabaseId") + private String restorableDroppedDatabaseId; + + /* + * Collation of the metadata catalog. + */ + @JsonProperty(value = "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 = "zoneRedundant") + private Boolean zoneRedundant; + + /* + * The license type to apply for this database. `LicenseIncluded` if you need a license, or `BasePrice` if you have + * a license and are eligible for the Azure Hybrid Benefit. + */ + @JsonProperty(value = "licenseType") + private DatabaseLicenseType licenseType; + + /* + * The max log size for this database. + */ + @JsonProperty(value = "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 = "earliestRestoreDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime 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. Not applicable to a + * Hyperscale database within an elastic pool. + */ + @JsonProperty(value = "readScale") + private DatabaseReadScale readScale; + + /* + * The number of secondary replicas associated with the database that are used to provide high availability. Not + * applicable to a Hyperscale database within an elastic pool. + */ + @JsonProperty(value = "highAvailabilityReplicaCount") + private Integer highAvailabilityReplicaCount; + + /* + * The secondary type of the database if it is a secondary. Valid values are Geo, Named and Standby. + */ + @JsonProperty(value = "secondaryType") + private SecondaryType secondaryType; + + /* + * The name and tier of the SKU. + */ + @JsonProperty(value = "currentSku", access = JsonProperty.Access.WRITE_ONLY) + private Sku currentSku; + + /* + * Time in minutes after which database is automatically paused. A value of -1 means that automatic pause is + * disabled + */ + @JsonProperty(value = "autoPauseDelay") + private Integer autoPauseDelay; + + /* + * The storage account type used to store backups for this database. + */ + @JsonProperty(value = "currentBackupStorageRedundancy", access = JsonProperty.Access.WRITE_ONLY) + private BackupStorageRedundancy currentBackupStorageRedundancy; + + /* + * The storage account type to be used to store backups for this database. + */ + @JsonProperty(value = "requestedBackupStorageRedundancy") + private BackupStorageRedundancy requestedBackupStorageRedundancy; + + /* + * Minimal capacity that database will always have allocated, if not paused + */ + @JsonProperty(value = "minCapacity") + private Double minCapacity; + + /* + * The date when database was paused by user configuration or action(ISO8601 format). Null if the database is + * ready. + */ + @JsonProperty(value = "pausedDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime pausedDate; + + /* + * The date when database was resumed by user action or database login (ISO8601 format). Null if the database is + * paused. + */ + @JsonProperty(value = "resumedDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime resumedDate; + + /* + * Maintenance configuration id assigned to the database. This configuration defines the period when the + * maintenance updates will occur. + */ + @JsonProperty(value = "maintenanceConfigurationId") + private String maintenanceConfigurationId; + + /* + * Whether or not this database is a ledger database, which means all tables in the database are ledger tables. + * Note: the value of this property cannot be changed after the database has been created. + */ + @JsonProperty(value = "isLedgerOn") + private Boolean isLedgerOn; + + /* + * Infra encryption is enabled for this database. + */ + @JsonProperty(value = "isInfraEncryptionEnabled", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isInfraEncryptionEnabled; + + /* + * The Client id used for cross tenant per database CMK scenario + */ + @JsonProperty(value = "federatedClientId") + private UUID federatedClientId; + + /* + * Type of enclave requested on the database i.e. Default or VBS enclaves. + */ + @JsonProperty(value = "preferredEnclaveType") + private AlwaysEncryptedEnclaveType preferredEnclaveType; + + /** Creates an instance of DatabaseUpdateProperties class. */ + public DatabaseUpdateProperties() { + } + + /** + * Get the createMode property: 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. + * + * @return the createMode value. + */ + public CreateMode createMode() { + return this.createMode; + } + + /** + * Set the createMode property: 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. + * + * @param createMode the createMode value to set. + * @return the DatabaseUpdateProperties object itself. + */ + public DatabaseUpdateProperties withCreateMode(CreateMode createMode) { + this.createMode = createMode; + return this; + } + + /** + * Get the collation property: The collation of the database. + * + * @return the collation value. + */ + public String collation() { + return this.collation; + } + + /** + * Set the collation property: The collation of the database. + * + * @param collation the collation value to set. + * @return the DatabaseUpdateProperties object itself. + */ + public DatabaseUpdateProperties withCollation(String collation) { + this.collation = collation; + return this; + } + + /** + * Get the maxSizeBytes property: The max size of the database expressed in bytes. + * + * @return the maxSizeBytes value. + */ + public Long maxSizeBytes() { + return this.maxSizeBytes; + } + + /** + * Set the maxSizeBytes property: The max size of the database expressed in bytes. + * + * @param maxSizeBytes the maxSizeBytes value to set. + * @return the DatabaseUpdateProperties object itself. + */ + public DatabaseUpdateProperties withMaxSizeBytes(Long maxSizeBytes) { + this.maxSizeBytes = maxSizeBytes; + return this; + } + + /** + * Get the sampleName property: The name of the sample schema to apply when creating this database. + * + * @return the sampleName value. + */ + public SampleName sampleName() { + return this.sampleName; + } + + /** + * Set the sampleName property: The name of the sample schema to apply when creating this database. + * + * @param sampleName the sampleName value to set. + * @return the DatabaseUpdateProperties object itself. + */ + public DatabaseUpdateProperties withSampleName(SampleName sampleName) { + this.sampleName = sampleName; + return this; + } + + /** + * Get the elasticPoolId property: The resource identifier of the elastic pool containing this database. + * + * @return the elasticPoolId value. + */ + public String elasticPoolId() { + return this.elasticPoolId; + } + + /** + * Set the elasticPoolId property: The resource identifier of the elastic pool containing this database. + * + * @param elasticPoolId the elasticPoolId value to set. + * @return the DatabaseUpdateProperties object itself. + */ + public DatabaseUpdateProperties withElasticPoolId(String elasticPoolId) { + this.elasticPoolId = elasticPoolId; + return this; + } + + /** + * Get the sourceDatabaseId property: 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 sourceDatabaseId property: The resource identifier of the source database associated with create + * operation of this database. + * + * @param sourceDatabaseId the sourceDatabaseId value to set. + * @return the DatabaseUpdateProperties object itself. + */ + public DatabaseUpdateProperties withSourceDatabaseId(String sourceDatabaseId) { + this.sourceDatabaseId = sourceDatabaseId; + return this; + } + + /** + * Get the status property: The status of the database. + * + * @return the status value. + */ + public DatabaseStatus status() { + return this.status; + } + + /** + * Get the databaseId property: The ID of the database. + * + * @return the databaseId value. + */ + public UUID databaseId() { + return this.databaseId; + } + + /** + * Get the creationDate property: The creation date of the database (ISO8601 format). + * + * @return the creationDate value. + */ + public OffsetDateTime creationDate() { + return this.creationDate; + } + + /** + * Get the currentServiceObjectiveName property: The current service level objective name of the database. + * + * @return the currentServiceObjectiveName value. + */ + public String currentServiceObjectiveName() { + return this.currentServiceObjectiveName; + } + + /** + * Get the requestedServiceObjectiveName property: The requested service level objective name of the database. + * + * @return the requestedServiceObjectiveName value. + */ + public String requestedServiceObjectiveName() { + return this.requestedServiceObjectiveName; + } + + /** + * Get the defaultSecondaryLocation property: The default secondary region for this database. + * + * @return the defaultSecondaryLocation value. + */ + public String defaultSecondaryLocation() { + return this.defaultSecondaryLocation; + } + + /** + * Get the failoverGroupId property: Failover Group resource identifier that this database belongs to. + * + * @return the failoverGroupId value. + */ + public String failoverGroupId() { + return this.failoverGroupId; + } + + /** + * Get the restorePointInTime property: Specifies the point in time (ISO8601 format) of the source database that + * will be restored to create the new database. + * + * @return the restorePointInTime value. + */ + public OffsetDateTime restorePointInTime() { + return this.restorePointInTime; + } + + /** + * Set the restorePointInTime property: 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 DatabaseUpdateProperties object itself. + */ + public DatabaseUpdateProperties withRestorePointInTime(OffsetDateTime restorePointInTime) { + this.restorePointInTime = restorePointInTime; + return this; + } + + /** + * Get the sourceDatabaseDeletionDate property: Specifies the time that the database was deleted. + * + * @return the sourceDatabaseDeletionDate value. + */ + public OffsetDateTime sourceDatabaseDeletionDate() { + return this.sourceDatabaseDeletionDate; + } + + /** + * Set the sourceDatabaseDeletionDate property: Specifies the time that the database was deleted. + * + * @param sourceDatabaseDeletionDate the sourceDatabaseDeletionDate value to set. + * @return the DatabaseUpdateProperties object itself. + */ + public DatabaseUpdateProperties withSourceDatabaseDeletionDate(OffsetDateTime sourceDatabaseDeletionDate) { + this.sourceDatabaseDeletionDate = sourceDatabaseDeletionDate; + return this; + } + + /** + * Get the recoveryServicesRecoveryPointId property: 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 recoveryServicesRecoveryPointId property: The resource identifier of the recovery point associated with + * create operation of this database. + * + * @param recoveryServicesRecoveryPointId the recoveryServicesRecoveryPointId value to set. + * @return the DatabaseUpdateProperties object itself. + */ + public DatabaseUpdateProperties withRecoveryServicesRecoveryPointId(String recoveryServicesRecoveryPointId) { + this.recoveryServicesRecoveryPointId = recoveryServicesRecoveryPointId; + return this; + } + + /** + * Get the longTermRetentionBackupResourceId property: 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 longTermRetentionBackupResourceId property: 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 DatabaseUpdateProperties object itself. + */ + public DatabaseUpdateProperties withLongTermRetentionBackupResourceId(String longTermRetentionBackupResourceId) { + this.longTermRetentionBackupResourceId = longTermRetentionBackupResourceId; + return this; + } + + /** + * Get the recoverableDatabaseId property: 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 recoverableDatabaseId property: The resource identifier of the recoverable database associated with + * create operation of this database. + * + * @param recoverableDatabaseId the recoverableDatabaseId value to set. + * @return the DatabaseUpdateProperties object itself. + */ + public DatabaseUpdateProperties withRecoverableDatabaseId(String recoverableDatabaseId) { + this.recoverableDatabaseId = recoverableDatabaseId; + return this; + } + + /** + * Get the restorableDroppedDatabaseId property: 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 restorableDroppedDatabaseId property: The resource identifier of the restorable dropped database + * associated with create operation of this database. + * + * @param restorableDroppedDatabaseId the restorableDroppedDatabaseId value to set. + * @return the DatabaseUpdateProperties object itself. + */ + public DatabaseUpdateProperties withRestorableDroppedDatabaseId(String restorableDroppedDatabaseId) { + this.restorableDroppedDatabaseId = restorableDroppedDatabaseId; + return this; + } + + /** + * Get the catalogCollation property: Collation of the metadata catalog. + * + * @return the catalogCollation value. + */ + public CatalogCollationType catalogCollation() { + return this.catalogCollation; + } + + /** + * Set the catalogCollation property: Collation of the metadata catalog. + * + * @param catalogCollation the catalogCollation value to set. + * @return the DatabaseUpdateProperties object itself. + */ + public DatabaseUpdateProperties withCatalogCollation(CatalogCollationType catalogCollation) { + this.catalogCollation = catalogCollation; + return this; + } + + /** + * Get the zoneRedundant property: 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 the zoneRedundant property: 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 DatabaseUpdateProperties object itself. + */ + public DatabaseUpdateProperties withZoneRedundant(Boolean zoneRedundant) { + this.zoneRedundant = zoneRedundant; + return this; + } + + /** + * Get the licenseType property: The license type to apply for this database. `LicenseIncluded` if you need a + * license, or `BasePrice` if you have a license and are eligible for the Azure Hybrid Benefit. + * + * @return the licenseType value. + */ + public DatabaseLicenseType licenseType() { + return this.licenseType; + } + + /** + * Set the licenseType property: The license type to apply for this database. `LicenseIncluded` if you need a + * license, or `BasePrice` if you have a license and are eligible for the Azure Hybrid Benefit. + * + * @param licenseType the licenseType value to set. + * @return the DatabaseUpdateProperties object itself. + */ + public DatabaseUpdateProperties withLicenseType(DatabaseLicenseType licenseType) { + this.licenseType = licenseType; + return this; + } + + /** + * Get the maxLogSizeBytes property: The max log size for this database. + * + * @return the maxLogSizeBytes value. + */ + public Long maxLogSizeBytes() { + return this.maxLogSizeBytes; + } + + /** + * Get the earliestRestoreDate property: This records the earliest start date and time that restore is available for + * this database (ISO8601 format). + * + * @return the earliestRestoreDate value. + */ + public OffsetDateTime earliestRestoreDate() { + return this.earliestRestoreDate; + } + + /** + * Get the readScale property: 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. Not + * applicable to a Hyperscale database within an elastic pool. + * + * @return the readScale value. + */ + public DatabaseReadScale readScale() { + return this.readScale; + } + + /** + * Set the readScale property: 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. Not + * applicable to a Hyperscale database within an elastic pool. + * + * @param readScale the readScale value to set. + * @return the DatabaseUpdateProperties object itself. + */ + public DatabaseUpdateProperties withReadScale(DatabaseReadScale readScale) { + this.readScale = readScale; + return this; + } + + /** + * Get the highAvailabilityReplicaCount property: The number of secondary replicas associated with the database that + * are used to provide high availability. Not applicable to a Hyperscale database within an elastic pool. + * + * @return the highAvailabilityReplicaCount value. + */ + public Integer highAvailabilityReplicaCount() { + return this.highAvailabilityReplicaCount; + } + + /** + * Set the highAvailabilityReplicaCount property: The number of secondary replicas associated with the database that + * are used to provide high availability. Not applicable to a Hyperscale database within an elastic pool. + * + * @param highAvailabilityReplicaCount the highAvailabilityReplicaCount value to set. + * @return the DatabaseUpdateProperties object itself. + */ + public DatabaseUpdateProperties withHighAvailabilityReplicaCount(Integer highAvailabilityReplicaCount) { + this.highAvailabilityReplicaCount = highAvailabilityReplicaCount; + return this; + } + + /** + * Get the secondaryType property: The secondary type of the database if it is a secondary. Valid values are Geo, + * Named and Standby. + * + * @return the secondaryType value. + */ + public SecondaryType secondaryType() { + return this.secondaryType; + } + + /** + * Set the secondaryType property: The secondary type of the database if it is a secondary. Valid values are Geo, + * Named and Standby. + * + * @param secondaryType the secondaryType value to set. + * @return the DatabaseUpdateProperties object itself. + */ + public DatabaseUpdateProperties withSecondaryType(SecondaryType secondaryType) { + this.secondaryType = secondaryType; + return this; + } + + /** + * Get the currentSku property: The name and tier of the SKU. + * + * @return the currentSku value. + */ + public Sku currentSku() { + return this.currentSku; + } + + /** + * Get the autoPauseDelay property: Time in minutes after which database is automatically paused. A value of -1 + * means that automatic pause is disabled. + * + * @return the autoPauseDelay value. + */ + public Integer autoPauseDelay() { + return this.autoPauseDelay; + } + + /** + * Set the autoPauseDelay property: Time in minutes after which database is automatically paused. A value of -1 + * means that automatic pause is disabled. + * + * @param autoPauseDelay the autoPauseDelay value to set. + * @return the DatabaseUpdateProperties object itself. + */ + public DatabaseUpdateProperties withAutoPauseDelay(Integer autoPauseDelay) { + this.autoPauseDelay = autoPauseDelay; + return this; + } + + /** + * Get the currentBackupStorageRedundancy property: The storage account type used to store backups for this + * database. + * + * @return the currentBackupStorageRedundancy value. + */ + public BackupStorageRedundancy currentBackupStorageRedundancy() { + return this.currentBackupStorageRedundancy; + } + + /** + * Get the requestedBackupStorageRedundancy property: The storage account type to be used to store backups for this + * database. + * + * @return the requestedBackupStorageRedundancy value. + */ + public BackupStorageRedundancy requestedBackupStorageRedundancy() { + return this.requestedBackupStorageRedundancy; + } + + /** + * Set the requestedBackupStorageRedundancy property: The storage account type to be used to store backups for this + * database. + * + * @param requestedBackupStorageRedundancy the requestedBackupStorageRedundancy value to set. + * @return the DatabaseUpdateProperties object itself. + */ + public DatabaseUpdateProperties withRequestedBackupStorageRedundancy( + BackupStorageRedundancy requestedBackupStorageRedundancy) { + this.requestedBackupStorageRedundancy = requestedBackupStorageRedundancy; + return this; + } + + /** + * Get the minCapacity property: Minimal capacity that database will always have allocated, if not paused. + * + * @return the minCapacity value. + */ + public Double minCapacity() { + return this.minCapacity; + } + + /** + * Set the minCapacity property: Minimal capacity that database will always have allocated, if not paused. + * + * @param minCapacity the minCapacity value to set. + * @return the DatabaseUpdateProperties object itself. + */ + public DatabaseUpdateProperties withMinCapacity(Double minCapacity) { + this.minCapacity = minCapacity; + return this; + } + + /** + * Get the pausedDate property: The date when database was paused by user configuration or action(ISO8601 format). + * Null if the database is ready. + * + * @return the pausedDate value. + */ + public OffsetDateTime pausedDate() { + return this.pausedDate; + } + + /** + * Get the resumedDate property: The date when database was resumed by user action or database login (ISO8601 + * format). Null if the database is paused. + * + * @return the resumedDate value. + */ + public OffsetDateTime resumedDate() { + return this.resumedDate; + } + + /** + * Get the maintenanceConfigurationId property: Maintenance configuration id assigned to the database. This + * configuration defines the period when the maintenance updates will occur. + * + * @return the maintenanceConfigurationId value. + */ + public String maintenanceConfigurationId() { + return this.maintenanceConfigurationId; + } + + /** + * Set the maintenanceConfigurationId property: Maintenance configuration id assigned to the database. This + * configuration defines the period when the maintenance updates will occur. + * + * @param maintenanceConfigurationId the maintenanceConfigurationId value to set. + * @return the DatabaseUpdateProperties object itself. + */ + public DatabaseUpdateProperties withMaintenanceConfigurationId(String maintenanceConfigurationId) { + this.maintenanceConfigurationId = maintenanceConfigurationId; + return this; + } + + /** + * Get the isLedgerOn property: Whether or not this database is a ledger database, which means all tables in the + * database are ledger tables. Note: the value of this property cannot be changed after the database has been + * created. + * + * @return the isLedgerOn value. + */ + public Boolean isLedgerOn() { + return this.isLedgerOn; + } + + /** + * Set the isLedgerOn property: Whether or not this database is a ledger database, which means all tables in the + * database are ledger tables. Note: the value of this property cannot be changed after the database has been + * created. + * + * @param isLedgerOn the isLedgerOn value to set. + * @return the DatabaseUpdateProperties object itself. + */ + public DatabaseUpdateProperties withIsLedgerOn(Boolean isLedgerOn) { + this.isLedgerOn = isLedgerOn; + return this; + } + + /** + * Get the isInfraEncryptionEnabled property: Infra encryption is enabled for this database. + * + * @return the isInfraEncryptionEnabled value. + */ + public Boolean isInfraEncryptionEnabled() { + return this.isInfraEncryptionEnabled; + } + + /** + * Get the federatedClientId property: The Client id used for cross tenant per database CMK scenario. + * + * @return the federatedClientId value. + */ + public UUID federatedClientId() { + return this.federatedClientId; + } + + /** + * Set the federatedClientId property: The Client id used for cross tenant per database CMK scenario. + * + * @param federatedClientId the federatedClientId value to set. + * @return the DatabaseUpdateProperties object itself. + */ + public DatabaseUpdateProperties withFederatedClientId(UUID federatedClientId) { + this.federatedClientId = federatedClientId; + return this; + } + + /** + * Get the preferredEnclaveType property: Type of enclave requested on the database i.e. Default or VBS enclaves. + * + * @return the preferredEnclaveType value. + */ + public AlwaysEncryptedEnclaveType preferredEnclaveType() { + return this.preferredEnclaveType; + } + + /** + * Set the preferredEnclaveType property: Type of enclave requested on the database i.e. Default or VBS enclaves. + * + * @param preferredEnclaveType the preferredEnclaveType value to set. + * @return the DatabaseUpdateProperties object itself. + */ + public DatabaseUpdateProperties withPreferredEnclaveType(AlwaysEncryptedEnclaveType preferredEnclaveType) { + this.preferredEnclaveType = preferredEnclaveType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (currentSku() != null) { + currentSku().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseUsageInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseUsageInner.java new file mode 100644 index 0000000000000..db9062a1ec94e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseUsageInner.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Usage metric of a database. */ +@Immutable +public final class DatabaseUsageInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private DatabaseUsageProperties innerProperties; + + /** Creates an instance of DatabaseUsageInner class. */ + public DatabaseUsageInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private DatabaseUsageProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the displayName property: User-readable name of the metric. + * + * @return the displayName value. + */ + public String displayName() { + return this.innerProperties() == null ? null : this.innerProperties().displayName(); + } + + /** + * Get the currentValue property: Current value of the metric. + * + * @return the currentValue value. + */ + public Double currentValue() { + return this.innerProperties() == null ? null : this.innerProperties().currentValue(); + } + + /** + * Get the limit property: Boundary value of the metric. + * + * @return the limit value. + */ + public Double limit() { + return this.innerProperties() == null ? null : this.innerProperties().limit(); + } + + /** + * Get the unit property: Unit of the metric. + * + * @return the unit value. + */ + public String unit() { + return this.innerProperties() == null ? null : this.innerProperties().unit(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseUsageProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseUsageProperties.java new file mode 100644 index 0000000000000..a009988bfcb83 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseUsageProperties.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a database usage. */ +@Immutable +public final class DatabaseUsageProperties { + /* + * User-readable name of the metric. + */ + @JsonProperty(value = "displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /* + * Current value of the metric. + */ + @JsonProperty(value = "currentValue", access = JsonProperty.Access.WRITE_ONLY) + private Double currentValue; + + /* + * Boundary value of the metric. + */ + @JsonProperty(value = "limit", access = JsonProperty.Access.WRITE_ONLY) + private Double limit; + + /* + * Unit of the metric. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private String unit; + + /** Creates an instance of DatabaseUsageProperties class. */ + public DatabaseUsageProperties() { + } + + /** + * Get the displayName property: User-readable name of the metric. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the currentValue property: Current value of the metric. + * + * @return the currentValue value. + */ + public Double currentValue() { + return this.currentValue; + } + + /** + * Get the limit property: Boundary value of the metric. + * + * @return the limit value. + */ + public Double limit() { + return this.limit; + } + + /** + * Get the unit property: Unit of the metric. + * + * @return the unit value. + */ + public String unit() { + return this.unit; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseVulnerabilityAssessmentInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseVulnerabilityAssessmentInner.java new file mode 100644 index 0000000000000..3d38a663a8e27 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseVulnerabilityAssessmentInner.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentRecurringScansProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A database vulnerability assessment. */ +@Fluent +public final class DatabaseVulnerabilityAssessmentInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private DatabaseVulnerabilityAssessmentProperties innerProperties; + + /** Creates an instance of DatabaseVulnerabilityAssessmentInner class. */ + public DatabaseVulnerabilityAssessmentInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private DatabaseVulnerabilityAssessmentProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the storageContainerPath property: 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.innerProperties() == null ? null : this.innerProperties().storageContainerPath(); + } + + /** + * Set the storageContainerPath property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseVulnerabilityAssessmentProperties(); + } + this.innerProperties().withStorageContainerPath(storageContainerPath); + return this; + } + + /** + * Get the storageContainerSasKey property: 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.innerProperties() == null ? null : this.innerProperties().storageContainerSasKey(); + } + + /** + * Set the storageContainerSasKey property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseVulnerabilityAssessmentProperties(); + } + this.innerProperties().withStorageContainerSasKey(storageContainerSasKey); + return this; + } + + /** + * Get the storageAccountAccessKey property: 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.innerProperties() == null ? null : this.innerProperties().storageAccountAccessKey(); + } + + /** + * Set the storageAccountAccessKey property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseVulnerabilityAssessmentProperties(); + } + this.innerProperties().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + /** + * Get the recurringScans property: The recurring scans settings. + * + * @return the recurringScans value. + */ + public VulnerabilityAssessmentRecurringScansProperties recurringScans() { + return this.innerProperties() == null ? null : this.innerProperties().recurringScans(); + } + + /** + * Set the recurringScans property: The recurring scans settings. + * + * @param recurringScans the recurringScans value to set. + * @return the DatabaseVulnerabilityAssessmentInner object itself. + */ + public DatabaseVulnerabilityAssessmentInner withRecurringScans( + VulnerabilityAssessmentRecurringScansProperties recurringScans) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseVulnerabilityAssessmentProperties(); + } + this.innerProperties().withRecurringScans(recurringScans); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseVulnerabilityAssessmentProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseVulnerabilityAssessmentProperties.java new file mode 100644 index 0000000000000..5888cdf6e1601 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseVulnerabilityAssessmentProperties.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentRecurringScansProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a database Vulnerability Assessment. */ +@Fluent +public final class DatabaseVulnerabilityAssessmentProperties { + /* + * 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 = "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 = "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 = "storageAccountAccessKey") + private String storageAccountAccessKey; + + /* + * The recurring scans settings + */ + @JsonProperty(value = "recurringScans") + private VulnerabilityAssessmentRecurringScansProperties recurringScans; + + /** Creates an instance of DatabaseVulnerabilityAssessmentProperties class. */ + public DatabaseVulnerabilityAssessmentProperties() { + } + + /** + * Get the storageContainerPath property: 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 the storageContainerPath property: 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 DatabaseVulnerabilityAssessmentProperties object itself. + */ + public DatabaseVulnerabilityAssessmentProperties withStorageContainerPath(String storageContainerPath) { + this.storageContainerPath = storageContainerPath; + return this; + } + + /** + * Get the storageContainerSasKey property: 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 the storageContainerSasKey property: 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 DatabaseVulnerabilityAssessmentProperties object itself. + */ + public DatabaseVulnerabilityAssessmentProperties withStorageContainerSasKey(String storageContainerSasKey) { + this.storageContainerSasKey = storageContainerSasKey; + return this; + } + + /** + * Get the storageAccountAccessKey property: 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 the storageAccountAccessKey property: 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 DatabaseVulnerabilityAssessmentProperties object itself. + */ + public DatabaseVulnerabilityAssessmentProperties withStorageAccountAccessKey(String storageAccountAccessKey) { + this.storageAccountAccessKey = storageAccountAccessKey; + return this; + } + + /** + * Get the recurringScans property: The recurring scans settings. + * + * @return the recurringScans value. + */ + public VulnerabilityAssessmentRecurringScansProperties recurringScans() { + return this.recurringScans; + } + + /** + * Set the recurringScans property: The recurring scans settings. + * + * @param recurringScans the recurringScans value to set. + * @return the DatabaseVulnerabilityAssessmentProperties object itself. + */ + public DatabaseVulnerabilityAssessmentProperties withRecurringScans( + VulnerabilityAssessmentRecurringScansProperties recurringScans) { + this.recurringScans = recurringScans; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (recurringScans() != null) { + recurringScans().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseVulnerabilityAssessmentRuleBaselineInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseVulnerabilityAssessmentRuleBaselineInner.java new file mode 100644 index 0000000000000..76032aa3f1655 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseVulnerabilityAssessmentRuleBaselineInner.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.DatabaseVulnerabilityAssessmentRuleBaselineItem; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A database vulnerability assessment rule baseline. */ +@Fluent +public final class DatabaseVulnerabilityAssessmentRuleBaselineInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private DatabaseVulnerabilityAssessmentRuleBaselineProperties innerProperties; + + /** Creates an instance of DatabaseVulnerabilityAssessmentRuleBaselineInner class. */ + public DatabaseVulnerabilityAssessmentRuleBaselineInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private DatabaseVulnerabilityAssessmentRuleBaselineProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the baselineResults property: The rule baseline result. + * + * @return the baselineResults value. + */ + public List baselineResults() { + return this.innerProperties() == null ? null : this.innerProperties().baselineResults(); + } + + /** + * Set the baselineResults property: The rule baseline result. + * + * @param baselineResults the baselineResults value to set. + * @return the DatabaseVulnerabilityAssessmentRuleBaselineInner object itself. + */ + public DatabaseVulnerabilityAssessmentRuleBaselineInner withBaselineResults( + List baselineResults) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseVulnerabilityAssessmentRuleBaselineProperties(); + } + this.innerProperties().withBaselineResults(baselineResults); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseVulnerabilityAssessmentRuleBaselineProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseVulnerabilityAssessmentRuleBaselineProperties.java new file mode 100644 index 0000000000000..156dbce8782e3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseVulnerabilityAssessmentRuleBaselineProperties.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.DatabaseVulnerabilityAssessmentRuleBaselineItem; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of a database Vulnerability Assessment rule baseline. */ +@Fluent +public final class DatabaseVulnerabilityAssessmentRuleBaselineProperties { + /* + * The rule baseline result + */ + @JsonProperty(value = "baselineResults", required = true) + private List baselineResults; + + /** Creates an instance of DatabaseVulnerabilityAssessmentRuleBaselineProperties class. */ + public DatabaseVulnerabilityAssessmentRuleBaselineProperties() { + } + + /** + * Get the baselineResults property: The rule baseline result. + * + * @return the baselineResults value. + */ + public List baselineResults() { + return this.baselineResults; + } + + /** + * Set the baselineResults property: The rule baseline result. + * + * @param baselineResults the baselineResults value to set. + * @return the DatabaseVulnerabilityAssessmentRuleBaselineProperties object itself. + */ + public DatabaseVulnerabilityAssessmentRuleBaselineProperties withBaselineResults( + List baselineResults) { + this.baselineResults = baselineResults; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (baselineResults() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property baselineResults in model" + + " DatabaseVulnerabilityAssessmentRuleBaselineProperties")); + } else { + baselineResults().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = + new ClientLogger(DatabaseVulnerabilityAssessmentRuleBaselineProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseVulnerabilityAssessmentScanExportProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseVulnerabilityAssessmentScanExportProperties.java new file mode 100644 index 0000000000000..38acc47ea45f6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseVulnerabilityAssessmentScanExportProperties.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of the export operation's result. */ +@Immutable +public final class DatabaseVulnerabilityAssessmentScanExportProperties { + /* + * Location of the exported report (e.g. + * https://myStorage.blob.core.windows.net/VaScans/scans/serverName/databaseName/scan_scanId.xlsx). + */ + @JsonProperty(value = "exportedReportLocation", access = JsonProperty.Access.WRITE_ONLY) + private String exportedReportLocation; + + /** Creates an instance of DatabaseVulnerabilityAssessmentScanExportProperties class. */ + public DatabaseVulnerabilityAssessmentScanExportProperties() { + } + + /** + * Get the exportedReportLocation property: 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseVulnerabilityAssessmentScansExportInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseVulnerabilityAssessmentScansExportInner.java new file mode 100644 index 0000000000000..4b5a5fab98b78 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DatabaseVulnerabilityAssessmentScansExportInner.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A database Vulnerability Assessment scan export resource. */ +@Immutable +public final class DatabaseVulnerabilityAssessmentScansExportInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private DatabaseVulnerabilityAssessmentScanExportProperties innerProperties; + + /** Creates an instance of DatabaseVulnerabilityAssessmentScansExportInner class. */ + public DatabaseVulnerabilityAssessmentScansExportInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private DatabaseVulnerabilityAssessmentScanExportProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the exportedReportLocation property: 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.innerProperties() == null ? null : this.innerProperties().exportedReportLocation(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DeletedServerInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DeletedServerInner.java new file mode 100644 index 0000000000000..da2ed669069be --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DeletedServerInner.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** A deleted server. */ +@Immutable +public final class DeletedServerInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private DeletedServerProperties innerProperties; + + /** Creates an instance of DeletedServerInner class. */ + public DeletedServerInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private DeletedServerProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the version property: The version of the deleted server. + * + * @return the version value. + */ + public String version() { + return this.innerProperties() == null ? null : this.innerProperties().version(); + } + + /** + * Get the deletionTime property: The deletion time of the deleted server. + * + * @return the deletionTime value. + */ + public OffsetDateTime deletionTime() { + return this.innerProperties() == null ? null : this.innerProperties().deletionTime(); + } + + /** + * Get the originalId property: The original ID of the server before deletion. + * + * @return the originalId value. + */ + public String originalId() { + return this.innerProperties() == null ? null : this.innerProperties().originalId(); + } + + /** + * Get the fullyQualifiedDomainName property: The fully qualified domain name of the server. + * + * @return the fullyQualifiedDomainName value. + */ + public String fullyQualifiedDomainName() { + return this.innerProperties() == null ? null : this.innerProperties().fullyQualifiedDomainName(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DeletedServerProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DeletedServerProperties.java new file mode 100644 index 0000000000000..d028c49202940 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DeletedServerProperties.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The properties of a deleted server. */ +@Immutable +public final class DeletedServerProperties { + /* + * The version of the deleted server. + */ + @JsonProperty(value = "version", access = JsonProperty.Access.WRITE_ONLY) + private String version; + + /* + * The deletion time of the deleted server. + */ + @JsonProperty(value = "deletionTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime deletionTime; + + /* + * The original ID of the server before deletion. + */ + @JsonProperty(value = "originalId", access = JsonProperty.Access.WRITE_ONLY) + private String originalId; + + /* + * The fully qualified domain name of the server. + */ + @JsonProperty(value = "fullyQualifiedDomainName", access = JsonProperty.Access.WRITE_ONLY) + private String fullyQualifiedDomainName; + + /** Creates an instance of DeletedServerProperties class. */ + public DeletedServerProperties() { + } + + /** + * Get the version property: The version of the deleted server. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Get the deletionTime property: The deletion time of the deleted server. + * + * @return the deletionTime value. + */ + public OffsetDateTime deletionTime() { + return this.deletionTime; + } + + /** + * Get the originalId property: The original ID of the server before deletion. + * + * @return the originalId value. + */ + public String originalId() { + return this.originalId; + } + + /** + * Get the fullyQualifiedDomainName property: The fully qualified domain name of the server. + * + * @return the fullyQualifiedDomainName value. + */ + public String fullyQualifiedDomainName() { + return this.fullyQualifiedDomainName; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DistributedAvailabilityGroupInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DistributedAvailabilityGroupInner.java new file mode 100644 index 0000000000000..203665efce314 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DistributedAvailabilityGroupInner.java @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.ReplicationMode; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +/** Distributed availability group between box and Sql Managed Instance. */ +@Fluent +public final class DistributedAvailabilityGroupInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private DistributedAvailabilityGroupProperties innerProperties; + + /** Creates an instance of DistributedAvailabilityGroupInner class. */ + public DistributedAvailabilityGroupInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private DistributedAvailabilityGroupProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the targetDatabase property: The name of the target database. + * + * @return the targetDatabase value. + */ + public String targetDatabase() { + return this.innerProperties() == null ? null : this.innerProperties().targetDatabase(); + } + + /** + * Set the targetDatabase property: The name of the target database. + * + * @param targetDatabase the targetDatabase value to set. + * @return the DistributedAvailabilityGroupInner object itself. + */ + public DistributedAvailabilityGroupInner withTargetDatabase(String targetDatabase) { + if (this.innerProperties() == null) { + this.innerProperties = new DistributedAvailabilityGroupProperties(); + } + this.innerProperties().withTargetDatabase(targetDatabase); + return this; + } + + /** + * Get the sourceEndpoint property: The source endpoint. + * + * @return the sourceEndpoint value. + */ + public String sourceEndpoint() { + return this.innerProperties() == null ? null : this.innerProperties().sourceEndpoint(); + } + + /** + * Set the sourceEndpoint property: The source endpoint. + * + * @param sourceEndpoint the sourceEndpoint value to set. + * @return the DistributedAvailabilityGroupInner object itself. + */ + public DistributedAvailabilityGroupInner withSourceEndpoint(String sourceEndpoint) { + if (this.innerProperties() == null) { + this.innerProperties = new DistributedAvailabilityGroupProperties(); + } + this.innerProperties().withSourceEndpoint(sourceEndpoint); + return this; + } + + /** + * Get the primaryAvailabilityGroupName property: The primary availability group name. + * + * @return the primaryAvailabilityGroupName value. + */ + public String primaryAvailabilityGroupName() { + return this.innerProperties() == null ? null : this.innerProperties().primaryAvailabilityGroupName(); + } + + /** + * Set the primaryAvailabilityGroupName property: The primary availability group name. + * + * @param primaryAvailabilityGroupName the primaryAvailabilityGroupName value to set. + * @return the DistributedAvailabilityGroupInner object itself. + */ + public DistributedAvailabilityGroupInner withPrimaryAvailabilityGroupName(String primaryAvailabilityGroupName) { + if (this.innerProperties() == null) { + this.innerProperties = new DistributedAvailabilityGroupProperties(); + } + this.innerProperties().withPrimaryAvailabilityGroupName(primaryAvailabilityGroupName); + return this; + } + + /** + * Get the secondaryAvailabilityGroupName property: The secondary availability group name. + * + * @return the secondaryAvailabilityGroupName value. + */ + public String secondaryAvailabilityGroupName() { + return this.innerProperties() == null ? null : this.innerProperties().secondaryAvailabilityGroupName(); + } + + /** + * Set the secondaryAvailabilityGroupName property: The secondary availability group name. + * + * @param secondaryAvailabilityGroupName the secondaryAvailabilityGroupName value to set. + * @return the DistributedAvailabilityGroupInner object itself. + */ + public DistributedAvailabilityGroupInner withSecondaryAvailabilityGroupName(String secondaryAvailabilityGroupName) { + if (this.innerProperties() == null) { + this.innerProperties = new DistributedAvailabilityGroupProperties(); + } + this.innerProperties().withSecondaryAvailabilityGroupName(secondaryAvailabilityGroupName); + return this; + } + + /** + * Get the replicationMode property: The replication mode of a distributed availability group. Parameter will be + * ignored during link creation. + * + * @return the replicationMode value. + */ + public ReplicationMode replicationMode() { + return this.innerProperties() == null ? null : this.innerProperties().replicationMode(); + } + + /** + * Set the replicationMode property: The replication mode of a distributed availability group. Parameter will be + * ignored during link creation. + * + * @param replicationMode the replicationMode value to set. + * @return the DistributedAvailabilityGroupInner object itself. + */ + public DistributedAvailabilityGroupInner withReplicationMode(ReplicationMode replicationMode) { + if (this.innerProperties() == null) { + this.innerProperties = new DistributedAvailabilityGroupProperties(); + } + this.innerProperties().withReplicationMode(replicationMode); + return this; + } + + /** + * Get the distributedAvailabilityGroupId property: The distributed availability group id. + * + * @return the distributedAvailabilityGroupId value. + */ + public UUID distributedAvailabilityGroupId() { + return this.innerProperties() == null ? null : this.innerProperties().distributedAvailabilityGroupId(); + } + + /** + * Get the sourceReplicaId property: The source replica id. + * + * @return the sourceReplicaId value. + */ + public UUID sourceReplicaId() { + return this.innerProperties() == null ? null : this.innerProperties().sourceReplicaId(); + } + + /** + * Get the targetReplicaId property: The target replica id. + * + * @return the targetReplicaId value. + */ + public UUID targetReplicaId() { + return this.innerProperties() == null ? null : this.innerProperties().targetReplicaId(); + } + + /** + * Get the linkState property: The link state. + * + * @return the linkState value. + */ + public String linkState() { + return this.innerProperties() == null ? null : this.innerProperties().linkState(); + } + + /** + * Get the lastHardenedLsn property: The last hardened lsn. + * + * @return the lastHardenedLsn value. + */ + public String lastHardenedLsn() { + return this.innerProperties() == null ? null : this.innerProperties().lastHardenedLsn(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DistributedAvailabilityGroupProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DistributedAvailabilityGroupProperties.java new file mode 100644 index 0000000000000..5b4335eccc398 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/DistributedAvailabilityGroupProperties.java @@ -0,0 +1,235 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.models.ReplicationMode; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +/** The properties of a distributed availability group. */ +@Fluent +public final class DistributedAvailabilityGroupProperties { + /* + * The name of the target database + */ + @JsonProperty(value = "targetDatabase") + private String targetDatabase; + + /* + * The source endpoint + */ + @JsonProperty(value = "sourceEndpoint") + private String sourceEndpoint; + + /* + * The primary availability group name + */ + @JsonProperty(value = "primaryAvailabilityGroupName") + private String primaryAvailabilityGroupName; + + /* + * The secondary availability group name + */ + @JsonProperty(value = "secondaryAvailabilityGroupName") + private String secondaryAvailabilityGroupName; + + /* + * The replication mode of a distributed availability group. Parameter will be ignored during link creation. + */ + @JsonProperty(value = "replicationMode") + private ReplicationMode replicationMode; + + /* + * The distributed availability group id + */ + @JsonProperty(value = "distributedAvailabilityGroupId", access = JsonProperty.Access.WRITE_ONLY) + private UUID distributedAvailabilityGroupId; + + /* + * The source replica id + */ + @JsonProperty(value = "sourceReplicaId", access = JsonProperty.Access.WRITE_ONLY) + private UUID sourceReplicaId; + + /* + * The target replica id + */ + @JsonProperty(value = "targetReplicaId", access = JsonProperty.Access.WRITE_ONLY) + private UUID targetReplicaId; + + /* + * The link state + */ + @JsonProperty(value = "linkState", access = JsonProperty.Access.WRITE_ONLY) + private String linkState; + + /* + * The last hardened lsn + */ + @JsonProperty(value = "lastHardenedLsn", access = JsonProperty.Access.WRITE_ONLY) + private String lastHardenedLsn; + + /** Creates an instance of DistributedAvailabilityGroupProperties class. */ + public DistributedAvailabilityGroupProperties() { + } + + /** + * Get the targetDatabase property: The name of the target database. + * + * @return the targetDatabase value. + */ + public String targetDatabase() { + return this.targetDatabase; + } + + /** + * Set the targetDatabase property: The name of the target database. + * + * @param targetDatabase the targetDatabase value to set. + * @return the DistributedAvailabilityGroupProperties object itself. + */ + public DistributedAvailabilityGroupProperties withTargetDatabase(String targetDatabase) { + this.targetDatabase = targetDatabase; + return this; + } + + /** + * Get the sourceEndpoint property: The source endpoint. + * + * @return the sourceEndpoint value. + */ + public String sourceEndpoint() { + return this.sourceEndpoint; + } + + /** + * Set the sourceEndpoint property: The source endpoint. + * + * @param sourceEndpoint the sourceEndpoint value to set. + * @return the DistributedAvailabilityGroupProperties object itself. + */ + public DistributedAvailabilityGroupProperties withSourceEndpoint(String sourceEndpoint) { + this.sourceEndpoint = sourceEndpoint; + return this; + } + + /** + * Get the primaryAvailabilityGroupName property: The primary availability group name. + * + * @return the primaryAvailabilityGroupName value. + */ + public String primaryAvailabilityGroupName() { + return this.primaryAvailabilityGroupName; + } + + /** + * Set the primaryAvailabilityGroupName property: The primary availability group name. + * + * @param primaryAvailabilityGroupName the primaryAvailabilityGroupName value to set. + * @return the DistributedAvailabilityGroupProperties object itself. + */ + public DistributedAvailabilityGroupProperties withPrimaryAvailabilityGroupName( + String primaryAvailabilityGroupName) { + this.primaryAvailabilityGroupName = primaryAvailabilityGroupName; + return this; + } + + /** + * Get the secondaryAvailabilityGroupName property: The secondary availability group name. + * + * @return the secondaryAvailabilityGroupName value. + */ + public String secondaryAvailabilityGroupName() { + return this.secondaryAvailabilityGroupName; + } + + /** + * Set the secondaryAvailabilityGroupName property: The secondary availability group name. + * + * @param secondaryAvailabilityGroupName the secondaryAvailabilityGroupName value to set. + * @return the DistributedAvailabilityGroupProperties object itself. + */ + public DistributedAvailabilityGroupProperties withSecondaryAvailabilityGroupName( + String secondaryAvailabilityGroupName) { + this.secondaryAvailabilityGroupName = secondaryAvailabilityGroupName; + return this; + } + + /** + * Get the replicationMode property: The replication mode of a distributed availability group. Parameter will be + * ignored during link creation. + * + * @return the replicationMode value. + */ + public ReplicationMode replicationMode() { + return this.replicationMode; + } + + /** + * Set the replicationMode property: The replication mode of a distributed availability group. Parameter will be + * ignored during link creation. + * + * @param replicationMode the replicationMode value to set. + * @return the DistributedAvailabilityGroupProperties object itself. + */ + public DistributedAvailabilityGroupProperties withReplicationMode(ReplicationMode replicationMode) { + this.replicationMode = replicationMode; + return this; + } + + /** + * Get the distributedAvailabilityGroupId property: The distributed availability group id. + * + * @return the distributedAvailabilityGroupId value. + */ + public UUID distributedAvailabilityGroupId() { + return this.distributedAvailabilityGroupId; + } + + /** + * Get the sourceReplicaId property: The source replica id. + * + * @return the sourceReplicaId value. + */ + public UUID sourceReplicaId() { + return this.sourceReplicaId; + } + + /** + * Get the targetReplicaId property: The target replica id. + * + * @return the targetReplicaId value. + */ + public UUID targetReplicaId() { + return this.targetReplicaId; + } + + /** + * Get the linkState property: The link state. + * + * @return the linkState value. + */ + public String linkState() { + return this.linkState; + } + + /** + * Get the lastHardenedLsn property: The last hardened lsn. + * + * @return the lastHardenedLsn value. + */ + public String lastHardenedLsn() { + return this.lastHardenedLsn; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolActivityInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolActivityInner.java new file mode 100644 index 0000000000000..e092f4c0e851c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolActivityInner.java @@ -0,0 +1,251 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.UUID; + +/** Represents the activity on an elastic pool. */ +@Fluent +public final class ElasticPoolActivityInner extends ProxyResource { + /* + * The geo-location where the resource lives + */ + @JsonProperty(value = "location") + private String location; + + /* + * The properties representing the resource. + */ + @JsonProperty(value = "properties") + private ElasticPoolActivityProperties innerProperties; + + /** Creates an instance of ElasticPoolActivityInner class. */ + public ElasticPoolActivityInner() { + } + + /** + * Get the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: 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 innerProperties property: The properties representing the resource. + * + * @return the innerProperties value. + */ + private ElasticPoolActivityProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the endTime property: The time the operation finished (ISO8601 format). + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.innerProperties() == null ? null : this.innerProperties().endTime(); + } + + /** + * Get the errorCode property: The error code if available. + * + * @return the errorCode value. + */ + public Integer errorCode() { + return this.innerProperties() == null ? null : this.innerProperties().errorCode(); + } + + /** + * Get the errorMessage property: The error message if available. + * + * @return the errorMessage value. + */ + public String errorMessage() { + return this.innerProperties() == null ? null : this.innerProperties().errorMessage(); + } + + /** + * Get the errorSeverity property: The error severity if available. + * + * @return the errorSeverity value. + */ + public Integer errorSeverity() { + return this.innerProperties() == null ? null : this.innerProperties().errorSeverity(); + } + + /** + * Get the operation property: The operation name. + * + * @return the operation value. + */ + public String operation() { + return this.innerProperties() == null ? null : this.innerProperties().operation(); + } + + /** + * Get the operationId property: The unique operation ID. + * + * @return the operationId value. + */ + public UUID operationId() { + return this.innerProperties() == null ? null : this.innerProperties().operationId(); + } + + /** + * Get the percentComplete property: The percentage complete if available. + * + * @return the percentComplete value. + */ + public Integer percentComplete() { + return this.innerProperties() == null ? null : this.innerProperties().percentComplete(); + } + + /** + * Get the requestedDatabaseDtuMax property: The requested max DTU per database if available. + * + * @return the requestedDatabaseDtuMax value. + */ + public Integer requestedDatabaseDtuMax() { + return this.innerProperties() == null ? null : this.innerProperties().requestedDatabaseDtuMax(); + } + + /** + * Get the requestedDatabaseDtuMin property: The requested min DTU per database if available. + * + * @return the requestedDatabaseDtuMin value. + */ + public Integer requestedDatabaseDtuMin() { + return this.innerProperties() == null ? null : this.innerProperties().requestedDatabaseDtuMin(); + } + + /** + * Get the requestedDtu property: The requested DTU for the pool if available. + * + * @return the requestedDtu value. + */ + public Integer requestedDtu() { + return this.innerProperties() == null ? null : this.innerProperties().requestedDtu(); + } + + /** + * Get the requestedElasticPoolName property: The requested name for the elastic pool if available. + * + * @return the requestedElasticPoolName value. + */ + public String requestedElasticPoolName() { + return this.innerProperties() == null ? null : this.innerProperties().requestedElasticPoolName(); + } + + /** + * Get the requestedStorageLimitInGB property: The requested storage limit for the pool in GB if available. + * + * @return the requestedStorageLimitInGB value. + */ + public Long requestedStorageLimitInGB() { + return this.innerProperties() == null ? null : this.innerProperties().requestedStorageLimitInGB(); + } + + /** + * Get the elasticPoolName property: The name of the elastic pool. + * + * @return the elasticPoolName value. + */ + public String elasticPoolName() { + return this.innerProperties() == null ? null : this.innerProperties().elasticPoolName(); + } + + /** + * Get the serverName property: The name of the server the elastic pool is in. + * + * @return the serverName value. + */ + public String serverName() { + return this.innerProperties() == null ? null : this.innerProperties().serverName(); + } + + /** + * Get the startTime property: The time the operation started (ISO8601 format). + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.innerProperties() == null ? null : this.innerProperties().startTime(); + } + + /** + * Get the state property: The current state of the operation. + * + * @return the state value. + */ + public String state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Get the requestedStorageLimitInMB property: The requested storage limit in MB. + * + * @return the requestedStorageLimitInMB value. + */ + public Integer requestedStorageLimitInMB() { + return this.innerProperties() == null ? null : this.innerProperties().requestedStorageLimitInMB(); + } + + /** + * Get the requestedDatabaseDtuGuarantee property: The requested per database DTU guarantee. + * + * @return the requestedDatabaseDtuGuarantee value. + */ + public Integer requestedDatabaseDtuGuarantee() { + return this.innerProperties() == null ? null : this.innerProperties().requestedDatabaseDtuGuarantee(); + } + + /** + * Get the requestedDatabaseDtuCap property: The requested per database DTU cap. + * + * @return the requestedDatabaseDtuCap value. + */ + public Integer requestedDatabaseDtuCap() { + return this.innerProperties() == null ? null : this.innerProperties().requestedDatabaseDtuCap(); + } + + /** + * Get the requestedDtuGuarantee property: The requested DTU guarantee. + * + * @return the requestedDtuGuarantee value. + */ + public Integer requestedDtuGuarantee() { + return this.innerProperties() == null ? null : this.innerProperties().requestedDtuGuarantee(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolActivityProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolActivityProperties.java new file mode 100644 index 0000000000000..235cec27ac04e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolActivityProperties.java @@ -0,0 +1,326 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.UUID; + +/** Represents the properties of an elastic pool. */ +@Immutable +public final class ElasticPoolActivityProperties { + /* + * The time the operation finished (ISO8601 format). + */ + @JsonProperty(value = "endTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime endTime; + + /* + * The error code if available. + */ + @JsonProperty(value = "errorCode", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorCode; + + /* + * The error message if available. + */ + @JsonProperty(value = "errorMessage", access = JsonProperty.Access.WRITE_ONLY) + private String errorMessage; + + /* + * The error severity if available. + */ + @JsonProperty(value = "errorSeverity", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorSeverity; + + /* + * The operation name. + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /* + * The unique operation ID. + */ + @JsonProperty(value = "operationId", access = JsonProperty.Access.WRITE_ONLY) + private UUID operationId; + + /* + * The percentage complete if available. + */ + @JsonProperty(value = "percentComplete", access = JsonProperty.Access.WRITE_ONLY) + private Integer percentComplete; + + /* + * The requested max DTU per database if available. + */ + @JsonProperty(value = "requestedDatabaseDtuMax", access = JsonProperty.Access.WRITE_ONLY) + private Integer requestedDatabaseDtuMax; + + /* + * The requested min DTU per database if available. + */ + @JsonProperty(value = "requestedDatabaseDtuMin", access = JsonProperty.Access.WRITE_ONLY) + private Integer requestedDatabaseDtuMin; + + /* + * The requested DTU for the pool if available. + */ + @JsonProperty(value = "requestedDtu", access = JsonProperty.Access.WRITE_ONLY) + private Integer requestedDtu; + + /* + * The requested name for the elastic pool if available. + */ + @JsonProperty(value = "requestedElasticPoolName", access = JsonProperty.Access.WRITE_ONLY) + private String requestedElasticPoolName; + + /* + * The requested storage limit for the pool in GB if available. + */ + @JsonProperty(value = "requestedStorageLimitInGB", access = JsonProperty.Access.WRITE_ONLY) + private Long requestedStorageLimitInGB; + + /* + * The name of the elastic pool. + */ + @JsonProperty(value = "elasticPoolName", access = JsonProperty.Access.WRITE_ONLY) + private String elasticPoolName; + + /* + * The name of the server the elastic pool is in. + */ + @JsonProperty(value = "serverName", access = JsonProperty.Access.WRITE_ONLY) + private String serverName; + + /* + * The time the operation started (ISO8601 format). + */ + @JsonProperty(value = "startTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime startTime; + + /* + * The current state of the operation. + */ + @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) + private String state; + + /* + * The requested storage limit in MB. + */ + @JsonProperty(value = "requestedStorageLimitInMB", access = JsonProperty.Access.WRITE_ONLY) + private Integer requestedStorageLimitInMB; + + /* + * The requested per database DTU guarantee. + */ + @JsonProperty(value = "requestedDatabaseDtuGuarantee", access = JsonProperty.Access.WRITE_ONLY) + private Integer requestedDatabaseDtuGuarantee; + + /* + * The requested per database DTU cap. + */ + @JsonProperty(value = "requestedDatabaseDtuCap", access = JsonProperty.Access.WRITE_ONLY) + private Integer requestedDatabaseDtuCap; + + /* + * The requested DTU guarantee. + */ + @JsonProperty(value = "requestedDtuGuarantee", access = JsonProperty.Access.WRITE_ONLY) + private Integer requestedDtuGuarantee; + + /** Creates an instance of ElasticPoolActivityProperties class. */ + public ElasticPoolActivityProperties() { + } + + /** + * Get the endTime property: The time the operation finished (ISO8601 format). + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Get the errorCode property: The error code if available. + * + * @return the errorCode value. + */ + public Integer errorCode() { + return this.errorCode; + } + + /** + * Get the errorMessage property: The error message if available. + * + * @return the errorMessage value. + */ + public String errorMessage() { + return this.errorMessage; + } + + /** + * Get the errorSeverity property: The error severity if available. + * + * @return the errorSeverity value. + */ + public Integer errorSeverity() { + return this.errorSeverity; + } + + /** + * Get the operation property: The operation name. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the operationId property: The unique operation ID. + * + * @return the operationId value. + */ + public UUID operationId() { + return this.operationId; + } + + /** + * Get the percentComplete property: The percentage complete if available. + * + * @return the percentComplete value. + */ + public Integer percentComplete() { + return this.percentComplete; + } + + /** + * Get the requestedDatabaseDtuMax property: The requested max DTU per database if available. + * + * @return the requestedDatabaseDtuMax value. + */ + public Integer requestedDatabaseDtuMax() { + return this.requestedDatabaseDtuMax; + } + + /** + * Get the requestedDatabaseDtuMin property: The requested min DTU per database if available. + * + * @return the requestedDatabaseDtuMin value. + */ + public Integer requestedDatabaseDtuMin() { + return this.requestedDatabaseDtuMin; + } + + /** + * Get the requestedDtu property: The requested DTU for the pool if available. + * + * @return the requestedDtu value. + */ + public Integer requestedDtu() { + return this.requestedDtu; + } + + /** + * Get the requestedElasticPoolName property: The requested name for the elastic pool if available. + * + * @return the requestedElasticPoolName value. + */ + public String requestedElasticPoolName() { + return this.requestedElasticPoolName; + } + + /** + * Get the requestedStorageLimitInGB property: The requested storage limit for the pool in GB if available. + * + * @return the requestedStorageLimitInGB value. + */ + public Long requestedStorageLimitInGB() { + return this.requestedStorageLimitInGB; + } + + /** + * Get the elasticPoolName property: The name of the elastic pool. + * + * @return the elasticPoolName value. + */ + public String elasticPoolName() { + return this.elasticPoolName; + } + + /** + * Get the serverName property: The name of the server the elastic pool is in. + * + * @return the serverName value. + */ + public String serverName() { + return this.serverName; + } + + /** + * Get the startTime property: The time the operation started (ISO8601 format). + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Get the state property: The current state of the operation. + * + * @return the state value. + */ + public String state() { + return this.state; + } + + /** + * Get the requestedStorageLimitInMB property: The requested storage limit in MB. + * + * @return the requestedStorageLimitInMB value. + */ + public Integer requestedStorageLimitInMB() { + return this.requestedStorageLimitInMB; + } + + /** + * Get the requestedDatabaseDtuGuarantee property: The requested per database DTU guarantee. + * + * @return the requestedDatabaseDtuGuarantee value. + */ + public Integer requestedDatabaseDtuGuarantee() { + return this.requestedDatabaseDtuGuarantee; + } + + /** + * Get the requestedDatabaseDtuCap property: The requested per database DTU cap. + * + * @return the requestedDatabaseDtuCap value. + */ + public Integer requestedDatabaseDtuCap() { + return this.requestedDatabaseDtuCap; + } + + /** + * Get the requestedDtuGuarantee property: The requested DTU guarantee. + * + * @return the requestedDtuGuarantee value. + */ + public Integer requestedDtuGuarantee() { + return this.requestedDtuGuarantee; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolDatabaseActivityInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolDatabaseActivityInner.java new file mode 100644 index 0000000000000..b691e21d76944 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolDatabaseActivityInner.java @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.UUID; + +/** Represents the activity on an elastic pool. */ +@Fluent +public final class ElasticPoolDatabaseActivityInner extends ProxyResource { + /* + * The geo-location where the resource lives + */ + @JsonProperty(value = "location") + private String location; + + /* + * The properties representing the resource. + */ + @JsonProperty(value = "properties") + private ElasticPoolDatabaseActivityProperties innerProperties; + + /** Creates an instance of ElasticPoolDatabaseActivityInner class. */ + public ElasticPoolDatabaseActivityInner() { + } + + /** + * Get the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: 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 innerProperties property: The properties representing the resource. + * + * @return the innerProperties value. + */ + private ElasticPoolDatabaseActivityProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the databaseName property: The database name. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.innerProperties() == null ? null : this.innerProperties().databaseName(); + } + + /** + * Get the endTime property: The time the operation finished (ISO8601 format). + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.innerProperties() == null ? null : this.innerProperties().endTime(); + } + + /** + * Get the errorCode property: The error code if available. + * + * @return the errorCode value. + */ + public Integer errorCode() { + return this.innerProperties() == null ? null : this.innerProperties().errorCode(); + } + + /** + * Get the errorMessage property: The error message if available. + * + * @return the errorMessage value. + */ + public String errorMessage() { + return this.innerProperties() == null ? null : this.innerProperties().errorMessage(); + } + + /** + * Get the errorSeverity property: The error severity if available. + * + * @return the errorSeverity value. + */ + public Integer errorSeverity() { + return this.innerProperties() == null ? null : this.innerProperties().errorSeverity(); + } + + /** + * Get the operation property: The operation name. + * + * @return the operation value. + */ + public String operation() { + return this.innerProperties() == null ? null : this.innerProperties().operation(); + } + + /** + * Get the operationId property: The unique operation ID. + * + * @return the operationId value. + */ + public UUID operationId() { + return this.innerProperties() == null ? null : this.innerProperties().operationId(); + } + + /** + * Get the percentComplete property: The percentage complete if available. + * + * @return the percentComplete value. + */ + public Integer percentComplete() { + return this.innerProperties() == null ? null : this.innerProperties().percentComplete(); + } + + /** + * Get the requestedElasticPoolName property: The name for the elastic pool the database is moving into if + * available. + * + * @return the requestedElasticPoolName value. + */ + public String requestedElasticPoolName() { + return this.innerProperties() == null ? null : this.innerProperties().requestedElasticPoolName(); + } + + /** + * Get the currentElasticPoolName property: The name of the current elastic pool the database is in if available. + * + * @return the currentElasticPoolName value. + */ + public String currentElasticPoolName() { + return this.innerProperties() == null ? null : this.innerProperties().currentElasticPoolName(); + } + + /** + * Get the currentServiceObjective property: The name of the current service objective if available. + * + * @return the currentServiceObjective value. + */ + public String currentServiceObjective() { + return this.innerProperties() == null ? null : this.innerProperties().currentServiceObjective(); + } + + /** + * Get the requestedServiceObjective property: The name of the requested service objective if available. + * + * @return the requestedServiceObjective value. + */ + public String requestedServiceObjective() { + return this.innerProperties() == null ? null : this.innerProperties().requestedServiceObjective(); + } + + /** + * Get the serverName property: The name of the server the elastic pool is in. + * + * @return the serverName value. + */ + public String serverName() { + return this.innerProperties() == null ? null : this.innerProperties().serverName(); + } + + /** + * Get the startTime property: The time the operation started (ISO8601 format). + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.innerProperties() == null ? null : this.innerProperties().startTime(); + } + + /** + * Get the state property: The current state of the operation. + * + * @return the state value. + */ + public String state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolDatabaseActivityProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolDatabaseActivityProperties.java new file mode 100644 index 0000000000000..f5e752a99847c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolDatabaseActivityProperties.java @@ -0,0 +1,252 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.UUID; + +/** Represents the properties of an elastic pool database activity. */ +@Immutable +public final class ElasticPoolDatabaseActivityProperties { + /* + * The database name. + */ + @JsonProperty(value = "databaseName", access = JsonProperty.Access.WRITE_ONLY) + private String databaseName; + + /* + * The time the operation finished (ISO8601 format). + */ + @JsonProperty(value = "endTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime endTime; + + /* + * The error code if available. + */ + @JsonProperty(value = "errorCode", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorCode; + + /* + * The error message if available. + */ + @JsonProperty(value = "errorMessage", access = JsonProperty.Access.WRITE_ONLY) + private String errorMessage; + + /* + * The error severity if available. + */ + @JsonProperty(value = "errorSeverity", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorSeverity; + + /* + * The operation name. + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /* + * The unique operation ID. + */ + @JsonProperty(value = "operationId", access = JsonProperty.Access.WRITE_ONLY) + private UUID operationId; + + /* + * The percentage complete if available. + */ + @JsonProperty(value = "percentComplete", access = JsonProperty.Access.WRITE_ONLY) + private Integer percentComplete; + + /* + * The name for the elastic pool the database is moving into if available. + */ + @JsonProperty(value = "requestedElasticPoolName", access = JsonProperty.Access.WRITE_ONLY) + private String requestedElasticPoolName; + + /* + * The name of the current elastic pool the database is in if available. + */ + @JsonProperty(value = "currentElasticPoolName", access = JsonProperty.Access.WRITE_ONLY) + private String currentElasticPoolName; + + /* + * The name of the current service objective if available. + */ + @JsonProperty(value = "currentServiceObjective", access = JsonProperty.Access.WRITE_ONLY) + private String currentServiceObjective; + + /* + * The name of the requested service objective if available. + */ + @JsonProperty(value = "requestedServiceObjective", access = JsonProperty.Access.WRITE_ONLY) + private String requestedServiceObjective; + + /* + * The name of the server the elastic pool is in. + */ + @JsonProperty(value = "serverName", access = JsonProperty.Access.WRITE_ONLY) + private String serverName; + + /* + * The time the operation started (ISO8601 format). + */ + @JsonProperty(value = "startTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime startTime; + + /* + * The current state of the operation. + */ + @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) + private String state; + + /** Creates an instance of ElasticPoolDatabaseActivityProperties class. */ + public ElasticPoolDatabaseActivityProperties() { + } + + /** + * Get the databaseName property: The database name. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Get the endTime property: The time the operation finished (ISO8601 format). + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Get the errorCode property: The error code if available. + * + * @return the errorCode value. + */ + public Integer errorCode() { + return this.errorCode; + } + + /** + * Get the errorMessage property: The error message if available. + * + * @return the errorMessage value. + */ + public String errorMessage() { + return this.errorMessage; + } + + /** + * Get the errorSeverity property: The error severity if available. + * + * @return the errorSeverity value. + */ + public Integer errorSeverity() { + return this.errorSeverity; + } + + /** + * Get the operation property: The operation name. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the operationId property: The unique operation ID. + * + * @return the operationId value. + */ + public UUID operationId() { + return this.operationId; + } + + /** + * Get the percentComplete property: The percentage complete if available. + * + * @return the percentComplete value. + */ + public Integer percentComplete() { + return this.percentComplete; + } + + /** + * Get the requestedElasticPoolName property: 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 currentElasticPoolName property: 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 currentServiceObjective property: The name of the current service objective if available. + * + * @return the currentServiceObjective value. + */ + public String currentServiceObjective() { + return this.currentServiceObjective; + } + + /** + * Get the requestedServiceObjective property: The name of the requested service objective if available. + * + * @return the requestedServiceObjective value. + */ + public String requestedServiceObjective() { + return this.requestedServiceObjective; + } + + /** + * Get the serverName property: The name of the server the elastic pool is in. + * + * @return the serverName value. + */ + public String serverName() { + return this.serverName; + } + + /** + * Get the startTime property: The time the operation started (ISO8601 format). + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Get the state property: The current state of the operation. + * + * @return the state value. + */ + public String state() { + return this.state; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolInner.java new file mode 100644 index 0000000000000..91aa93e9b3e8d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolInner.java @@ -0,0 +1,290 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolLicenseType; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolPerDatabaseSettings; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolState; +import com.azure.resourcemanager.sql.generated.models.Sku; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.Map; + +/** An elastic pool. */ +@Fluent +public final class ElasticPoolInner extends Resource { + /* + * The elastic pool SKU. + * + * The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU name, + * tier/edition, family, and capacity) that are available to your subscription in an Azure region, use the + * `Capabilities_ListByLocation` REST API or the following command: + * + * ```azurecli + * az sql elastic-pool list-editions -l -o table + * ```` + * + */ + @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; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ElasticPoolProperties innerProperties; + + /** Creates an instance of ElasticPoolInner class. */ + public ElasticPoolInner() { + } + + /** + * Get the sku property: The elastic pool SKU. + * + *

The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU name, + * tier/edition, family, and capacity) that are available to your subscription in an Azure region, use the + * `Capabilities_ListByLocation` REST API or the following command: + * + *

```azurecli az sql elastic-pool list-editions -l <location> -o table ````. + * + * @return the sku value. + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku property: The elastic pool SKU. + * + *

The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU name, + * tier/edition, family, and capacity) that are available to your subscription in an Azure region, use the + * `Capabilities_ListByLocation` REST API or the following command: + * + *

```azurecli az sql elastic-pool list-editions -l <location> -o table ````. + * + * @param sku the sku value to set. + * @return the ElasticPoolInner object itself. + */ + public ElasticPoolInner withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the kind property: 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 innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ElasticPoolProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public ElasticPoolInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ElasticPoolInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the state property: The state of the elastic pool. + * + * @return the state value. + */ + public ElasticPoolState state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Get the creationDate property: The creation date of the elastic pool (ISO8601 format). + * + * @return the creationDate value. + */ + public OffsetDateTime creationDate() { + return this.innerProperties() == null ? null : this.innerProperties().creationDate(); + } + + /** + * Get the maxSizeBytes property: The storage limit for the database elastic pool in bytes. + * + * @return the maxSizeBytes value. + */ + public Long maxSizeBytes() { + return this.innerProperties() == null ? null : this.innerProperties().maxSizeBytes(); + } + + /** + * Set the maxSizeBytes property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new ElasticPoolProperties(); + } + this.innerProperties().withMaxSizeBytes(maxSizeBytes); + return this; + } + + /** + * Get the perDatabaseSettings property: The per database settings for the elastic pool. + * + * @return the perDatabaseSettings value. + */ + public ElasticPoolPerDatabaseSettings perDatabaseSettings() { + return this.innerProperties() == null ? null : this.innerProperties().perDatabaseSettings(); + } + + /** + * Set the perDatabaseSettings property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new ElasticPoolProperties(); + } + this.innerProperties().withPerDatabaseSettings(perDatabaseSettings); + return this; + } + + /** + * Get the zoneRedundant property: 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.innerProperties() == null ? null : this.innerProperties().zoneRedundant(); + } + + /** + * Set the zoneRedundant property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new ElasticPoolProperties(); + } + this.innerProperties().withZoneRedundant(zoneRedundant); + return this; + } + + /** + * Get the licenseType property: The license type to apply for this elastic pool. + * + * @return the licenseType value. + */ + public ElasticPoolLicenseType licenseType() { + return this.innerProperties() == null ? null : this.innerProperties().licenseType(); + } + + /** + * Set the licenseType property: The license type to apply for this elastic pool. + * + * @param licenseType the licenseType value to set. + * @return the ElasticPoolInner object itself. + */ + public ElasticPoolInner withLicenseType(ElasticPoolLicenseType licenseType) { + if (this.innerProperties() == null) { + this.innerProperties = new ElasticPoolProperties(); + } + this.innerProperties().withLicenseType(licenseType); + return this; + } + + /** + * Get the maintenanceConfigurationId property: Maintenance configuration id assigned to the elastic pool. This + * configuration defines the period when the maintenance updates will will occur. + * + * @return the maintenanceConfigurationId value. + */ + public String maintenanceConfigurationId() { + return this.innerProperties() == null ? null : this.innerProperties().maintenanceConfigurationId(); + } + + /** + * Set the maintenanceConfigurationId property: Maintenance configuration id assigned to the elastic pool. This + * configuration defines the period when the maintenance updates will will occur. + * + * @param maintenanceConfigurationId the maintenanceConfigurationId value to set. + * @return the ElasticPoolInner object itself. + */ + public ElasticPoolInner withMaintenanceConfigurationId(String maintenanceConfigurationId) { + if (this.innerProperties() == null) { + this.innerProperties = new ElasticPoolProperties(); + } + this.innerProperties().withMaintenanceConfigurationId(maintenanceConfigurationId); + return this; + } + + /** + * Get the highAvailabilityReplicaCount property: The number of secondary replicas associated with the elastic pool + * that are used to provide high availability. + * + * @return the highAvailabilityReplicaCount value. + */ + public Integer highAvailabilityReplicaCount() { + return this.innerProperties() == null ? null : this.innerProperties().highAvailabilityReplicaCount(); + } + + /** + * Set the highAvailabilityReplicaCount property: The number of secondary replicas associated with the elastic pool + * that are used to provide high availability. + * + * @param highAvailabilityReplicaCount the highAvailabilityReplicaCount value to set. + * @return the ElasticPoolInner object itself. + */ + public ElasticPoolInner withHighAvailabilityReplicaCount(Integer highAvailabilityReplicaCount) { + if (this.innerProperties() == null) { + this.innerProperties = new ElasticPoolProperties(); + } + this.innerProperties().withHighAvailabilityReplicaCount(highAvailabilityReplicaCount); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolOperationInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolOperationInner.java new file mode 100644 index 0000000000000..cc0175fd71333 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolOperationInner.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** A elastic pool operation. */ +@Immutable +public final class ElasticPoolOperationInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ElasticPoolOperationProperties innerProperties; + + /** Creates an instance of ElasticPoolOperationInner class. */ + public ElasticPoolOperationInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ElasticPoolOperationProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the elasticPoolName property: The name of the elastic pool the operation is being performed on. + * + * @return the elasticPoolName value. + */ + public String elasticPoolName() { + return this.innerProperties() == null ? null : this.innerProperties().elasticPoolName(); + } + + /** + * Get the operation property: The name of operation. + * + * @return the operation value. + */ + public String operation() { + return this.innerProperties() == null ? null : this.innerProperties().operation(); + } + + /** + * Get the operationFriendlyName property: The friendly name of operation. + * + * @return the operationFriendlyName value. + */ + public String operationFriendlyName() { + return this.innerProperties() == null ? null : this.innerProperties().operationFriendlyName(); + } + + /** + * Get the percentComplete property: The percentage of the operation completed. + * + * @return the percentComplete value. + */ + public Integer percentComplete() { + return this.innerProperties() == null ? null : this.innerProperties().percentComplete(); + } + + /** + * Get the serverName property: The name of the server. + * + * @return the serverName value. + */ + public String serverName() { + return this.innerProperties() == null ? null : this.innerProperties().serverName(); + } + + /** + * Get the startTime property: The operation start time. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.innerProperties() == null ? null : this.innerProperties().startTime(); + } + + /** + * Get the state property: The operation state. + * + * @return the state value. + */ + public String state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Get the errorCode property: The operation error code. + * + * @return the errorCode value. + */ + public Integer errorCode() { + return this.innerProperties() == null ? null : this.innerProperties().errorCode(); + } + + /** + * Get the errorDescription property: The operation error description. + * + * @return the errorDescription value. + */ + public String errorDescription() { + return this.innerProperties() == null ? null : this.innerProperties().errorDescription(); + } + + /** + * Get the errorSeverity property: The operation error severity. + * + * @return the errorSeverity value. + */ + public Integer errorSeverity() { + return this.innerProperties() == null ? null : this.innerProperties().errorSeverity(); + } + + /** + * Get the isUserError property: Whether or not the error is a user error. + * + * @return the isUserError value. + */ + public Boolean isUserError() { + return this.innerProperties() == null ? null : this.innerProperties().isUserError(); + } + + /** + * Get the estimatedCompletionTime property: The estimated completion time of the operation. + * + * @return the estimatedCompletionTime value. + */ + public OffsetDateTime estimatedCompletionTime() { + return this.innerProperties() == null ? null : this.innerProperties().estimatedCompletionTime(); + } + + /** + * Get the description property: The operation description. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Get the isCancellable property: Whether the operation can be cancelled. + * + * @return the isCancellable value. + */ + public Boolean isCancellable() { + return this.innerProperties() == null ? null : this.innerProperties().isCancellable(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolOperationProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolOperationProperties.java new file mode 100644 index 0000000000000..2163e9cbed5bb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolOperationProperties.java @@ -0,0 +1,235 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The properties of a elastic pool operation. */ +@Immutable +public final class ElasticPoolOperationProperties { + /* + * The name of the elastic pool the operation is being performed on. + */ + @JsonProperty(value = "elasticPoolName", access = JsonProperty.Access.WRITE_ONLY) + private String elasticPoolName; + + /* + * The name of operation. + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /* + * The friendly name of operation. + */ + @JsonProperty(value = "operationFriendlyName", access = JsonProperty.Access.WRITE_ONLY) + private String operationFriendlyName; + + /* + * The percentage of the operation completed. + */ + @JsonProperty(value = "percentComplete", access = JsonProperty.Access.WRITE_ONLY) + private Integer percentComplete; + + /* + * The name of the server. + */ + @JsonProperty(value = "serverName", access = JsonProperty.Access.WRITE_ONLY) + private String serverName; + + /* + * The operation start time. + */ + @JsonProperty(value = "startTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime startTime; + + /* + * The operation state. + */ + @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) + private String state; + + /* + * The operation error code. + */ + @JsonProperty(value = "errorCode", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorCode; + + /* + * The operation error description. + */ + @JsonProperty(value = "errorDescription", access = JsonProperty.Access.WRITE_ONLY) + private String errorDescription; + + /* + * The operation error severity. + */ + @JsonProperty(value = "errorSeverity", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorSeverity; + + /* + * Whether or not the error is a user error. + */ + @JsonProperty(value = "isUserError", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isUserError; + + /* + * The estimated completion time of the operation. + */ + @JsonProperty(value = "estimatedCompletionTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime estimatedCompletionTime; + + /* + * The operation description. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /* + * Whether the operation can be cancelled. + */ + @JsonProperty(value = "isCancellable", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isCancellable; + + /** Creates an instance of ElasticPoolOperationProperties class. */ + public ElasticPoolOperationProperties() { + } + + /** + * Get the elasticPoolName property: The name of the elastic pool the operation is being performed on. + * + * @return the elasticPoolName value. + */ + public String elasticPoolName() { + return this.elasticPoolName; + } + + /** + * Get the operation property: The name of operation. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the operationFriendlyName property: The friendly name of operation. + * + * @return the operationFriendlyName value. + */ + public String operationFriendlyName() { + return this.operationFriendlyName; + } + + /** + * Get the percentComplete property: The percentage of the operation completed. + * + * @return the percentComplete value. + */ + public Integer percentComplete() { + return this.percentComplete; + } + + /** + * Get the serverName property: The name of the server. + * + * @return the serverName value. + */ + public String serverName() { + return this.serverName; + } + + /** + * Get the startTime property: The operation start time. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Get the state property: The operation state. + * + * @return the state value. + */ + public String state() { + return this.state; + } + + /** + * Get the errorCode property: The operation error code. + * + * @return the errorCode value. + */ + public Integer errorCode() { + return this.errorCode; + } + + /** + * Get the errorDescription property: The operation error description. + * + * @return the errorDescription value. + */ + public String errorDescription() { + return this.errorDescription; + } + + /** + * Get the errorSeverity property: The operation error severity. + * + * @return the errorSeverity value. + */ + public Integer errorSeverity() { + return this.errorSeverity; + } + + /** + * Get the isUserError property: Whether or not the error is a user error. + * + * @return the isUserError value. + */ + public Boolean isUserError() { + return this.isUserError; + } + + /** + * Get the estimatedCompletionTime property: The estimated completion time of the operation. + * + * @return the estimatedCompletionTime value. + */ + public OffsetDateTime estimatedCompletionTime() { + return this.estimatedCompletionTime; + } + + /** + * Get the description property: The operation description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the isCancellable property: Whether the operation can be cancelled. + * + * @return the isCancellable value. + */ + public Boolean isCancellable() { + return this.isCancellable; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolProperties.java new file mode 100644 index 0000000000000..365966115e1d8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolProperties.java @@ -0,0 +1,225 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolLicenseType; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolPerDatabaseSettings; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Properties of an elastic pool. */ +@Fluent +public final class ElasticPoolProperties { + /* + * The state of the elastic pool. + */ + @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) + private ElasticPoolState state; + + /* + * The creation date of the elastic pool (ISO8601 format). + */ + @JsonProperty(value = "creationDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime creationDate; + + /* + * The storage limit for the database elastic pool in bytes. + */ + @JsonProperty(value = "maxSizeBytes") + private Long maxSizeBytes; + + /* + * The per database settings for the elastic pool. + */ + @JsonProperty(value = "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 = "zoneRedundant") + private Boolean zoneRedundant; + + /* + * The license type to apply for this elastic pool. + */ + @JsonProperty(value = "licenseType") + private ElasticPoolLicenseType licenseType; + + /* + * Maintenance configuration id assigned to the elastic pool. This configuration defines the period when the + * maintenance updates will will occur. + */ + @JsonProperty(value = "maintenanceConfigurationId") + private String maintenanceConfigurationId; + + /* + * The number of secondary replicas associated with the elastic pool that are used to provide high availability. + */ + @JsonProperty(value = "highAvailabilityReplicaCount") + private Integer highAvailabilityReplicaCount; + + /** Creates an instance of ElasticPoolProperties class. */ + public ElasticPoolProperties() { + } + + /** + * Get the state property: The state of the elastic pool. + * + * @return the state value. + */ + public ElasticPoolState state() { + return this.state; + } + + /** + * Get the creationDate property: The creation date of the elastic pool (ISO8601 format). + * + * @return the creationDate value. + */ + public OffsetDateTime creationDate() { + return this.creationDate; + } + + /** + * Get the maxSizeBytes property: The storage limit for the database elastic pool in bytes. + * + * @return the maxSizeBytes value. + */ + public Long maxSizeBytes() { + return this.maxSizeBytes; + } + + /** + * Set the maxSizeBytes property: The storage limit for the database elastic pool in bytes. + * + * @param maxSizeBytes the maxSizeBytes value to set. + * @return the ElasticPoolProperties object itself. + */ + public ElasticPoolProperties withMaxSizeBytes(Long maxSizeBytes) { + this.maxSizeBytes = maxSizeBytes; + return this; + } + + /** + * Get the perDatabaseSettings property: The per database settings for the elastic pool. + * + * @return the perDatabaseSettings value. + */ + public ElasticPoolPerDatabaseSettings perDatabaseSettings() { + return this.perDatabaseSettings; + } + + /** + * Set the perDatabaseSettings property: The per database settings for the elastic pool. + * + * @param perDatabaseSettings the perDatabaseSettings value to set. + * @return the ElasticPoolProperties object itself. + */ + public ElasticPoolProperties withPerDatabaseSettings(ElasticPoolPerDatabaseSettings perDatabaseSettings) { + this.perDatabaseSettings = perDatabaseSettings; + return this; + } + + /** + * Get the zoneRedundant property: 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 the zoneRedundant property: 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 ElasticPoolProperties object itself. + */ + public ElasticPoolProperties withZoneRedundant(Boolean zoneRedundant) { + this.zoneRedundant = zoneRedundant; + return this; + } + + /** + * Get the licenseType property: The license type to apply for this elastic pool. + * + * @return the licenseType value. + */ + public ElasticPoolLicenseType licenseType() { + return this.licenseType; + } + + /** + * Set the licenseType property: The license type to apply for this elastic pool. + * + * @param licenseType the licenseType value to set. + * @return the ElasticPoolProperties object itself. + */ + public ElasticPoolProperties withLicenseType(ElasticPoolLicenseType licenseType) { + this.licenseType = licenseType; + return this; + } + + /** + * Get the maintenanceConfigurationId property: Maintenance configuration id assigned to the elastic pool. This + * configuration defines the period when the maintenance updates will will occur. + * + * @return the maintenanceConfigurationId value. + */ + public String maintenanceConfigurationId() { + return this.maintenanceConfigurationId; + } + + /** + * Set the maintenanceConfigurationId property: Maintenance configuration id assigned to the elastic pool. This + * configuration defines the period when the maintenance updates will will occur. + * + * @param maintenanceConfigurationId the maintenanceConfigurationId value to set. + * @return the ElasticPoolProperties object itself. + */ + public ElasticPoolProperties withMaintenanceConfigurationId(String maintenanceConfigurationId) { + this.maintenanceConfigurationId = maintenanceConfigurationId; + return this; + } + + /** + * Get the highAvailabilityReplicaCount property: The number of secondary replicas associated with the elastic pool + * that are used to provide high availability. + * + * @return the highAvailabilityReplicaCount value. + */ + public Integer highAvailabilityReplicaCount() { + return this.highAvailabilityReplicaCount; + } + + /** + * Set the highAvailabilityReplicaCount property: The number of secondary replicas associated with the elastic pool + * that are used to provide high availability. + * + * @param highAvailabilityReplicaCount the highAvailabilityReplicaCount value to set. + * @return the ElasticPoolProperties object itself. + */ + public ElasticPoolProperties withHighAvailabilityReplicaCount(Integer highAvailabilityReplicaCount) { + this.highAvailabilityReplicaCount = highAvailabilityReplicaCount; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (perDatabaseSettings() != null) { + perDatabaseSettings().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolUpdateProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolUpdateProperties.java new file mode 100644 index 0000000000000..1662bb57faa4d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ElasticPoolUpdateProperties.java @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolLicenseType; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolPerDatabaseSettings; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of an elastic pool. */ +@Fluent +public final class ElasticPoolUpdateProperties { + /* + * The storage limit for the database elastic pool in bytes. + */ + @JsonProperty(value = "maxSizeBytes") + private Long maxSizeBytes; + + /* + * The per database settings for the elastic pool. + */ + @JsonProperty(value = "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 = "zoneRedundant") + private Boolean zoneRedundant; + + /* + * The license type to apply for this elastic pool. + */ + @JsonProperty(value = "licenseType") + private ElasticPoolLicenseType licenseType; + + /* + * Maintenance configuration id assigned to the elastic pool. This configuration defines the period when the + * maintenance updates will will occur. + */ + @JsonProperty(value = "maintenanceConfigurationId") + private String maintenanceConfigurationId; + + /* + * The number of secondary replicas associated with the elastic pool that are used to provide high availability. + * Applicable only to Hyperscale elastic pools. + */ + @JsonProperty(value = "highAvailabilityReplicaCount") + private Integer highAvailabilityReplicaCount; + + /** Creates an instance of ElasticPoolUpdateProperties class. */ + public ElasticPoolUpdateProperties() { + } + + /** + * Get the maxSizeBytes property: The storage limit for the database elastic pool in bytes. + * + * @return the maxSizeBytes value. + */ + public Long maxSizeBytes() { + return this.maxSizeBytes; + } + + /** + * Set the maxSizeBytes property: The storage limit for the database elastic pool in bytes. + * + * @param maxSizeBytes the maxSizeBytes value to set. + * @return the ElasticPoolUpdateProperties object itself. + */ + public ElasticPoolUpdateProperties withMaxSizeBytes(Long maxSizeBytes) { + this.maxSizeBytes = maxSizeBytes; + return this; + } + + /** + * Get the perDatabaseSettings property: The per database settings for the elastic pool. + * + * @return the perDatabaseSettings value. + */ + public ElasticPoolPerDatabaseSettings perDatabaseSettings() { + return this.perDatabaseSettings; + } + + /** + * Set the perDatabaseSettings property: The per database settings for the elastic pool. + * + * @param perDatabaseSettings the perDatabaseSettings value to set. + * @return the ElasticPoolUpdateProperties object itself. + */ + public ElasticPoolUpdateProperties withPerDatabaseSettings(ElasticPoolPerDatabaseSettings perDatabaseSettings) { + this.perDatabaseSettings = perDatabaseSettings; + return this; + } + + /** + * Get the zoneRedundant property: 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 the zoneRedundant property: 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 ElasticPoolUpdateProperties object itself. + */ + public ElasticPoolUpdateProperties withZoneRedundant(Boolean zoneRedundant) { + this.zoneRedundant = zoneRedundant; + return this; + } + + /** + * Get the licenseType property: The license type to apply for this elastic pool. + * + * @return the licenseType value. + */ + public ElasticPoolLicenseType licenseType() { + return this.licenseType; + } + + /** + * Set the licenseType property: The license type to apply for this elastic pool. + * + * @param licenseType the licenseType value to set. + * @return the ElasticPoolUpdateProperties object itself. + */ + public ElasticPoolUpdateProperties withLicenseType(ElasticPoolLicenseType licenseType) { + this.licenseType = licenseType; + return this; + } + + /** + * Get the maintenanceConfigurationId property: Maintenance configuration id assigned to the elastic pool. This + * configuration defines the period when the maintenance updates will will occur. + * + * @return the maintenanceConfigurationId value. + */ + public String maintenanceConfigurationId() { + return this.maintenanceConfigurationId; + } + + /** + * Set the maintenanceConfigurationId property: Maintenance configuration id assigned to the elastic pool. This + * configuration defines the period when the maintenance updates will will occur. + * + * @param maintenanceConfigurationId the maintenanceConfigurationId value to set. + * @return the ElasticPoolUpdateProperties object itself. + */ + public ElasticPoolUpdateProperties withMaintenanceConfigurationId(String maintenanceConfigurationId) { + this.maintenanceConfigurationId = maintenanceConfigurationId; + return this; + } + + /** + * Get the highAvailabilityReplicaCount property: The number of secondary replicas associated with the elastic pool + * that are used to provide high availability. Applicable only to Hyperscale elastic pools. + * + * @return the highAvailabilityReplicaCount value. + */ + public Integer highAvailabilityReplicaCount() { + return this.highAvailabilityReplicaCount; + } + + /** + * Set the highAvailabilityReplicaCount property: The number of secondary replicas associated with the elastic pool + * that are used to provide high availability. Applicable only to Hyperscale elastic pools. + * + * @param highAvailabilityReplicaCount the highAvailabilityReplicaCount value to set. + * @return the ElasticPoolUpdateProperties object itself. + */ + public ElasticPoolUpdateProperties withHighAvailabilityReplicaCount(Integer highAvailabilityReplicaCount) { + this.highAvailabilityReplicaCount = highAvailabilityReplicaCount; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (perDatabaseSettings() != null) { + perDatabaseSettings().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/EncryptionProtectorInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/EncryptionProtectorInner.java new file mode 100644 index 0000000000000..521bf182168a2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/EncryptionProtectorInner.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.ServerKeyType; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The server encryption protector. */ +@Fluent +public final class EncryptionProtectorInner 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; + + /* + * Resource location. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private EncryptionProtectorProperties innerProperties; + + /** Creates an instance of EncryptionProtectorInner class. */ + public EncryptionProtectorInner() { + } + + /** + * Get the kind property: 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 location property: Resource location. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private EncryptionProtectorProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the subregion property: Subregion of the encryption protector. + * + * @return the subregion value. + */ + public String subregion() { + return this.innerProperties() == null ? null : this.innerProperties().subregion(); + } + + /** + * Get the serverKeyName property: The name of the server key. + * + * @return the serverKeyName value. + */ + public String serverKeyName() { + return this.innerProperties() == null ? null : this.innerProperties().serverKeyName(); + } + + /** + * Set the serverKeyName property: The name of the server key. + * + * @param serverKeyName the serverKeyName value to set. + * @return the EncryptionProtectorInner object itself. + */ + public EncryptionProtectorInner withServerKeyName(String serverKeyName) { + if (this.innerProperties() == null) { + this.innerProperties = new EncryptionProtectorProperties(); + } + this.innerProperties().withServerKeyName(serverKeyName); + return this; + } + + /** + * Get the serverKeyType property: The encryption protector type like 'ServiceManaged', 'AzureKeyVault'. + * + * @return the serverKeyType value. + */ + public ServerKeyType serverKeyType() { + return this.innerProperties() == null ? null : this.innerProperties().serverKeyType(); + } + + /** + * Set the serverKeyType property: The encryption protector type like 'ServiceManaged', 'AzureKeyVault'. + * + * @param serverKeyType the serverKeyType value to set. + * @return the EncryptionProtectorInner object itself. + */ + public EncryptionProtectorInner withServerKeyType(ServerKeyType serverKeyType) { + if (this.innerProperties() == null) { + this.innerProperties = new EncryptionProtectorProperties(); + } + this.innerProperties().withServerKeyType(serverKeyType); + return this; + } + + /** + * Get the uri property: The URI of the server key. + * + * @return the uri value. + */ + public String uri() { + return this.innerProperties() == null ? null : this.innerProperties().uri(); + } + + /** + * Get the thumbprint property: Thumbprint of the server key. + * + * @return the thumbprint value. + */ + public String thumbprint() { + return this.innerProperties() == null ? null : this.innerProperties().thumbprint(); + } + + /** + * Get the autoRotationEnabled property: Key auto rotation opt-in flag. Either true or false. + * + * @return the autoRotationEnabled value. + */ + public Boolean autoRotationEnabled() { + return this.innerProperties() == null ? null : this.innerProperties().autoRotationEnabled(); + } + + /** + * Set the autoRotationEnabled property: Key auto rotation opt-in flag. Either true or false. + * + * @param autoRotationEnabled the autoRotationEnabled value to set. + * @return the EncryptionProtectorInner object itself. + */ + public EncryptionProtectorInner withAutoRotationEnabled(Boolean autoRotationEnabled) { + if (this.innerProperties() == null) { + this.innerProperties = new EncryptionProtectorProperties(); + } + this.innerProperties().withAutoRotationEnabled(autoRotationEnabled); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/EncryptionProtectorProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/EncryptionProtectorProperties.java new file mode 100644 index 0000000000000..af4986144ab47 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/EncryptionProtectorProperties.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.ServerKeyType; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties for an encryption protector execution. */ +@Fluent +public final class EncryptionProtectorProperties { + /* + * Subregion of the encryption protector. + */ + @JsonProperty(value = "subregion", access = JsonProperty.Access.WRITE_ONLY) + private String subregion; + + /* + * The name of the server key. + */ + @JsonProperty(value = "serverKeyName") + private String serverKeyName; + + /* + * The encryption protector type like 'ServiceManaged', 'AzureKeyVault'. + */ + @JsonProperty(value = "serverKeyType", required = true) + private ServerKeyType serverKeyType; + + /* + * The URI of the server key. + */ + @JsonProperty(value = "uri", access = JsonProperty.Access.WRITE_ONLY) + private String uri; + + /* + * Thumbprint of the server key. + */ + @JsonProperty(value = "thumbprint", access = JsonProperty.Access.WRITE_ONLY) + private String thumbprint; + + /* + * Key auto rotation opt-in flag. Either true or false. + */ + @JsonProperty(value = "autoRotationEnabled") + private Boolean autoRotationEnabled; + + /** Creates an instance of EncryptionProtectorProperties class. */ + public EncryptionProtectorProperties() { + } + + /** + * Get the subregion property: Subregion of the encryption protector. + * + * @return the subregion value. + */ + public String subregion() { + return this.subregion; + } + + /** + * Get the serverKeyName property: The name of the server key. + * + * @return the serverKeyName value. + */ + public String serverKeyName() { + return this.serverKeyName; + } + + /** + * Set the serverKeyName property: The name of the server key. + * + * @param serverKeyName the serverKeyName value to set. + * @return the EncryptionProtectorProperties object itself. + */ + public EncryptionProtectorProperties withServerKeyName(String serverKeyName) { + this.serverKeyName = serverKeyName; + return this; + } + + /** + * Get the serverKeyType property: The encryption protector type like 'ServiceManaged', 'AzureKeyVault'. + * + * @return the serverKeyType value. + */ + public ServerKeyType serverKeyType() { + return this.serverKeyType; + } + + /** + * Set the serverKeyType property: The encryption protector type like 'ServiceManaged', 'AzureKeyVault'. + * + * @param serverKeyType the serverKeyType value to set. + * @return the EncryptionProtectorProperties object itself. + */ + public EncryptionProtectorProperties withServerKeyType(ServerKeyType serverKeyType) { + this.serverKeyType = serverKeyType; + return this; + } + + /** + * Get the uri property: The URI of the server key. + * + * @return the uri value. + */ + public String uri() { + return this.uri; + } + + /** + * Get the thumbprint property: Thumbprint of the server key. + * + * @return the thumbprint value. + */ + public String thumbprint() { + return this.thumbprint; + } + + /** + * Get the autoRotationEnabled property: Key auto rotation opt-in flag. Either true or false. + * + * @return the autoRotationEnabled value. + */ + public Boolean autoRotationEnabled() { + return this.autoRotationEnabled; + } + + /** + * Set the autoRotationEnabled property: Key auto rotation opt-in flag. Either true or false. + * + * @param autoRotationEnabled the autoRotationEnabled value to set. + * @return the EncryptionProtectorProperties object itself. + */ + public EncryptionProtectorProperties withAutoRotationEnabled(Boolean autoRotationEnabled) { + this.autoRotationEnabled = autoRotationEnabled; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (serverKeyType() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property serverKeyType in model EncryptionProtectorProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(EncryptionProtectorProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/EndpointCertificateInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/EndpointCertificateInner.java new file mode 100644 index 0000000000000..b974562df9b2e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/EndpointCertificateInner.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Certificate used on an endpoint on the Managed Instance. */ +@Fluent +public final class EndpointCertificateInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private EndpointCertificateProperties innerProperties; + + /** Creates an instance of EndpointCertificateInner class. */ + public EndpointCertificateInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private EndpointCertificateProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the publicBlob property: The certificate public blob. + * + * @return the publicBlob value. + */ + public String publicBlob() { + return this.innerProperties() == null ? null : this.innerProperties().publicBlob(); + } + + /** + * Set the publicBlob property: The certificate public blob. + * + * @param publicBlob the publicBlob value to set. + * @return the EndpointCertificateInner object itself. + */ + public EndpointCertificateInner withPublicBlob(String publicBlob) { + if (this.innerProperties() == null) { + this.innerProperties = new EndpointCertificateProperties(); + } + this.innerProperties().withPublicBlob(publicBlob); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/EndpointCertificateProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/EndpointCertificateProperties.java new file mode 100644 index 0000000000000..6c78588108b28 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/EndpointCertificateProperties.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of an endpoint certificate. */ +@Fluent +public final class EndpointCertificateProperties { + /* + * The certificate public blob + */ + @JsonProperty(value = "publicBlob") + private String publicBlob; + + /** Creates an instance of EndpointCertificateProperties class. */ + public EndpointCertificateProperties() { + } + + /** + * Get the publicBlob property: The certificate public blob. + * + * @return the publicBlob value. + */ + public String publicBlob() { + return this.publicBlob; + } + + /** + * Set the publicBlob property: The certificate public blob. + * + * @param publicBlob the publicBlob value to set. + * @return the EndpointCertificateProperties object itself. + */ + public EndpointCertificateProperties withPublicBlob(String publicBlob) { + this.publicBlob = publicBlob; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ExtendedDatabaseBlobAuditingPolicyInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ExtendedDatabaseBlobAuditingPolicyInner.java new file mode 100644 index 0000000000000..ef3257efcf820 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ExtendedDatabaseBlobAuditingPolicyInner.java @@ -0,0 +1,426 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.BlobAuditingPolicyState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.UUID; + +/** An extended database blob auditing policy. */ +@Fluent +public final class ExtendedDatabaseBlobAuditingPolicyInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ExtendedDatabaseBlobAuditingPolicyProperties innerProperties; + + /** Creates an instance of ExtendedDatabaseBlobAuditingPolicyInner class. */ + public ExtendedDatabaseBlobAuditingPolicyInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ExtendedDatabaseBlobAuditingPolicyProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the predicateExpression property: Specifies condition of where clause when creating an audit. + * + * @return the predicateExpression value. + */ + public String predicateExpression() { + return this.innerProperties() == null ? null : this.innerProperties().predicateExpression(); + } + + /** + * Set the predicateExpression property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new ExtendedDatabaseBlobAuditingPolicyProperties(); + } + this.innerProperties().withPredicateExpression(predicateExpression); + return this; + } + + /** + * Get the retentionDays property: Specifies the number of days to keep in the audit logs in the storage account. + * + * @return the retentionDays value. + */ + public Integer retentionDays() { + return this.innerProperties() == null ? null : this.innerProperties().retentionDays(); + } + + /** + * Set the retentionDays property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new ExtendedDatabaseBlobAuditingPolicyProperties(); + } + this.innerProperties().withRetentionDays(retentionDays); + return this; + } + + /** + * Get the auditActionsAndGroups property: 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 + * DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP LEDGER_OPERATION_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.innerProperties() == null ? null : this.innerProperties().auditActionsAndGroups(); + } + + /** + * Set the auditActionsAndGroups property: 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 + * DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP LEDGER_OPERATION_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) { + if (this.innerProperties() == null) { + this.innerProperties = new ExtendedDatabaseBlobAuditingPolicyProperties(); + } + this.innerProperties().withAuditActionsAndGroups(auditActionsAndGroups); + return this; + } + + /** + * Get the isStorageSecondaryKeyInUse property: Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + * + * @return the isStorageSecondaryKeyInUse value. + */ + public Boolean isStorageSecondaryKeyInUse() { + return this.innerProperties() == null ? null : this.innerProperties().isStorageSecondaryKeyInUse(); + } + + /** + * Set the isStorageSecondaryKeyInUse property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new ExtendedDatabaseBlobAuditingPolicyProperties(); + } + this.innerProperties().withIsStorageSecondaryKeyInUse(isStorageSecondaryKeyInUse); + return this; + } + + /** + * Get the isAzureMonitorTargetEnabled property: 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.innerProperties() == null ? null : this.innerProperties().isAzureMonitorTargetEnabled(); + } + + /** + * Set the isAzureMonitorTargetEnabled property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new ExtendedDatabaseBlobAuditingPolicyProperties(); + } + this.innerProperties().withIsAzureMonitorTargetEnabled(isAzureMonitorTargetEnabled); + return this; + } + + /** + * Get the queueDelayMs property: Specifies the amount of time in milliseconds that can elapse before audit actions + * are forced to be processed. The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + * + * @return the queueDelayMs value. + */ + public Integer queueDelayMs() { + return this.innerProperties() == null ? null : this.innerProperties().queueDelayMs(); + } + + /** + * Set the queueDelayMs property: Specifies the amount of time in milliseconds that can elapse before audit actions + * are forced to be processed. The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + * + * @param queueDelayMs the queueDelayMs value to set. + * @return the ExtendedDatabaseBlobAuditingPolicyInner object itself. + */ + public ExtendedDatabaseBlobAuditingPolicyInner withQueueDelayMs(Integer queueDelayMs) { + if (this.innerProperties() == null) { + this.innerProperties = new ExtendedDatabaseBlobAuditingPolicyProperties(); + } + this.innerProperties().withQueueDelayMs(queueDelayMs); + return this; + } + + /** + * Get the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob storage. + * + * @return the isManagedIdentityInUse value. + */ + public Boolean isManagedIdentityInUse() { + return this.innerProperties() == null ? null : this.innerProperties().isManagedIdentityInUse(); + } + + /** + * Set the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob storage. + * + * @param isManagedIdentityInUse the isManagedIdentityInUse value to set. + * @return the ExtendedDatabaseBlobAuditingPolicyInner object itself. + */ + public ExtendedDatabaseBlobAuditingPolicyInner withIsManagedIdentityInUse(Boolean isManagedIdentityInUse) { + if (this.innerProperties() == null) { + this.innerProperties = new ExtendedDatabaseBlobAuditingPolicyProperties(); + } + this.innerProperties().withIsManagedIdentityInUse(isManagedIdentityInUse); + return this; + } + + /** + * Get the state property: Specifies the state of the audit. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * + * @return the state value. + */ + public BlobAuditingPolicyState state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Set the state property: Specifies the state of the audit. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * + * @param state the state value to set. + * @return the ExtendedDatabaseBlobAuditingPolicyInner object itself. + */ + public ExtendedDatabaseBlobAuditingPolicyInner withState(BlobAuditingPolicyState state) { + if (this.innerProperties() == null) { + this.innerProperties = new ExtendedDatabaseBlobAuditingPolicyProperties(); + } + this.innerProperties().withState(state); + return this; + } + + /** + * Get the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is + * required. + * + * @return the storageEndpoint value. + */ + public String storageEndpoint() { + return this.innerProperties() == null ? null : this.innerProperties().storageEndpoint(); + } + + /** + * Set the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is + * required. + * + * @param storageEndpoint the storageEndpoint value to set. + * @return the ExtendedDatabaseBlobAuditingPolicyInner object itself. + */ + public ExtendedDatabaseBlobAuditingPolicyInner withStorageEndpoint(String storageEndpoint) { + if (this.innerProperties() == null) { + this.innerProperties = new ExtendedDatabaseBlobAuditingPolicyProperties(); + } + this.innerProperties().withStorageEndpoint(storageEndpoint); + return this; + } + + /** + * Get the storageAccountAccessKey property: Specifies the identifier key of the auditing storage account. If state + * is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server + * system-assigned managed identity to access the storage. Prerequisites for using managed identity authentication: + * 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). 2. Grant SQL Server + * identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server + * identity. For more information, see [Auditing to storage using Managed Identity + * authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @return the storageAccountAccessKey value. + */ + public String storageAccountAccessKey() { + return this.innerProperties() == null ? null : this.innerProperties().storageAccountAccessKey(); + } + + /** + * Set the storageAccountAccessKey property: Specifies the identifier key of the auditing storage account. If state + * is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server + * system-assigned managed identity to access the storage. Prerequisites for using managed identity authentication: + * 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). 2. Grant SQL Server + * identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server + * identity. For more information, see [Auditing to storage using Managed Identity + * authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set. + * @return the ExtendedDatabaseBlobAuditingPolicyInner object itself. + */ + public ExtendedDatabaseBlobAuditingPolicyInner withStorageAccountAccessKey(String storageAccountAccessKey) { + if (this.innerProperties() == null) { + this.innerProperties = new ExtendedDatabaseBlobAuditingPolicyProperties(); + } + this.innerProperties().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + /** + * Get the storageAccountSubscriptionId property: Specifies the blob storage subscription Id. + * + * @return the storageAccountSubscriptionId value. + */ + public UUID storageAccountSubscriptionId() { + return this.innerProperties() == null ? null : this.innerProperties().storageAccountSubscriptionId(); + } + + /** + * Set the storageAccountSubscriptionId property: Specifies the blob storage subscription Id. + * + * @param storageAccountSubscriptionId the storageAccountSubscriptionId value to set. + * @return the ExtendedDatabaseBlobAuditingPolicyInner object itself. + */ + public ExtendedDatabaseBlobAuditingPolicyInner withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId) { + if (this.innerProperties() == null) { + this.innerProperties = new ExtendedDatabaseBlobAuditingPolicyProperties(); + } + this.innerProperties().withStorageAccountSubscriptionId(storageAccountSubscriptionId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ExtendedDatabaseBlobAuditingPolicyProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ExtendedDatabaseBlobAuditingPolicyProperties.java new file mode 100644 index 0000000000000..9db4dfb17738a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ExtendedDatabaseBlobAuditingPolicyProperties.java @@ -0,0 +1,545 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.BlobAuditingPolicyState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.UUID; + +/** Properties of an extended database blob auditing policy. */ +@Fluent +public final class ExtendedDatabaseBlobAuditingPolicyProperties { + /* + * Specifies condition of where clause when creating an audit. + */ + @JsonProperty(value = "predicateExpression") + private String predicateExpression; + + /* + * Specifies the number of days to keep in the audit logs in the storage account. + */ + @JsonProperty(value = "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 + * DBCC_GROUP + * DATABASE_OWNERSHIP_CHANGE_GROUP + * DATABASE_CHANGE_GROUP + * LEDGER_OPERATION_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 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 = "auditActionsAndGroups") + private List auditActionsAndGroups; + + /* + * Specifies whether storageAccountAccessKey value is the storage's secondary key. + */ + @JsonProperty(value = "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 = "isAzureMonitorTargetEnabled") + private Boolean isAzureMonitorTargetEnabled; + + /* + * Specifies the amount of time in milliseconds that can elapse before audit actions are forced to be processed. + * The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + */ + @JsonProperty(value = "queueDelayMs") + private Integer queueDelayMs; + + /* + * Specifies whether Managed Identity is used to access blob storage + */ + @JsonProperty(value = "isManagedIdentityInUse") + private Boolean isManagedIdentityInUse; + + /* + * Specifies the state of the audit. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are + * required. + */ + @JsonProperty(value = "state", required = true) + private BlobAuditingPolicyState state; + + /* + * Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, + * storageEndpoint or isAzureMonitorTargetEnabled is required. + */ + @JsonProperty(value = "storageEndpoint") + private String storageEndpoint; + + /* + * Specifies the identifier key of the auditing storage account. + * If state is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL + * server system-assigned managed identity to access the storage. + * Prerequisites for using managed identity authentication: + * 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). + * 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role + * to the server identity. + * For more information, see [Auditing to storage using Managed Identity + * authentication](https://go.microsoft.com/fwlink/?linkid=2114355) + */ + @JsonProperty(value = "storageAccountAccessKey") + private String storageAccountAccessKey; + + /* + * Specifies the blob storage subscription Id. + */ + @JsonProperty(value = "storageAccountSubscriptionId") + private UUID storageAccountSubscriptionId; + + /** Creates an instance of ExtendedDatabaseBlobAuditingPolicyProperties class. */ + public ExtendedDatabaseBlobAuditingPolicyProperties() { + } + + /** + * Get the predicateExpression property: Specifies condition of where clause when creating an audit. + * + * @return the predicateExpression value. + */ + public String predicateExpression() { + return this.predicateExpression; + } + + /** + * Set the predicateExpression property: Specifies condition of where clause when creating an audit. + * + * @param predicateExpression the predicateExpression value to set. + * @return the ExtendedDatabaseBlobAuditingPolicyProperties object itself. + */ + public ExtendedDatabaseBlobAuditingPolicyProperties withPredicateExpression(String predicateExpression) { + this.predicateExpression = predicateExpression; + return this; + } + + /** + * Get the retentionDays property: 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 the retentionDays property: Specifies the number of days to keep in the audit logs in the storage account. + * + * @param retentionDays the retentionDays value to set. + * @return the ExtendedDatabaseBlobAuditingPolicyProperties object itself. + */ + public ExtendedDatabaseBlobAuditingPolicyProperties withRetentionDays(Integer retentionDays) { + this.retentionDays = retentionDays; + return this; + } + + /** + * Get the auditActionsAndGroups property: 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 + * DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP LEDGER_OPERATION_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 the auditActionsAndGroups property: 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 + * DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP LEDGER_OPERATION_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 ExtendedDatabaseBlobAuditingPolicyProperties object itself. + */ + public ExtendedDatabaseBlobAuditingPolicyProperties withAuditActionsAndGroups(List auditActionsAndGroups) { + this.auditActionsAndGroups = auditActionsAndGroups; + return this; + } + + /** + * Get the isStorageSecondaryKeyInUse property: Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + * + * @return the isStorageSecondaryKeyInUse value. + */ + public Boolean isStorageSecondaryKeyInUse() { + return this.isStorageSecondaryKeyInUse; + } + + /** + * Set the isStorageSecondaryKeyInUse property: Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + * + * @param isStorageSecondaryKeyInUse the isStorageSecondaryKeyInUse value to set. + * @return the ExtendedDatabaseBlobAuditingPolicyProperties object itself. + */ + public ExtendedDatabaseBlobAuditingPolicyProperties withIsStorageSecondaryKeyInUse( + Boolean isStorageSecondaryKeyInUse) { + this.isStorageSecondaryKeyInUse = isStorageSecondaryKeyInUse; + return this; + } + + /** + * Get the isAzureMonitorTargetEnabled property: 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 the isAzureMonitorTargetEnabled property: 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 ExtendedDatabaseBlobAuditingPolicyProperties object itself. + */ + public ExtendedDatabaseBlobAuditingPolicyProperties withIsAzureMonitorTargetEnabled( + Boolean isAzureMonitorTargetEnabled) { + this.isAzureMonitorTargetEnabled = isAzureMonitorTargetEnabled; + return this; + } + + /** + * Get the queueDelayMs property: Specifies the amount of time in milliseconds that can elapse before audit actions + * are forced to be processed. The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + * + * @return the queueDelayMs value. + */ + public Integer queueDelayMs() { + return this.queueDelayMs; + } + + /** + * Set the queueDelayMs property: Specifies the amount of time in milliseconds that can elapse before audit actions + * are forced to be processed. The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + * + * @param queueDelayMs the queueDelayMs value to set. + * @return the ExtendedDatabaseBlobAuditingPolicyProperties object itself. + */ + public ExtendedDatabaseBlobAuditingPolicyProperties withQueueDelayMs(Integer queueDelayMs) { + this.queueDelayMs = queueDelayMs; + return this; + } + + /** + * Get the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob storage. + * + * @return the isManagedIdentityInUse value. + */ + public Boolean isManagedIdentityInUse() { + return this.isManagedIdentityInUse; + } + + /** + * Set the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob storage. + * + * @param isManagedIdentityInUse the isManagedIdentityInUse value to set. + * @return the ExtendedDatabaseBlobAuditingPolicyProperties object itself. + */ + public ExtendedDatabaseBlobAuditingPolicyProperties withIsManagedIdentityInUse(Boolean isManagedIdentityInUse) { + this.isManagedIdentityInUse = isManagedIdentityInUse; + return this; + } + + /** + * Get the state property: Specifies the state of the audit. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * + * @return the state value. + */ + public BlobAuditingPolicyState state() { + return this.state; + } + + /** + * Set the state property: Specifies the state of the audit. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * + * @param state the state value to set. + * @return the ExtendedDatabaseBlobAuditingPolicyProperties object itself. + */ + public ExtendedDatabaseBlobAuditingPolicyProperties withState(BlobAuditingPolicyState state) { + this.state = state; + return this; + } + + /** + * Get the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is + * required. + * + * @return the storageEndpoint value. + */ + public String storageEndpoint() { + return this.storageEndpoint; + } + + /** + * Set the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is + * required. + * + * @param storageEndpoint the storageEndpoint value to set. + * @return the ExtendedDatabaseBlobAuditingPolicyProperties object itself. + */ + public ExtendedDatabaseBlobAuditingPolicyProperties withStorageEndpoint(String storageEndpoint) { + this.storageEndpoint = storageEndpoint; + return this; + } + + /** + * Get the storageAccountAccessKey property: Specifies the identifier key of the auditing storage account. If state + * is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server + * system-assigned managed identity to access the storage. Prerequisites for using managed identity authentication: + * 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). 2. Grant SQL Server + * identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server + * identity. For more information, see [Auditing to storage using Managed Identity + * authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @return the storageAccountAccessKey value. + */ + public String storageAccountAccessKey() { + return this.storageAccountAccessKey; + } + + /** + * Set the storageAccountAccessKey property: Specifies the identifier key of the auditing storage account. If state + * is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server + * system-assigned managed identity to access the storage. Prerequisites for using managed identity authentication: + * 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). 2. Grant SQL Server + * identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server + * identity. For more information, see [Auditing to storage using Managed Identity + * authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set. + * @return the ExtendedDatabaseBlobAuditingPolicyProperties object itself. + */ + public ExtendedDatabaseBlobAuditingPolicyProperties withStorageAccountAccessKey(String storageAccountAccessKey) { + this.storageAccountAccessKey = storageAccountAccessKey; + return this; + } + + /** + * Get the storageAccountSubscriptionId property: Specifies the blob storage subscription Id. + * + * @return the storageAccountSubscriptionId value. + */ + public UUID storageAccountSubscriptionId() { + return this.storageAccountSubscriptionId; + } + + /** + * Set the storageAccountSubscriptionId property: Specifies the blob storage subscription Id. + * + * @param storageAccountSubscriptionId the storageAccountSubscriptionId value to set. + * @return the ExtendedDatabaseBlobAuditingPolicyProperties object itself. + */ + public ExtendedDatabaseBlobAuditingPolicyProperties withStorageAccountSubscriptionId( + UUID storageAccountSubscriptionId) { + this.storageAccountSubscriptionId = storageAccountSubscriptionId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (state() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property state in model ExtendedDatabaseBlobAuditingPolicyProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ExtendedDatabaseBlobAuditingPolicyProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ExtendedServerBlobAuditingPolicyInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ExtendedServerBlobAuditingPolicyInner.java new file mode 100644 index 0000000000000..4c31671c8def3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ExtendedServerBlobAuditingPolicyInner.java @@ -0,0 +1,470 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.BlobAuditingPolicyState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.UUID; + +/** An extended server blob auditing policy. */ +@Fluent +public final class ExtendedServerBlobAuditingPolicyInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ExtendedServerBlobAuditingPolicyProperties innerProperties; + + /** Creates an instance of ExtendedServerBlobAuditingPolicyInner class. */ + public ExtendedServerBlobAuditingPolicyInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ExtendedServerBlobAuditingPolicyProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the isDevopsAuditEnabled property: Specifies the state of devops audit. If state is Enabled, devops logs will + * be sent to Azure Monitor. In order to send the events to Azure Monitor, specify 'State' as 'Enabled', + * 'IsAzureMonitorTargetEnabled' as true and 'IsDevopsAuditEnabled' as true + * + *

When using REST API to configure auditing, Diagnostic Settings with 'DevOpsOperationsAudit' diagnostic logs + * category on the master database should also be created. + * + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/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 isDevopsAuditEnabled value. + */ + public Boolean isDevopsAuditEnabled() { + return this.innerProperties() == null ? null : this.innerProperties().isDevopsAuditEnabled(); + } + + /** + * Set the isDevopsAuditEnabled property: Specifies the state of devops audit. If state is Enabled, devops logs will + * be sent to Azure Monitor. In order to send the events to Azure Monitor, specify 'State' as 'Enabled', + * 'IsAzureMonitorTargetEnabled' as true and 'IsDevopsAuditEnabled' as true + * + *

When using REST API to configure auditing, Diagnostic Settings with 'DevOpsOperationsAudit' diagnostic logs + * category on the master database should also be created. + * + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/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 isDevopsAuditEnabled the isDevopsAuditEnabled value to set. + * @return the ExtendedServerBlobAuditingPolicyInner object itself. + */ + public ExtendedServerBlobAuditingPolicyInner withIsDevopsAuditEnabled(Boolean isDevopsAuditEnabled) { + if (this.innerProperties() == null) { + this.innerProperties = new ExtendedServerBlobAuditingPolicyProperties(); + } + this.innerProperties().withIsDevopsAuditEnabled(isDevopsAuditEnabled); + return this; + } + + /** + * Get the predicateExpression property: Specifies condition of where clause when creating an audit. + * + * @return the predicateExpression value. + */ + public String predicateExpression() { + return this.innerProperties() == null ? null : this.innerProperties().predicateExpression(); + } + + /** + * Set the predicateExpression property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new ExtendedServerBlobAuditingPolicyProperties(); + } + this.innerProperties().withPredicateExpression(predicateExpression); + return this; + } + + /** + * Get the retentionDays property: Specifies the number of days to keep in the audit logs in the storage account. + * + * @return the retentionDays value. + */ + public Integer retentionDays() { + return this.innerProperties() == null ? null : this.innerProperties().retentionDays(); + } + + /** + * Set the retentionDays property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new ExtendedServerBlobAuditingPolicyProperties(); + } + this.innerProperties().withRetentionDays(retentionDays); + return this; + } + + /** + * Get the auditActionsAndGroups property: 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 + * DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP LEDGER_OPERATION_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.innerProperties() == null ? null : this.innerProperties().auditActionsAndGroups(); + } + + /** + * Set the auditActionsAndGroups property: 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 + * DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP LEDGER_OPERATION_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) { + if (this.innerProperties() == null) { + this.innerProperties = new ExtendedServerBlobAuditingPolicyProperties(); + } + this.innerProperties().withAuditActionsAndGroups(auditActionsAndGroups); + return this; + } + + /** + * Get the isStorageSecondaryKeyInUse property: Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + * + * @return the isStorageSecondaryKeyInUse value. + */ + public Boolean isStorageSecondaryKeyInUse() { + return this.innerProperties() == null ? null : this.innerProperties().isStorageSecondaryKeyInUse(); + } + + /** + * Set the isStorageSecondaryKeyInUse property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new ExtendedServerBlobAuditingPolicyProperties(); + } + this.innerProperties().withIsStorageSecondaryKeyInUse(isStorageSecondaryKeyInUse); + return this; + } + + /** + * Get the isAzureMonitorTargetEnabled property: 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.innerProperties() == null ? null : this.innerProperties().isAzureMonitorTargetEnabled(); + } + + /** + * Set the isAzureMonitorTargetEnabled property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new ExtendedServerBlobAuditingPolicyProperties(); + } + this.innerProperties().withIsAzureMonitorTargetEnabled(isAzureMonitorTargetEnabled); + return this; + } + + /** + * Get the queueDelayMs property: Specifies the amount of time in milliseconds that can elapse before audit actions + * are forced to be processed. The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + * + * @return the queueDelayMs value. + */ + public Integer queueDelayMs() { + return this.innerProperties() == null ? null : this.innerProperties().queueDelayMs(); + } + + /** + * Set the queueDelayMs property: Specifies the amount of time in milliseconds that can elapse before audit actions + * are forced to be processed. The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + * + * @param queueDelayMs the queueDelayMs value to set. + * @return the ExtendedServerBlobAuditingPolicyInner object itself. + */ + public ExtendedServerBlobAuditingPolicyInner withQueueDelayMs(Integer queueDelayMs) { + if (this.innerProperties() == null) { + this.innerProperties = new ExtendedServerBlobAuditingPolicyProperties(); + } + this.innerProperties().withQueueDelayMs(queueDelayMs); + return this; + } + + /** + * Get the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob storage. + * + * @return the isManagedIdentityInUse value. + */ + public Boolean isManagedIdentityInUse() { + return this.innerProperties() == null ? null : this.innerProperties().isManagedIdentityInUse(); + } + + /** + * Set the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob storage. + * + * @param isManagedIdentityInUse the isManagedIdentityInUse value to set. + * @return the ExtendedServerBlobAuditingPolicyInner object itself. + */ + public ExtendedServerBlobAuditingPolicyInner withIsManagedIdentityInUse(Boolean isManagedIdentityInUse) { + if (this.innerProperties() == null) { + this.innerProperties = new ExtendedServerBlobAuditingPolicyProperties(); + } + this.innerProperties().withIsManagedIdentityInUse(isManagedIdentityInUse); + return this; + } + + /** + * Get the state property: Specifies the state of the audit. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * + * @return the state value. + */ + public BlobAuditingPolicyState state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Set the state property: Specifies the state of the audit. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * + * @param state the state value to set. + * @return the ExtendedServerBlobAuditingPolicyInner object itself. + */ + public ExtendedServerBlobAuditingPolicyInner withState(BlobAuditingPolicyState state) { + if (this.innerProperties() == null) { + this.innerProperties = new ExtendedServerBlobAuditingPolicyProperties(); + } + this.innerProperties().withState(state); + return this; + } + + /** + * Get the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is + * required. + * + * @return the storageEndpoint value. + */ + public String storageEndpoint() { + return this.innerProperties() == null ? null : this.innerProperties().storageEndpoint(); + } + + /** + * Set the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is + * required. + * + * @param storageEndpoint the storageEndpoint value to set. + * @return the ExtendedServerBlobAuditingPolicyInner object itself. + */ + public ExtendedServerBlobAuditingPolicyInner withStorageEndpoint(String storageEndpoint) { + if (this.innerProperties() == null) { + this.innerProperties = new ExtendedServerBlobAuditingPolicyProperties(); + } + this.innerProperties().withStorageEndpoint(storageEndpoint); + return this; + } + + /** + * Get the storageAccountAccessKey property: Specifies the identifier key of the auditing storage account. If state + * is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server + * system-assigned managed identity to access the storage. Prerequisites for using managed identity authentication: + * 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). 2. Grant SQL Server + * identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server + * identity. For more information, see [Auditing to storage using Managed Identity + * authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @return the storageAccountAccessKey value. + */ + public String storageAccountAccessKey() { + return this.innerProperties() == null ? null : this.innerProperties().storageAccountAccessKey(); + } + + /** + * Set the storageAccountAccessKey property: Specifies the identifier key of the auditing storage account. If state + * is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server + * system-assigned managed identity to access the storage. Prerequisites for using managed identity authentication: + * 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). 2. Grant SQL Server + * identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server + * identity. For more information, see [Auditing to storage using Managed Identity + * authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set. + * @return the ExtendedServerBlobAuditingPolicyInner object itself. + */ + public ExtendedServerBlobAuditingPolicyInner withStorageAccountAccessKey(String storageAccountAccessKey) { + if (this.innerProperties() == null) { + this.innerProperties = new ExtendedServerBlobAuditingPolicyProperties(); + } + this.innerProperties().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + /** + * Get the storageAccountSubscriptionId property: Specifies the blob storage subscription Id. + * + * @return the storageAccountSubscriptionId value. + */ + public UUID storageAccountSubscriptionId() { + return this.innerProperties() == null ? null : this.innerProperties().storageAccountSubscriptionId(); + } + + /** + * Set the storageAccountSubscriptionId property: Specifies the blob storage subscription Id. + * + * @param storageAccountSubscriptionId the storageAccountSubscriptionId value to set. + * @return the ExtendedServerBlobAuditingPolicyInner object itself. + */ + public ExtendedServerBlobAuditingPolicyInner withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId) { + if (this.innerProperties() == null) { + this.innerProperties = new ExtendedServerBlobAuditingPolicyProperties(); + } + this.innerProperties().withStorageAccountSubscriptionId(storageAccountSubscriptionId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ExtendedServerBlobAuditingPolicyProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ExtendedServerBlobAuditingPolicyProperties.java new file mode 100644 index 0000000000000..06c9b4932abc6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ExtendedServerBlobAuditingPolicyProperties.java @@ -0,0 +1,606 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.BlobAuditingPolicyState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.UUID; + +/** Properties of an extended server blob auditing policy. */ +@Fluent +public final class ExtendedServerBlobAuditingPolicyProperties { + /* + * Specifies the state of devops audit. If state is Enabled, devops logs will be sent to Azure Monitor. + * In order to send the events to Azure Monitor, specify 'State' as 'Enabled', 'IsAzureMonitorTargetEnabled' as + * true and 'IsDevopsAuditEnabled' as true + * + * When using REST API to configure auditing, Diagnostic Settings with 'DevOpsOperationsAudit' diagnostic logs + * category on the master database should also be created. + * + * Diagnostic Settings URI format: + * PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/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 = "isDevopsAuditEnabled") + private Boolean isDevopsAuditEnabled; + + /* + * Specifies condition of where clause when creating an audit. + */ + @JsonProperty(value = "predicateExpression") + private String predicateExpression; + + /* + * Specifies the number of days to keep in the audit logs in the storage account. + */ + @JsonProperty(value = "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 + * DBCC_GROUP + * DATABASE_OWNERSHIP_CHANGE_GROUP + * DATABASE_CHANGE_GROUP + * LEDGER_OPERATION_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 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 = "auditActionsAndGroups") + private List auditActionsAndGroups; + + /* + * Specifies whether storageAccountAccessKey value is the storage's secondary key. + */ + @JsonProperty(value = "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 = "isAzureMonitorTargetEnabled") + private Boolean isAzureMonitorTargetEnabled; + + /* + * Specifies the amount of time in milliseconds that can elapse before audit actions are forced to be processed. + * The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + */ + @JsonProperty(value = "queueDelayMs") + private Integer queueDelayMs; + + /* + * Specifies whether Managed Identity is used to access blob storage + */ + @JsonProperty(value = "isManagedIdentityInUse") + private Boolean isManagedIdentityInUse; + + /* + * Specifies the state of the audit. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are + * required. + */ + @JsonProperty(value = "state", required = true) + private BlobAuditingPolicyState state; + + /* + * Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, + * storageEndpoint or isAzureMonitorTargetEnabled is required. + */ + @JsonProperty(value = "storageEndpoint") + private String storageEndpoint; + + /* + * Specifies the identifier key of the auditing storage account. + * If state is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL + * server system-assigned managed identity to access the storage. + * Prerequisites for using managed identity authentication: + * 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). + * 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role + * to the server identity. + * For more information, see [Auditing to storage using Managed Identity + * authentication](https://go.microsoft.com/fwlink/?linkid=2114355) + */ + @JsonProperty(value = "storageAccountAccessKey") + private String storageAccountAccessKey; + + /* + * Specifies the blob storage subscription Id. + */ + @JsonProperty(value = "storageAccountSubscriptionId") + private UUID storageAccountSubscriptionId; + + /** Creates an instance of ExtendedServerBlobAuditingPolicyProperties class. */ + public ExtendedServerBlobAuditingPolicyProperties() { + } + + /** + * Get the isDevopsAuditEnabled property: Specifies the state of devops audit. If state is Enabled, devops logs will + * be sent to Azure Monitor. In order to send the events to Azure Monitor, specify 'State' as 'Enabled', + * 'IsAzureMonitorTargetEnabled' as true and 'IsDevopsAuditEnabled' as true + * + *

When using REST API to configure auditing, Diagnostic Settings with 'DevOpsOperationsAudit' diagnostic logs + * category on the master database should also be created. + * + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/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 isDevopsAuditEnabled value. + */ + public Boolean isDevopsAuditEnabled() { + return this.isDevopsAuditEnabled; + } + + /** + * Set the isDevopsAuditEnabled property: Specifies the state of devops audit. If state is Enabled, devops logs will + * be sent to Azure Monitor. In order to send the events to Azure Monitor, specify 'State' as 'Enabled', + * 'IsAzureMonitorTargetEnabled' as true and 'IsDevopsAuditEnabled' as true + * + *

When using REST API to configure auditing, Diagnostic Settings with 'DevOpsOperationsAudit' diagnostic logs + * category on the master database should also be created. + * + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/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 isDevopsAuditEnabled the isDevopsAuditEnabled value to set. + * @return the ExtendedServerBlobAuditingPolicyProperties object itself. + */ + public ExtendedServerBlobAuditingPolicyProperties withIsDevopsAuditEnabled(Boolean isDevopsAuditEnabled) { + this.isDevopsAuditEnabled = isDevopsAuditEnabled; + return this; + } + + /** + * Get the predicateExpression property: Specifies condition of where clause when creating an audit. + * + * @return the predicateExpression value. + */ + public String predicateExpression() { + return this.predicateExpression; + } + + /** + * Set the predicateExpression property: Specifies condition of where clause when creating an audit. + * + * @param predicateExpression the predicateExpression value to set. + * @return the ExtendedServerBlobAuditingPolicyProperties object itself. + */ + public ExtendedServerBlobAuditingPolicyProperties withPredicateExpression(String predicateExpression) { + this.predicateExpression = predicateExpression; + return this; + } + + /** + * Get the retentionDays property: 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 the retentionDays property: Specifies the number of days to keep in the audit logs in the storage account. + * + * @param retentionDays the retentionDays value to set. + * @return the ExtendedServerBlobAuditingPolicyProperties object itself. + */ + public ExtendedServerBlobAuditingPolicyProperties withRetentionDays(Integer retentionDays) { + this.retentionDays = retentionDays; + return this; + } + + /** + * Get the auditActionsAndGroups property: 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 + * DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP LEDGER_OPERATION_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 the auditActionsAndGroups property: 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 + * DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP LEDGER_OPERATION_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 ExtendedServerBlobAuditingPolicyProperties object itself. + */ + public ExtendedServerBlobAuditingPolicyProperties withAuditActionsAndGroups(List auditActionsAndGroups) { + this.auditActionsAndGroups = auditActionsAndGroups; + return this; + } + + /** + * Get the isStorageSecondaryKeyInUse property: Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + * + * @return the isStorageSecondaryKeyInUse value. + */ + public Boolean isStorageSecondaryKeyInUse() { + return this.isStorageSecondaryKeyInUse; + } + + /** + * Set the isStorageSecondaryKeyInUse property: Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + * + * @param isStorageSecondaryKeyInUse the isStorageSecondaryKeyInUse value to set. + * @return the ExtendedServerBlobAuditingPolicyProperties object itself. + */ + public ExtendedServerBlobAuditingPolicyProperties withIsStorageSecondaryKeyInUse( + Boolean isStorageSecondaryKeyInUse) { + this.isStorageSecondaryKeyInUse = isStorageSecondaryKeyInUse; + return this; + } + + /** + * Get the isAzureMonitorTargetEnabled property: 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 the isAzureMonitorTargetEnabled property: 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 ExtendedServerBlobAuditingPolicyProperties object itself. + */ + public ExtendedServerBlobAuditingPolicyProperties withIsAzureMonitorTargetEnabled( + Boolean isAzureMonitorTargetEnabled) { + this.isAzureMonitorTargetEnabled = isAzureMonitorTargetEnabled; + return this; + } + + /** + * Get the queueDelayMs property: Specifies the amount of time in milliseconds that can elapse before audit actions + * are forced to be processed. The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + * + * @return the queueDelayMs value. + */ + public Integer queueDelayMs() { + return this.queueDelayMs; + } + + /** + * Set the queueDelayMs property: Specifies the amount of time in milliseconds that can elapse before audit actions + * are forced to be processed. The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + * + * @param queueDelayMs the queueDelayMs value to set. + * @return the ExtendedServerBlobAuditingPolicyProperties object itself. + */ + public ExtendedServerBlobAuditingPolicyProperties withQueueDelayMs(Integer queueDelayMs) { + this.queueDelayMs = queueDelayMs; + return this; + } + + /** + * Get the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob storage. + * + * @return the isManagedIdentityInUse value. + */ + public Boolean isManagedIdentityInUse() { + return this.isManagedIdentityInUse; + } + + /** + * Set the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob storage. + * + * @param isManagedIdentityInUse the isManagedIdentityInUse value to set. + * @return the ExtendedServerBlobAuditingPolicyProperties object itself. + */ + public ExtendedServerBlobAuditingPolicyProperties withIsManagedIdentityInUse(Boolean isManagedIdentityInUse) { + this.isManagedIdentityInUse = isManagedIdentityInUse; + return this; + } + + /** + * Get the state property: Specifies the state of the audit. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * + * @return the state value. + */ + public BlobAuditingPolicyState state() { + return this.state; + } + + /** + * Set the state property: Specifies the state of the audit. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * + * @param state the state value to set. + * @return the ExtendedServerBlobAuditingPolicyProperties object itself. + */ + public ExtendedServerBlobAuditingPolicyProperties withState(BlobAuditingPolicyState state) { + this.state = state; + return this; + } + + /** + * Get the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is + * required. + * + * @return the storageEndpoint value. + */ + public String storageEndpoint() { + return this.storageEndpoint; + } + + /** + * Set the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is + * required. + * + * @param storageEndpoint the storageEndpoint value to set. + * @return the ExtendedServerBlobAuditingPolicyProperties object itself. + */ + public ExtendedServerBlobAuditingPolicyProperties withStorageEndpoint(String storageEndpoint) { + this.storageEndpoint = storageEndpoint; + return this; + } + + /** + * Get the storageAccountAccessKey property: Specifies the identifier key of the auditing storage account. If state + * is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server + * system-assigned managed identity to access the storage. Prerequisites for using managed identity authentication: + * 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). 2. Grant SQL Server + * identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server + * identity. For more information, see [Auditing to storage using Managed Identity + * authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @return the storageAccountAccessKey value. + */ + public String storageAccountAccessKey() { + return this.storageAccountAccessKey; + } + + /** + * Set the storageAccountAccessKey property: Specifies the identifier key of the auditing storage account. If state + * is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server + * system-assigned managed identity to access the storage. Prerequisites for using managed identity authentication: + * 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). 2. Grant SQL Server + * identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server + * identity. For more information, see [Auditing to storage using Managed Identity + * authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set. + * @return the ExtendedServerBlobAuditingPolicyProperties object itself. + */ + public ExtendedServerBlobAuditingPolicyProperties withStorageAccountAccessKey(String storageAccountAccessKey) { + this.storageAccountAccessKey = storageAccountAccessKey; + return this; + } + + /** + * Get the storageAccountSubscriptionId property: Specifies the blob storage subscription Id. + * + * @return the storageAccountSubscriptionId value. + */ + public UUID storageAccountSubscriptionId() { + return this.storageAccountSubscriptionId; + } + + /** + * Set the storageAccountSubscriptionId property: Specifies the blob storage subscription Id. + * + * @param storageAccountSubscriptionId the storageAccountSubscriptionId value to set. + * @return the ExtendedServerBlobAuditingPolicyProperties object itself. + */ + public ExtendedServerBlobAuditingPolicyProperties withStorageAccountSubscriptionId( + UUID storageAccountSubscriptionId) { + this.storageAccountSubscriptionId = storageAccountSubscriptionId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (state() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property state in model ExtendedServerBlobAuditingPolicyProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ExtendedServerBlobAuditingPolicyProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/FailoverGroupInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/FailoverGroupInner.java new file mode 100644 index 0000000000000..5d60dafe051c5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/FailoverGroupInner.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.FailoverGroupReadOnlyEndpoint; +import com.azure.resourcemanager.sql.generated.models.FailoverGroupReadWriteEndpoint; +import com.azure.resourcemanager.sql.generated.models.FailoverGroupReplicationRole; +import com.azure.resourcemanager.sql.generated.models.PartnerInfo; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** A failover group. */ +@Fluent +public final class FailoverGroupInner extends ProxyResource { + /* + * Resource location. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private FailoverGroupProperties innerProperties; + + /** Creates an instance of FailoverGroupInner class. */ + public FailoverGroupInner() { + } + + /** + * Get the location property: Resource location. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the FailoverGroupInner object itself. + */ + public FailoverGroupInner withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private FailoverGroupProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the readWriteEndpoint property: Read-write endpoint of the failover group instance. + * + * @return the readWriteEndpoint value. + */ + public FailoverGroupReadWriteEndpoint readWriteEndpoint() { + return this.innerProperties() == null ? null : this.innerProperties().readWriteEndpoint(); + } + + /** + * Set the readWriteEndpoint property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new FailoverGroupProperties(); + } + this.innerProperties().withReadWriteEndpoint(readWriteEndpoint); + return this; + } + + /** + * Get the readOnlyEndpoint property: Read-only endpoint of the failover group instance. + * + * @return the readOnlyEndpoint value. + */ + public FailoverGroupReadOnlyEndpoint readOnlyEndpoint() { + return this.innerProperties() == null ? null : this.innerProperties().readOnlyEndpoint(); + } + + /** + * Set the readOnlyEndpoint property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new FailoverGroupProperties(); + } + this.innerProperties().withReadOnlyEndpoint(readOnlyEndpoint); + return this; + } + + /** + * Get the replicationRole property: Local replication role of the failover group instance. + * + * @return the replicationRole value. + */ + public FailoverGroupReplicationRole replicationRole() { + return this.innerProperties() == null ? null : this.innerProperties().replicationRole(); + } + + /** + * Get the replicationState property: Replication state of the failover group instance. + * + * @return the replicationState value. + */ + public String replicationState() { + return this.innerProperties() == null ? null : this.innerProperties().replicationState(); + } + + /** + * Get the partnerServers property: List of partner server information for the failover group. + * + * @return the partnerServers value. + */ + public List partnerServers() { + return this.innerProperties() == null ? null : this.innerProperties().partnerServers(); + } + + /** + * Set the partnerServers property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new FailoverGroupProperties(); + } + this.innerProperties().withPartnerServers(partnerServers); + return this; + } + + /** + * Get the databases property: List of databases in the failover group. + * + * @return the databases value. + */ + public List databases() { + return this.innerProperties() == null ? null : this.innerProperties().databases(); + } + + /** + * Set the databases property: List of databases in the failover group. + * + * @param databases the databases value to set. + * @return the FailoverGroupInner object itself. + */ + public FailoverGroupInner withDatabases(List databases) { + if (this.innerProperties() == null) { + this.innerProperties = new FailoverGroupProperties(); + } + this.innerProperties().withDatabases(databases); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/FailoverGroupProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/FailoverGroupProperties.java new file mode 100644 index 0000000000000..87160580ecdb3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/FailoverGroupProperties.java @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.FailoverGroupReadOnlyEndpoint; +import com.azure.resourcemanager.sql.generated.models.FailoverGroupReadWriteEndpoint; +import com.azure.resourcemanager.sql.generated.models.FailoverGroupReplicationRole; +import com.azure.resourcemanager.sql.generated.models.PartnerInfo; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of a failover group. */ +@Fluent +public final class FailoverGroupProperties { + /* + * Read-write endpoint of the failover group instance. + */ + @JsonProperty(value = "readWriteEndpoint", required = true) + private FailoverGroupReadWriteEndpoint readWriteEndpoint; + + /* + * Read-only endpoint of the failover group instance. + */ + @JsonProperty(value = "readOnlyEndpoint") + private FailoverGroupReadOnlyEndpoint readOnlyEndpoint; + + /* + * Local replication role of the failover group instance. + */ + @JsonProperty(value = "replicationRole", access = JsonProperty.Access.WRITE_ONLY) + private FailoverGroupReplicationRole replicationRole; + + /* + * Replication state of the failover group instance. + */ + @JsonProperty(value = "replicationState", access = JsonProperty.Access.WRITE_ONLY) + private String replicationState; + + /* + * List of partner server information for the failover group. + */ + @JsonProperty(value = "partnerServers", required = true) + private List partnerServers; + + /* + * List of databases in the failover group. + */ + @JsonProperty(value = "databases") + private List databases; + + /** Creates an instance of FailoverGroupProperties class. */ + public FailoverGroupProperties() { + } + + /** + * Get the readWriteEndpoint property: Read-write endpoint of the failover group instance. + * + * @return the readWriteEndpoint value. + */ + public FailoverGroupReadWriteEndpoint readWriteEndpoint() { + return this.readWriteEndpoint; + } + + /** + * Set the readWriteEndpoint property: Read-write endpoint of the failover group instance. + * + * @param readWriteEndpoint the readWriteEndpoint value to set. + * @return the FailoverGroupProperties object itself. + */ + public FailoverGroupProperties withReadWriteEndpoint(FailoverGroupReadWriteEndpoint readWriteEndpoint) { + this.readWriteEndpoint = readWriteEndpoint; + return this; + } + + /** + * Get the readOnlyEndpoint property: Read-only endpoint of the failover group instance. + * + * @return the readOnlyEndpoint value. + */ + public FailoverGroupReadOnlyEndpoint readOnlyEndpoint() { + return this.readOnlyEndpoint; + } + + /** + * Set the readOnlyEndpoint property: Read-only endpoint of the failover group instance. + * + * @param readOnlyEndpoint the readOnlyEndpoint value to set. + * @return the FailoverGroupProperties object itself. + */ + public FailoverGroupProperties withReadOnlyEndpoint(FailoverGroupReadOnlyEndpoint readOnlyEndpoint) { + this.readOnlyEndpoint = readOnlyEndpoint; + return this; + } + + /** + * Get the replicationRole property: Local replication role of the failover group instance. + * + * @return the replicationRole value. + */ + public FailoverGroupReplicationRole replicationRole() { + return this.replicationRole; + } + + /** + * Get the replicationState property: Replication state of the failover group instance. + * + * @return the replicationState value. + */ + public String replicationState() { + return this.replicationState; + } + + /** + * Get the partnerServers property: List of partner server information for the failover group. + * + * @return the partnerServers value. + */ + public List partnerServers() { + return this.partnerServers; + } + + /** + * Set the partnerServers property: List of partner server information for the failover group. + * + * @param partnerServers the partnerServers value to set. + * @return the FailoverGroupProperties object itself. + */ + public FailoverGroupProperties withPartnerServers(List partnerServers) { + this.partnerServers = partnerServers; + return this; + } + + /** + * Get the databases property: List of databases in the failover group. + * + * @return the databases value. + */ + public List databases() { + return this.databases; + } + + /** + * Set the databases property: List of databases in the failover group. + * + * @param databases the databases value to set. + * @return the FailoverGroupProperties object itself. + */ + public FailoverGroupProperties withDatabases(List databases) { + this.databases = databases; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (readWriteEndpoint() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property readWriteEndpoint in model FailoverGroupProperties")); + } else { + readWriteEndpoint().validate(); + } + if (readOnlyEndpoint() != null) { + readOnlyEndpoint().validate(); + } + if (partnerServers() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property partnerServers in model FailoverGroupProperties")); + } else { + partnerServers().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(FailoverGroupProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/FailoverGroupUpdateProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/FailoverGroupUpdateProperties.java new file mode 100644 index 0000000000000..0d8d00a924380 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/FailoverGroupUpdateProperties.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.models.FailoverGroupReadOnlyEndpoint; +import com.azure.resourcemanager.sql.generated.models.FailoverGroupReadWriteEndpoint; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of a failover group update. */ +@Fluent +public final class FailoverGroupUpdateProperties { + /* + * Read-write endpoint of the failover group instance. + */ + @JsonProperty(value = "readWriteEndpoint") + private FailoverGroupReadWriteEndpoint readWriteEndpoint; + + /* + * Read-only endpoint of the failover group instance. + */ + @JsonProperty(value = "readOnlyEndpoint") + private FailoverGroupReadOnlyEndpoint readOnlyEndpoint; + + /* + * List of databases in the failover group. + */ + @JsonProperty(value = "databases") + private List databases; + + /** Creates an instance of FailoverGroupUpdateProperties class. */ + public FailoverGroupUpdateProperties() { + } + + /** + * Get the readWriteEndpoint property: Read-write endpoint of the failover group instance. + * + * @return the readWriteEndpoint value. + */ + public FailoverGroupReadWriteEndpoint readWriteEndpoint() { + return this.readWriteEndpoint; + } + + /** + * Set the readWriteEndpoint property: Read-write endpoint of the failover group instance. + * + * @param readWriteEndpoint the readWriteEndpoint value to set. + * @return the FailoverGroupUpdateProperties object itself. + */ + public FailoverGroupUpdateProperties withReadWriteEndpoint(FailoverGroupReadWriteEndpoint readWriteEndpoint) { + this.readWriteEndpoint = readWriteEndpoint; + return this; + } + + /** + * Get the readOnlyEndpoint property: Read-only endpoint of the failover group instance. + * + * @return the readOnlyEndpoint value. + */ + public FailoverGroupReadOnlyEndpoint readOnlyEndpoint() { + return this.readOnlyEndpoint; + } + + /** + * Set the readOnlyEndpoint property: Read-only endpoint of the failover group instance. + * + * @param readOnlyEndpoint the readOnlyEndpoint value to set. + * @return the FailoverGroupUpdateProperties object itself. + */ + public FailoverGroupUpdateProperties withReadOnlyEndpoint(FailoverGroupReadOnlyEndpoint readOnlyEndpoint) { + this.readOnlyEndpoint = readOnlyEndpoint; + return this; + } + + /** + * Get the databases property: List of databases in the failover group. + * + * @return the databases value. + */ + public List databases() { + return this.databases; + } + + /** + * Set the databases property: List of databases in the failover group. + * + * @param databases the databases value to set. + * @return the FailoverGroupUpdateProperties object itself. + */ + public FailoverGroupUpdateProperties withDatabases(List databases) { + this.databases = databases; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (readWriteEndpoint() != null) { + readWriteEndpoint().validate(); + } + if (readOnlyEndpoint() != null) { + readOnlyEndpoint().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/FirewallRuleInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/FirewallRuleInner.java new file mode 100644 index 0000000000000..8e72cfe86287a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/FirewallRuleInner.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.models.ProxyResourceWithWritableName; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A server firewall rule. */ +@Fluent +public final class FirewallRuleInner extends ProxyResourceWithWritableName { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ServerFirewallRuleProperties innerProperties; + + /** Creates an instance of FirewallRuleInner class. */ + public FirewallRuleInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ServerFirewallRuleProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public FirewallRuleInner withName(String name) { + super.withName(name); + return this; + } + + /** + * Get the startIpAddress property: 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.innerProperties() == null ? null : this.innerProperties().startIpAddress(); + } + + /** + * Set the startIpAddress property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerFirewallRuleProperties(); + } + this.innerProperties().withStartIpAddress(startIpAddress); + return this; + } + + /** + * Get the endIpAddress property: 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.innerProperties() == null ? null : this.innerProperties().endIpAddress(); + } + + /** + * Set the endIpAddress property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerFirewallRuleProperties(); + } + this.innerProperties().withEndIpAddress(endIpAddress); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/GeoBackupPolicyInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/GeoBackupPolicyInner.java new file mode 100644 index 0000000000000..d295cf87dff75 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/GeoBackupPolicyInner.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.GeoBackupPolicyState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A database geo backup policy. */ +@Fluent +public final class GeoBackupPolicyInner extends ProxyResource { + /* + * The properties of the geo backup policy. + */ + @JsonProperty(value = "properties", required = true) + private GeoBackupPolicyProperties innerProperties = new GeoBackupPolicyProperties(); + + /* + * 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; + + /** Creates an instance of GeoBackupPolicyInner class. */ + public GeoBackupPolicyInner() { + } + + /** + * Get the innerProperties property: The properties of the geo backup policy. + * + * @return the innerProperties value. + */ + private GeoBackupPolicyProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the kind property: 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 the location property: Backup policy location. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Get the state property: The state of the geo backup policy. + * + * @return the state value. + */ + public GeoBackupPolicyState state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Set the state property: The state of the geo backup policy. + * + * @param state the state value to set. + * @return the GeoBackupPolicyInner object itself. + */ + public GeoBackupPolicyInner withState(GeoBackupPolicyState state) { + if (this.innerProperties() == null) { + this.innerProperties = new GeoBackupPolicyProperties(); + } + this.innerProperties().withState(state); + return this; + } + + /** + * Get the storageType property: The storage type of the geo backup policy. + * + * @return the storageType value. + */ + public String storageType() { + return this.innerProperties() == null ? null : this.innerProperties().storageType(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model GeoBackupPolicyInner")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(GeoBackupPolicyInner.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/GeoBackupPolicyProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/GeoBackupPolicyProperties.java new file mode 100644 index 0000000000000..d6c66946daa31 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/GeoBackupPolicyProperties.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.GeoBackupPolicyState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of the geo backup policy. */ +@Fluent +public final class GeoBackupPolicyProperties { + /* + * The state of the geo backup policy. + */ + @JsonProperty(value = "state", required = true) + private GeoBackupPolicyState state; + + /* + * The storage type of the geo backup policy. + */ + @JsonProperty(value = "storageType", access = JsonProperty.Access.WRITE_ONLY) + private String storageType; + + /** Creates an instance of GeoBackupPolicyProperties class. */ + public GeoBackupPolicyProperties() { + } + + /** + * Get the state property: The state of the geo backup policy. + * + * @return the state value. + */ + public GeoBackupPolicyState state() { + return this.state; + } + + /** + * Set the state property: The state of the geo backup policy. + * + * @param state the state value to set. + * @return the GeoBackupPolicyProperties object itself. + */ + public GeoBackupPolicyProperties withState(GeoBackupPolicyState state) { + this.state = state; + return this; + } + + /** + * Get the storageType property: The storage type of the geo backup policy. + * + * @return the storageType value. + */ + public String storageType() { + return this.storageType; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (state() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property state in model GeoBackupPolicyProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(GeoBackupPolicyProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/IPv6FirewallRuleInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/IPv6FirewallRuleInner.java new file mode 100644 index 0000000000000..ec2ee6f9a2845 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/IPv6FirewallRuleInner.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.models.ProxyResourceWithWritableName; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An IPv6 server firewall rule. */ +@Fluent +public final class IPv6FirewallRuleInner extends ProxyResourceWithWritableName { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private IPv6ServerFirewallRuleProperties innerProperties; + + /** Creates an instance of IPv6FirewallRuleInner class. */ + public IPv6FirewallRuleInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private IPv6ServerFirewallRuleProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public IPv6FirewallRuleInner withName(String name) { + super.withName(name); + return this; + } + + /** + * Get the startIPv6Address property: The start IP address of the firewall rule. Must be IPv6 format. + * + * @return the startIPv6Address value. + */ + public String startIPv6Address() { + return this.innerProperties() == null ? null : this.innerProperties().startIPv6Address(); + } + + /** + * Set the startIPv6Address property: The start IP address of the firewall rule. Must be IPv6 format. + * + * @param startIPv6Address the startIPv6Address value to set. + * @return the IPv6FirewallRuleInner object itself. + */ + public IPv6FirewallRuleInner withStartIPv6Address(String startIPv6Address) { + if (this.innerProperties() == null) { + this.innerProperties = new IPv6ServerFirewallRuleProperties(); + } + this.innerProperties().withStartIPv6Address(startIPv6Address); + return this; + } + + /** + * Get the endIPv6Address property: The end IP address of the firewall rule. Must be IPv6 format. Must be greater + * than or equal to startIpAddress. + * + * @return the endIPv6Address value. + */ + public String endIPv6Address() { + return this.innerProperties() == null ? null : this.innerProperties().endIPv6Address(); + } + + /** + * Set the endIPv6Address property: The end IP address of the firewall rule. Must be IPv6 format. Must be greater + * than or equal to startIpAddress. + * + * @param endIPv6Address the endIPv6Address value to set. + * @return the IPv6FirewallRuleInner object itself. + */ + public IPv6FirewallRuleInner withEndIPv6Address(String endIPv6Address) { + if (this.innerProperties() == null) { + this.innerProperties = new IPv6ServerFirewallRuleProperties(); + } + this.innerProperties().withEndIPv6Address(endIPv6Address); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/IPv6ServerFirewallRuleProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/IPv6ServerFirewallRuleProperties.java new file mode 100644 index 0000000000000..523cff465a828 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/IPv6ServerFirewallRuleProperties.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of an IPv6 server firewall rule. */ +@Fluent +public final class IPv6ServerFirewallRuleProperties { + /* + * The start IP address of the firewall rule. Must be IPv6 format. + */ + @JsonProperty(value = "startIPv6Address") + private String startIPv6Address; + + /* + * The end IP address of the firewall rule. Must be IPv6 format. Must be greater than or equal to startIpAddress. + */ + @JsonProperty(value = "endIPv6Address") + private String endIPv6Address; + + /** Creates an instance of IPv6ServerFirewallRuleProperties class. */ + public IPv6ServerFirewallRuleProperties() { + } + + /** + * Get the startIPv6Address property: The start IP address of the firewall rule. Must be IPv6 format. + * + * @return the startIPv6Address value. + */ + public String startIPv6Address() { + return this.startIPv6Address; + } + + /** + * Set the startIPv6Address property: The start IP address of the firewall rule. Must be IPv6 format. + * + * @param startIPv6Address the startIPv6Address value to set. + * @return the IPv6ServerFirewallRuleProperties object itself. + */ + public IPv6ServerFirewallRuleProperties withStartIPv6Address(String startIPv6Address) { + this.startIPv6Address = startIPv6Address; + return this; + } + + /** + * Get the endIPv6Address property: The end IP address of the firewall rule. Must be IPv6 format. Must be greater + * than or equal to startIpAddress. + * + * @return the endIPv6Address value. + */ + public String endIPv6Address() { + return this.endIPv6Address; + } + + /** + * Set the endIPv6Address property: The end IP address of the firewall rule. Must be IPv6 format. Must be greater + * than or equal to startIpAddress. + * + * @param endIPv6Address the endIPv6Address value to set. + * @return the IPv6ServerFirewallRuleProperties object itself. + */ + public IPv6ServerFirewallRuleProperties withEndIPv6Address(String endIPv6Address) { + this.endIPv6Address = endIPv6Address; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ImportExportExtensionsOperationResultInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ImportExportExtensionsOperationResultInner.java new file mode 100644 index 0000000000000..6051543636942 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ImportExportExtensionsOperationResultInner.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +/** An Extension operation result resource. */ +@Immutable +public final class ImportExportExtensionsOperationResultInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ImportExportExtensionsOperationResultProperties innerProperties; + + /** Creates an instance of ImportExportExtensionsOperationResultInner class. */ + public ImportExportExtensionsOperationResultInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ImportExportExtensionsOperationResultProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the requestId property: Request Id. + * + * @return the requestId value. + */ + public UUID requestId() { + return this.innerProperties() == null ? null : this.innerProperties().requestId(); + } + + /** + * Get the requestType property: Request type. + * + * @return the requestType value. + */ + public String requestType() { + return this.innerProperties() == null ? null : this.innerProperties().requestType(); + } + + /** + * Get the lastModifiedTime property: Last modified time. + * + * @return the lastModifiedTime value. + */ + public String lastModifiedTime() { + return this.innerProperties() == null ? null : this.innerProperties().lastModifiedTime(); + } + + /** + * Get the serverName property: Server name. + * + * @return the serverName value. + */ + public String serverName() { + return this.innerProperties() == null ? null : this.innerProperties().serverName(); + } + + /** + * Get the databaseName property: Database name. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.innerProperties() == null ? null : this.innerProperties().databaseName(); + } + + /** + * Get the status property: Operation status. + * + * @return the status value. + */ + public String status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); + } + + /** + * Get the errorMessage property: Error message. + * + * @return the errorMessage value. + */ + public String errorMessage() { + return this.innerProperties() == null ? null : this.innerProperties().errorMessage(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ImportExportExtensionsOperationResultProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ImportExportExtensionsOperationResultProperties.java new file mode 100644 index 0000000000000..c61c59ea75091 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ImportExportExtensionsOperationResultProperties.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +/** Contains the operation result properties for import/export operation. */ +@Immutable +public final class ImportExportExtensionsOperationResultProperties { + /* + * Request Id. + */ + @JsonProperty(value = "requestId", access = JsonProperty.Access.WRITE_ONLY) + private UUID requestId; + + /* + * Request type. + */ + @JsonProperty(value = "requestType", access = JsonProperty.Access.WRITE_ONLY) + private String requestType; + + /* + * Last modified time. + */ + @JsonProperty(value = "lastModifiedTime", access = JsonProperty.Access.WRITE_ONLY) + private String lastModifiedTime; + + /* + * Server name. + */ + @JsonProperty(value = "serverName", access = JsonProperty.Access.WRITE_ONLY) + private String serverName; + + /* + * Database name. + */ + @JsonProperty(value = "databaseName", access = JsonProperty.Access.WRITE_ONLY) + private String databaseName; + + /* + * Operation status. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /* + * Error message. + */ + @JsonProperty(value = "errorMessage", access = JsonProperty.Access.WRITE_ONLY) + private String errorMessage; + + /** Creates an instance of ImportExportExtensionsOperationResultProperties class. */ + public ImportExportExtensionsOperationResultProperties() { + } + + /** + * Get the requestId property: Request Id. + * + * @return the requestId value. + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Get the requestType property: Request type. + * + * @return the requestType value. + */ + public String requestType() { + return this.requestType; + } + + /** + * Get the lastModifiedTime property: Last modified time. + * + * @return the lastModifiedTime value. + */ + public String lastModifiedTime() { + return this.lastModifiedTime; + } + + /** + * Get the serverName property: Server name. + * + * @return the serverName value. + */ + public String serverName() { + return this.serverName; + } + + /** + * Get the databaseName property: Database name. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Get the status property: Operation status. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Get the errorMessage property: Error message. + * + * @return the errorMessage value. + */ + public String errorMessage() { + return this.errorMessage; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ImportExportOperationResultInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ImportExportOperationResultInner.java new file mode 100644 index 0000000000000..7240333ebfb58 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ImportExportOperationResultInner.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.PrivateEndpointConnectionRequestStatus; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.UUID; + +/** An ImportExport operation result resource. */ +@Immutable +public final class ImportExportOperationResultInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ImportExportOperationResultProperties innerProperties; + + /** Creates an instance of ImportExportOperationResultInner class. */ + public ImportExportOperationResultInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ImportExportOperationResultProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the requestId property: Request Id. + * + * @return the requestId value. + */ + public UUID requestId() { + return this.innerProperties() == null ? null : this.innerProperties().requestId(); + } + + /** + * Get the requestType property: Request type. + * + * @return the requestType value. + */ + public String requestType() { + return this.innerProperties() == null ? null : this.innerProperties().requestType(); + } + + /** + * Get the queuedTime property: Queued time. + * + * @return the queuedTime value. + */ + public String queuedTime() { + return this.innerProperties() == null ? null : this.innerProperties().queuedTime(); + } + + /** + * Get the lastModifiedTime property: Last modified time. + * + * @return the lastModifiedTime value. + */ + public String lastModifiedTime() { + return this.innerProperties() == null ? null : this.innerProperties().lastModifiedTime(); + } + + /** + * Get the blobUri property: Blob Uri. + * + * @return the blobUri value. + */ + public String blobUri() { + return this.innerProperties() == null ? null : this.innerProperties().blobUri(); + } + + /** + * Get the serverName property: Server name. + * + * @return the serverName value. + */ + public String serverName() { + return this.innerProperties() == null ? null : this.innerProperties().serverName(); + } + + /** + * Get the databaseName property: Database name. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.innerProperties() == null ? null : this.innerProperties().databaseName(); + } + + /** + * Get the status property: Operation status. + * + * @return the status value. + */ + public String status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); + } + + /** + * Get the errorMessage property: Error message. + * + * @return the errorMessage value. + */ + public String errorMessage() { + return this.innerProperties() == null ? null : this.innerProperties().errorMessage(); + } + + /** + * Get the privateEndpointConnections property: Gets the status of private endpoints associated with this request. + * + * @return the privateEndpointConnections value. + */ + public List privateEndpointConnections() { + return this.innerProperties() == null ? null : this.innerProperties().privateEndpointConnections(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ImportExportOperationResultProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ImportExportOperationResultProperties.java new file mode 100644 index 0000000000000..e3e20bac9164f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ImportExportOperationResultProperties.java @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.models.PrivateEndpointConnectionRequestStatus; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.UUID; + +/** Contains the operation result properties for import/export operation. */ +@Immutable +public final class ImportExportOperationResultProperties { + /* + * Request Id. + */ + @JsonProperty(value = "requestId", access = JsonProperty.Access.WRITE_ONLY) + private UUID requestId; + + /* + * Request type. + */ + @JsonProperty(value = "requestType", access = JsonProperty.Access.WRITE_ONLY) + private String requestType; + + /* + * Queued time. + */ + @JsonProperty(value = "queuedTime", access = JsonProperty.Access.WRITE_ONLY) + private String queuedTime; + + /* + * Last modified time. + */ + @JsonProperty(value = "lastModifiedTime", access = JsonProperty.Access.WRITE_ONLY) + private String lastModifiedTime; + + /* + * Blob Uri. + */ + @JsonProperty(value = "blobUri", access = JsonProperty.Access.WRITE_ONLY) + private String blobUri; + + /* + * Server name. + */ + @JsonProperty(value = "serverName", access = JsonProperty.Access.WRITE_ONLY) + private String serverName; + + /* + * Database name. + */ + @JsonProperty(value = "databaseName", access = JsonProperty.Access.WRITE_ONLY) + private String databaseName; + + /* + * Operation status. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /* + * Error message. + */ + @JsonProperty(value = "errorMessage", access = JsonProperty.Access.WRITE_ONLY) + private String errorMessage; + + /* + * Gets the status of private endpoints associated with this request. + */ + @JsonProperty(value = "privateEndpointConnections", access = JsonProperty.Access.WRITE_ONLY) + private List privateEndpointConnections; + + /** Creates an instance of ImportExportOperationResultProperties class. */ + public ImportExportOperationResultProperties() { + } + + /** + * Get the requestId property: Request Id. + * + * @return the requestId value. + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Get the requestType property: Request type. + * + * @return the requestType value. + */ + public String requestType() { + return this.requestType; + } + + /** + * Get the queuedTime property: Queued time. + * + * @return the queuedTime value. + */ + public String queuedTime() { + return this.queuedTime; + } + + /** + * Get the lastModifiedTime property: Last modified time. + * + * @return the lastModifiedTime value. + */ + public String lastModifiedTime() { + return this.lastModifiedTime; + } + + /** + * Get the blobUri property: Blob Uri. + * + * @return the blobUri value. + */ + public String blobUri() { + return this.blobUri; + } + + /** + * Get the serverName property: Server name. + * + * @return the serverName value. + */ + public String serverName() { + return this.serverName; + } + + /** + * Get the databaseName property: Database name. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Get the status property: Operation status. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Get the errorMessage property: Error message. + * + * @return the errorMessage value. + */ + public String errorMessage() { + return this.errorMessage; + } + + /** + * Get the privateEndpointConnections property: Gets the status of private endpoints associated with this request. + * + * @return the privateEndpointConnections value. + */ + public List privateEndpointConnections() { + return this.privateEndpointConnections; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (privateEndpointConnections() != null) { + privateEndpointConnections().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/InstanceFailoverGroupInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/InstanceFailoverGroupInner.java new file mode 100644 index 0000000000000..29cccbd7e8923 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/InstanceFailoverGroupInner.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.InstanceFailoverGroupReadOnlyEndpoint; +import com.azure.resourcemanager.sql.generated.models.InstanceFailoverGroupReadWriteEndpoint; +import com.azure.resourcemanager.sql.generated.models.InstanceFailoverGroupReplicationRole; +import com.azure.resourcemanager.sql.generated.models.ManagedInstancePairInfo; +import com.azure.resourcemanager.sql.generated.models.PartnerRegionInfo; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** An instance failover group. */ +@Fluent +public final class InstanceFailoverGroupInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private InstanceFailoverGroupProperties innerProperties; + + /** Creates an instance of InstanceFailoverGroupInner class. */ + public InstanceFailoverGroupInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private InstanceFailoverGroupProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the readWriteEndpoint property: Read-write endpoint of the failover group instance. + * + * @return the readWriteEndpoint value. + */ + public InstanceFailoverGroupReadWriteEndpoint readWriteEndpoint() { + return this.innerProperties() == null ? null : this.innerProperties().readWriteEndpoint(); + } + + /** + * Set the readWriteEndpoint property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new InstanceFailoverGroupProperties(); + } + this.innerProperties().withReadWriteEndpoint(readWriteEndpoint); + return this; + } + + /** + * Get the readOnlyEndpoint property: Read-only endpoint of the failover group instance. + * + * @return the readOnlyEndpoint value. + */ + public InstanceFailoverGroupReadOnlyEndpoint readOnlyEndpoint() { + return this.innerProperties() == null ? null : this.innerProperties().readOnlyEndpoint(); + } + + /** + * Set the readOnlyEndpoint property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new InstanceFailoverGroupProperties(); + } + this.innerProperties().withReadOnlyEndpoint(readOnlyEndpoint); + return this; + } + + /** + * Get the replicationRole property: Local replication role of the failover group instance. + * + * @return the replicationRole value. + */ + public InstanceFailoverGroupReplicationRole replicationRole() { + return this.innerProperties() == null ? null : this.innerProperties().replicationRole(); + } + + /** + * Get the replicationState property: Replication state of the failover group instance. + * + * @return the replicationState value. + */ + public String replicationState() { + return this.innerProperties() == null ? null : this.innerProperties().replicationState(); + } + + /** + * Get the partnerRegions property: Partner region information for the failover group. + * + * @return the partnerRegions value. + */ + public List partnerRegions() { + return this.innerProperties() == null ? null : this.innerProperties().partnerRegions(); + } + + /** + * Set the partnerRegions property: Partner region information for the failover group. + * + * @param partnerRegions the partnerRegions value to set. + * @return the InstanceFailoverGroupInner object itself. + */ + public InstanceFailoverGroupInner withPartnerRegions(List partnerRegions) { + if (this.innerProperties() == null) { + this.innerProperties = new InstanceFailoverGroupProperties(); + } + this.innerProperties().withPartnerRegions(partnerRegions); + return this; + } + + /** + * Get the managedInstancePairs property: List of managed instance pairs in the failover group. + * + * @return the managedInstancePairs value. + */ + public List managedInstancePairs() { + return this.innerProperties() == null ? null : this.innerProperties().managedInstancePairs(); + } + + /** + * Set the managedInstancePairs property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new InstanceFailoverGroupProperties(); + } + this.innerProperties().withManagedInstancePairs(managedInstancePairs); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/InstanceFailoverGroupProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/InstanceFailoverGroupProperties.java new file mode 100644 index 0000000000000..158e5ea953cec --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/InstanceFailoverGroupProperties.java @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.InstanceFailoverGroupReadOnlyEndpoint; +import com.azure.resourcemanager.sql.generated.models.InstanceFailoverGroupReadWriteEndpoint; +import com.azure.resourcemanager.sql.generated.models.InstanceFailoverGroupReplicationRole; +import com.azure.resourcemanager.sql.generated.models.ManagedInstancePairInfo; +import com.azure.resourcemanager.sql.generated.models.PartnerRegionInfo; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of a instance failover group. */ +@Fluent +public final class InstanceFailoverGroupProperties { + /* + * Read-write endpoint of the failover group instance. + */ + @JsonProperty(value = "readWriteEndpoint", required = true) + private InstanceFailoverGroupReadWriteEndpoint readWriteEndpoint; + + /* + * Read-only endpoint of the failover group instance. + */ + @JsonProperty(value = "readOnlyEndpoint") + private InstanceFailoverGroupReadOnlyEndpoint readOnlyEndpoint; + + /* + * Local replication role of the failover group instance. + */ + @JsonProperty(value = "replicationRole", access = JsonProperty.Access.WRITE_ONLY) + private InstanceFailoverGroupReplicationRole replicationRole; + + /* + * Replication state of the failover group instance. + */ + @JsonProperty(value = "replicationState", access = JsonProperty.Access.WRITE_ONLY) + private String replicationState; + + /* + * Partner region information for the failover group. + */ + @JsonProperty(value = "partnerRegions", required = true) + private List partnerRegions; + + /* + * List of managed instance pairs in the failover group. + */ + @JsonProperty(value = "managedInstancePairs", required = true) + private List managedInstancePairs; + + /** Creates an instance of InstanceFailoverGroupProperties class. */ + public InstanceFailoverGroupProperties() { + } + + /** + * Get the readWriteEndpoint property: Read-write endpoint of the failover group instance. + * + * @return the readWriteEndpoint value. + */ + public InstanceFailoverGroupReadWriteEndpoint readWriteEndpoint() { + return this.readWriteEndpoint; + } + + /** + * Set the readWriteEndpoint property: Read-write endpoint of the failover group instance. + * + * @param readWriteEndpoint the readWriteEndpoint value to set. + * @return the InstanceFailoverGroupProperties object itself. + */ + public InstanceFailoverGroupProperties withReadWriteEndpoint( + InstanceFailoverGroupReadWriteEndpoint readWriteEndpoint) { + this.readWriteEndpoint = readWriteEndpoint; + return this; + } + + /** + * Get the readOnlyEndpoint property: Read-only endpoint of the failover group instance. + * + * @return the readOnlyEndpoint value. + */ + public InstanceFailoverGroupReadOnlyEndpoint readOnlyEndpoint() { + return this.readOnlyEndpoint; + } + + /** + * Set the readOnlyEndpoint property: Read-only endpoint of the failover group instance. + * + * @param readOnlyEndpoint the readOnlyEndpoint value to set. + * @return the InstanceFailoverGroupProperties object itself. + */ + public InstanceFailoverGroupProperties withReadOnlyEndpoint( + InstanceFailoverGroupReadOnlyEndpoint readOnlyEndpoint) { + this.readOnlyEndpoint = readOnlyEndpoint; + return this; + } + + /** + * Get the replicationRole property: Local replication role of the failover group instance. + * + * @return the replicationRole value. + */ + public InstanceFailoverGroupReplicationRole replicationRole() { + return this.replicationRole; + } + + /** + * Get the replicationState property: Replication state of the failover group instance. + * + * @return the replicationState value. + */ + public String replicationState() { + return this.replicationState; + } + + /** + * Get the partnerRegions property: Partner region information for the failover group. + * + * @return the partnerRegions value. + */ + public List partnerRegions() { + return this.partnerRegions; + } + + /** + * Set the partnerRegions property: Partner region information for the failover group. + * + * @param partnerRegions the partnerRegions value to set. + * @return the InstanceFailoverGroupProperties object itself. + */ + public InstanceFailoverGroupProperties withPartnerRegions(List partnerRegions) { + this.partnerRegions = partnerRegions; + return this; + } + + /** + * Get the managedInstancePairs property: List of managed instance pairs in the failover group. + * + * @return the managedInstancePairs value. + */ + public List managedInstancePairs() { + return this.managedInstancePairs; + } + + /** + * Set the managedInstancePairs property: List of managed instance pairs in the failover group. + * + * @param managedInstancePairs the managedInstancePairs value to set. + * @return the InstanceFailoverGroupProperties object itself. + */ + public InstanceFailoverGroupProperties withManagedInstancePairs( + List managedInstancePairs) { + this.managedInstancePairs = managedInstancePairs; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (readWriteEndpoint() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property readWriteEndpoint in model InstanceFailoverGroupProperties")); + } else { + readWriteEndpoint().validate(); + } + if (readOnlyEndpoint() != null) { + readOnlyEndpoint().validate(); + } + if (partnerRegions() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property partnerRegions in model InstanceFailoverGroupProperties")); + } else { + partnerRegions().forEach(e -> e.validate()); + } + if (managedInstancePairs() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property managedInstancePairs in model InstanceFailoverGroupProperties")); + } else { + managedInstancePairs().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(InstanceFailoverGroupProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/InstancePoolInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/InstancePoolInner.java new file mode 100644 index 0000000000000..e8f4e196c9116 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/InstancePoolInner.java @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.resourcemanager.sql.generated.models.InstancePoolLicenseType; +import com.azure.resourcemanager.sql.generated.models.Sku; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An Azure SQL instance pool. */ +@Fluent +public final class InstancePoolInner extends Resource { + /* + * The name and tier of the SKU. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private InstancePoolProperties innerProperties; + + /** Creates an instance of InstancePoolInner class. */ + public InstancePoolInner() { + } + + /** + * Get the sku property: The name and tier of the SKU. + * + * @return the sku value. + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku property: The name and tier of the SKU. + * + * @param sku the sku value to set. + * @return the InstancePoolInner object itself. + */ + public InstancePoolInner withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private InstancePoolProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public InstancePoolInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public InstancePoolInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the subnetId property: Resource ID of the subnet to place this instance pool in. + * + * @return the subnetId value. + */ + public String subnetId() { + return this.innerProperties() == null ? null : this.innerProperties().subnetId(); + } + + /** + * Set the subnetId property: Resource ID of the subnet to place this instance pool in. + * + * @param subnetId the subnetId value to set. + * @return the InstancePoolInner object itself. + */ + public InstancePoolInner withSubnetId(String subnetId) { + if (this.innerProperties() == null) { + this.innerProperties = new InstancePoolProperties(); + } + this.innerProperties().withSubnetId(subnetId); + return this; + } + + /** + * Get the vCores property: Count of vCores belonging to this instance pool. + * + * @return the vCores value. + */ + public Integer vCores() { + return this.innerProperties() == null ? null : this.innerProperties().vCores(); + } + + /** + * Set the vCores property: Count of vCores belonging to this instance pool. + * + * @param vCores the vCores value to set. + * @return the InstancePoolInner object itself. + */ + public InstancePoolInner withVCores(Integer vCores) { + if (this.innerProperties() == null) { + this.innerProperties = new InstancePoolProperties(); + } + this.innerProperties().withVCores(vCores); + return this; + } + + /** + * Get the licenseType property: The license type. Possible values are 'LicenseIncluded' (price for SQL license is + * included) and 'BasePrice' (without SQL license price). + * + * @return the licenseType value. + */ + public InstancePoolLicenseType licenseType() { + return this.innerProperties() == null ? null : this.innerProperties().licenseType(); + } + + /** + * Set the licenseType property: The license type. Possible values are 'LicenseIncluded' (price for SQL license is + * included) and 'BasePrice' (without SQL license price). + * + * @param licenseType the licenseType value to set. + * @return the InstancePoolInner object itself. + */ + public InstancePoolInner withLicenseType(InstancePoolLicenseType licenseType) { + if (this.innerProperties() == null) { + this.innerProperties = new InstancePoolProperties(); + } + this.innerProperties().withLicenseType(licenseType); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/InstancePoolProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/InstancePoolProperties.java new file mode 100644 index 0000000000000..b9aefa0dabaef --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/InstancePoolProperties.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.InstancePoolLicenseType; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of an instance pool. */ +@Fluent +public final class InstancePoolProperties { + /* + * Resource ID of the subnet to place this instance pool in. + */ + @JsonProperty(value = "subnetId", required = true) + private String subnetId; + + /* + * Count of vCores belonging to this instance pool. + */ + @JsonProperty(value = "vCores", required = true) + private int vCores; + + /* + * The license type. Possible values are 'LicenseIncluded' (price for SQL license is included) and 'BasePrice' + * (without SQL license price). + */ + @JsonProperty(value = "licenseType", required = true) + private InstancePoolLicenseType licenseType; + + /** Creates an instance of InstancePoolProperties class. */ + public InstancePoolProperties() { + } + + /** + * Get the subnetId property: Resource ID of the subnet to place this instance pool in. + * + * @return the subnetId value. + */ + public String subnetId() { + return this.subnetId; + } + + /** + * Set the subnetId property: Resource ID of the subnet to place this instance pool in. + * + * @param subnetId the subnetId value to set. + * @return the InstancePoolProperties object itself. + */ + public InstancePoolProperties withSubnetId(String subnetId) { + this.subnetId = subnetId; + return this; + } + + /** + * Get the vCores property: Count of vCores belonging to this instance pool. + * + * @return the vCores value. + */ + public int vCores() { + return this.vCores; + } + + /** + * Set the vCores property: Count of vCores belonging to this instance pool. + * + * @param vCores the vCores value to set. + * @return the InstancePoolProperties object itself. + */ + public InstancePoolProperties withVCores(int vCores) { + this.vCores = vCores; + return this; + } + + /** + * Get the licenseType property: The license type. Possible values are 'LicenseIncluded' (price for SQL license is + * included) and 'BasePrice' (without SQL license price). + * + * @return the licenseType value. + */ + public InstancePoolLicenseType licenseType() { + return this.licenseType; + } + + /** + * Set the licenseType property: The license type. Possible values are 'LicenseIncluded' (price for SQL license is + * included) and 'BasePrice' (without SQL license price). + * + * @param licenseType the licenseType value to set. + * @return the InstancePoolProperties object itself. + */ + public InstancePoolProperties withLicenseType(InstancePoolLicenseType licenseType) { + this.licenseType = licenseType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (subnetId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property subnetId in model InstancePoolProperties")); + } + if (licenseType() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property licenseType in model InstancePoolProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(InstancePoolProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobAgentInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobAgentInner.java new file mode 100644 index 0000000000000..43cc0f28d5bf6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobAgentInner.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.resourcemanager.sql.generated.models.JobAgentState; +import com.azure.resourcemanager.sql.generated.models.Sku; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An Azure SQL job agent. */ +@Fluent +public final class JobAgentInner extends Resource { + /* + * The name and tier of the SKU. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private JobAgentProperties innerProperties; + + /** Creates an instance of JobAgentInner class. */ + public JobAgentInner() { + } + + /** + * Get the sku property: The name and tier of the SKU. + * + * @return the sku value. + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku property: 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 the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private JobAgentProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public JobAgentInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public JobAgentInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the databaseId property: Resource ID of the database to store job metadata in. + * + * @return the databaseId value. + */ + public String databaseId() { + return this.innerProperties() == null ? null : this.innerProperties().databaseId(); + } + + /** + * Set the databaseId property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new JobAgentProperties(); + } + this.innerProperties().withDatabaseId(databaseId); + return this; + } + + /** + * Get the state property: The state of the job agent. + * + * @return the state value. + */ + public JobAgentState state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobAgentProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobAgentProperties.java new file mode 100644 index 0000000000000..76dcb12379f1f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobAgentProperties.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.JobAgentState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a job agent. */ +@Fluent +public final class JobAgentProperties { + /* + * Resource ID of the database to store job metadata in. + */ + @JsonProperty(value = "databaseId", required = true) + private String databaseId; + + /* + * The state of the job agent. + */ + @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) + private JobAgentState state; + + /** Creates an instance of JobAgentProperties class. */ + public JobAgentProperties() { + } + + /** + * Get the databaseId property: Resource ID of the database to store job metadata in. + * + * @return the databaseId value. + */ + public String databaseId() { + return this.databaseId; + } + + /** + * Set the databaseId property: Resource ID of the database to store job metadata in. + * + * @param databaseId the databaseId value to set. + * @return the JobAgentProperties object itself. + */ + public JobAgentProperties withDatabaseId(String databaseId) { + this.databaseId = databaseId; + return this; + } + + /** + * Get the state property: The state of the job agent. + * + * @return the state value. + */ + public JobAgentState state() { + return this.state; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (databaseId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property databaseId in model JobAgentProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(JobAgentProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobCredentialInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobCredentialInner.java new file mode 100644 index 0000000000000..cc818b01bd825 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobCredentialInner.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A stored credential that can be used by a job to connect to target databases. */ +@Fluent +public final class JobCredentialInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private JobCredentialProperties innerProperties; + + /** Creates an instance of JobCredentialInner class. */ + public JobCredentialInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private JobCredentialProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the username property: The credential user name. + * + * @return the username value. + */ + public String username() { + return this.innerProperties() == null ? null : this.innerProperties().username(); + } + + /** + * Set the username property: The credential user name. + * + * @param username the username value to set. + * @return the JobCredentialInner object itself. + */ + public JobCredentialInner withUsername(String username) { + if (this.innerProperties() == null) { + this.innerProperties = new JobCredentialProperties(); + } + this.innerProperties().withUsername(username); + return this; + } + + /** + * Get the password property: The credential password. + * + * @return the password value. + */ + public String password() { + return this.innerProperties() == null ? null : this.innerProperties().password(); + } + + /** + * Set the password property: The credential password. + * + * @param password the password value to set. + * @return the JobCredentialInner object itself. + */ + public JobCredentialInner withPassword(String password) { + if (this.innerProperties() == null) { + this.innerProperties = new JobCredentialProperties(); + } + this.innerProperties().withPassword(password); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobCredentialProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobCredentialProperties.java new file mode 100644 index 0000000000000..0bf85bdbfcd78 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobCredentialProperties.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a job credential. */ +@Fluent +public final class JobCredentialProperties { + /* + * The credential user name. + */ + @JsonProperty(value = "username", required = true) + private String username; + + /* + * The credential password. + */ + @JsonProperty(value = "password", required = true) + private String password; + + /** Creates an instance of JobCredentialProperties class. */ + public JobCredentialProperties() { + } + + /** + * Get the username property: The credential user name. + * + * @return the username value. + */ + public String username() { + return this.username; + } + + /** + * Set the username property: The credential user name. + * + * @param username the username value to set. + * @return the JobCredentialProperties object itself. + */ + public JobCredentialProperties withUsername(String username) { + this.username = username; + return this; + } + + /** + * Get the password property: The credential password. + * + * @return the password value. + */ + public String password() { + return this.password; + } + + /** + * Set the password property: The credential password. + * + * @param password the password value to set. + * @return the JobCredentialProperties object itself. + */ + public JobCredentialProperties withPassword(String password) { + this.password = password; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (username() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property username in model JobCredentialProperties")); + } + if (password() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property password in model JobCredentialProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(JobCredentialProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobExecutionInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobExecutionInner.java new file mode 100644 index 0000000000000..11950bfdef376 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobExecutionInner.java @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.JobExecutionLifecycle; +import com.azure.resourcemanager.sql.generated.models.JobExecutionTarget; +import com.azure.resourcemanager.sql.generated.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.UUID; + +/** An execution of a job. */ +@Fluent +public final class JobExecutionInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private JobExecutionProperties innerProperties; + + /** Creates an instance of JobExecutionInner class. */ + public JobExecutionInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private JobExecutionProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the jobVersion property: The job version number. + * + * @return the jobVersion value. + */ + public Integer jobVersion() { + return this.innerProperties() == null ? null : this.innerProperties().jobVersion(); + } + + /** + * Get the stepName property: The job step name. + * + * @return the stepName value. + */ + public String stepName() { + return this.innerProperties() == null ? null : this.innerProperties().stepName(); + } + + /** + * Get the stepId property: The job step id. + * + * @return the stepId value. + */ + public Integer stepId() { + return this.innerProperties() == null ? null : this.innerProperties().stepId(); + } + + /** + * Get the jobExecutionId property: The unique identifier of the job execution. + * + * @return the jobExecutionId value. + */ + public UUID jobExecutionId() { + return this.innerProperties() == null ? null : this.innerProperties().jobExecutionId(); + } + + /** + * Get the lifecycle property: The detailed state of the job execution. + * + * @return the lifecycle value. + */ + public JobExecutionLifecycle lifecycle() { + return this.innerProperties() == null ? null : this.innerProperties().lifecycle(); + } + + /** + * Get the provisioningState property: The ARM provisioning state of the job execution. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the createTime property: The time that the job execution was created. + * + * @return the createTime value. + */ + public OffsetDateTime createTime() { + return this.innerProperties() == null ? null : this.innerProperties().createTime(); + } + + /** + * Get the startTime property: The time that the job execution started. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.innerProperties() == null ? null : this.innerProperties().startTime(); + } + + /** + * Get the endTime property: The time that the job execution completed. + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.innerProperties() == null ? null : this.innerProperties().endTime(); + } + + /** + * Get the currentAttempts property: Number of times the job execution has been attempted. + * + * @return the currentAttempts value. + */ + public Integer currentAttempts() { + return this.innerProperties() == null ? null : this.innerProperties().currentAttempts(); + } + + /** + * Set the currentAttempts property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new JobExecutionProperties(); + } + this.innerProperties().withCurrentAttempts(currentAttempts); + return this; + } + + /** + * Get the currentAttemptStartTime property: Start time of the current attempt. + * + * @return the currentAttemptStartTime value. + */ + public OffsetDateTime currentAttemptStartTime() { + return this.innerProperties() == null ? null : this.innerProperties().currentAttemptStartTime(); + } + + /** + * Get the lastMessage property: The last status or error message. + * + * @return the lastMessage value. + */ + public String lastMessage() { + return this.innerProperties() == null ? null : this.innerProperties().lastMessage(); + } + + /** + * Get the target property: The target that this execution is executed on. + * + * @return the target value. + */ + public JobExecutionTarget target() { + return this.innerProperties() == null ? null : this.innerProperties().target(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobExecutionProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobExecutionProperties.java new file mode 100644 index 0000000000000..65a4de72bdfba --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobExecutionProperties.java @@ -0,0 +1,238 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.models.JobExecutionLifecycle; +import com.azure.resourcemanager.sql.generated.models.JobExecutionTarget; +import com.azure.resourcemanager.sql.generated.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.UUID; + +/** Properties for an Azure SQL Database Elastic job execution. */ +@Fluent +public final class JobExecutionProperties { + /* + * The job version number. + */ + @JsonProperty(value = "jobVersion", access = JsonProperty.Access.WRITE_ONLY) + private Integer jobVersion; + + /* + * The job step name. + */ + @JsonProperty(value = "stepName", access = JsonProperty.Access.WRITE_ONLY) + private String stepName; + + /* + * The job step id. + */ + @JsonProperty(value = "stepId", access = JsonProperty.Access.WRITE_ONLY) + private Integer stepId; + + /* + * The unique identifier of the job execution. + */ + @JsonProperty(value = "jobExecutionId", access = JsonProperty.Access.WRITE_ONLY) + private UUID jobExecutionId; + + /* + * The detailed state of the job execution. + */ + @JsonProperty(value = "lifecycle", access = JsonProperty.Access.WRITE_ONLY) + private JobExecutionLifecycle lifecycle; + + /* + * The ARM provisioning state of the job execution. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /* + * The time that the job execution was created. + */ + @JsonProperty(value = "createTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime createTime; + + /* + * The time that the job execution started. + */ + @JsonProperty(value = "startTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime startTime; + + /* + * The time that the job execution completed. + */ + @JsonProperty(value = "endTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime endTime; + + /* + * Number of times the job execution has been attempted. + */ + @JsonProperty(value = "currentAttempts") + private Integer currentAttempts; + + /* + * Start time of the current attempt. + */ + @JsonProperty(value = "currentAttemptStartTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime currentAttemptStartTime; + + /* + * The last status or error message. + */ + @JsonProperty(value = "lastMessage", access = JsonProperty.Access.WRITE_ONLY) + private String lastMessage; + + /* + * The target that this execution is executed on. + */ + @JsonProperty(value = "target", access = JsonProperty.Access.WRITE_ONLY) + private JobExecutionTarget target; + + /** Creates an instance of JobExecutionProperties class. */ + public JobExecutionProperties() { + } + + /** + * Get the jobVersion property: The job version number. + * + * @return the jobVersion value. + */ + public Integer jobVersion() { + return this.jobVersion; + } + + /** + * Get the stepName property: The job step name. + * + * @return the stepName value. + */ + public String stepName() { + return this.stepName; + } + + /** + * Get the stepId property: The job step id. + * + * @return the stepId value. + */ + public Integer stepId() { + return this.stepId; + } + + /** + * Get the jobExecutionId property: The unique identifier of the job execution. + * + * @return the jobExecutionId value. + */ + public UUID jobExecutionId() { + return this.jobExecutionId; + } + + /** + * Get the lifecycle property: The detailed state of the job execution. + * + * @return the lifecycle value. + */ + public JobExecutionLifecycle lifecycle() { + return this.lifecycle; + } + + /** + * Get the provisioningState property: The ARM provisioning state of the job execution. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the createTime property: The time that the job execution was created. + * + * @return the createTime value. + */ + public OffsetDateTime createTime() { + return this.createTime; + } + + /** + * Get the startTime property: The time that the job execution started. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Get the endTime property: The time that the job execution completed. + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Get the currentAttempts property: Number of times the job execution has been attempted. + * + * @return the currentAttempts value. + */ + public Integer currentAttempts() { + return this.currentAttempts; + } + + /** + * Set the currentAttempts property: Number of times the job execution has been attempted. + * + * @param currentAttempts the currentAttempts value to set. + * @return the JobExecutionProperties object itself. + */ + public JobExecutionProperties withCurrentAttempts(Integer currentAttempts) { + this.currentAttempts = currentAttempts; + return this; + } + + /** + * Get the currentAttemptStartTime property: Start time of the current attempt. + * + * @return the currentAttemptStartTime value. + */ + public OffsetDateTime currentAttemptStartTime() { + return this.currentAttemptStartTime; + } + + /** + * Get the lastMessage property: The last status or error message. + * + * @return the lastMessage value. + */ + public String lastMessage() { + return this.lastMessage; + } + + /** + * Get the target property: The target that this execution is executed on. + * + * @return the target value. + */ + public JobExecutionTarget target() { + return this.target; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (target() != null) { + target().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobInner.java new file mode 100644 index 0000000000000..e892d68d0614a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobInner.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.JobSchedule; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A job. */ +@Fluent +public final class JobInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private JobProperties innerProperties; + + /** Creates an instance of JobInner class. */ + public JobInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private JobProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the description property: User-defined description of the job. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: User-defined description of the job. + * + * @param description the description value to set. + * @return the JobInner object itself. + */ + public JobInner withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new JobProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the version property: The job version number. + * + * @return the version value. + */ + public Integer version() { + return this.innerProperties() == null ? null : this.innerProperties().version(); + } + + /** + * Get the schedule property: Schedule properties of the job. + * + * @return the schedule value. + */ + public JobSchedule schedule() { + return this.innerProperties() == null ? null : this.innerProperties().schedule(); + } + + /** + * Set the schedule property: Schedule properties of the job. + * + * @param schedule the schedule value to set. + * @return the JobInner object itself. + */ + public JobInner withSchedule(JobSchedule schedule) { + if (this.innerProperties() == null) { + this.innerProperties = new JobProperties(); + } + this.innerProperties().withSchedule(schedule); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobProperties.java new file mode 100644 index 0000000000000..82b614abed617 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobProperties.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.models.JobSchedule; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a job. */ +@Fluent +public final class JobProperties { + /* + * User-defined description of the job. + */ + @JsonProperty(value = "description") + private String description; + + /* + * The job version number. + */ + @JsonProperty(value = "version", access = JsonProperty.Access.WRITE_ONLY) + private Integer version; + + /* + * Schedule properties of the job. + */ + @JsonProperty(value = "schedule") + private JobSchedule schedule; + + /** Creates an instance of JobProperties class. */ + public JobProperties() { + } + + /** + * Get the description property: User-defined description of the job. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: User-defined description of the job. + * + * @param description the description value to set. + * @return the JobProperties object itself. + */ + public JobProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the version property: The job version number. + * + * @return the version value. + */ + public Integer version() { + return this.version; + } + + /** + * Get the schedule property: Schedule properties of the job. + * + * @return the schedule value. + */ + public JobSchedule schedule() { + return this.schedule; + } + + /** + * Set the schedule property: Schedule properties of the job. + * + * @param schedule the schedule value to set. + * @return the JobProperties object itself. + */ + public JobProperties withSchedule(JobSchedule schedule) { + this.schedule = schedule; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (schedule() != null) { + schedule().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobStepInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobStepInner.java new file mode 100644 index 0000000000000..665f58f1557f0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobStepInner.java @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.JobStepAction; +import com.azure.resourcemanager.sql.generated.models.JobStepExecutionOptions; +import com.azure.resourcemanager.sql.generated.models.JobStepOutput; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A job step. */ +@Fluent +public final class JobStepInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private JobStepProperties innerProperties; + + /** Creates an instance of JobStepInner class. */ + public JobStepInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private JobStepProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the stepId property: 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.innerProperties() == null ? null : this.innerProperties().stepId(); + } + + /** + * Set the stepId property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new JobStepProperties(); + } + this.innerProperties().withStepId(stepId); + return this; + } + + /** + * Get the targetGroup property: The resource ID of the target group that the job step will be executed on. + * + * @return the targetGroup value. + */ + public String targetGroup() { + return this.innerProperties() == null ? null : this.innerProperties().targetGroup(); + } + + /** + * Set the targetGroup property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new JobStepProperties(); + } + this.innerProperties().withTargetGroup(targetGroup); + return this; + } + + /** + * Get the credential property: 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.innerProperties() == null ? null : this.innerProperties().credential(); + } + + /** + * Set the credential property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new JobStepProperties(); + } + this.innerProperties().withCredential(credential); + return this; + } + + /** + * Get the action property: The action payload of the job step. + * + * @return the action value. + */ + public JobStepAction action() { + return this.innerProperties() == null ? null : this.innerProperties().action(); + } + + /** + * Set the action property: The action payload of the job step. + * + * @param action the action value to set. + * @return the JobStepInner object itself. + */ + public JobStepInner withAction(JobStepAction action) { + if (this.innerProperties() == null) { + this.innerProperties = new JobStepProperties(); + } + this.innerProperties().withAction(action); + return this; + } + + /** + * Get the output property: Output destination properties of the job step. + * + * @return the output value. + */ + public JobStepOutput output() { + return this.innerProperties() == null ? null : this.innerProperties().output(); + } + + /** + * Set the output property: Output destination properties of the job step. + * + * @param output the output value to set. + * @return the JobStepInner object itself. + */ + public JobStepInner withOutput(JobStepOutput output) { + if (this.innerProperties() == null) { + this.innerProperties = new JobStepProperties(); + } + this.innerProperties().withOutput(output); + return this; + } + + /** + * Get the executionOptions property: Execution options for the job step. + * + * @return the executionOptions value. + */ + public JobStepExecutionOptions executionOptions() { + return this.innerProperties() == null ? null : this.innerProperties().executionOptions(); + } + + /** + * Set the executionOptions property: Execution options for the job step. + * + * @param executionOptions the executionOptions value to set. + * @return the JobStepInner object itself. + */ + public JobStepInner withExecutionOptions(JobStepExecutionOptions executionOptions) { + if (this.innerProperties() == null) { + this.innerProperties = new JobStepProperties(); + } + this.innerProperties().withExecutionOptions(executionOptions); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobStepProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobStepProperties.java new file mode 100644 index 0000000000000..ee1d10ad5f9e2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobStepProperties.java @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.JobStepAction; +import com.azure.resourcemanager.sql.generated.models.JobStepExecutionOptions; +import com.azure.resourcemanager.sql.generated.models.JobStepOutput; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a job step. */ +@Fluent +public final class JobStepProperties { + /* + * 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 = "stepId") + private Integer stepId; + + /* + * The resource ID of the target group that the job step will be executed on. + */ + @JsonProperty(value = "targetGroup", required = true) + private String targetGroup; + + /* + * The resource ID of the job credential that will be used to connect to the targets. + */ + @JsonProperty(value = "credential", required = true) + private String credential; + + /* + * The action payload of the job step. + */ + @JsonProperty(value = "action", required = true) + private JobStepAction action; + + /* + * Output destination properties of the job step. + */ + @JsonProperty(value = "output") + private JobStepOutput output; + + /* + * Execution options for the job step. + */ + @JsonProperty(value = "executionOptions") + private JobStepExecutionOptions executionOptions; + + /** Creates an instance of JobStepProperties class. */ + public JobStepProperties() { + } + + /** + * Get the stepId property: 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 stepId property: 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 JobStepProperties object itself. + */ + public JobStepProperties withStepId(Integer stepId) { + this.stepId = stepId; + return this; + } + + /** + * Get the targetGroup property: 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 targetGroup property: The resource ID of the target group that the job step will be executed on. + * + * @param targetGroup the targetGroup value to set. + * @return the JobStepProperties object itself. + */ + public JobStepProperties withTargetGroup(String targetGroup) { + this.targetGroup = targetGroup; + return this; + } + + /** + * Get the credential property: 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 credential property: 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 JobStepProperties object itself. + */ + public JobStepProperties withCredential(String credential) { + this.credential = credential; + return this; + } + + /** + * Get the action property: The action payload of the job step. + * + * @return the action value. + */ + public JobStepAction action() { + return this.action; + } + + /** + * Set the action property: The action payload of the job step. + * + * @param action the action value to set. + * @return the JobStepProperties object itself. + */ + public JobStepProperties withAction(JobStepAction action) { + this.action = action; + return this; + } + + /** + * Get the output property: Output destination properties of the job step. + * + * @return the output value. + */ + public JobStepOutput output() { + return this.output; + } + + /** + * Set the output property: Output destination properties of the job step. + * + * @param output the output value to set. + * @return the JobStepProperties object itself. + */ + public JobStepProperties withOutput(JobStepOutput output) { + this.output = output; + return this; + } + + /** + * Get the executionOptions property: Execution options for the job step. + * + * @return the executionOptions value. + */ + public JobStepExecutionOptions executionOptions() { + return this.executionOptions; + } + + /** + * Set the executionOptions property: Execution options for the job step. + * + * @param executionOptions the executionOptions value to set. + * @return the JobStepProperties object itself. + */ + public JobStepProperties withExecutionOptions(JobStepExecutionOptions executionOptions) { + this.executionOptions = executionOptions; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (targetGroup() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property targetGroup in model JobStepProperties")); + } + if (credential() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property credential in model JobStepProperties")); + } + if (action() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property action in model JobStepProperties")); + } else { + action().validate(); + } + if (output() != null) { + output().validate(); + } + if (executionOptions() != null) { + executionOptions().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(JobStepProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobTargetGroupInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobTargetGroupInner.java new file mode 100644 index 0000000000000..50727a280817f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobTargetGroupInner.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.JobTarget; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A group of job targets. */ +@Fluent +public final class JobTargetGroupInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private JobTargetGroupProperties innerProperties; + + /** Creates an instance of JobTargetGroupInner class. */ + public JobTargetGroupInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private JobTargetGroupProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the members property: Members of the target group. + * + * @return the members value. + */ + public List members() { + return this.innerProperties() == null ? null : this.innerProperties().members(); + } + + /** + * Set the members property: Members of the target group. + * + * @param members the members value to set. + * @return the JobTargetGroupInner object itself. + */ + public JobTargetGroupInner withMembers(List members) { + if (this.innerProperties() == null) { + this.innerProperties = new JobTargetGroupProperties(); + } + this.innerProperties().withMembers(members); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobTargetGroupProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobTargetGroupProperties.java new file mode 100644 index 0000000000000..fa4e7a53d8b92 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobTargetGroupProperties.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.JobTarget; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of job target group. */ +@Fluent +public final class JobTargetGroupProperties { + /* + * Members of the target group. + */ + @JsonProperty(value = "members", required = true) + private List members; + + /** Creates an instance of JobTargetGroupProperties class. */ + public JobTargetGroupProperties() { + } + + /** + * Get the members property: Members of the target group. + * + * @return the members value. + */ + public List members() { + return this.members; + } + + /** + * Set the members property: Members of the target group. + * + * @param members the members value to set. + * @return the JobTargetGroupProperties object itself. + */ + public JobTargetGroupProperties withMembers(List members) { + this.members = members; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (members() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property members in model JobTargetGroupProperties")); + } else { + members().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(JobTargetGroupProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobVersionInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobVersionInner.java new file mode 100644 index 0000000000000..580562522d719 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/JobVersionInner.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; + +/** A job version. */ +@Immutable +public final class JobVersionInner extends ProxyResource { + /** Creates an instance of JobVersionInner class. */ + public JobVersionInner() { + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LedgerDigestUploadsInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LedgerDigestUploadsInner.java new file mode 100644 index 0000000000000..d89be8a13cafa --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LedgerDigestUploadsInner.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.LedgerDigestUploadsState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Azure SQL Database ledger digest upload settings. */ +@Fluent +public final class LedgerDigestUploadsInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private LedgerDigestUploadsProperties innerProperties; + + /** Creates an instance of LedgerDigestUploadsInner class. */ + public LedgerDigestUploadsInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private LedgerDigestUploadsProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the digestStorageEndpoint property: The digest storage endpoint, which must be either an Azure blob storage + * endpoint or an URI for Azure Confidential Ledger. + * + * @return the digestStorageEndpoint value. + */ + public String digestStorageEndpoint() { + return this.innerProperties() == null ? null : this.innerProperties().digestStorageEndpoint(); + } + + /** + * Set the digestStorageEndpoint property: The digest storage endpoint, which must be either an Azure blob storage + * endpoint or an URI for Azure Confidential Ledger. + * + * @param digestStorageEndpoint the digestStorageEndpoint value to set. + * @return the LedgerDigestUploadsInner object itself. + */ + public LedgerDigestUploadsInner withDigestStorageEndpoint(String digestStorageEndpoint) { + if (this.innerProperties() == null) { + this.innerProperties = new LedgerDigestUploadsProperties(); + } + this.innerProperties().withDigestStorageEndpoint(digestStorageEndpoint); + return this; + } + + /** + * Get the state property: Specifies the state of ledger digest upload. + * + * @return the state value. + */ + public LedgerDigestUploadsState state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LedgerDigestUploadsProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LedgerDigestUploadsProperties.java new file mode 100644 index 0000000000000..cc60dff3e0d6b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LedgerDigestUploadsProperties.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.models.LedgerDigestUploadsState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of a database ledger digest upload settings. */ +@Fluent +public final class LedgerDigestUploadsProperties { + /* + * The digest storage endpoint, which must be either an Azure blob storage endpoint or an URI for Azure + * Confidential Ledger. + */ + @JsonProperty(value = "digestStorageEndpoint") + private String digestStorageEndpoint; + + /* + * Specifies the state of ledger digest upload. + */ + @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) + private LedgerDigestUploadsState state; + + /** Creates an instance of LedgerDigestUploadsProperties class. */ + public LedgerDigestUploadsProperties() { + } + + /** + * Get the digestStorageEndpoint property: The digest storage endpoint, which must be either an Azure blob storage + * endpoint or an URI for Azure Confidential Ledger. + * + * @return the digestStorageEndpoint value. + */ + public String digestStorageEndpoint() { + return this.digestStorageEndpoint; + } + + /** + * Set the digestStorageEndpoint property: The digest storage endpoint, which must be either an Azure blob storage + * endpoint or an URI for Azure Confidential Ledger. + * + * @param digestStorageEndpoint the digestStorageEndpoint value to set. + * @return the LedgerDigestUploadsProperties object itself. + */ + public LedgerDigestUploadsProperties withDigestStorageEndpoint(String digestStorageEndpoint) { + this.digestStorageEndpoint = digestStorageEndpoint; + return this; + } + + /** + * Get the state property: Specifies the state of ledger digest upload. + * + * @return the state value. + */ + public LedgerDigestUploadsState state() { + return this.state; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LocationCapabilitiesInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LocationCapabilitiesInner.java new file mode 100644 index 0000000000000..56111e9330d71 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LocationCapabilitiesInner.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.models.CapabilityStatus; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceVersionCapability; +import com.azure.resourcemanager.sql.generated.models.ServerVersionCapability; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The location capability. */ +@Fluent +public final 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. + */ + @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; + + /** Creates an instance of LocationCapabilitiesInner class. */ + public LocationCapabilitiesInner() { + } + + /** + * Get the name property: The location name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the supportedServerVersions property: The list of supported server versions. + * + * @return the supportedServerVersions value. + */ + public List supportedServerVersions() { + return this.supportedServerVersions; + } + + /** + * Get the supportedManagedInstanceVersions property: The list of supported managed instance versions. + * + * @return the supportedManagedInstanceVersions value. + */ + public List supportedManagedInstanceVersions() { + return this.supportedManagedInstanceVersions; + } + + /** + * Get the status property: The status of the capability. + * + * @return the status value. + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason property: The reason for the capability not being available. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (supportedServerVersions() != null) { + supportedServerVersions().forEach(e -> e.validate()); + } + if (supportedManagedInstanceVersions() != null) { + supportedManagedInstanceVersions().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LogicalDatabaseTransparentDataEncryptionInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LogicalDatabaseTransparentDataEncryptionInner.java new file mode 100644 index 0000000000000..eb61f8cf65ea7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LogicalDatabaseTransparentDataEncryptionInner.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A logical database transparent data encryption state. */ +@Fluent +public final class LogicalDatabaseTransparentDataEncryptionInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private TransparentDataEncryptionProperties innerProperties; + + /** Creates an instance of LogicalDatabaseTransparentDataEncryptionInner class. */ + public LogicalDatabaseTransparentDataEncryptionInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private TransparentDataEncryptionProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the state property: Specifies the state of the transparent data encryption. + * + * @return the state value. + */ + public TransparentDataEncryptionState state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Set the state property: Specifies the state of the transparent data encryption. + * + * @param state the state value to set. + * @return the LogicalDatabaseTransparentDataEncryptionInner object itself. + */ + public LogicalDatabaseTransparentDataEncryptionInner withState(TransparentDataEncryptionState state) { + if (this.innerProperties() == null) { + this.innerProperties = new TransparentDataEncryptionProperties(); + } + this.innerProperties().withState(state); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LongTermRetentionBackupInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LongTermRetentionBackupInner.java new file mode 100644 index 0000000000000..12b855785c656 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LongTermRetentionBackupInner.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** A long term retention backup. */ +@Fluent +public final class LongTermRetentionBackupInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private LongTermRetentionBackupProperties innerProperties; + + /** Creates an instance of LongTermRetentionBackupInner class. */ + public LongTermRetentionBackupInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private LongTermRetentionBackupProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the serverName property: The server name that the backup database belong to. + * + * @return the serverName value. + */ + public String serverName() { + return this.innerProperties() == null ? null : this.innerProperties().serverName(); + } + + /** + * Get the serverCreateTime property: The create time of the server. + * + * @return the serverCreateTime value. + */ + public OffsetDateTime serverCreateTime() { + return this.innerProperties() == null ? null : this.innerProperties().serverCreateTime(); + } + + /** + * Get the databaseName property: The name of the database the backup belong to. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.innerProperties() == null ? null : this.innerProperties().databaseName(); + } + + /** + * Get the databaseDeletionTime property: The delete time of the database. + * + * @return the databaseDeletionTime value. + */ + public OffsetDateTime databaseDeletionTime() { + return this.innerProperties() == null ? null : this.innerProperties().databaseDeletionTime(); + } + + /** + * Get the backupTime property: The time the backup was taken. + * + * @return the backupTime value. + */ + public OffsetDateTime backupTime() { + return this.innerProperties() == null ? null : this.innerProperties().backupTime(); + } + + /** + * Get the backupExpirationTime property: The time the long term retention backup will expire. + * + * @return the backupExpirationTime value. + */ + public OffsetDateTime backupExpirationTime() { + return this.innerProperties() == null ? null : this.innerProperties().backupExpirationTime(); + } + + /** + * Get the backupStorageRedundancy property: The storage redundancy type of the backup. + * + * @return the backupStorageRedundancy value. + */ + public BackupStorageRedundancy backupStorageRedundancy() { + return this.innerProperties() == null ? null : this.innerProperties().backupStorageRedundancy(); + } + + /** + * Get the requestedBackupStorageRedundancy property: The storage redundancy type of the backup. + * + * @return the requestedBackupStorageRedundancy value. + */ + public BackupStorageRedundancy requestedBackupStorageRedundancy() { + return this.innerProperties() == null ? null : this.innerProperties().requestedBackupStorageRedundancy(); + } + + /** + * Set the requestedBackupStorageRedundancy property: The storage redundancy type of the backup. + * + * @param requestedBackupStorageRedundancy the requestedBackupStorageRedundancy value to set. + * @return the LongTermRetentionBackupInner object itself. + */ + public LongTermRetentionBackupInner withRequestedBackupStorageRedundancy( + BackupStorageRedundancy requestedBackupStorageRedundancy) { + if (this.innerProperties() == null) { + this.innerProperties = new LongTermRetentionBackupProperties(); + } + this.innerProperties().withRequestedBackupStorageRedundancy(requestedBackupStorageRedundancy); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LongTermRetentionBackupOperationResultInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LongTermRetentionBackupOperationResultInner.java new file mode 100644 index 0000000000000..1eea27adbbc82 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LongTermRetentionBackupOperationResultInner.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +/** A LongTermRetentionBackup operation result resource. */ +@Immutable +public final class LongTermRetentionBackupOperationResultInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private LongTermRetentionOperationResultProperties innerProperties; + + /** Creates an instance of LongTermRetentionBackupOperationResultInner class. */ + public LongTermRetentionBackupOperationResultInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private LongTermRetentionOperationResultProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the requestId property: Request Id. + * + * @return the requestId value. + */ + public UUID requestId() { + return this.innerProperties() == null ? null : this.innerProperties().requestId(); + } + + /** + * Get the operationType property: Operation type. + * + * @return the operationType value. + */ + public String operationType() { + return this.innerProperties() == null ? null : this.innerProperties().operationType(); + } + + /** + * Get the fromBackupResourceId property: Source backup resource id. + * + * @return the fromBackupResourceId value. + */ + public String fromBackupResourceId() { + return this.innerProperties() == null ? null : this.innerProperties().fromBackupResourceId(); + } + + /** + * Get the toBackupResourceId property: Target backup resource id. + * + * @return the toBackupResourceId value. + */ + public String toBackupResourceId() { + return this.innerProperties() == null ? null : this.innerProperties().toBackupResourceId(); + } + + /** + * Get the targetBackupStorageRedundancy property: The storage redundancy type of the copied backup. + * + * @return the targetBackupStorageRedundancy value. + */ + public BackupStorageRedundancy targetBackupStorageRedundancy() { + return this.innerProperties() == null ? null : this.innerProperties().targetBackupStorageRedundancy(); + } + + /** + * Get the status property: Operation status. + * + * @return the status value. + */ + public String status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); + } + + /** + * Get the message property: Progress message. + * + * @return the message value. + */ + public String message() { + return this.innerProperties() == null ? null : this.innerProperties().message(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LongTermRetentionBackupProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LongTermRetentionBackupProperties.java new file mode 100644 index 0000000000000..55aebc4f51da6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LongTermRetentionBackupProperties.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Properties of a long term retention backup. */ +@Fluent +public final class LongTermRetentionBackupProperties { + /* + * The server name that the backup database belong to. + */ + @JsonProperty(value = "serverName", access = JsonProperty.Access.WRITE_ONLY) + private String serverName; + + /* + * The create time of the server. + */ + @JsonProperty(value = "serverCreateTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime serverCreateTime; + + /* + * The name of the database the backup belong to + */ + @JsonProperty(value = "databaseName", access = JsonProperty.Access.WRITE_ONLY) + private String databaseName; + + /* + * The delete time of the database + */ + @JsonProperty(value = "databaseDeletionTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime databaseDeletionTime; + + /* + * The time the backup was taken + */ + @JsonProperty(value = "backupTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime backupTime; + + /* + * The time the long term retention backup will expire. + */ + @JsonProperty(value = "backupExpirationTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime backupExpirationTime; + + /* + * The storage redundancy type of the backup + */ + @JsonProperty(value = "backupStorageRedundancy", access = JsonProperty.Access.WRITE_ONLY) + private BackupStorageRedundancy backupStorageRedundancy; + + /* + * The storage redundancy type of the backup + */ + @JsonProperty(value = "requestedBackupStorageRedundancy") + private BackupStorageRedundancy requestedBackupStorageRedundancy; + + /** Creates an instance of LongTermRetentionBackupProperties class. */ + public LongTermRetentionBackupProperties() { + } + + /** + * Get the serverName property: The server name that the backup database belong to. + * + * @return the serverName value. + */ + public String serverName() { + return this.serverName; + } + + /** + * Get the serverCreateTime property: The create time of the server. + * + * @return the serverCreateTime value. + */ + public OffsetDateTime serverCreateTime() { + return this.serverCreateTime; + } + + /** + * Get the databaseName property: The name of the database the backup belong to. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Get the databaseDeletionTime property: The delete time of the database. + * + * @return the databaseDeletionTime value. + */ + public OffsetDateTime databaseDeletionTime() { + return this.databaseDeletionTime; + } + + /** + * Get the backupTime property: The time the backup was taken. + * + * @return the backupTime value. + */ + public OffsetDateTime backupTime() { + return this.backupTime; + } + + /** + * Get the backupExpirationTime property: The time the long term retention backup will expire. + * + * @return the backupExpirationTime value. + */ + public OffsetDateTime backupExpirationTime() { + return this.backupExpirationTime; + } + + /** + * Get the backupStorageRedundancy property: The storage redundancy type of the backup. + * + * @return the backupStorageRedundancy value. + */ + public BackupStorageRedundancy backupStorageRedundancy() { + return this.backupStorageRedundancy; + } + + /** + * Get the requestedBackupStorageRedundancy property: The storage redundancy type of the backup. + * + * @return the requestedBackupStorageRedundancy value. + */ + public BackupStorageRedundancy requestedBackupStorageRedundancy() { + return this.requestedBackupStorageRedundancy; + } + + /** + * Set the requestedBackupStorageRedundancy property: The storage redundancy type of the backup. + * + * @param requestedBackupStorageRedundancy the requestedBackupStorageRedundancy value to set. + * @return the LongTermRetentionBackupProperties object itself. + */ + public LongTermRetentionBackupProperties withRequestedBackupStorageRedundancy( + BackupStorageRedundancy requestedBackupStorageRedundancy) { + this.requestedBackupStorageRedundancy = requestedBackupStorageRedundancy; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LongTermRetentionOperationResultProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LongTermRetentionOperationResultProperties.java new file mode 100644 index 0000000000000..3a0f3531b1cc0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LongTermRetentionOperationResultProperties.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +/** Contains the operation result properties for long term retention backup operation. */ +@Immutable +public final class LongTermRetentionOperationResultProperties { + /* + * Request Id. + */ + @JsonProperty(value = "requestId", access = JsonProperty.Access.WRITE_ONLY) + private UUID requestId; + + /* + * Operation type. + */ + @JsonProperty(value = "operationType", access = JsonProperty.Access.WRITE_ONLY) + private String operationType; + + /* + * Source backup resource id + */ + @JsonProperty(value = "fromBackupResourceId", access = JsonProperty.Access.WRITE_ONLY) + private String fromBackupResourceId; + + /* + * Target backup resource id + */ + @JsonProperty(value = "toBackupResourceId", access = JsonProperty.Access.WRITE_ONLY) + private String toBackupResourceId; + + /* + * The storage redundancy type of the copied backup + */ + @JsonProperty(value = "targetBackupStorageRedundancy", access = JsonProperty.Access.WRITE_ONLY) + private BackupStorageRedundancy targetBackupStorageRedundancy; + + /* + * Operation status + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /* + * Progress message + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** Creates an instance of LongTermRetentionOperationResultProperties class. */ + public LongTermRetentionOperationResultProperties() { + } + + /** + * Get the requestId property: Request Id. + * + * @return the requestId value. + */ + public UUID requestId() { + return this.requestId; + } + + /** + * Get the operationType property: Operation type. + * + * @return the operationType value. + */ + public String operationType() { + return this.operationType; + } + + /** + * Get the fromBackupResourceId property: Source backup resource id. + * + * @return the fromBackupResourceId value. + */ + public String fromBackupResourceId() { + return this.fromBackupResourceId; + } + + /** + * Get the toBackupResourceId property: Target backup resource id. + * + * @return the toBackupResourceId value. + */ + public String toBackupResourceId() { + return this.toBackupResourceId; + } + + /** + * Get the targetBackupStorageRedundancy property: The storage redundancy type of the copied backup. + * + * @return the targetBackupStorageRedundancy value. + */ + public BackupStorageRedundancy targetBackupStorageRedundancy() { + return this.targetBackupStorageRedundancy; + } + + /** + * Get the status property: Operation status. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Get the message property: Progress message. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LongTermRetentionPolicyInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LongTermRetentionPolicyInner.java new file mode 100644 index 0000000000000..983bd5542eed0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/LongTermRetentionPolicyInner.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A long term retention policy. */ +@Fluent +public final class LongTermRetentionPolicyInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private BaseLongTermRetentionPolicyProperties innerProperties; + + /** Creates an instance of LongTermRetentionPolicyInner class. */ + public LongTermRetentionPolicyInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private BaseLongTermRetentionPolicyProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the weeklyRetention property: The weekly retention policy for an LTR backup in an ISO 8601 format. + * + * @return the weeklyRetention value. + */ + public String weeklyRetention() { + return this.innerProperties() == null ? null : this.innerProperties().weeklyRetention(); + } + + /** + * Set the weeklyRetention property: The weekly retention policy for an LTR backup in an ISO 8601 format. + * + * @param weeklyRetention the weeklyRetention value to set. + * @return the LongTermRetentionPolicyInner object itself. + */ + public LongTermRetentionPolicyInner withWeeklyRetention(String weeklyRetention) { + if (this.innerProperties() == null) { + this.innerProperties = new BaseLongTermRetentionPolicyProperties(); + } + this.innerProperties().withWeeklyRetention(weeklyRetention); + return this; + } + + /** + * Get the monthlyRetention property: The monthly retention policy for an LTR backup in an ISO 8601 format. + * + * @return the monthlyRetention value. + */ + public String monthlyRetention() { + return this.innerProperties() == null ? null : this.innerProperties().monthlyRetention(); + } + + /** + * Set the monthlyRetention property: The monthly retention policy for an LTR backup in an ISO 8601 format. + * + * @param monthlyRetention the monthlyRetention value to set. + * @return the LongTermRetentionPolicyInner object itself. + */ + public LongTermRetentionPolicyInner withMonthlyRetention(String monthlyRetention) { + if (this.innerProperties() == null) { + this.innerProperties = new BaseLongTermRetentionPolicyProperties(); + } + this.innerProperties().withMonthlyRetention(monthlyRetention); + return this; + } + + /** + * Get the yearlyRetention property: The yearly retention policy for an LTR backup in an ISO 8601 format. + * + * @return the yearlyRetention value. + */ + public String yearlyRetention() { + return this.innerProperties() == null ? null : this.innerProperties().yearlyRetention(); + } + + /** + * Set the yearlyRetention property: The yearly retention policy for an LTR backup in an ISO 8601 format. + * + * @param yearlyRetention the yearlyRetention value to set. + * @return the LongTermRetentionPolicyInner object itself. + */ + public LongTermRetentionPolicyInner withYearlyRetention(String yearlyRetention) { + if (this.innerProperties() == null) { + this.innerProperties = new BaseLongTermRetentionPolicyProperties(); + } + this.innerProperties().withYearlyRetention(yearlyRetention); + return this; + } + + /** + * Get the weekOfYear property: The week of year to take the yearly backup in an ISO 8601 format. + * + * @return the weekOfYear value. + */ + public Integer weekOfYear() { + return this.innerProperties() == null ? null : this.innerProperties().weekOfYear(); + } + + /** + * Set the weekOfYear property: The week of year to take the yearly backup in an ISO 8601 format. + * + * @param weekOfYear the weekOfYear value to set. + * @return the LongTermRetentionPolicyInner object itself. + */ + public LongTermRetentionPolicyInner withWeekOfYear(Integer weekOfYear) { + if (this.innerProperties() == null) { + this.innerProperties = new BaseLongTermRetentionPolicyProperties(); + } + this.innerProperties().withWeekOfYear(weekOfYear); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/MaintenanceWindowOptionsInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/MaintenanceWindowOptionsInner.java new file mode 100644 index 0000000000000..e921bcd064b38 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/MaintenanceWindowOptionsInner.java @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.MaintenanceWindowTimeRange; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Maintenance window options. */ +@Fluent +public final class MaintenanceWindowOptionsInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private MaintenanceWindowOptionsProperties innerProperties; + + /** Creates an instance of MaintenanceWindowOptionsInner class. */ + public MaintenanceWindowOptionsInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private MaintenanceWindowOptionsProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the isEnabled property: Whether maintenance windows are enabled for the database. + * + * @return the isEnabled value. + */ + public Boolean isEnabled() { + return this.innerProperties() == null ? null : this.innerProperties().isEnabled(); + } + + /** + * Set the isEnabled property: Whether maintenance windows are enabled for the database. + * + * @param isEnabled the isEnabled value to set. + * @return the MaintenanceWindowOptionsInner object itself. + */ + public MaintenanceWindowOptionsInner withIsEnabled(Boolean isEnabled) { + if (this.innerProperties() == null) { + this.innerProperties = new MaintenanceWindowOptionsProperties(); + } + this.innerProperties().withIsEnabled(isEnabled); + return this; + } + + /** + * Get the maintenanceWindowCycles property: Available maintenance cycles e.g. {Saturday, 0, 48*60}, {Wednesday, 0, + * 24*60}. + * + * @return the maintenanceWindowCycles value. + */ + public List maintenanceWindowCycles() { + return this.innerProperties() == null ? null : this.innerProperties().maintenanceWindowCycles(); + } + + /** + * Set the maintenanceWindowCycles property: Available maintenance cycles e.g. {Saturday, 0, 48*60}, {Wednesday, 0, + * 24*60}. + * + * @param maintenanceWindowCycles the maintenanceWindowCycles value to set. + * @return the MaintenanceWindowOptionsInner object itself. + */ + public MaintenanceWindowOptionsInner withMaintenanceWindowCycles( + List maintenanceWindowCycles) { + if (this.innerProperties() == null) { + this.innerProperties = new MaintenanceWindowOptionsProperties(); + } + this.innerProperties().withMaintenanceWindowCycles(maintenanceWindowCycles); + return this; + } + + /** + * Get the minDurationInMinutes property: Minimum duration of maintenance window. + * + * @return the minDurationInMinutes value. + */ + public Integer minDurationInMinutes() { + return this.innerProperties() == null ? null : this.innerProperties().minDurationInMinutes(); + } + + /** + * Set the minDurationInMinutes property: Minimum duration of maintenance window. + * + * @param minDurationInMinutes the minDurationInMinutes value to set. + * @return the MaintenanceWindowOptionsInner object itself. + */ + public MaintenanceWindowOptionsInner withMinDurationInMinutes(Integer minDurationInMinutes) { + if (this.innerProperties() == null) { + this.innerProperties = new MaintenanceWindowOptionsProperties(); + } + this.innerProperties().withMinDurationInMinutes(minDurationInMinutes); + return this; + } + + /** + * Get the defaultDurationInMinutes property: Default duration for maintenance window. + * + * @return the defaultDurationInMinutes value. + */ + public Integer defaultDurationInMinutes() { + return this.innerProperties() == null ? null : this.innerProperties().defaultDurationInMinutes(); + } + + /** + * Set the defaultDurationInMinutes property: Default duration for maintenance window. + * + * @param defaultDurationInMinutes the defaultDurationInMinutes value to set. + * @return the MaintenanceWindowOptionsInner object itself. + */ + public MaintenanceWindowOptionsInner withDefaultDurationInMinutes(Integer defaultDurationInMinutes) { + if (this.innerProperties() == null) { + this.innerProperties = new MaintenanceWindowOptionsProperties(); + } + this.innerProperties().withDefaultDurationInMinutes(defaultDurationInMinutes); + return this; + } + + /** + * Get the minCycles property: Minimum number of maintenance windows cycles to be set on the database. + * + * @return the minCycles value. + */ + public Integer minCycles() { + return this.innerProperties() == null ? null : this.innerProperties().minCycles(); + } + + /** + * Set the minCycles property: Minimum number of maintenance windows cycles to be set on the database. + * + * @param minCycles the minCycles value to set. + * @return the MaintenanceWindowOptionsInner object itself. + */ + public MaintenanceWindowOptionsInner withMinCycles(Integer minCycles) { + if (this.innerProperties() == null) { + this.innerProperties = new MaintenanceWindowOptionsProperties(); + } + this.innerProperties().withMinCycles(minCycles); + return this; + } + + /** + * Get the timeGranularityInMinutes property: Time granularity in minutes for maintenance windows. + * + * @return the timeGranularityInMinutes value. + */ + public Integer timeGranularityInMinutes() { + return this.innerProperties() == null ? null : this.innerProperties().timeGranularityInMinutes(); + } + + /** + * Set the timeGranularityInMinutes property: Time granularity in minutes for maintenance windows. + * + * @param timeGranularityInMinutes the timeGranularityInMinutes value to set. + * @return the MaintenanceWindowOptionsInner object itself. + */ + public MaintenanceWindowOptionsInner withTimeGranularityInMinutes(Integer timeGranularityInMinutes) { + if (this.innerProperties() == null) { + this.innerProperties = new MaintenanceWindowOptionsProperties(); + } + this.innerProperties().withTimeGranularityInMinutes(timeGranularityInMinutes); + return this; + } + + /** + * Get the allowMultipleMaintenanceWindowsPerCycle property: Whether we allow multiple maintenance windows per + * cycle. + * + * @return the allowMultipleMaintenanceWindowsPerCycle value. + */ + public Boolean allowMultipleMaintenanceWindowsPerCycle() { + return this.innerProperties() == null ? null : this.innerProperties().allowMultipleMaintenanceWindowsPerCycle(); + } + + /** + * Set the allowMultipleMaintenanceWindowsPerCycle property: Whether we allow multiple maintenance windows per + * cycle. + * + * @param allowMultipleMaintenanceWindowsPerCycle the allowMultipleMaintenanceWindowsPerCycle value to set. + * @return the MaintenanceWindowOptionsInner object itself. + */ + public MaintenanceWindowOptionsInner withAllowMultipleMaintenanceWindowsPerCycle( + Boolean allowMultipleMaintenanceWindowsPerCycle) { + if (this.innerProperties() == null) { + this.innerProperties = new MaintenanceWindowOptionsProperties(); + } + this.innerProperties().withAllowMultipleMaintenanceWindowsPerCycle(allowMultipleMaintenanceWindowsPerCycle); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/MaintenanceWindowOptionsProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/MaintenanceWindowOptionsProperties.java new file mode 100644 index 0000000000000..eaa390fc9a345 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/MaintenanceWindowOptionsProperties.java @@ -0,0 +1,217 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.models.MaintenanceWindowTimeRange; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Maintenance window options properties. */ +@Fluent +public final class MaintenanceWindowOptionsProperties { + /* + * Whether maintenance windows are enabled for the database. + */ + @JsonProperty(value = "isEnabled") + private Boolean isEnabled; + + /* + * Available maintenance cycles e.g. {Saturday, 0, 48*60}, {Wednesday, 0, 24*60}. + */ + @JsonProperty(value = "maintenanceWindowCycles") + private List maintenanceWindowCycles; + + /* + * Minimum duration of maintenance window. + */ + @JsonProperty(value = "minDurationInMinutes") + private Integer minDurationInMinutes; + + /* + * Default duration for maintenance window. + */ + @JsonProperty(value = "defaultDurationInMinutes") + private Integer defaultDurationInMinutes; + + /* + * Minimum number of maintenance windows cycles to be set on the database. + */ + @JsonProperty(value = "minCycles") + private Integer minCycles; + + /* + * Time granularity in minutes for maintenance windows. + */ + @JsonProperty(value = "timeGranularityInMinutes") + private Integer timeGranularityInMinutes; + + /* + * Whether we allow multiple maintenance windows per cycle. + */ + @JsonProperty(value = "allowMultipleMaintenanceWindowsPerCycle") + private Boolean allowMultipleMaintenanceWindowsPerCycle; + + /** Creates an instance of MaintenanceWindowOptionsProperties class. */ + public MaintenanceWindowOptionsProperties() { + } + + /** + * Get the isEnabled property: Whether maintenance windows are enabled for the database. + * + * @return the isEnabled value. + */ + public Boolean isEnabled() { + return this.isEnabled; + } + + /** + * Set the isEnabled property: Whether maintenance windows are enabled for the database. + * + * @param isEnabled the isEnabled value to set. + * @return the MaintenanceWindowOptionsProperties object itself. + */ + public MaintenanceWindowOptionsProperties withIsEnabled(Boolean isEnabled) { + this.isEnabled = isEnabled; + return this; + } + + /** + * Get the maintenanceWindowCycles property: Available maintenance cycles e.g. {Saturday, 0, 48*60}, {Wednesday, 0, + * 24*60}. + * + * @return the maintenanceWindowCycles value. + */ + public List maintenanceWindowCycles() { + return this.maintenanceWindowCycles; + } + + /** + * Set the maintenanceWindowCycles property: Available maintenance cycles e.g. {Saturday, 0, 48*60}, {Wednesday, 0, + * 24*60}. + * + * @param maintenanceWindowCycles the maintenanceWindowCycles value to set. + * @return the MaintenanceWindowOptionsProperties object itself. + */ + public MaintenanceWindowOptionsProperties withMaintenanceWindowCycles( + List maintenanceWindowCycles) { + this.maintenanceWindowCycles = maintenanceWindowCycles; + return this; + } + + /** + * Get the minDurationInMinutes property: Minimum duration of maintenance window. + * + * @return the minDurationInMinutes value. + */ + public Integer minDurationInMinutes() { + return this.minDurationInMinutes; + } + + /** + * Set the minDurationInMinutes property: Minimum duration of maintenance window. + * + * @param minDurationInMinutes the minDurationInMinutes value to set. + * @return the MaintenanceWindowOptionsProperties object itself. + */ + public MaintenanceWindowOptionsProperties withMinDurationInMinutes(Integer minDurationInMinutes) { + this.minDurationInMinutes = minDurationInMinutes; + return this; + } + + /** + * Get the defaultDurationInMinutes property: Default duration for maintenance window. + * + * @return the defaultDurationInMinutes value. + */ + public Integer defaultDurationInMinutes() { + return this.defaultDurationInMinutes; + } + + /** + * Set the defaultDurationInMinutes property: Default duration for maintenance window. + * + * @param defaultDurationInMinutes the defaultDurationInMinutes value to set. + * @return the MaintenanceWindowOptionsProperties object itself. + */ + public MaintenanceWindowOptionsProperties withDefaultDurationInMinutes(Integer defaultDurationInMinutes) { + this.defaultDurationInMinutes = defaultDurationInMinutes; + return this; + } + + /** + * Get the minCycles property: Minimum number of maintenance windows cycles to be set on the database. + * + * @return the minCycles value. + */ + public Integer minCycles() { + return this.minCycles; + } + + /** + * Set the minCycles property: Minimum number of maintenance windows cycles to be set on the database. + * + * @param minCycles the minCycles value to set. + * @return the MaintenanceWindowOptionsProperties object itself. + */ + public MaintenanceWindowOptionsProperties withMinCycles(Integer minCycles) { + this.minCycles = minCycles; + return this; + } + + /** + * Get the timeGranularityInMinutes property: Time granularity in minutes for maintenance windows. + * + * @return the timeGranularityInMinutes value. + */ + public Integer timeGranularityInMinutes() { + return this.timeGranularityInMinutes; + } + + /** + * Set the timeGranularityInMinutes property: Time granularity in minutes for maintenance windows. + * + * @param timeGranularityInMinutes the timeGranularityInMinutes value to set. + * @return the MaintenanceWindowOptionsProperties object itself. + */ + public MaintenanceWindowOptionsProperties withTimeGranularityInMinutes(Integer timeGranularityInMinutes) { + this.timeGranularityInMinutes = timeGranularityInMinutes; + return this; + } + + /** + * Get the allowMultipleMaintenanceWindowsPerCycle property: Whether we allow multiple maintenance windows per + * cycle. + * + * @return the allowMultipleMaintenanceWindowsPerCycle value. + */ + public Boolean allowMultipleMaintenanceWindowsPerCycle() { + return this.allowMultipleMaintenanceWindowsPerCycle; + } + + /** + * Set the allowMultipleMaintenanceWindowsPerCycle property: Whether we allow multiple maintenance windows per + * cycle. + * + * @param allowMultipleMaintenanceWindowsPerCycle the allowMultipleMaintenanceWindowsPerCycle value to set. + * @return the MaintenanceWindowOptionsProperties object itself. + */ + public MaintenanceWindowOptionsProperties withAllowMultipleMaintenanceWindowsPerCycle( + Boolean allowMultipleMaintenanceWindowsPerCycle) { + this.allowMultipleMaintenanceWindowsPerCycle = allowMultipleMaintenanceWindowsPerCycle; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (maintenanceWindowCycles() != null) { + maintenanceWindowCycles().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/MaintenanceWindowsInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/MaintenanceWindowsInner.java new file mode 100644 index 0000000000000..21e0bf14d8566 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/MaintenanceWindowsInner.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.MaintenanceWindowTimeRange; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Maintenance windows. */ +@Fluent +public final class MaintenanceWindowsInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private MaintenanceWindowsProperties innerProperties; + + /** Creates an instance of MaintenanceWindowsInner class. */ + public MaintenanceWindowsInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private MaintenanceWindowsProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the timeRanges property: The timeRanges property. + * + * @return the timeRanges value. + */ + public List timeRanges() { + return this.innerProperties() == null ? null : this.innerProperties().timeRanges(); + } + + /** + * Set the timeRanges property: The timeRanges property. + * + * @param timeRanges the timeRanges value to set. + * @return the MaintenanceWindowsInner object itself. + */ + public MaintenanceWindowsInner withTimeRanges(List timeRanges) { + if (this.innerProperties() == null) { + this.innerProperties = new MaintenanceWindowsProperties(); + } + this.innerProperties().withTimeRanges(timeRanges); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/MaintenanceWindowsProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/MaintenanceWindowsProperties.java new file mode 100644 index 0000000000000..dee0870c0662c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/MaintenanceWindowsProperties.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.models.MaintenanceWindowTimeRange; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Maintenance windows resource properties. */ +@Fluent +public final class MaintenanceWindowsProperties { + /* + * The timeRanges property. + */ + @JsonProperty(value = "timeRanges") + private List timeRanges; + + /** Creates an instance of MaintenanceWindowsProperties class. */ + public MaintenanceWindowsProperties() { + } + + /** + * Get the timeRanges property: The timeRanges property. + * + * @return the timeRanges value. + */ + public List timeRanges() { + return this.timeRanges; + } + + /** + * Set the timeRanges property: The timeRanges property. + * + * @param timeRanges the timeRanges value to set. + * @return the MaintenanceWindowsProperties object itself. + */ + public MaintenanceWindowsProperties withTimeRanges(List timeRanges) { + this.timeRanges = timeRanges; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (timeRanges() != null) { + timeRanges().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedBackupShortTermRetentionPolicyInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedBackupShortTermRetentionPolicyInner.java new file mode 100644 index 0000000000000..9ca4aa7a146f9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedBackupShortTermRetentionPolicyInner.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A short term retention policy. */ +@Fluent +public final class ManagedBackupShortTermRetentionPolicyInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ManagedBackupShortTermRetentionPolicyProperties innerProperties; + + /** Creates an instance of ManagedBackupShortTermRetentionPolicyInner class. */ + public ManagedBackupShortTermRetentionPolicyInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ManagedBackupShortTermRetentionPolicyProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the retentionDays property: 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.innerProperties() == null ? null : this.innerProperties().retentionDays(); + } + + /** + * Set the retentionDays property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedBackupShortTermRetentionPolicyProperties(); + } + this.innerProperties().withRetentionDays(retentionDays); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedBackupShortTermRetentionPolicyProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedBackupShortTermRetentionPolicyProperties.java new file mode 100644 index 0000000000000..73c071d6cbad5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedBackupShortTermRetentionPolicyProperties.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a short term retention policy. */ +@Fluent +public final class ManagedBackupShortTermRetentionPolicyProperties { + /* + * The backup retention period in days. This is how many days Point-in-Time Restore will be supported. + */ + @JsonProperty(value = "retentionDays") + private Integer retentionDays; + + /** Creates an instance of ManagedBackupShortTermRetentionPolicyProperties class. */ + public ManagedBackupShortTermRetentionPolicyProperties() { + } + + /** + * Get the retentionDays property: 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 retentionDays property: 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 ManagedBackupShortTermRetentionPolicyProperties object itself. + */ + public ManagedBackupShortTermRetentionPolicyProperties withRetentionDays(Integer retentionDays) { + this.retentionDays = retentionDays; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedDatabaseAdvancedThreatProtectionInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedDatabaseAdvancedThreatProtectionInner.java new file mode 100644 index 0000000000000..534fb3f436922 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedDatabaseAdvancedThreatProtectionInner.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.sql.generated.models.AdvancedThreatProtectionState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** A managed database Advanced Threat Protection. */ +@Fluent +public final class ManagedDatabaseAdvancedThreatProtectionInner extends ProxyResource { + /* + * SystemData of AdvancedThreatProtectionResource. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private AdvancedThreatProtectionProperties innerProperties; + + /** Creates an instance of ManagedDatabaseAdvancedThreatProtectionInner class. */ + public ManagedDatabaseAdvancedThreatProtectionInner() { + } + + /** + * Get the systemData property: SystemData of AdvancedThreatProtectionResource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private AdvancedThreatProtectionProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the state property: Specifies the state of the Advanced Threat Protection, whether it is enabled or disabled + * or a state has not been applied yet on the specific database or server. + * + * @return the state value. + */ + public AdvancedThreatProtectionState state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Set the state property: Specifies the state of the Advanced Threat Protection, whether it is enabled or disabled + * or a state has not been applied yet on the specific database or server. + * + * @param state the state value to set. + * @return the ManagedDatabaseAdvancedThreatProtectionInner object itself. + */ + public ManagedDatabaseAdvancedThreatProtectionInner withState(AdvancedThreatProtectionState state) { + if (this.innerProperties() == null) { + this.innerProperties = new AdvancedThreatProtectionProperties(); + } + this.innerProperties().withState(state); + return this; + } + + /** + * Get the creationTime property: Specifies the UTC creation time of the policy. + * + * @return the creationTime value. + */ + public OffsetDateTime creationTime() { + return this.innerProperties() == null ? null : this.innerProperties().creationTime(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedDatabaseInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedDatabaseInner.java new file mode 100644 index 0000000000000..6670fcbdac95b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedDatabaseInner.java @@ -0,0 +1,441 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.resourcemanager.sql.generated.models.CatalogCollationType; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseCreateMode; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseStatus; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.Map; + +/** A managed database resource. */ +@Fluent +public final class ManagedDatabaseInner extends Resource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ManagedDatabaseProperties innerProperties; + + /** Creates an instance of ManagedDatabaseInner class. */ + public ManagedDatabaseInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ManagedDatabaseProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public ManagedDatabaseInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ManagedDatabaseInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the collation property: Collation of the managed database. + * + * @return the collation value. + */ + public String collation() { + return this.innerProperties() == null ? null : this.innerProperties().collation(); + } + + /** + * Set the collation property: Collation of the managed database. + * + * @param collation the collation value to set. + * @return the ManagedDatabaseInner object itself. + */ + public ManagedDatabaseInner withCollation(String collation) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedDatabaseProperties(); + } + this.innerProperties().withCollation(collation); + return this; + } + + /** + * Get the status property: Status of the database. + * + * @return the status value. + */ + public ManagedDatabaseStatus status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); + } + + /** + * Get the creationDate property: Creation date of the database. + * + * @return the creationDate value. + */ + public OffsetDateTime creationDate() { + return this.innerProperties() == null ? null : this.innerProperties().creationDate(); + } + + /** + * Get the earliestRestorePoint property: Earliest restore point in time for point in time restore. + * + * @return the earliestRestorePoint value. + */ + public OffsetDateTime earliestRestorePoint() { + return this.innerProperties() == null ? null : this.innerProperties().earliestRestorePoint(); + } + + /** + * Get the restorePointInTime property: Conditional. If createMode is PointInTimeRestore, this value is required. + * Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new + * database. + * + * @return the restorePointInTime value. + */ + public OffsetDateTime restorePointInTime() { + return this.innerProperties() == null ? null : this.innerProperties().restorePointInTime(); + } + + /** + * Set the restorePointInTime property: Conditional. If createMode is PointInTimeRestore, this value is required. + * Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new + * database. + * + * @param restorePointInTime the restorePointInTime value to set. + * @return the ManagedDatabaseInner object itself. + */ + public ManagedDatabaseInner withRestorePointInTime(OffsetDateTime restorePointInTime) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedDatabaseProperties(); + } + this.innerProperties().withRestorePointInTime(restorePointInTime); + return this; + } + + /** + * Get the defaultSecondaryLocation property: Geo paired region. + * + * @return the defaultSecondaryLocation value. + */ + public String defaultSecondaryLocation() { + return this.innerProperties() == null ? null : this.innerProperties().defaultSecondaryLocation(); + } + + /** + * Get the catalogCollation property: Collation of the metadata catalog. + * + * @return the catalogCollation value. + */ + public CatalogCollationType catalogCollation() { + return this.innerProperties() == null ? null : this.innerProperties().catalogCollation(); + } + + /** + * Set the catalogCollation property: Collation of the metadata catalog. + * + * @param catalogCollation the catalogCollation value to set. + * @return the ManagedDatabaseInner object itself. + */ + public ManagedDatabaseInner withCatalogCollation(CatalogCollationType catalogCollation) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedDatabaseProperties(); + } + this.innerProperties().withCatalogCollation(catalogCollation); + return this; + } + + /** + * Get the createMode property: 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. RestoreLongTermRetentionBackup: Create a database by restoring from a long term retention backup + * (longTermRetentionBackupResourceId required). + * + * @return the createMode value. + */ + public ManagedDatabaseCreateMode createMode() { + return this.innerProperties() == null ? null : this.innerProperties().createMode(); + } + + /** + * Set the createMode property: 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. RestoreLongTermRetentionBackup: Create a database by restoring from a long term retention backup + * (longTermRetentionBackupResourceId required). + * + * @param createMode the createMode value to set. + * @return the ManagedDatabaseInner object itself. + */ + public ManagedDatabaseInner withCreateMode(ManagedDatabaseCreateMode createMode) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedDatabaseProperties(); + } + this.innerProperties().withCreateMode(createMode); + return this; + } + + /** + * Get the storageContainerUri property: 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.innerProperties() == null ? null : this.innerProperties().storageContainerUri(); + } + + /** + * Set the storageContainerUri property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedDatabaseProperties(); + } + this.innerProperties().withStorageContainerUri(storageContainerUri); + return this; + } + + /** + * Get the sourceDatabaseId property: The resource identifier of the source database associated with create + * operation of this database. + * + * @return the sourceDatabaseId value. + */ + public String sourceDatabaseId() { + return this.innerProperties() == null ? null : this.innerProperties().sourceDatabaseId(); + } + + /** + * Set the sourceDatabaseId property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedDatabaseProperties(); + } + this.innerProperties().withSourceDatabaseId(sourceDatabaseId); + return this; + } + + /** + * Get the restorableDroppedDatabaseId property: The restorable dropped database resource id to restore when + * creating this database. + * + * @return the restorableDroppedDatabaseId value. + */ + public String restorableDroppedDatabaseId() { + return this.innerProperties() == null ? null : this.innerProperties().restorableDroppedDatabaseId(); + } + + /** + * Set the restorableDroppedDatabaseId property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedDatabaseProperties(); + } + this.innerProperties().withRestorableDroppedDatabaseId(restorableDroppedDatabaseId); + return this; + } + + /** + * Get the storageContainerIdentity property: Conditional. If createMode is RestoreExternalBackup, this value is + * used. Specifies the identity used for storage container authentication. Can be 'SharedAccessSignature' or + * 'ManagedIdentity'; if not specified 'SharedAccessSignature' is assumed. + * + * @return the storageContainerIdentity value. + */ + public String storageContainerIdentity() { + return this.innerProperties() == null ? null : this.innerProperties().storageContainerIdentity(); + } + + /** + * Set the storageContainerIdentity property: Conditional. If createMode is RestoreExternalBackup, this value is + * used. Specifies the identity used for storage container authentication. Can be 'SharedAccessSignature' or + * 'ManagedIdentity'; if not specified 'SharedAccessSignature' is assumed. + * + * @param storageContainerIdentity the storageContainerIdentity value to set. + * @return the ManagedDatabaseInner object itself. + */ + public ManagedDatabaseInner withStorageContainerIdentity(String storageContainerIdentity) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedDatabaseProperties(); + } + this.innerProperties().withStorageContainerIdentity(storageContainerIdentity); + return this; + } + + /** + * Get the storageContainerSasToken property: Conditional. If createMode is RestoreExternalBackup and + * storageContainerIdentity is not ManagedIdentity, this value is required. Specifies the storage container sas + * token. + * + * @return the storageContainerSasToken value. + */ + public String storageContainerSasToken() { + return this.innerProperties() == null ? null : this.innerProperties().storageContainerSasToken(); + } + + /** + * Set the storageContainerSasToken property: Conditional. If createMode is RestoreExternalBackup and + * storageContainerIdentity is not ManagedIdentity, 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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedDatabaseProperties(); + } + this.innerProperties().withStorageContainerSasToken(storageContainerSasToken); + return this; + } + + /** + * Get the failoverGroupId property: Instance Failover Group resource identifier that this managed database belongs + * to. + * + * @return the failoverGroupId value. + */ + public String failoverGroupId() { + return this.innerProperties() == null ? null : this.innerProperties().failoverGroupId(); + } + + /** + * Get the recoverableDatabaseId property: The resource identifier of the recoverable database associated with + * create operation of this database. + * + * @return the recoverableDatabaseId value. + */ + public String recoverableDatabaseId() { + return this.innerProperties() == null ? null : this.innerProperties().recoverableDatabaseId(); + } + + /** + * Set the recoverableDatabaseId property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedDatabaseProperties(); + } + this.innerProperties().withRecoverableDatabaseId(recoverableDatabaseId); + return this; + } + + /** + * Get the longTermRetentionBackupResourceId property: The name of the Long Term Retention backup to be used for + * restore of this managed database. + * + * @return the longTermRetentionBackupResourceId value. + */ + public String longTermRetentionBackupResourceId() { + return this.innerProperties() == null ? null : this.innerProperties().longTermRetentionBackupResourceId(); + } + + /** + * Set the longTermRetentionBackupResourceId property: The name of the Long Term Retention backup to be used for + * restore of this managed database. + * + * @param longTermRetentionBackupResourceId the longTermRetentionBackupResourceId value to set. + * @return the ManagedDatabaseInner object itself. + */ + public ManagedDatabaseInner withLongTermRetentionBackupResourceId(String longTermRetentionBackupResourceId) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedDatabaseProperties(); + } + this.innerProperties().withLongTermRetentionBackupResourceId(longTermRetentionBackupResourceId); + return this; + } + + /** + * Get the autoCompleteRestore property: Whether to auto complete restore of this managed database. + * + * @return the autoCompleteRestore value. + */ + public Boolean autoCompleteRestore() { + return this.innerProperties() == null ? null : this.innerProperties().autoCompleteRestore(); + } + + /** + * Set the autoCompleteRestore property: Whether to auto complete restore of this managed database. + * + * @param autoCompleteRestore the autoCompleteRestore value to set. + * @return the ManagedDatabaseInner object itself. + */ + public ManagedDatabaseInner withAutoCompleteRestore(Boolean autoCompleteRestore) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedDatabaseProperties(); + } + this.innerProperties().withAutoCompleteRestore(autoCompleteRestore); + return this; + } + + /** + * Get the lastBackupName property: Last backup file name for restore of this managed database. + * + * @return the lastBackupName value. + */ + public String lastBackupName() { + return this.innerProperties() == null ? null : this.innerProperties().lastBackupName(); + } + + /** + * Set the lastBackupName property: Last backup file name for restore of this managed database. + * + * @param lastBackupName the lastBackupName value to set. + * @return the ManagedDatabaseInner object itself. + */ + public ManagedDatabaseInner withLastBackupName(String lastBackupName) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedDatabaseProperties(); + } + this.innerProperties().withLastBackupName(lastBackupName); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedDatabaseMoveOperationResultInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedDatabaseMoveOperationResultInner.java new file mode 100644 index 0000000000000..eaf314eb7acef --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedDatabaseMoveOperationResultInner.java @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.ManagementOperationState; +import com.azure.resourcemanager.sql.generated.models.MoveOperationMode; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** A managed database move operation. */ +@Immutable +public final class ManagedDatabaseMoveOperationResultInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ManagedDatabaseMoveOperationResultProperties innerProperties; + + /** Creates an instance of ManagedDatabaseMoveOperationResultInner class. */ + public ManagedDatabaseMoveOperationResultInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ManagedDatabaseMoveOperationResultProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the operation property: The name of operation. + * + * @return the operation value. + */ + public String operation() { + return this.innerProperties() == null ? null : this.innerProperties().operation(); + } + + /** + * Get the operationFriendlyName property: The friendly name of operation. + * + * @return the operationFriendlyName value. + */ + public String operationFriendlyName() { + return this.innerProperties() == null ? null : this.innerProperties().operationFriendlyName(); + } + + /** + * Get the startTime property: The operation start time. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.innerProperties() == null ? null : this.innerProperties().startTime(); + } + + /** + * Get the state property: The operation state. + * + * @return the state value. + */ + public ManagementOperationState state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Get the operationMode property: Operation mode. + * + * @return the operationMode value. + */ + public MoveOperationMode operationMode() { + return this.innerProperties() == null ? null : this.innerProperties().operationMode(); + } + + /** + * Get the sourceManagedInstanceName property: Source Managed Instance name. + * + * @return the sourceManagedInstanceName value. + */ + public String sourceManagedInstanceName() { + return this.innerProperties() == null ? null : this.innerProperties().sourceManagedInstanceName(); + } + + /** + * Get the targetManagedInstanceName property: Target Managed Instance name. + * + * @return the targetManagedInstanceName value. + */ + public String targetManagedInstanceName() { + return this.innerProperties() == null ? null : this.innerProperties().targetManagedInstanceName(); + } + + /** + * Get the sourceManagedInstanceId property: Source Managed Instance resource id. + * + * @return the sourceManagedInstanceId value. + */ + public String sourceManagedInstanceId() { + return this.innerProperties() == null ? null : this.innerProperties().sourceManagedInstanceId(); + } + + /** + * Get the targetManagedInstanceId property: Target Managed instance resource id. + * + * @return the targetManagedInstanceId value. + */ + public String targetManagedInstanceId() { + return this.innerProperties() == null ? null : this.innerProperties().targetManagedInstanceId(); + } + + /** + * Get the sourceDatabaseName property: Source database name. + * + * @return the sourceDatabaseName value. + */ + public String sourceDatabaseName() { + return this.innerProperties() == null ? null : this.innerProperties().sourceDatabaseName(); + } + + /** + * Get the targetDatabaseName property: Target database name. + * + * @return the targetDatabaseName value. + */ + public String targetDatabaseName() { + return this.innerProperties() == null ? null : this.innerProperties().targetDatabaseName(); + } + + /** + * Get the isCancellable property: Is move operation cancellable. + * + * @return the isCancellable value. + */ + public Boolean isCancellable() { + return this.innerProperties() == null ? null : this.innerProperties().isCancellable(); + } + + /** + * Get the errorCode property: The operation error code. + * + * @return the errorCode value. + */ + public Integer errorCode() { + return this.innerProperties() == null ? null : this.innerProperties().errorCode(); + } + + /** + * Get the errorDescription property: The operation error description. + * + * @return the errorDescription value. + */ + public String errorDescription() { + return this.innerProperties() == null ? null : this.innerProperties().errorDescription(); + } + + /** + * Get the errorSeverity property: The operation error severity. + * + * @return the errorSeverity value. + */ + public Integer errorSeverity() { + return this.innerProperties() == null ? null : this.innerProperties().errorSeverity(); + } + + /** + * Get the isUserError property: Whether or not the error is a user error. + * + * @return the isUserError value. + */ + public Boolean isUserError() { + return this.innerProperties() == null ? null : this.innerProperties().isUserError(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedDatabaseMoveOperationResultProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedDatabaseMoveOperationResultProperties.java new file mode 100644 index 0000000000000..5a8afbf877861 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedDatabaseMoveOperationResultProperties.java @@ -0,0 +1,267 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.models.ManagementOperationState; +import com.azure.resourcemanager.sql.generated.models.MoveOperationMode; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Contains the operation result properties for managed database move operation. */ +@Immutable +public final class ManagedDatabaseMoveOperationResultProperties { + /* + * The name of operation. + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /* + * The friendly name of operation. + */ + @JsonProperty(value = "operationFriendlyName", access = JsonProperty.Access.WRITE_ONLY) + private String operationFriendlyName; + + /* + * The operation start time. + */ + @JsonProperty(value = "startTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime startTime; + + /* + * The operation state. + */ + @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) + private ManagementOperationState state; + + /* + * Operation mode. + */ + @JsonProperty(value = "operationMode", access = JsonProperty.Access.WRITE_ONLY) + private MoveOperationMode operationMode; + + /* + * Source Managed Instance name. + */ + @JsonProperty(value = "sourceManagedInstanceName", access = JsonProperty.Access.WRITE_ONLY) + private String sourceManagedInstanceName; + + /* + * Target Managed Instance name. + */ + @JsonProperty(value = "targetManagedInstanceName", access = JsonProperty.Access.WRITE_ONLY) + private String targetManagedInstanceName; + + /* + * Source Managed Instance resource id. + */ + @JsonProperty(value = "sourceManagedInstanceId", access = JsonProperty.Access.WRITE_ONLY) + private String sourceManagedInstanceId; + + /* + * Target Managed instance resource id. + */ + @JsonProperty(value = "targetManagedInstanceId", access = JsonProperty.Access.WRITE_ONLY) + private String targetManagedInstanceId; + + /* + * Source database name. + */ + @JsonProperty(value = "sourceDatabaseName", access = JsonProperty.Access.WRITE_ONLY) + private String sourceDatabaseName; + + /* + * Target database name. + */ + @JsonProperty(value = "targetDatabaseName", access = JsonProperty.Access.WRITE_ONLY) + private String targetDatabaseName; + + /* + * Is move operation cancellable. + */ + @JsonProperty(value = "isCancellable", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isCancellable; + + /* + * The operation error code. + */ + @JsonProperty(value = "errorCode", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorCode; + + /* + * The operation error description. + */ + @JsonProperty(value = "errorDescription", access = JsonProperty.Access.WRITE_ONLY) + private String errorDescription; + + /* + * The operation error severity. + */ + @JsonProperty(value = "errorSeverity", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorSeverity; + + /* + * Whether or not the error is a user error. + */ + @JsonProperty(value = "isUserError", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isUserError; + + /** Creates an instance of ManagedDatabaseMoveOperationResultProperties class. */ + public ManagedDatabaseMoveOperationResultProperties() { + } + + /** + * Get the operation property: The name of operation. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the operationFriendlyName property: The friendly name of operation. + * + * @return the operationFriendlyName value. + */ + public String operationFriendlyName() { + return this.operationFriendlyName; + } + + /** + * Get the startTime property: The operation start time. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Get the state property: The operation state. + * + * @return the state value. + */ + public ManagementOperationState state() { + return this.state; + } + + /** + * Get the operationMode property: Operation mode. + * + * @return the operationMode value. + */ + public MoveOperationMode operationMode() { + return this.operationMode; + } + + /** + * Get the sourceManagedInstanceName property: Source Managed Instance name. + * + * @return the sourceManagedInstanceName value. + */ + public String sourceManagedInstanceName() { + return this.sourceManagedInstanceName; + } + + /** + * Get the targetManagedInstanceName property: Target Managed Instance name. + * + * @return the targetManagedInstanceName value. + */ + public String targetManagedInstanceName() { + return this.targetManagedInstanceName; + } + + /** + * Get the sourceManagedInstanceId property: Source Managed Instance resource id. + * + * @return the sourceManagedInstanceId value. + */ + public String sourceManagedInstanceId() { + return this.sourceManagedInstanceId; + } + + /** + * Get the targetManagedInstanceId property: Target Managed instance resource id. + * + * @return the targetManagedInstanceId value. + */ + public String targetManagedInstanceId() { + return this.targetManagedInstanceId; + } + + /** + * Get the sourceDatabaseName property: Source database name. + * + * @return the sourceDatabaseName value. + */ + public String sourceDatabaseName() { + return this.sourceDatabaseName; + } + + /** + * Get the targetDatabaseName property: Target database name. + * + * @return the targetDatabaseName value. + */ + public String targetDatabaseName() { + return this.targetDatabaseName; + } + + /** + * Get the isCancellable property: Is move operation cancellable. + * + * @return the isCancellable value. + */ + public Boolean isCancellable() { + return this.isCancellable; + } + + /** + * Get the errorCode property: The operation error code. + * + * @return the errorCode value. + */ + public Integer errorCode() { + return this.errorCode; + } + + /** + * Get the errorDescription property: The operation error description. + * + * @return the errorDescription value. + */ + public String errorDescription() { + return this.errorDescription; + } + + /** + * Get the errorSeverity property: The operation error severity. + * + * @return the errorSeverity value. + */ + public Integer errorSeverity() { + return this.errorSeverity; + } + + /** + * Get the isUserError property: Whether or not the error is a user error. + * + * @return the isUserError value. + */ + public Boolean isUserError() { + return this.isUserError; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedDatabaseProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedDatabaseProperties.java new file mode 100644 index 0000000000000..5c856d575fc12 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedDatabaseProperties.java @@ -0,0 +1,487 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.models.CatalogCollationType; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseCreateMode; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseStatus; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The managed database's properties. */ +@Fluent +public final class ManagedDatabaseProperties { + /* + * Collation of the managed database. + */ + @JsonProperty(value = "collation") + private String collation; + + /* + * Status of the database. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private ManagedDatabaseStatus status; + + /* + * Creation date of the database. + */ + @JsonProperty(value = "creationDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime creationDate; + + /* + * Earliest restore point in time for point in time restore. + */ + @JsonProperty(value = "earliestRestorePoint", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime 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 = "restorePointInTime") + private OffsetDateTime restorePointInTime; + + /* + * Geo paired region. + */ + @JsonProperty(value = "defaultSecondaryLocation", access = JsonProperty.Access.WRITE_ONLY) + private String defaultSecondaryLocation; + + /* + * Collation of the metadata catalog. + */ + @JsonProperty(value = "catalogCollation") + private CatalogCollationType catalogCollation; + + /* + * Managed database create mode. PointInTimeRestore: Create a database by restoring a point in time backup of an + * existing database. SourceDatabaseName, SourceManagedInstanceName and PointInTime must be specified. + * RestoreExternalBackup: Create a database by restoring from external backup files. Collation, StorageContainerUri + * and StorageContainerSasToken must be specified. Recovery: Creates a database by restoring a geo-replicated + * backup. RecoverableDatabaseId must be specified as the recoverable database resource ID to restore. + * RestoreLongTermRetentionBackup: Create a database by restoring from a long term retention backup + * (longTermRetentionBackupResourceId required). + */ + @JsonProperty(value = "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 = "storageContainerUri") + private String storageContainerUri; + + /* + * The resource identifier of the source database associated with create operation of this database. + */ + @JsonProperty(value = "sourceDatabaseId") + private String sourceDatabaseId; + + /* + * The restorable dropped database resource id to restore when creating this database. + */ + @JsonProperty(value = "restorableDroppedDatabaseId") + private String restorableDroppedDatabaseId; + + /* + * Conditional. If createMode is RestoreExternalBackup, this value is used. Specifies the identity used for storage + * container authentication. Can be 'SharedAccessSignature' or 'ManagedIdentity'; if not specified + * 'SharedAccessSignature' is assumed. + */ + @JsonProperty(value = "storageContainerIdentity") + private String storageContainerIdentity; + + /* + * Conditional. If createMode is RestoreExternalBackup and storageContainerIdentity is not ManagedIdentity, this + * value is required. Specifies the storage container sas token. + */ + @JsonProperty(value = "storageContainerSasToken") + private String storageContainerSasToken; + + /* + * Instance Failover Group resource identifier that this managed database belongs to. + */ + @JsonProperty(value = "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 = "recoverableDatabaseId") + private String recoverableDatabaseId; + + /* + * The name of the Long Term Retention backup to be used for restore of this managed database. + */ + @JsonProperty(value = "longTermRetentionBackupResourceId") + private String longTermRetentionBackupResourceId; + + /* + * Whether to auto complete restore of this managed database. + */ + @JsonProperty(value = "autoCompleteRestore") + private Boolean autoCompleteRestore; + + /* + * Last backup file name for restore of this managed database. + */ + @JsonProperty(value = "lastBackupName") + private String lastBackupName; + + /** Creates an instance of ManagedDatabaseProperties class. */ + public ManagedDatabaseProperties() { + } + + /** + * Get the collation property: Collation of the managed database. + * + * @return the collation value. + */ + public String collation() { + return this.collation; + } + + /** + * Set the collation property: Collation of the managed database. + * + * @param collation the collation value to set. + * @return the ManagedDatabaseProperties object itself. + */ + public ManagedDatabaseProperties withCollation(String collation) { + this.collation = collation; + return this; + } + + /** + * Get the status property: Status of the database. + * + * @return the status value. + */ + public ManagedDatabaseStatus status() { + return this.status; + } + + /** + * Get the creationDate property: Creation date of the database. + * + * @return the creationDate value. + */ + public OffsetDateTime creationDate() { + return this.creationDate; + } + + /** + * Get the earliestRestorePoint property: Earliest restore point in time for point in time restore. + * + * @return the earliestRestorePoint value. + */ + public OffsetDateTime earliestRestorePoint() { + return this.earliestRestorePoint; + } + + /** + * Get the restorePointInTime property: Conditional. If createMode is PointInTimeRestore, this value is required. + * Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new + * database. + * + * @return the restorePointInTime value. + */ + public OffsetDateTime restorePointInTime() { + return this.restorePointInTime; + } + + /** + * Set the restorePointInTime property: Conditional. If createMode is PointInTimeRestore, this value is required. + * Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new + * database. + * + * @param restorePointInTime the restorePointInTime value to set. + * @return the ManagedDatabaseProperties object itself. + */ + public ManagedDatabaseProperties withRestorePointInTime(OffsetDateTime restorePointInTime) { + this.restorePointInTime = restorePointInTime; + return this; + } + + /** + * Get the defaultSecondaryLocation property: Geo paired region. + * + * @return the defaultSecondaryLocation value. + */ + public String defaultSecondaryLocation() { + return this.defaultSecondaryLocation; + } + + /** + * Get the catalogCollation property: Collation of the metadata catalog. + * + * @return the catalogCollation value. + */ + public CatalogCollationType catalogCollation() { + return this.catalogCollation; + } + + /** + * Set the catalogCollation property: Collation of the metadata catalog. + * + * @param catalogCollation the catalogCollation value to set. + * @return the ManagedDatabaseProperties object itself. + */ + public ManagedDatabaseProperties withCatalogCollation(CatalogCollationType catalogCollation) { + this.catalogCollation = catalogCollation; + return this; + } + + /** + * Get the createMode property: 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. RestoreLongTermRetentionBackup: Create a database by restoring from a long term retention backup + * (longTermRetentionBackupResourceId required). + * + * @return the createMode value. + */ + public ManagedDatabaseCreateMode createMode() { + return this.createMode; + } + + /** + * Set the createMode property: 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. RestoreLongTermRetentionBackup: Create a database by restoring from a long term retention backup + * (longTermRetentionBackupResourceId required). + * + * @param createMode the createMode value to set. + * @return the ManagedDatabaseProperties object itself. + */ + public ManagedDatabaseProperties withCreateMode(ManagedDatabaseCreateMode createMode) { + this.createMode = createMode; + return this; + } + + /** + * Get the storageContainerUri property: 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 the storageContainerUri property: 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 ManagedDatabaseProperties object itself. + */ + public ManagedDatabaseProperties withStorageContainerUri(String storageContainerUri) { + this.storageContainerUri = storageContainerUri; + return this; + } + + /** + * Get the sourceDatabaseId property: 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 sourceDatabaseId property: The resource identifier of the source database associated with create + * operation of this database. + * + * @param sourceDatabaseId the sourceDatabaseId value to set. + * @return the ManagedDatabaseProperties object itself. + */ + public ManagedDatabaseProperties withSourceDatabaseId(String sourceDatabaseId) { + this.sourceDatabaseId = sourceDatabaseId; + return this; + } + + /** + * Get the restorableDroppedDatabaseId property: The restorable dropped database resource id to restore when + * creating this database. + * + * @return the restorableDroppedDatabaseId value. + */ + public String restorableDroppedDatabaseId() { + return this.restorableDroppedDatabaseId; + } + + /** + * Set the restorableDroppedDatabaseId property: The restorable dropped database resource id to restore when + * creating this database. + * + * @param restorableDroppedDatabaseId the restorableDroppedDatabaseId value to set. + * @return the ManagedDatabaseProperties object itself. + */ + public ManagedDatabaseProperties withRestorableDroppedDatabaseId(String restorableDroppedDatabaseId) { + this.restorableDroppedDatabaseId = restorableDroppedDatabaseId; + return this; + } + + /** + * Get the storageContainerIdentity property: Conditional. If createMode is RestoreExternalBackup, this value is + * used. Specifies the identity used for storage container authentication. Can be 'SharedAccessSignature' or + * 'ManagedIdentity'; if not specified 'SharedAccessSignature' is assumed. + * + * @return the storageContainerIdentity value. + */ + public String storageContainerIdentity() { + return this.storageContainerIdentity; + } + + /** + * Set the storageContainerIdentity property: Conditional. If createMode is RestoreExternalBackup, this value is + * used. Specifies the identity used for storage container authentication. Can be 'SharedAccessSignature' or + * 'ManagedIdentity'; if not specified 'SharedAccessSignature' is assumed. + * + * @param storageContainerIdentity the storageContainerIdentity value to set. + * @return the ManagedDatabaseProperties object itself. + */ + public ManagedDatabaseProperties withStorageContainerIdentity(String storageContainerIdentity) { + this.storageContainerIdentity = storageContainerIdentity; + return this; + } + + /** + * Get the storageContainerSasToken property: Conditional. If createMode is RestoreExternalBackup and + * storageContainerIdentity is not ManagedIdentity, this value is required. Specifies the storage container sas + * token. + * + * @return the storageContainerSasToken value. + */ + public String storageContainerSasToken() { + return this.storageContainerSasToken; + } + + /** + * Set the storageContainerSasToken property: Conditional. If createMode is RestoreExternalBackup and + * storageContainerIdentity is not ManagedIdentity, this value is required. Specifies the storage container sas + * token. + * + * @param storageContainerSasToken the storageContainerSasToken value to set. + * @return the ManagedDatabaseProperties object itself. + */ + public ManagedDatabaseProperties withStorageContainerSasToken(String storageContainerSasToken) { + this.storageContainerSasToken = storageContainerSasToken; + return this; + } + + /** + * Get the failoverGroupId property: Instance Failover Group resource identifier that this managed database belongs + * to. + * + * @return the failoverGroupId value. + */ + public String failoverGroupId() { + return this.failoverGroupId; + } + + /** + * Get the recoverableDatabaseId property: 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 recoverableDatabaseId property: The resource identifier of the recoverable database associated with + * create operation of this database. + * + * @param recoverableDatabaseId the recoverableDatabaseId value to set. + * @return the ManagedDatabaseProperties object itself. + */ + public ManagedDatabaseProperties withRecoverableDatabaseId(String recoverableDatabaseId) { + this.recoverableDatabaseId = recoverableDatabaseId; + return this; + } + + /** + * Get the longTermRetentionBackupResourceId property: The name of the Long Term Retention backup to be used for + * restore of this managed database. + * + * @return the longTermRetentionBackupResourceId value. + */ + public String longTermRetentionBackupResourceId() { + return this.longTermRetentionBackupResourceId; + } + + /** + * Set the longTermRetentionBackupResourceId property: The name of the Long Term Retention backup to be used for + * restore of this managed database. + * + * @param longTermRetentionBackupResourceId the longTermRetentionBackupResourceId value to set. + * @return the ManagedDatabaseProperties object itself. + */ + public ManagedDatabaseProperties withLongTermRetentionBackupResourceId(String longTermRetentionBackupResourceId) { + this.longTermRetentionBackupResourceId = longTermRetentionBackupResourceId; + return this; + } + + /** + * Get the autoCompleteRestore property: Whether to auto complete restore of this managed database. + * + * @return the autoCompleteRestore value. + */ + public Boolean autoCompleteRestore() { + return this.autoCompleteRestore; + } + + /** + * Set the autoCompleteRestore property: Whether to auto complete restore of this managed database. + * + * @param autoCompleteRestore the autoCompleteRestore value to set. + * @return the ManagedDatabaseProperties object itself. + */ + public ManagedDatabaseProperties withAutoCompleteRestore(Boolean autoCompleteRestore) { + this.autoCompleteRestore = autoCompleteRestore; + return this; + } + + /** + * Get the lastBackupName property: Last backup file name for restore of this managed database. + * + * @return the lastBackupName value. + */ + public String lastBackupName() { + return this.lastBackupName; + } + + /** + * Set the lastBackupName property: Last backup file name for restore of this managed database. + * + * @param lastBackupName the lastBackupName value to set. + * @return the ManagedDatabaseProperties object itself. + */ + public ManagedDatabaseProperties withLastBackupName(String lastBackupName) { + this.lastBackupName = lastBackupName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedDatabaseRestoreDetailsProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedDatabaseRestoreDetailsProperties.java new file mode 100644 index 0000000000000..9c41ba00c0200 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedDatabaseRestoreDetailsProperties.java @@ -0,0 +1,370 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseRestoreDetailsBackupSetProperties; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseRestoreDetailsUnrestorableFileProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** The managed database's restore details properties. */ +@Immutable +public final class ManagedDatabaseRestoreDetailsProperties { + /* + * Restore type. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * Restore status. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /* + * The reason why restore is in Blocked state. + */ + @JsonProperty(value = "blockReason", access = JsonProperty.Access.WRITE_ONLY) + private String blockReason; + + /* + * Last uploaded file name. + */ + @JsonProperty(value = "lastUploadedFileName", access = JsonProperty.Access.WRITE_ONLY) + private String lastUploadedFileName; + + /* + * Last uploaded file time. + */ + @JsonProperty(value = "lastUploadedFileTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastUploadedFileTime; + + /* + * Last restored file name. + */ + @JsonProperty(value = "lastRestoredFileName", access = JsonProperty.Access.WRITE_ONLY) + private String lastRestoredFileName; + + /* + * Last restored file time. + */ + @JsonProperty(value = "lastRestoredFileTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastRestoredFileTime; + + /* + * Percent completed. + */ + @JsonProperty(value = "percentCompleted", access = JsonProperty.Access.WRITE_ONLY) + private Integer percentCompleted; + + /* + * Current restored size MB. + */ + @JsonProperty(value = "currentRestoredSizeMB", access = JsonProperty.Access.WRITE_ONLY) + private Integer currentRestoredSizeMB; + + /* + * Current restore plan size MB. + */ + @JsonProperty(value = "currentRestorePlanSizeMB", access = JsonProperty.Access.WRITE_ONLY) + private Integer currentRestorePlanSizeMB; + + /* + * Current backup type. + */ + @JsonProperty(value = "currentBackupType", access = JsonProperty.Access.WRITE_ONLY) + private String currentBackupType; + + /* + * Current restoring file name. + */ + @JsonProperty(value = "currentRestoringFileName", access = JsonProperty.Access.WRITE_ONLY) + private String currentRestoringFileName; + + /* + * Number of files detected. + */ + @JsonProperty(value = "numberOfFilesDetected", access = JsonProperty.Access.WRITE_ONLY) + private Integer numberOfFilesDetected; + + /* + * Number of files queued. + */ + @JsonProperty(value = "numberOfFilesQueued", access = JsonProperty.Access.WRITE_ONLY) + private Integer numberOfFilesQueued; + + /* + * Number of files skipped. + */ + @JsonProperty(value = "numberOfFilesSkipped", access = JsonProperty.Access.WRITE_ONLY) + private Integer numberOfFilesSkipped; + + /* + * Number of files restoring. + */ + @JsonProperty(value = "numberOfFilesRestoring", access = JsonProperty.Access.WRITE_ONLY) + private Integer numberOfFilesRestoring; + + /* + * Number of files restored. + */ + @JsonProperty(value = "numberOfFilesRestored", access = JsonProperty.Access.WRITE_ONLY) + private Integer numberOfFilesRestored; + + /* + * Number of files unrestorable. + */ + @JsonProperty(value = "numberOfFilesUnrestorable", access = JsonProperty.Access.WRITE_ONLY) + private Integer numberOfFilesUnrestorable; + + /* + * Full backup sets. + */ + @JsonProperty(value = "fullBackupSets", access = JsonProperty.Access.WRITE_ONLY) + private List fullBackupSets; + + /* + * Diff backup sets. + */ + @JsonProperty(value = "diffBackupSets", access = JsonProperty.Access.WRITE_ONLY) + private List diffBackupSets; + + /* + * Log backup sets. + */ + @JsonProperty(value = "logBackupSets", access = JsonProperty.Access.WRITE_ONLY) + private List logBackupSets; + + /* + * Unrestorable files. + */ + @JsonProperty(value = "unrestorableFiles", access = JsonProperty.Access.WRITE_ONLY) + private List unrestorableFiles; + + /** Creates an instance of ManagedDatabaseRestoreDetailsProperties class. */ + public ManagedDatabaseRestoreDetailsProperties() { + } + + /** + * Get the type property: Restore type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the status property: Restore status. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Get the blockReason property: The reason why restore is in Blocked state. + * + * @return the blockReason value. + */ + public String blockReason() { + return this.blockReason; + } + + /** + * Get the lastUploadedFileName property: Last uploaded file name. + * + * @return the lastUploadedFileName value. + */ + public String lastUploadedFileName() { + return this.lastUploadedFileName; + } + + /** + * Get the lastUploadedFileTime property: Last uploaded file time. + * + * @return the lastUploadedFileTime value. + */ + public OffsetDateTime lastUploadedFileTime() { + return this.lastUploadedFileTime; + } + + /** + * Get the lastRestoredFileName property: Last restored file name. + * + * @return the lastRestoredFileName value. + */ + public String lastRestoredFileName() { + return this.lastRestoredFileName; + } + + /** + * Get the lastRestoredFileTime property: Last restored file time. + * + * @return the lastRestoredFileTime value. + */ + public OffsetDateTime lastRestoredFileTime() { + return this.lastRestoredFileTime; + } + + /** + * Get the percentCompleted property: Percent completed. + * + * @return the percentCompleted value. + */ + public Integer percentCompleted() { + return this.percentCompleted; + } + + /** + * Get the currentRestoredSizeMB property: Current restored size MB. + * + * @return the currentRestoredSizeMB value. + */ + public Integer currentRestoredSizeMB() { + return this.currentRestoredSizeMB; + } + + /** + * Get the currentRestorePlanSizeMB property: Current restore plan size MB. + * + * @return the currentRestorePlanSizeMB value. + */ + public Integer currentRestorePlanSizeMB() { + return this.currentRestorePlanSizeMB; + } + + /** + * Get the currentBackupType property: Current backup type. + * + * @return the currentBackupType value. + */ + public String currentBackupType() { + return this.currentBackupType; + } + + /** + * Get the currentRestoringFileName property: Current restoring file name. + * + * @return the currentRestoringFileName value. + */ + public String currentRestoringFileName() { + return this.currentRestoringFileName; + } + + /** + * Get the numberOfFilesDetected property: Number of files detected. + * + * @return the numberOfFilesDetected value. + */ + public Integer numberOfFilesDetected() { + return this.numberOfFilesDetected; + } + + /** + * Get the numberOfFilesQueued property: Number of files queued. + * + * @return the numberOfFilesQueued value. + */ + public Integer numberOfFilesQueued() { + return this.numberOfFilesQueued; + } + + /** + * Get the numberOfFilesSkipped property: Number of files skipped. + * + * @return the numberOfFilesSkipped value. + */ + public Integer numberOfFilesSkipped() { + return this.numberOfFilesSkipped; + } + + /** + * Get the numberOfFilesRestoring property: Number of files restoring. + * + * @return the numberOfFilesRestoring value. + */ + public Integer numberOfFilesRestoring() { + return this.numberOfFilesRestoring; + } + + /** + * Get the numberOfFilesRestored property: Number of files restored. + * + * @return the numberOfFilesRestored value. + */ + public Integer numberOfFilesRestored() { + return this.numberOfFilesRestored; + } + + /** + * Get the numberOfFilesUnrestorable property: Number of files unrestorable. + * + * @return the numberOfFilesUnrestorable value. + */ + public Integer numberOfFilesUnrestorable() { + return this.numberOfFilesUnrestorable; + } + + /** + * Get the fullBackupSets property: Full backup sets. + * + * @return the fullBackupSets value. + */ + public List fullBackupSets() { + return this.fullBackupSets; + } + + /** + * Get the diffBackupSets property: Diff backup sets. + * + * @return the diffBackupSets value. + */ + public List diffBackupSets() { + return this.diffBackupSets; + } + + /** + * Get the logBackupSets property: Log backup sets. + * + * @return the logBackupSets value. + */ + public List logBackupSets() { + return this.logBackupSets; + } + + /** + * Get the unrestorableFiles property: Unrestorable files. + * + * @return the unrestorableFiles value. + */ + public List unrestorableFiles() { + return this.unrestorableFiles; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (fullBackupSets() != null) { + fullBackupSets().forEach(e -> e.validate()); + } + if (diffBackupSets() != null) { + diffBackupSets().forEach(e -> e.validate()); + } + if (logBackupSets() != null) { + logBackupSets().forEach(e -> e.validate()); + } + if (unrestorableFiles() != null) { + unrestorableFiles().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedDatabaseRestoreDetailsResultInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedDatabaseRestoreDetailsResultInner.java new file mode 100644 index 0000000000000..b255a56bd2ed5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedDatabaseRestoreDetailsResultInner.java @@ -0,0 +1,245 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseRestoreDetailsBackupSetProperties; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseRestoreDetailsUnrestorableFileProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** A managed database restore details. */ +@Immutable +public final class ManagedDatabaseRestoreDetailsResultInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ManagedDatabaseRestoreDetailsProperties innerProperties; + + /** Creates an instance of ManagedDatabaseRestoreDetailsResultInner class. */ + public ManagedDatabaseRestoreDetailsResultInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ManagedDatabaseRestoreDetailsProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the type property: Restore type. + * + * @return the type value. + */ + public String typePropertiesType() { + return this.innerProperties() == null ? null : this.innerProperties().type(); + } + + /** + * Get the status property: Restore status. + * + * @return the status value. + */ + public String status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); + } + + /** + * Get the blockReason property: The reason why restore is in Blocked state. + * + * @return the blockReason value. + */ + public String blockReason() { + return this.innerProperties() == null ? null : this.innerProperties().blockReason(); + } + + /** + * Get the lastUploadedFileName property: Last uploaded file name. + * + * @return the lastUploadedFileName value. + */ + public String lastUploadedFileName() { + return this.innerProperties() == null ? null : this.innerProperties().lastUploadedFileName(); + } + + /** + * Get the lastUploadedFileTime property: Last uploaded file time. + * + * @return the lastUploadedFileTime value. + */ + public OffsetDateTime lastUploadedFileTime() { + return this.innerProperties() == null ? null : this.innerProperties().lastUploadedFileTime(); + } + + /** + * Get the lastRestoredFileName property: Last restored file name. + * + * @return the lastRestoredFileName value. + */ + public String lastRestoredFileName() { + return this.innerProperties() == null ? null : this.innerProperties().lastRestoredFileName(); + } + + /** + * Get the lastRestoredFileTime property: Last restored file time. + * + * @return the lastRestoredFileTime value. + */ + public OffsetDateTime lastRestoredFileTime() { + return this.innerProperties() == null ? null : this.innerProperties().lastRestoredFileTime(); + } + + /** + * Get the percentCompleted property: Percent completed. + * + * @return the percentCompleted value. + */ + public Integer percentCompleted() { + return this.innerProperties() == null ? null : this.innerProperties().percentCompleted(); + } + + /** + * Get the currentRestoredSizeMB property: Current restored size MB. + * + * @return the currentRestoredSizeMB value. + */ + public Integer currentRestoredSizeMB() { + return this.innerProperties() == null ? null : this.innerProperties().currentRestoredSizeMB(); + } + + /** + * Get the currentRestorePlanSizeMB property: Current restore plan size MB. + * + * @return the currentRestorePlanSizeMB value. + */ + public Integer currentRestorePlanSizeMB() { + return this.innerProperties() == null ? null : this.innerProperties().currentRestorePlanSizeMB(); + } + + /** + * Get the currentBackupType property: Current backup type. + * + * @return the currentBackupType value. + */ + public String currentBackupType() { + return this.innerProperties() == null ? null : this.innerProperties().currentBackupType(); + } + + /** + * Get the currentRestoringFileName property: Current restoring file name. + * + * @return the currentRestoringFileName value. + */ + public String currentRestoringFileName() { + return this.innerProperties() == null ? null : this.innerProperties().currentRestoringFileName(); + } + + /** + * Get the numberOfFilesDetected property: Number of files detected. + * + * @return the numberOfFilesDetected value. + */ + public Integer numberOfFilesDetected() { + return this.innerProperties() == null ? null : this.innerProperties().numberOfFilesDetected(); + } + + /** + * Get the numberOfFilesQueued property: Number of files queued. + * + * @return the numberOfFilesQueued value. + */ + public Integer numberOfFilesQueued() { + return this.innerProperties() == null ? null : this.innerProperties().numberOfFilesQueued(); + } + + /** + * Get the numberOfFilesSkipped property: Number of files skipped. + * + * @return the numberOfFilesSkipped value. + */ + public Integer numberOfFilesSkipped() { + return this.innerProperties() == null ? null : this.innerProperties().numberOfFilesSkipped(); + } + + /** + * Get the numberOfFilesRestoring property: Number of files restoring. + * + * @return the numberOfFilesRestoring value. + */ + public Integer numberOfFilesRestoring() { + return this.innerProperties() == null ? null : this.innerProperties().numberOfFilesRestoring(); + } + + /** + * Get the numberOfFilesRestored property: Number of files restored. + * + * @return the numberOfFilesRestored value. + */ + public Integer numberOfFilesRestored() { + return this.innerProperties() == null ? null : this.innerProperties().numberOfFilesRestored(); + } + + /** + * Get the numberOfFilesUnrestorable property: Number of files unrestorable. + * + * @return the numberOfFilesUnrestorable value. + */ + public Integer numberOfFilesUnrestorable() { + return this.innerProperties() == null ? null : this.innerProperties().numberOfFilesUnrestorable(); + } + + /** + * Get the fullBackupSets property: Full backup sets. + * + * @return the fullBackupSets value. + */ + public List fullBackupSets() { + return this.innerProperties() == null ? null : this.innerProperties().fullBackupSets(); + } + + /** + * Get the diffBackupSets property: Diff backup sets. + * + * @return the diffBackupSets value. + */ + public List diffBackupSets() { + return this.innerProperties() == null ? null : this.innerProperties().diffBackupSets(); + } + + /** + * Get the logBackupSets property: Log backup sets. + * + * @return the logBackupSets value. + */ + public List logBackupSets() { + return this.innerProperties() == null ? null : this.innerProperties().logBackupSets(); + } + + /** + * Get the unrestorableFiles property: Unrestorable files. + * + * @return the unrestorableFiles value. + */ + public List unrestorableFiles() { + return this.innerProperties() == null ? null : this.innerProperties().unrestorableFiles(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedDatabaseSecurityAlertPolicyInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedDatabaseSecurityAlertPolicyInner.java new file mode 100644 index 0000000000000..912d25c8b7b4b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedDatabaseSecurityAlertPolicyInner.java @@ -0,0 +1,224 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** A managed database security alert policy. */ +@Fluent +public final class ManagedDatabaseSecurityAlertPolicyInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private SecurityAlertPolicyProperties innerProperties; + + /** Creates an instance of ManagedDatabaseSecurityAlertPolicyInner class. */ + public ManagedDatabaseSecurityAlertPolicyInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private SecurityAlertPolicyProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the state property: Specifies the state of the policy, whether it is enabled or disabled or a policy has not + * been applied yet on the specific database. + * + * @return the state value. + */ + public SecurityAlertPolicyState state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Set the state property: Specifies the state of the policy, whether it is enabled or disabled or a policy has not + * been applied yet on the specific database. + * + * @param state the state value to set. + * @return the ManagedDatabaseSecurityAlertPolicyInner object itself. + */ + public ManagedDatabaseSecurityAlertPolicyInner withState(SecurityAlertPolicyState state) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertPolicyProperties(); + } + this.innerProperties().withState(state); + return this; + } + + /** + * Get the disabledAlerts property: Specifies an array of alerts that are disabled. Allowed values are: + * Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action, Brute_Force. + * + * @return the disabledAlerts value. + */ + public List disabledAlerts() { + return this.innerProperties() == null ? null : this.innerProperties().disabledAlerts(); + } + + /** + * Set the disabledAlerts property: Specifies an array of alerts that are disabled. Allowed values are: + * Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action, Brute_Force. + * + * @param disabledAlerts the disabledAlerts value to set. + * @return the ManagedDatabaseSecurityAlertPolicyInner object itself. + */ + public ManagedDatabaseSecurityAlertPolicyInner withDisabledAlerts(List disabledAlerts) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertPolicyProperties(); + } + this.innerProperties().withDisabledAlerts(disabledAlerts); + return this; + } + + /** + * Get the emailAddresses property: Specifies an array of e-mail addresses to which the alert is sent. + * + * @return the emailAddresses value. + */ + public List emailAddresses() { + return this.innerProperties() == null ? null : this.innerProperties().emailAddresses(); + } + + /** + * Set the emailAddresses property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertPolicyProperties(); + } + this.innerProperties().withEmailAddresses(emailAddresses); + return this; + } + + /** + * Get the emailAccountAdmins property: Specifies that the alert is sent to the account administrators. + * + * @return the emailAccountAdmins value. + */ + public Boolean emailAccountAdmins() { + return this.innerProperties() == null ? null : this.innerProperties().emailAccountAdmins(); + } + + /** + * Set the emailAccountAdmins property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertPolicyProperties(); + } + this.innerProperties().withEmailAccountAdmins(emailAccountAdmins); + return this; + } + + /** + * Get the storageEndpoint property: 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.innerProperties() == null ? null : this.innerProperties().storageEndpoint(); + } + + /** + * Set the storageEndpoint property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertPolicyProperties(); + } + this.innerProperties().withStorageEndpoint(storageEndpoint); + return this; + } + + /** + * Get the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection audit storage + * account. + * + * @return the storageAccountAccessKey value. + */ + public String storageAccountAccessKey() { + return this.innerProperties() == null ? null : this.innerProperties().storageAccountAccessKey(); + } + + /** + * Set the storageAccountAccessKey property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertPolicyProperties(); + } + this.innerProperties().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + /** + * Get the retentionDays property: Specifies the number of days to keep in the Threat Detection audit logs. + * + * @return the retentionDays value. + */ + public Integer retentionDays() { + return this.innerProperties() == null ? null : this.innerProperties().retentionDays(); + } + + /** + * Set the retentionDays property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertPolicyProperties(); + } + this.innerProperties().withRetentionDays(retentionDays); + return this; + } + + /** + * Get the creationTime property: Specifies the UTC creation time of the policy. + * + * @return the creationTime value. + */ + public OffsetDateTime creationTime() { + return this.innerProperties() == null ? null : this.innerProperties().creationTime(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceAdministratorInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceAdministratorInner.java new file mode 100644 index 0000000000000..85c73412e93bd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceAdministratorInner.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceAdministratorType; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +/** An Azure SQL managed instance administrator. */ +@Fluent +public final class ManagedInstanceAdministratorInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ManagedInstanceAdministratorProperties innerProperties; + + /** Creates an instance of ManagedInstanceAdministratorInner class. */ + public ManagedInstanceAdministratorInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ManagedInstanceAdministratorProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the administratorType property: Type of the managed instance administrator. + * + * @return the administratorType value. + */ + public ManagedInstanceAdministratorType administratorType() { + return this.innerProperties() == null ? null : this.innerProperties().administratorType(); + } + + /** + * Set the administratorType property: Type of the managed instance administrator. + * + * @param administratorType the administratorType value to set. + * @return the ManagedInstanceAdministratorInner object itself. + */ + public ManagedInstanceAdministratorInner withAdministratorType(ManagedInstanceAdministratorType administratorType) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceAdministratorProperties(); + } + this.innerProperties().withAdministratorType(administratorType); + return this; + } + + /** + * Get the login property: Login name of the managed instance administrator. + * + * @return the login value. + */ + public String login() { + return this.innerProperties() == null ? null : this.innerProperties().login(); + } + + /** + * Set the login property: Login name of the managed instance administrator. + * + * @param login the login value to set. + * @return the ManagedInstanceAdministratorInner object itself. + */ + public ManagedInstanceAdministratorInner withLogin(String login) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceAdministratorProperties(); + } + this.innerProperties().withLogin(login); + return this; + } + + /** + * Get the sid property: SID (object ID) of the managed instance administrator. + * + * @return the sid value. + */ + public UUID sid() { + return this.innerProperties() == null ? null : this.innerProperties().sid(); + } + + /** + * Set the sid property: SID (object ID) of the managed instance administrator. + * + * @param sid the sid value to set. + * @return the ManagedInstanceAdministratorInner object itself. + */ + public ManagedInstanceAdministratorInner withSid(UUID sid) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceAdministratorProperties(); + } + this.innerProperties().withSid(sid); + return this; + } + + /** + * Get the tenantId property: Tenant ID of the managed instance administrator. + * + * @return the tenantId value. + */ + public UUID tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().tenantId(); + } + + /** + * Set the tenantId property: Tenant ID of the managed instance administrator. + * + * @param tenantId the tenantId value to set. + * @return the ManagedInstanceAdministratorInner object itself. + */ + public ManagedInstanceAdministratorInner withTenantId(UUID tenantId) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceAdministratorProperties(); + } + this.innerProperties().withTenantId(tenantId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceAdministratorProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceAdministratorProperties.java new file mode 100644 index 0000000000000..95dab5ac1c52d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceAdministratorProperties.java @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceAdministratorType; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +/** The properties of a managed instance administrator. */ +@Fluent +public final class ManagedInstanceAdministratorProperties { + /* + * Type of the managed instance administrator. + */ + @JsonProperty(value = "administratorType", required = true) + private ManagedInstanceAdministratorType administratorType; + + /* + * Login name of the managed instance administrator. + */ + @JsonProperty(value = "login", required = true) + private String login; + + /* + * SID (object ID) of the managed instance administrator. + */ + @JsonProperty(value = "sid", required = true) + private UUID sid; + + /* + * Tenant ID of the managed instance administrator. + */ + @JsonProperty(value = "tenantId") + private UUID tenantId; + + /** Creates an instance of ManagedInstanceAdministratorProperties class. */ + public ManagedInstanceAdministratorProperties() { + } + + /** + * Get the administratorType property: Type of the managed instance administrator. + * + * @return the administratorType value. + */ + public ManagedInstanceAdministratorType administratorType() { + return this.administratorType; + } + + /** + * Set the administratorType property: Type of the managed instance administrator. + * + * @param administratorType the administratorType value to set. + * @return the ManagedInstanceAdministratorProperties object itself. + */ + public ManagedInstanceAdministratorProperties withAdministratorType( + ManagedInstanceAdministratorType administratorType) { + this.administratorType = administratorType; + return this; + } + + /** + * Get the login property: Login name of the managed instance administrator. + * + * @return the login value. + */ + public String login() { + return this.login; + } + + /** + * Set the login property: Login name of the managed instance administrator. + * + * @param login the login value to set. + * @return the ManagedInstanceAdministratorProperties object itself. + */ + public ManagedInstanceAdministratorProperties withLogin(String login) { + this.login = login; + return this; + } + + /** + * Get the sid property: SID (object ID) of the managed instance administrator. + * + * @return the sid value. + */ + public UUID sid() { + return this.sid; + } + + /** + * Set the sid property: SID (object ID) of the managed instance administrator. + * + * @param sid the sid value to set. + * @return the ManagedInstanceAdministratorProperties object itself. + */ + public ManagedInstanceAdministratorProperties withSid(UUID sid) { + this.sid = sid; + return this; + } + + /** + * Get the tenantId property: Tenant ID of the managed instance administrator. + * + * @return the tenantId value. + */ + public UUID tenantId() { + return this.tenantId; + } + + /** + * Set the tenantId property: Tenant ID of the managed instance administrator. + * + * @param tenantId the tenantId value to set. + * @return the ManagedInstanceAdministratorProperties object itself. + */ + public ManagedInstanceAdministratorProperties withTenantId(UUID tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (administratorType() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property administratorType in model ManagedInstanceAdministratorProperties")); + } + if (login() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property login in model ManagedInstanceAdministratorProperties")); + } + if (sid() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property sid in model ManagedInstanceAdministratorProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ManagedInstanceAdministratorProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceAdvancedThreatProtectionInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceAdvancedThreatProtectionInner.java new file mode 100644 index 0000000000000..636701e879945 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceAdvancedThreatProtectionInner.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.sql.generated.models.AdvancedThreatProtectionState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** A managed instance Advanced Threat Protection. */ +@Fluent +public final class ManagedInstanceAdvancedThreatProtectionInner extends ProxyResource { + /* + * SystemData of AdvancedThreatProtectionResource. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private AdvancedThreatProtectionProperties innerProperties; + + /** Creates an instance of ManagedInstanceAdvancedThreatProtectionInner class. */ + public ManagedInstanceAdvancedThreatProtectionInner() { + } + + /** + * Get the systemData property: SystemData of AdvancedThreatProtectionResource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private AdvancedThreatProtectionProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the state property: Specifies the state of the Advanced Threat Protection, whether it is enabled or disabled + * or a state has not been applied yet on the specific database or server. + * + * @return the state value. + */ + public AdvancedThreatProtectionState state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Set the state property: Specifies the state of the Advanced Threat Protection, whether it is enabled or disabled + * or a state has not been applied yet on the specific database or server. + * + * @param state the state value to set. + * @return the ManagedInstanceAdvancedThreatProtectionInner object itself. + */ + public ManagedInstanceAdvancedThreatProtectionInner withState(AdvancedThreatProtectionState state) { + if (this.innerProperties() == null) { + this.innerProperties = new AdvancedThreatProtectionProperties(); + } + this.innerProperties().withState(state); + return this; + } + + /** + * Get the creationTime property: Specifies the UTC creation time of the policy. + * + * @return the creationTime value. + */ + public OffsetDateTime creationTime() { + return this.innerProperties() == null ? null : this.innerProperties().creationTime(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceAzureADOnlyAuthProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceAzureADOnlyAuthProperties.java new file mode 100644 index 0000000000000..1c9d0c1dd8de9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceAzureADOnlyAuthProperties.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a active directory only authentication for Managed Instance. */ +@Fluent +public final class ManagedInstanceAzureADOnlyAuthProperties { + /* + * Azure Active Directory only Authentication enabled. + */ + @JsonProperty(value = "azureADOnlyAuthentication", required = true) + private boolean azureADOnlyAuthentication; + + /** Creates an instance of ManagedInstanceAzureADOnlyAuthProperties class. */ + public ManagedInstanceAzureADOnlyAuthProperties() { + } + + /** + * Get the azureADOnlyAuthentication property: Azure Active Directory only Authentication enabled. + * + * @return the azureADOnlyAuthentication value. + */ + public boolean azureADOnlyAuthentication() { + return this.azureADOnlyAuthentication; + } + + /** + * Set the azureADOnlyAuthentication property: Azure Active Directory only Authentication enabled. + * + * @param azureADOnlyAuthentication the azureADOnlyAuthentication value to set. + * @return the ManagedInstanceAzureADOnlyAuthProperties object itself. + */ + public ManagedInstanceAzureADOnlyAuthProperties withAzureADOnlyAuthentication(boolean azureADOnlyAuthentication) { + this.azureADOnlyAuthentication = azureADOnlyAuthentication; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceAzureADOnlyAuthenticationInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceAzureADOnlyAuthenticationInner.java new file mode 100644 index 0000000000000..3ffc480ac30d2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceAzureADOnlyAuthenticationInner.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Azure Active Directory only authentication. */ +@Fluent +public final class ManagedInstanceAzureADOnlyAuthenticationInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ManagedInstanceAzureADOnlyAuthProperties innerProperties; + + /** Creates an instance of ManagedInstanceAzureADOnlyAuthenticationInner class. */ + public ManagedInstanceAzureADOnlyAuthenticationInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ManagedInstanceAzureADOnlyAuthProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the azureADOnlyAuthentication property: Azure Active Directory only Authentication enabled. + * + * @return the azureADOnlyAuthentication value. + */ + public Boolean azureADOnlyAuthentication() { + return this.innerProperties() == null ? null : this.innerProperties().azureADOnlyAuthentication(); + } + + /** + * Set the azureADOnlyAuthentication property: Azure Active Directory only Authentication enabled. + * + * @param azureADOnlyAuthentication the azureADOnlyAuthentication value to set. + * @return the ManagedInstanceAzureADOnlyAuthenticationInner object itself. + */ + public ManagedInstanceAzureADOnlyAuthenticationInner withAzureADOnlyAuthentication( + Boolean azureADOnlyAuthentication) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceAzureADOnlyAuthProperties(); + } + this.innerProperties().withAzureADOnlyAuthentication(azureADOnlyAuthentication); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceDtcInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceDtcInner.java new file mode 100644 index 0000000000000..ba046f6400b18 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceDtcInner.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceDtcSecuritySettings; +import com.azure.resourcemanager.sql.generated.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** SQL Managed Instance DTC. */ +@Fluent +public final class ManagedInstanceDtcInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ManagedInstanceDtcProperties innerProperties; + + /** Creates an instance of ManagedInstanceDtcInner class. */ + public ManagedInstanceDtcInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ManagedInstanceDtcProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the dtcEnabled property: Active status of managed instance DTC. + * + * @return the dtcEnabled value. + */ + public Boolean dtcEnabled() { + return this.innerProperties() == null ? null : this.innerProperties().dtcEnabled(); + } + + /** + * Set the dtcEnabled property: Active status of managed instance DTC. + * + * @param dtcEnabled the dtcEnabled value to set. + * @return the ManagedInstanceDtcInner object itself. + */ + public ManagedInstanceDtcInner withDtcEnabled(Boolean dtcEnabled) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceDtcProperties(); + } + this.innerProperties().withDtcEnabled(dtcEnabled); + return this; + } + + /** + * Get the securitySettings property: Security settings of managed instance DTC. + * + * @return the securitySettings value. + */ + public ManagedInstanceDtcSecuritySettings securitySettings() { + return this.innerProperties() == null ? null : this.innerProperties().securitySettings(); + } + + /** + * Set the securitySettings property: Security settings of managed instance DTC. + * + * @param securitySettings the securitySettings value to set. + * @return the ManagedInstanceDtcInner object itself. + */ + public ManagedInstanceDtcInner withSecuritySettings(ManagedInstanceDtcSecuritySettings securitySettings) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceDtcProperties(); + } + this.innerProperties().withSecuritySettings(securitySettings); + return this; + } + + /** + * Get the externalDnsSuffixSearchList property: External dns suffix search list of managed instance DTC. + * + * @return the externalDnsSuffixSearchList value. + */ + public List externalDnsSuffixSearchList() { + return this.innerProperties() == null ? null : this.innerProperties().externalDnsSuffixSearchList(); + } + + /** + * Set the externalDnsSuffixSearchList property: External dns suffix search list of managed instance DTC. + * + * @param externalDnsSuffixSearchList the externalDnsSuffixSearchList value to set. + * @return the ManagedInstanceDtcInner object itself. + */ + public ManagedInstanceDtcInner withExternalDnsSuffixSearchList(List externalDnsSuffixSearchList) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceDtcProperties(); + } + this.innerProperties().withExternalDnsSuffixSearchList(externalDnsSuffixSearchList); + return this; + } + + /** + * Get the dtcHostnameDnsSuffix property: Host name dns suffix of managed instance DTC. + * + * @return the dtcHostnameDnsSuffix value. + */ + public String dtcHostnameDnsSuffix() { + return this.innerProperties() == null ? null : this.innerProperties().dtcHostnameDnsSuffix(); + } + + /** + * Get the provisioningState property: Provisioning state of managed instance DTC. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceDtcProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceDtcProperties.java new file mode 100644 index 0000000000000..f6dac11c3135c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceDtcProperties.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceDtcSecuritySettings; +import com.azure.resourcemanager.sql.generated.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The properties of managed instance DTC. */ +@Fluent +public final class ManagedInstanceDtcProperties { + /* + * Active status of managed instance DTC. + */ + @JsonProperty(value = "dtcEnabled") + private Boolean dtcEnabled; + + /* + * Security settings of managed instance DTC. + */ + @JsonProperty(value = "securitySettings") + private ManagedInstanceDtcSecuritySettings securitySettings; + + /* + * External dns suffix search list of managed instance DTC. + */ + @JsonProperty(value = "externalDnsSuffixSearchList") + private List externalDnsSuffixSearchList; + + /* + * Host name dns suffix of managed instance DTC. + */ + @JsonProperty(value = "dtcHostNameDnsSuffix", access = JsonProperty.Access.WRITE_ONLY) + private String dtcHostnameDnsSuffix; + + /* + * Provisioning state of managed instance DTC. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** Creates an instance of ManagedInstanceDtcProperties class. */ + public ManagedInstanceDtcProperties() { + } + + /** + * Get the dtcEnabled property: Active status of managed instance DTC. + * + * @return the dtcEnabled value. + */ + public Boolean dtcEnabled() { + return this.dtcEnabled; + } + + /** + * Set the dtcEnabled property: Active status of managed instance DTC. + * + * @param dtcEnabled the dtcEnabled value to set. + * @return the ManagedInstanceDtcProperties object itself. + */ + public ManagedInstanceDtcProperties withDtcEnabled(Boolean dtcEnabled) { + this.dtcEnabled = dtcEnabled; + return this; + } + + /** + * Get the securitySettings property: Security settings of managed instance DTC. + * + * @return the securitySettings value. + */ + public ManagedInstanceDtcSecuritySettings securitySettings() { + return this.securitySettings; + } + + /** + * Set the securitySettings property: Security settings of managed instance DTC. + * + * @param securitySettings the securitySettings value to set. + * @return the ManagedInstanceDtcProperties object itself. + */ + public ManagedInstanceDtcProperties withSecuritySettings(ManagedInstanceDtcSecuritySettings securitySettings) { + this.securitySettings = securitySettings; + return this; + } + + /** + * Get the externalDnsSuffixSearchList property: External dns suffix search list of managed instance DTC. + * + * @return the externalDnsSuffixSearchList value. + */ + public List externalDnsSuffixSearchList() { + return this.externalDnsSuffixSearchList; + } + + /** + * Set the externalDnsSuffixSearchList property: External dns suffix search list of managed instance DTC. + * + * @param externalDnsSuffixSearchList the externalDnsSuffixSearchList value to set. + * @return the ManagedInstanceDtcProperties object itself. + */ + public ManagedInstanceDtcProperties withExternalDnsSuffixSearchList(List externalDnsSuffixSearchList) { + this.externalDnsSuffixSearchList = externalDnsSuffixSearchList; + return this; + } + + /** + * Get the dtcHostnameDnsSuffix property: Host name dns suffix of managed instance DTC. + * + * @return the dtcHostnameDnsSuffix value. + */ + public String dtcHostnameDnsSuffix() { + return this.dtcHostnameDnsSuffix; + } + + /** + * Get the provisioningState property: Provisioning state of managed instance DTC. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (securitySettings() != null) { + securitySettings().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceEncryptionProtectorInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceEncryptionProtectorInner.java new file mode 100644 index 0000000000000..ed36d2bed8055 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceEncryptionProtectorInner.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.ServerKeyType; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The managed instance encryption protector. */ +@Fluent +public final 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; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ManagedInstanceEncryptionProtectorProperties innerProperties; + + /** Creates an instance of ManagedInstanceEncryptionProtectorInner class. */ + public ManagedInstanceEncryptionProtectorInner() { + } + + /** + * Get the kind property: 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 innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ManagedInstanceEncryptionProtectorProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the serverKeyName property: The name of the managed instance key. + * + * @return the serverKeyName value. + */ + public String serverKeyName() { + return this.innerProperties() == null ? null : this.innerProperties().serverKeyName(); + } + + /** + * Set the serverKeyName property: The name of the managed instance key. + * + * @param serverKeyName the serverKeyName value to set. + * @return the ManagedInstanceEncryptionProtectorInner object itself. + */ + public ManagedInstanceEncryptionProtectorInner withServerKeyName(String serverKeyName) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceEncryptionProtectorProperties(); + } + this.innerProperties().withServerKeyName(serverKeyName); + return this; + } + + /** + * Get the serverKeyType property: The encryption protector type like 'ServiceManaged', 'AzureKeyVault'. + * + * @return the serverKeyType value. + */ + public ServerKeyType serverKeyType() { + return this.innerProperties() == null ? null : this.innerProperties().serverKeyType(); + } + + /** + * Set the serverKeyType property: The encryption protector type like 'ServiceManaged', 'AzureKeyVault'. + * + * @param serverKeyType the serverKeyType value to set. + * @return the ManagedInstanceEncryptionProtectorInner object itself. + */ + public ManagedInstanceEncryptionProtectorInner withServerKeyType(ServerKeyType serverKeyType) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceEncryptionProtectorProperties(); + } + this.innerProperties().withServerKeyType(serverKeyType); + return this; + } + + /** + * Get the uri property: The URI of the server key. + * + * @return the uri value. + */ + public String uri() { + return this.innerProperties() == null ? null : this.innerProperties().uri(); + } + + /** + * Get the thumbprint property: Thumbprint of the server key. + * + * @return the thumbprint value. + */ + public String thumbprint() { + return this.innerProperties() == null ? null : this.innerProperties().thumbprint(); + } + + /** + * Get the autoRotationEnabled property: Key auto rotation opt-in flag. Either true or false. + * + * @return the autoRotationEnabled value. + */ + public Boolean autoRotationEnabled() { + return this.innerProperties() == null ? null : this.innerProperties().autoRotationEnabled(); + } + + /** + * Set the autoRotationEnabled property: Key auto rotation opt-in flag. Either true or false. + * + * @param autoRotationEnabled the autoRotationEnabled value to set. + * @return the ManagedInstanceEncryptionProtectorInner object itself. + */ + public ManagedInstanceEncryptionProtectorInner withAutoRotationEnabled(Boolean autoRotationEnabled) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceEncryptionProtectorProperties(); + } + this.innerProperties().withAutoRotationEnabled(autoRotationEnabled); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceEncryptionProtectorProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceEncryptionProtectorProperties.java new file mode 100644 index 0000000000000..efd1ad6fecb30 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceEncryptionProtectorProperties.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.ServerKeyType; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties for an encryption protector execution. */ +@Fluent +public final class ManagedInstanceEncryptionProtectorProperties { + /* + * The name of the managed instance key. + */ + @JsonProperty(value = "serverKeyName") + private String serverKeyName; + + /* + * The encryption protector type like 'ServiceManaged', 'AzureKeyVault'. + */ + @JsonProperty(value = "serverKeyType", required = true) + private ServerKeyType serverKeyType; + + /* + * The URI of the server key. + */ + @JsonProperty(value = "uri", access = JsonProperty.Access.WRITE_ONLY) + private String uri; + + /* + * Thumbprint of the server key. + */ + @JsonProperty(value = "thumbprint", access = JsonProperty.Access.WRITE_ONLY) + private String thumbprint; + + /* + * Key auto rotation opt-in flag. Either true or false. + */ + @JsonProperty(value = "autoRotationEnabled") + private Boolean autoRotationEnabled; + + /** Creates an instance of ManagedInstanceEncryptionProtectorProperties class. */ + public ManagedInstanceEncryptionProtectorProperties() { + } + + /** + * Get the serverKeyName property: The name of the managed instance key. + * + * @return the serverKeyName value. + */ + public String serverKeyName() { + return this.serverKeyName; + } + + /** + * Set the serverKeyName property: The name of the managed instance key. + * + * @param serverKeyName the serverKeyName value to set. + * @return the ManagedInstanceEncryptionProtectorProperties object itself. + */ + public ManagedInstanceEncryptionProtectorProperties withServerKeyName(String serverKeyName) { + this.serverKeyName = serverKeyName; + return this; + } + + /** + * Get the serverKeyType property: The encryption protector type like 'ServiceManaged', 'AzureKeyVault'. + * + * @return the serverKeyType value. + */ + public ServerKeyType serverKeyType() { + return this.serverKeyType; + } + + /** + * Set the serverKeyType property: The encryption protector type like 'ServiceManaged', 'AzureKeyVault'. + * + * @param serverKeyType the serverKeyType value to set. + * @return the ManagedInstanceEncryptionProtectorProperties object itself. + */ + public ManagedInstanceEncryptionProtectorProperties withServerKeyType(ServerKeyType serverKeyType) { + this.serverKeyType = serverKeyType; + return this; + } + + /** + * Get the uri property: The URI of the server key. + * + * @return the uri value. + */ + public String uri() { + return this.uri; + } + + /** + * Get the thumbprint property: Thumbprint of the server key. + * + * @return the thumbprint value. + */ + public String thumbprint() { + return this.thumbprint; + } + + /** + * Get the autoRotationEnabled property: Key auto rotation opt-in flag. Either true or false. + * + * @return the autoRotationEnabled value. + */ + public Boolean autoRotationEnabled() { + return this.autoRotationEnabled; + } + + /** + * Set the autoRotationEnabled property: Key auto rotation opt-in flag. Either true or false. + * + * @param autoRotationEnabled the autoRotationEnabled value to set. + * @return the ManagedInstanceEncryptionProtectorProperties object itself. + */ + public ManagedInstanceEncryptionProtectorProperties withAutoRotationEnabled(Boolean autoRotationEnabled) { + this.autoRotationEnabled = autoRotationEnabled; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (serverKeyType() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property serverKeyType in model" + + " ManagedInstanceEncryptionProtectorProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ManagedInstanceEncryptionProtectorProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceInner.java new file mode 100644 index 0000000000000..1fc0323896e9c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceInner.java @@ -0,0 +1,756 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceExternalAdministrator; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceLicenseType; +import com.azure.resourcemanager.sql.generated.models.ManagedInstancePecProperty; +import com.azure.resourcemanager.sql.generated.models.ManagedInstancePropertiesProvisioningState; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceProxyOverride; +import com.azure.resourcemanager.sql.generated.models.ManagedServerCreateMode; +import com.azure.resourcemanager.sql.generated.models.ResourceIdentity; +import com.azure.resourcemanager.sql.generated.models.ServicePrincipal; +import com.azure.resourcemanager.sql.generated.models.Sku; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** An Azure SQL managed instance. */ +@Fluent +public final class ManagedInstanceInner extends Resource { + /* + * The Azure Active Directory identity of the managed instance. + */ + @JsonProperty(value = "identity") + private ResourceIdentity identity; + + /* + * Managed instance SKU. Allowed values for sku.name: GP_Gen4, GP_Gen5, BC_Gen4, BC_Gen5 + */ + @JsonProperty(value = "sku") + private Sku sku; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ManagedInstanceProperties innerProperties; + + /** Creates an instance of ManagedInstanceInner class. */ + public ManagedInstanceInner() { + } + + /** + * Get the identity property: The Azure Active Directory identity of the managed instance. + * + * @return the identity value. + */ + public ResourceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: 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 the sku property: Managed instance SKU. Allowed values for sku.name: GP_Gen4, GP_Gen5, BC_Gen4, BC_Gen5. + * + * @return the sku value. + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku property: Managed instance SKU. Allowed values for sku.name: GP_Gen4, GP_Gen5, BC_Gen4, BC_Gen5. + * + * @param sku the sku value to set. + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ManagedInstanceProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public ManagedInstanceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ManagedInstanceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the provisioningState property: The provisioningState property. + * + * @return the provisioningState value. + */ + public ManagedInstancePropertiesProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the managedInstanceCreateMode property: Specifies the mode of database creation. + * + *

Default: Regular instance creation. + * + *

Restore: Creates an instance by restoring a set of backups to specific point in time. RestorePointInTime and + * SourceManagedInstanceId must be specified. + * + * @return the managedInstanceCreateMode value. + */ + public ManagedServerCreateMode managedInstanceCreateMode() { + return this.innerProperties() == null ? null : this.innerProperties().managedInstanceCreateMode(); + } + + /** + * Set the managedInstanceCreateMode property: Specifies the mode of database creation. + * + *

Default: Regular instance creation. + * + *

Restore: Creates an instance by restoring a set of backups to specific point in time. RestorePointInTime and + * SourceManagedInstanceId must be specified. + * + * @param managedInstanceCreateMode the managedInstanceCreateMode value to set. + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withManagedInstanceCreateMode(ManagedServerCreateMode managedInstanceCreateMode) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withManagedInstanceCreateMode(managedInstanceCreateMode); + return this; + } + + /** + * Get the fullyQualifiedDomainName property: The fully qualified domain name of the managed instance. + * + * @return the fullyQualifiedDomainName value. + */ + public String fullyQualifiedDomainName() { + return this.innerProperties() == null ? null : this.innerProperties().fullyQualifiedDomainName(); + } + + /** + * Get the administratorLogin property: 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.innerProperties() == null ? null : this.innerProperties().administratorLogin(); + } + + /** + * Set the administratorLogin property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withAdministratorLogin(administratorLogin); + return this; + } + + /** + * Get the administratorLoginPassword property: The administrator login password (required for managed instance + * creation). + * + * @return the administratorLoginPassword value. + */ + public String administratorLoginPassword() { + return this.innerProperties() == null ? null : this.innerProperties().administratorLoginPassword(); + } + + /** + * Set the administratorLoginPassword property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withAdministratorLoginPassword(administratorLoginPassword); + return this; + } + + /** + * Get the subnetId property: Subnet resource ID for the managed instance. + * + * @return the subnetId value. + */ + public String subnetId() { + return this.innerProperties() == null ? null : this.innerProperties().subnetId(); + } + + /** + * Set the subnetId property: Subnet resource ID for the managed instance. + * + * @param subnetId the subnetId value to set. + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withSubnetId(String subnetId) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withSubnetId(subnetId); + return this; + } + + /** + * Get the state property: The state of the managed instance. + * + * @return the state value. + */ + public String state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Get the licenseType property: The license type. Possible values are 'LicenseIncluded' (regular price inclusive of + * a new SQL license) and 'BasePrice' (discounted AHB price for bringing your own SQL licenses). + * + * @return the licenseType value. + */ + public ManagedInstanceLicenseType licenseType() { + return this.innerProperties() == null ? null : this.innerProperties().licenseType(); + } + + /** + * Set the licenseType property: The license type. Possible values are 'LicenseIncluded' (regular price inclusive of + * a new SQL license) and 'BasePrice' (discounted AHB price for bringing your own SQL licenses). + * + * @param licenseType the licenseType value to set. + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withLicenseType(ManagedInstanceLicenseType licenseType) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withLicenseType(licenseType); + return this; + } + + /** + * Get the vCores property: The number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80. + * + * @return the vCores value. + */ + public Integer vCores() { + return this.innerProperties() == null ? null : this.innerProperties().vCores(); + } + + /** + * Set the vCores property: The number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80. + * + * @param vCores the vCores value to set. + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withVCores(Integer vCores) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withVCores(vCores); + return this; + } + + /** + * Get the storageSizeInGB property: Storage size in GB. Minimum value: 32. Maximum value: 8192. Increments of 32 GB + * allowed only. + * + * @return the storageSizeInGB value. + */ + public Integer storageSizeInGB() { + return this.innerProperties() == null ? null : this.innerProperties().storageSizeInGB(); + } + + /** + * Set the storageSizeInGB property: Storage size in GB. Minimum value: 32. Maximum value: 8192. Increments of 32 GB + * allowed only. + * + * @param storageSizeInGB the storageSizeInGB value to set. + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withStorageSizeInGB(Integer storageSizeInGB) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withStorageSizeInGB(storageSizeInGB); + return this; + } + + /** + * Get the collation property: Collation of the managed instance. + * + * @return the collation value. + */ + public String collation() { + return this.innerProperties() == null ? null : this.innerProperties().collation(); + } + + /** + * Set the collation property: Collation of the managed instance. + * + * @param collation the collation value to set. + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withCollation(String collation) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withCollation(collation); + return this; + } + + /** + * Get the dnsZone property: The Dns Zone that the managed instance is in. + * + * @return the dnsZone value. + */ + public String dnsZone() { + return this.innerProperties() == null ? null : this.innerProperties().dnsZone(); + } + + /** + * Get the dnsZonePartner property: 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.innerProperties() == null ? null : this.innerProperties().dnsZonePartner(); + } + + /** + * Set the dnsZonePartner property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withDnsZonePartner(dnsZonePartner); + return this; + } + + /** + * Get the publicDataEndpointEnabled property: Whether or not the public data endpoint is enabled. + * + * @return the publicDataEndpointEnabled value. + */ + public Boolean publicDataEndpointEnabled() { + return this.innerProperties() == null ? null : this.innerProperties().publicDataEndpointEnabled(); + } + + /** + * Set the publicDataEndpointEnabled property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withPublicDataEndpointEnabled(publicDataEndpointEnabled); + return this; + } + + /** + * Get the sourceManagedInstanceId property: The resource identifier of the source managed instance associated with + * create operation of this instance. + * + * @return the sourceManagedInstanceId value. + */ + public String sourceManagedInstanceId() { + return this.innerProperties() == null ? null : this.innerProperties().sourceManagedInstanceId(); + } + + /** + * Set the sourceManagedInstanceId property: The resource identifier of the source managed instance associated with + * create operation of this instance. + * + * @param sourceManagedInstanceId the sourceManagedInstanceId value to set. + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withSourceManagedInstanceId(String sourceManagedInstanceId) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withSourceManagedInstanceId(sourceManagedInstanceId); + return this; + } + + /** + * Get the restorePointInTime property: Specifies the point in time (ISO8601 format) of the source database that + * will be restored to create the new database. + * + * @return the restorePointInTime value. + */ + public OffsetDateTime restorePointInTime() { + return this.innerProperties() == null ? null : this.innerProperties().restorePointInTime(); + } + + /** + * Set the restorePointInTime property: Specifies the point in time (ISO8601 format) of the source database that + * will be restored to create the new database. + * + * @param restorePointInTime the restorePointInTime value to set. + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withRestorePointInTime(OffsetDateTime restorePointInTime) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withRestorePointInTime(restorePointInTime); + return this; + } + + /** + * Get the proxyOverride property: Connection type used for connecting to the instance. + * + * @return the proxyOverride value. + */ + public ManagedInstanceProxyOverride proxyOverride() { + return this.innerProperties() == null ? null : this.innerProperties().proxyOverride(); + } + + /** + * Set the proxyOverride property: Connection type used for connecting to the instance. + * + * @param proxyOverride the proxyOverride value to set. + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withProxyOverride(ManagedInstanceProxyOverride proxyOverride) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withProxyOverride(proxyOverride); + return this; + } + + /** + * Get the timezoneId property: Id of the timezone. Allowed values are timezones supported by Windows. Windows keeps + * details on supported timezones, including the id, in registry under KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows + * NT\CurrentVersion\Time Zones. You can get those registry values via SQL Server by querying SELECT name AS + * timezone_id FROM sys.time_zone_info. List of Ids can also be obtained by executing + * [System.TimeZoneInfo]::GetSystemTimeZones() in PowerShell. An example of valid timezone id is "Pacific Standard + * Time" or "W. Europe Standard Time". + * + * @return the timezoneId value. + */ + public String timezoneId() { + return this.innerProperties() == null ? null : this.innerProperties().timezoneId(); + } + + /** + * Set the timezoneId property: Id of the timezone. Allowed values are timezones supported by Windows. Windows keeps + * details on supported timezones, including the id, in registry under KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows + * NT\CurrentVersion\Time Zones. You can get those registry values via SQL Server by querying SELECT name AS + * timezone_id FROM sys.time_zone_info. List of Ids can also be obtained by executing + * [System.TimeZoneInfo]::GetSystemTimeZones() in PowerShell. An example of valid timezone id is "Pacific Standard + * Time" or "W. Europe Standard Time". + * + * @param timezoneId the timezoneId value to set. + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withTimezoneId(String timezoneId) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withTimezoneId(timezoneId); + return this; + } + + /** + * Get the instancePoolId property: The Id of the instance pool this managed server belongs to. + * + * @return the instancePoolId value. + */ + public String instancePoolId() { + return this.innerProperties() == null ? null : this.innerProperties().instancePoolId(); + } + + /** + * Set the instancePoolId property: The Id of the instance pool this managed server belongs to. + * + * @param instancePoolId the instancePoolId value to set. + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withInstancePoolId(String instancePoolId) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withInstancePoolId(instancePoolId); + return this; + } + + /** + * Get the maintenanceConfigurationId property: Specifies maintenance configuration id to apply to this managed + * instance. + * + * @return the maintenanceConfigurationId value. + */ + public String maintenanceConfigurationId() { + return this.innerProperties() == null ? null : this.innerProperties().maintenanceConfigurationId(); + } + + /** + * Set the maintenanceConfigurationId property: Specifies maintenance configuration id to apply to this managed + * instance. + * + * @param maintenanceConfigurationId the maintenanceConfigurationId value to set. + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withMaintenanceConfigurationId(String maintenanceConfigurationId) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withMaintenanceConfigurationId(maintenanceConfigurationId); + return this; + } + + /** + * Get the privateEndpointConnections property: List of private endpoint connections on a managed instance. + * + * @return the privateEndpointConnections value. + */ + public List privateEndpointConnections() { + return this.innerProperties() == null ? null : this.innerProperties().privateEndpointConnections(); + } + + /** + * Get the minimalTlsVersion property: Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2'. + * + * @return the minimalTlsVersion value. + */ + public String minimalTlsVersion() { + return this.innerProperties() == null ? null : this.innerProperties().minimalTlsVersion(); + } + + /** + * Set the minimalTlsVersion property: Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2'. + * + * @param minimalTlsVersion the minimalTlsVersion value to set. + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withMinimalTlsVersion(String minimalTlsVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withMinimalTlsVersion(minimalTlsVersion); + return this; + } + + /** + * Get the currentBackupStorageRedundancy property: The storage account type used to store backups for this + * instance. The options are Local (LocallyRedundantStorage), Zone (ZoneRedundantStorage), Geo (GeoRedundantStorage) + * and GeoZone(GeoZoneRedundantStorage). + * + * @return the currentBackupStorageRedundancy value. + */ + public BackupStorageRedundancy currentBackupStorageRedundancy() { + return this.innerProperties() == null ? null : this.innerProperties().currentBackupStorageRedundancy(); + } + + /** + * Get the requestedBackupStorageRedundancy property: The storage account type to be used to store backups for this + * instance. The options are Local (LocallyRedundantStorage), Zone (ZoneRedundantStorage), Geo (GeoRedundantStorage) + * and GeoZone(GeoZoneRedundantStorage). + * + * @return the requestedBackupStorageRedundancy value. + */ + public BackupStorageRedundancy requestedBackupStorageRedundancy() { + return this.innerProperties() == null ? null : this.innerProperties().requestedBackupStorageRedundancy(); + } + + /** + * Set the requestedBackupStorageRedundancy property: The storage account type to be used to store backups for this + * instance. The options are Local (LocallyRedundantStorage), Zone (ZoneRedundantStorage), Geo (GeoRedundantStorage) + * and GeoZone(GeoZoneRedundantStorage). + * + * @param requestedBackupStorageRedundancy the requestedBackupStorageRedundancy value to set. + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withRequestedBackupStorageRedundancy( + BackupStorageRedundancy requestedBackupStorageRedundancy) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withRequestedBackupStorageRedundancy(requestedBackupStorageRedundancy); + return this; + } + + /** + * Get the zoneRedundant property: Whether or not the multi-az is enabled. + * + * @return the zoneRedundant value. + */ + public Boolean zoneRedundant() { + return this.innerProperties() == null ? null : this.innerProperties().zoneRedundant(); + } + + /** + * Set the zoneRedundant property: Whether or not the multi-az is enabled. + * + * @param zoneRedundant the zoneRedundant value to set. + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withZoneRedundant(Boolean zoneRedundant) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withZoneRedundant(zoneRedundant); + return this; + } + + /** + * Get the primaryUserAssignedIdentityId property: The resource id of a user assigned identity to be used by + * default. + * + * @return the primaryUserAssignedIdentityId value. + */ + public String primaryUserAssignedIdentityId() { + return this.innerProperties() == null ? null : this.innerProperties().primaryUserAssignedIdentityId(); + } + + /** + * Set the primaryUserAssignedIdentityId property: The resource id of a user assigned identity to be used by + * default. + * + * @param primaryUserAssignedIdentityId the primaryUserAssignedIdentityId value to set. + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withPrimaryUserAssignedIdentityId(String primaryUserAssignedIdentityId) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withPrimaryUserAssignedIdentityId(primaryUserAssignedIdentityId); + return this; + } + + /** + * Get the keyId property: A CMK URI of the key to use for encryption. + * + * @return the keyId value. + */ + public String keyId() { + return this.innerProperties() == null ? null : this.innerProperties().keyId(); + } + + /** + * Set the keyId property: A CMK URI of the key to use for encryption. + * + * @param keyId the keyId value to set. + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withKeyId(String keyId) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withKeyId(keyId); + return this; + } + + /** + * Get the administrators property: The Azure Active Directory administrator of the server. + * + * @return the administrators value. + */ + public ManagedInstanceExternalAdministrator administrators() { + return this.innerProperties() == null ? null : this.innerProperties().administrators(); + } + + /** + * Set the administrators property: The Azure Active Directory administrator of the server. + * + * @param administrators the administrators value to set. + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withAdministrators(ManagedInstanceExternalAdministrator administrators) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withAdministrators(administrators); + return this; + } + + /** + * Get the servicePrincipal property: The managed instance's service principal. + * + * @return the servicePrincipal value. + */ + public ServicePrincipal servicePrincipal() { + return this.innerProperties() == null ? null : this.innerProperties().servicePrincipal(); + } + + /** + * Set the servicePrincipal property: The managed instance's service principal. + * + * @param servicePrincipal the servicePrincipal value to set. + * @return the ManagedInstanceInner object itself. + */ + public ManagedInstanceInner withServicePrincipal(ServicePrincipal servicePrincipal) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withServicePrincipal(servicePrincipal); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (identity() != null) { + identity().validate(); + } + if (sku() != null) { + sku().validate(); + } + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceKeyInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceKeyInner.java new file mode 100644 index 0000000000000..9e29e4c28ae66 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceKeyInner.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.ServerKeyType; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** A managed instance key. */ +@Fluent +public final 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; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ManagedInstanceKeyProperties innerProperties; + + /** Creates an instance of ManagedInstanceKeyInner class. */ + public ManagedInstanceKeyInner() { + } + + /** + * Get the kind property: 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 innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ManagedInstanceKeyProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the serverKeyType property: The key type like 'ServiceManaged', 'AzureKeyVault'. + * + * @return the serverKeyType value. + */ + public ServerKeyType serverKeyType() { + return this.innerProperties() == null ? null : this.innerProperties().serverKeyType(); + } + + /** + * Set the serverKeyType property: The key type like 'ServiceManaged', 'AzureKeyVault'. + * + * @param serverKeyType the serverKeyType value to set. + * @return the ManagedInstanceKeyInner object itself. + */ + public ManagedInstanceKeyInner withServerKeyType(ServerKeyType serverKeyType) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceKeyProperties(); + } + this.innerProperties().withServerKeyType(serverKeyType); + return this; + } + + /** + * Get the uri property: The URI of the key. If the ServerKeyType is AzureKeyVault, then the URI is required. + * + * @return the uri value. + */ + public String uri() { + return this.innerProperties() == null ? null : this.innerProperties().uri(); + } + + /** + * Set the uri property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceKeyProperties(); + } + this.innerProperties().withUri(uri); + return this; + } + + /** + * Get the thumbprint property: Thumbprint of the key. + * + * @return the thumbprint value. + */ + public String thumbprint() { + return this.innerProperties() == null ? null : this.innerProperties().thumbprint(); + } + + /** + * Get the creationDate property: The key creation date. + * + * @return the creationDate value. + */ + public OffsetDateTime creationDate() { + return this.innerProperties() == null ? null : this.innerProperties().creationDate(); + } + + /** + * Get the autoRotationEnabled property: Key auto rotation opt-in flag. Either true or false. + * + * @return the autoRotationEnabled value. + */ + public Boolean autoRotationEnabled() { + return this.innerProperties() == null ? null : this.innerProperties().autoRotationEnabled(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceKeyProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceKeyProperties.java new file mode 100644 index 0000000000000..50d09037389ea --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceKeyProperties.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.ServerKeyType; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Properties for a key execution. */ +@Fluent +public final class ManagedInstanceKeyProperties { + /* + * The key type like 'ServiceManaged', 'AzureKeyVault'. + */ + @JsonProperty(value = "serverKeyType", required = true) + private ServerKeyType serverKeyType; + + /* + * The URI of the key. If the ServerKeyType is AzureKeyVault, then the URI is required. + */ + @JsonProperty(value = "uri") + private String uri; + + /* + * Thumbprint of the key. + */ + @JsonProperty(value = "thumbprint", access = JsonProperty.Access.WRITE_ONLY) + private String thumbprint; + + /* + * The key creation date. + */ + @JsonProperty(value = "creationDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime creationDate; + + /* + * Key auto rotation opt-in flag. Either true or false. + */ + @JsonProperty(value = "autoRotationEnabled", access = JsonProperty.Access.WRITE_ONLY) + private Boolean autoRotationEnabled; + + /** Creates an instance of ManagedInstanceKeyProperties class. */ + public ManagedInstanceKeyProperties() { + } + + /** + * Get the serverKeyType property: The key type like 'ServiceManaged', 'AzureKeyVault'. + * + * @return the serverKeyType value. + */ + public ServerKeyType serverKeyType() { + return this.serverKeyType; + } + + /** + * Set the serverKeyType property: The key type like 'ServiceManaged', 'AzureKeyVault'. + * + * @param serverKeyType the serverKeyType value to set. + * @return the ManagedInstanceKeyProperties object itself. + */ + public ManagedInstanceKeyProperties withServerKeyType(ServerKeyType serverKeyType) { + this.serverKeyType = serverKeyType; + return this; + } + + /** + * Get the uri property: 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 property: The URI of the key. If the ServerKeyType is AzureKeyVault, then the URI is required. + * + * @param uri the uri value to set. + * @return the ManagedInstanceKeyProperties object itself. + */ + public ManagedInstanceKeyProperties withUri(String uri) { + this.uri = uri; + return this; + } + + /** + * Get the thumbprint property: Thumbprint of the key. + * + * @return the thumbprint value. + */ + public String thumbprint() { + return this.thumbprint; + } + + /** + * Get the creationDate property: The key creation date. + * + * @return the creationDate value. + */ + public OffsetDateTime creationDate() { + return this.creationDate; + } + + /** + * Get the autoRotationEnabled property: Key auto rotation opt-in flag. Either true or false. + * + * @return the autoRotationEnabled value. + */ + public Boolean autoRotationEnabled() { + return this.autoRotationEnabled; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (serverKeyType() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property serverKeyType in model ManagedInstanceKeyProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ManagedInstanceKeyProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceLongTermRetentionBackupInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceLongTermRetentionBackupInner.java new file mode 100644 index 0000000000000..8e92c411ebc52 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceLongTermRetentionBackupInner.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** A long term retention backup for a managed database. */ +@Immutable +public final class ManagedInstanceLongTermRetentionBackupInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ManagedInstanceLongTermRetentionBackupProperties innerProperties; + + /** Creates an instance of ManagedInstanceLongTermRetentionBackupInner class. */ + public ManagedInstanceLongTermRetentionBackupInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ManagedInstanceLongTermRetentionBackupProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the managedInstanceName property: The managed instance that the backup database belongs to. + * + * @return the managedInstanceName value. + */ + public String managedInstanceName() { + return this.innerProperties() == null ? null : this.innerProperties().managedInstanceName(); + } + + /** + * Get the managedInstanceCreateTime property: The create time of the instance. + * + * @return the managedInstanceCreateTime value. + */ + public OffsetDateTime managedInstanceCreateTime() { + return this.innerProperties() == null ? null : this.innerProperties().managedInstanceCreateTime(); + } + + /** + * Get the databaseName property: The name of the database the backup belong to. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.innerProperties() == null ? null : this.innerProperties().databaseName(); + } + + /** + * Get the databaseDeletionTime property: The delete time of the database. + * + * @return the databaseDeletionTime value. + */ + public OffsetDateTime databaseDeletionTime() { + return this.innerProperties() == null ? null : this.innerProperties().databaseDeletionTime(); + } + + /** + * Get the backupTime property: The time the backup was taken. + * + * @return the backupTime value. + */ + public OffsetDateTime backupTime() { + return this.innerProperties() == null ? null : this.innerProperties().backupTime(); + } + + /** + * Get the backupExpirationTime property: The time the long term retention backup will expire. + * + * @return the backupExpirationTime value. + */ + public OffsetDateTime backupExpirationTime() { + return this.innerProperties() == null ? null : this.innerProperties().backupExpirationTime(); + } + + /** + * Get the backupStorageRedundancy property: The storage redundancy type of the backup. + * + * @return the backupStorageRedundancy value. + */ + public BackupStorageRedundancy backupStorageRedundancy() { + return this.innerProperties() == null ? null : this.innerProperties().backupStorageRedundancy(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceLongTermRetentionBackupProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceLongTermRetentionBackupProperties.java new file mode 100644 index 0000000000000..dea0caaf79371 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceLongTermRetentionBackupProperties.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Properties of a long term retention backup. */ +@Immutable +public final class ManagedInstanceLongTermRetentionBackupProperties { + /* + * The managed instance that the backup database belongs to. + */ + @JsonProperty(value = "managedInstanceName", access = JsonProperty.Access.WRITE_ONLY) + private String managedInstanceName; + + /* + * The create time of the instance. + */ + @JsonProperty(value = "managedInstanceCreateTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime managedInstanceCreateTime; + + /* + * The name of the database the backup belong to + */ + @JsonProperty(value = "databaseName", access = JsonProperty.Access.WRITE_ONLY) + private String databaseName; + + /* + * The delete time of the database + */ + @JsonProperty(value = "databaseDeletionTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime databaseDeletionTime; + + /* + * The time the backup was taken + */ + @JsonProperty(value = "backupTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime backupTime; + + /* + * The time the long term retention backup will expire. + */ + @JsonProperty(value = "backupExpirationTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime backupExpirationTime; + + /* + * The storage redundancy type of the backup + */ + @JsonProperty(value = "backupStorageRedundancy", access = JsonProperty.Access.WRITE_ONLY) + private BackupStorageRedundancy backupStorageRedundancy; + + /** Creates an instance of ManagedInstanceLongTermRetentionBackupProperties class. */ + public ManagedInstanceLongTermRetentionBackupProperties() { + } + + /** + * Get the managedInstanceName property: The managed instance that the backup database belongs to. + * + * @return the managedInstanceName value. + */ + public String managedInstanceName() { + return this.managedInstanceName; + } + + /** + * Get the managedInstanceCreateTime property: The create time of the instance. + * + * @return the managedInstanceCreateTime value. + */ + public OffsetDateTime managedInstanceCreateTime() { + return this.managedInstanceCreateTime; + } + + /** + * Get the databaseName property: The name of the database the backup belong to. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Get the databaseDeletionTime property: The delete time of the database. + * + * @return the databaseDeletionTime value. + */ + public OffsetDateTime databaseDeletionTime() { + return this.databaseDeletionTime; + } + + /** + * Get the backupTime property: The time the backup was taken. + * + * @return the backupTime value. + */ + public OffsetDateTime backupTime() { + return this.backupTime; + } + + /** + * Get the backupExpirationTime property: The time the long term retention backup will expire. + * + * @return the backupExpirationTime value. + */ + public OffsetDateTime backupExpirationTime() { + return this.backupExpirationTime; + } + + /** + * Get the backupStorageRedundancy property: The storage redundancy type of the backup. + * + * @return the backupStorageRedundancy value. + */ + public BackupStorageRedundancy backupStorageRedundancy() { + return this.backupStorageRedundancy; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceLongTermRetentionPolicyInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceLongTermRetentionPolicyInner.java new file mode 100644 index 0000000000000..40e3f99331bf8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceLongTermRetentionPolicyInner.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A long term retention policy. */ +@Fluent +public final class ManagedInstanceLongTermRetentionPolicyInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private BaseLongTermRetentionPolicyProperties innerProperties; + + /** Creates an instance of ManagedInstanceLongTermRetentionPolicyInner class. */ + public ManagedInstanceLongTermRetentionPolicyInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private BaseLongTermRetentionPolicyProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the weeklyRetention property: The weekly retention policy for an LTR backup in an ISO 8601 format. + * + * @return the weeklyRetention value. + */ + public String weeklyRetention() { + return this.innerProperties() == null ? null : this.innerProperties().weeklyRetention(); + } + + /** + * Set the weeklyRetention property: The weekly retention policy for an LTR backup in an ISO 8601 format. + * + * @param weeklyRetention the weeklyRetention value to set. + * @return the ManagedInstanceLongTermRetentionPolicyInner object itself. + */ + public ManagedInstanceLongTermRetentionPolicyInner withWeeklyRetention(String weeklyRetention) { + if (this.innerProperties() == null) { + this.innerProperties = new BaseLongTermRetentionPolicyProperties(); + } + this.innerProperties().withWeeklyRetention(weeklyRetention); + return this; + } + + /** + * Get the monthlyRetention property: The monthly retention policy for an LTR backup in an ISO 8601 format. + * + * @return the monthlyRetention value. + */ + public String monthlyRetention() { + return this.innerProperties() == null ? null : this.innerProperties().monthlyRetention(); + } + + /** + * Set the monthlyRetention property: The monthly retention policy for an LTR backup in an ISO 8601 format. + * + * @param monthlyRetention the monthlyRetention value to set. + * @return the ManagedInstanceLongTermRetentionPolicyInner object itself. + */ + public ManagedInstanceLongTermRetentionPolicyInner withMonthlyRetention(String monthlyRetention) { + if (this.innerProperties() == null) { + this.innerProperties = new BaseLongTermRetentionPolicyProperties(); + } + this.innerProperties().withMonthlyRetention(monthlyRetention); + return this; + } + + /** + * Get the yearlyRetention property: The yearly retention policy for an LTR backup in an ISO 8601 format. + * + * @return the yearlyRetention value. + */ + public String yearlyRetention() { + return this.innerProperties() == null ? null : this.innerProperties().yearlyRetention(); + } + + /** + * Set the yearlyRetention property: The yearly retention policy for an LTR backup in an ISO 8601 format. + * + * @param yearlyRetention the yearlyRetention value to set. + * @return the ManagedInstanceLongTermRetentionPolicyInner object itself. + */ + public ManagedInstanceLongTermRetentionPolicyInner withYearlyRetention(String yearlyRetention) { + if (this.innerProperties() == null) { + this.innerProperties = new BaseLongTermRetentionPolicyProperties(); + } + this.innerProperties().withYearlyRetention(yearlyRetention); + return this; + } + + /** + * Get the weekOfYear property: The week of year to take the yearly backup in an ISO 8601 format. + * + * @return the weekOfYear value. + */ + public Integer weekOfYear() { + return this.innerProperties() == null ? null : this.innerProperties().weekOfYear(); + } + + /** + * Set the weekOfYear property: The week of year to take the yearly backup in an ISO 8601 format. + * + * @param weekOfYear the weekOfYear value to set. + * @return the ManagedInstanceLongTermRetentionPolicyInner object itself. + */ + public ManagedInstanceLongTermRetentionPolicyInner withWeekOfYear(Integer weekOfYear) { + if (this.innerProperties() == null) { + this.innerProperties = new BaseLongTermRetentionPolicyProperties(); + } + this.innerProperties().withWeekOfYear(weekOfYear); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceOperationInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceOperationInner.java new file mode 100644 index 0000000000000..2df7613726019 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceOperationInner.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceOperationParametersPair; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceOperationSteps; +import com.azure.resourcemanager.sql.generated.models.ManagementOperationState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** A managed instance operation. */ +@Immutable +public final class ManagedInstanceOperationInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ManagedInstanceOperationProperties innerProperties; + + /** Creates an instance of ManagedInstanceOperationInner class. */ + public ManagedInstanceOperationInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ManagedInstanceOperationProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the managedInstanceName property: The name of the managed instance the operation is being performed on. + * + * @return the managedInstanceName value. + */ + public String managedInstanceName() { + return this.innerProperties() == null ? null : this.innerProperties().managedInstanceName(); + } + + /** + * Get the operation property: The name of operation. + * + * @return the operation value. + */ + public String operation() { + return this.innerProperties() == null ? null : this.innerProperties().operation(); + } + + /** + * Get the operationFriendlyName property: The friendly name of operation. + * + * @return the operationFriendlyName value. + */ + public String operationFriendlyName() { + return this.innerProperties() == null ? null : this.innerProperties().operationFriendlyName(); + } + + /** + * Get the percentComplete property: The percentage of the operation completed. + * + * @return the percentComplete value. + */ + public Integer percentComplete() { + return this.innerProperties() == null ? null : this.innerProperties().percentComplete(); + } + + /** + * Get the startTime property: The operation start time. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.innerProperties() == null ? null : this.innerProperties().startTime(); + } + + /** + * Get the state property: The operation state. + * + * @return the state value. + */ + public ManagementOperationState state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Get the errorCode property: The operation error code. + * + * @return the errorCode value. + */ + public Integer errorCode() { + return this.innerProperties() == null ? null : this.innerProperties().errorCode(); + } + + /** + * Get the errorDescription property: The operation error description. + * + * @return the errorDescription value. + */ + public String errorDescription() { + return this.innerProperties() == null ? null : this.innerProperties().errorDescription(); + } + + /** + * Get the errorSeverity property: The operation error severity. + * + * @return the errorSeverity value. + */ + public Integer errorSeverity() { + return this.innerProperties() == null ? null : this.innerProperties().errorSeverity(); + } + + /** + * Get the isUserError property: Whether or not the error is a user error. + * + * @return the isUserError value. + */ + public Boolean isUserError() { + return this.innerProperties() == null ? null : this.innerProperties().isUserError(); + } + + /** + * Get the estimatedCompletionTime property: The estimated completion time of the operation. + * + * @return the estimatedCompletionTime value. + */ + public OffsetDateTime estimatedCompletionTime() { + return this.innerProperties() == null ? null : this.innerProperties().estimatedCompletionTime(); + } + + /** + * Get the description property: The operation description. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Get the isCancellable property: Whether the operation can be cancelled. + * + * @return the isCancellable value. + */ + public Boolean isCancellable() { + return this.innerProperties() == null ? null : this.innerProperties().isCancellable(); + } + + /** + * Get the operationParameters property: The operation parameters. + * + * @return the operationParameters value. + */ + public ManagedInstanceOperationParametersPair operationParameters() { + return this.innerProperties() == null ? null : this.innerProperties().operationParameters(); + } + + /** + * Get the operationSteps property: The operation steps. + * + * @return the operationSteps value. + */ + public ManagedInstanceOperationSteps operationSteps() { + return this.innerProperties() == null ? null : this.innerProperties().operationSteps(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceOperationProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceOperationProperties.java new file mode 100644 index 0000000000000..b98b898864fbf --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceOperationProperties.java @@ -0,0 +1,259 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceOperationParametersPair; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceOperationSteps; +import com.azure.resourcemanager.sql.generated.models.ManagementOperationState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The properties of a managed instance operation. */ +@Immutable +public final class ManagedInstanceOperationProperties { + /* + * The name of the managed instance the operation is being performed on. + */ + @JsonProperty(value = "managedInstanceName", access = JsonProperty.Access.WRITE_ONLY) + private String managedInstanceName; + + /* + * The name of operation. + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /* + * The friendly name of operation. + */ + @JsonProperty(value = "operationFriendlyName", access = JsonProperty.Access.WRITE_ONLY) + private String operationFriendlyName; + + /* + * The percentage of the operation completed. + */ + @JsonProperty(value = "percentComplete", access = JsonProperty.Access.WRITE_ONLY) + private Integer percentComplete; + + /* + * The operation start time. + */ + @JsonProperty(value = "startTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime startTime; + + /* + * The operation state. + */ + @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) + private ManagementOperationState state; + + /* + * The operation error code. + */ + @JsonProperty(value = "errorCode", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorCode; + + /* + * The operation error description. + */ + @JsonProperty(value = "errorDescription", access = JsonProperty.Access.WRITE_ONLY) + private String errorDescription; + + /* + * The operation error severity. + */ + @JsonProperty(value = "errorSeverity", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorSeverity; + + /* + * Whether or not the error is a user error. + */ + @JsonProperty(value = "isUserError", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isUserError; + + /* + * The estimated completion time of the operation. + */ + @JsonProperty(value = "estimatedCompletionTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime estimatedCompletionTime; + + /* + * The operation description. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /* + * Whether the operation can be cancelled. + */ + @JsonProperty(value = "isCancellable", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isCancellable; + + /* + * The operation parameters. + */ + @JsonProperty(value = "operationParameters", access = JsonProperty.Access.WRITE_ONLY) + private ManagedInstanceOperationParametersPair operationParameters; + + /* + * The operation steps. + */ + @JsonProperty(value = "operationSteps", access = JsonProperty.Access.WRITE_ONLY) + private ManagedInstanceOperationSteps operationSteps; + + /** Creates an instance of ManagedInstanceOperationProperties class. */ + public ManagedInstanceOperationProperties() { + } + + /** + * Get the managedInstanceName property: The name of the managed instance the operation is being performed on. + * + * @return the managedInstanceName value. + */ + public String managedInstanceName() { + return this.managedInstanceName; + } + + /** + * Get the operation property: The name of operation. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the operationFriendlyName property: The friendly name of operation. + * + * @return the operationFriendlyName value. + */ + public String operationFriendlyName() { + return this.operationFriendlyName; + } + + /** + * Get the percentComplete property: The percentage of the operation completed. + * + * @return the percentComplete value. + */ + public Integer percentComplete() { + return this.percentComplete; + } + + /** + * Get the startTime property: The operation start time. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Get the state property: The operation state. + * + * @return the state value. + */ + public ManagementOperationState state() { + return this.state; + } + + /** + * Get the errorCode property: The operation error code. + * + * @return the errorCode value. + */ + public Integer errorCode() { + return this.errorCode; + } + + /** + * Get the errorDescription property: The operation error description. + * + * @return the errorDescription value. + */ + public String errorDescription() { + return this.errorDescription; + } + + /** + * Get the errorSeverity property: The operation error severity. + * + * @return the errorSeverity value. + */ + public Integer errorSeverity() { + return this.errorSeverity; + } + + /** + * Get the isUserError property: Whether or not the error is a user error. + * + * @return the isUserError value. + */ + public Boolean isUserError() { + return this.isUserError; + } + + /** + * Get the estimatedCompletionTime property: The estimated completion time of the operation. + * + * @return the estimatedCompletionTime value. + */ + public OffsetDateTime estimatedCompletionTime() { + return this.estimatedCompletionTime; + } + + /** + * Get the description property: The operation description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the isCancellable property: Whether the operation can be cancelled. + * + * @return the isCancellable value. + */ + public Boolean isCancellable() { + return this.isCancellable; + } + + /** + * Get the operationParameters property: The operation parameters. + * + * @return the operationParameters value. + */ + public ManagedInstanceOperationParametersPair operationParameters() { + return this.operationParameters; + } + + /** + * Get the operationSteps property: The operation steps. + * + * @return the operationSteps value. + */ + public ManagedInstanceOperationSteps operationSteps() { + return this.operationSteps; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (operationParameters() != null) { + operationParameters().validate(); + } + if (operationSteps() != null) { + operationSteps().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstancePrivateEndpointConnectionInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstancePrivateEndpointConnectionInner.java new file mode 100644 index 0000000000000..3e991f3432d73 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstancePrivateEndpointConnectionInner.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.ManagedInstancePrivateEndpointProperty; +import com.azure.resourcemanager.sql.generated.models.ManagedInstancePrivateLinkServiceConnectionStateProperty; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A private endpoint connection. */ +@Fluent +public final class ManagedInstancePrivateEndpointConnectionInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ManagedInstancePrivateEndpointConnectionProperties innerProperties; + + /** Creates an instance of ManagedInstancePrivateEndpointConnectionInner class. */ + public ManagedInstancePrivateEndpointConnectionInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ManagedInstancePrivateEndpointConnectionProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the privateEndpoint property: Private endpoint which the connection belongs to. + * + * @return the privateEndpoint value. + */ + public ManagedInstancePrivateEndpointProperty privateEndpoint() { + return this.innerProperties() == null ? null : this.innerProperties().privateEndpoint(); + } + + /** + * Set the privateEndpoint property: Private endpoint which the connection belongs to. + * + * @param privateEndpoint the privateEndpoint value to set. + * @return the ManagedInstancePrivateEndpointConnectionInner object itself. + */ + public ManagedInstancePrivateEndpointConnectionInner withPrivateEndpoint( + ManagedInstancePrivateEndpointProperty privateEndpoint) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstancePrivateEndpointConnectionProperties(); + } + this.innerProperties().withPrivateEndpoint(privateEndpoint); + return this; + } + + /** + * Get the privateLinkServiceConnectionState property: Connection State of the Private Endpoint Connection. + * + * @return the privateLinkServiceConnectionState value. + */ + public ManagedInstancePrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState() { + return this.innerProperties() == null ? null : this.innerProperties().privateLinkServiceConnectionState(); + } + + /** + * Set the privateLinkServiceConnectionState property: Connection State of the Private Endpoint Connection. + * + * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set. + * @return the ManagedInstancePrivateEndpointConnectionInner object itself. + */ + public ManagedInstancePrivateEndpointConnectionInner withPrivateLinkServiceConnectionState( + ManagedInstancePrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstancePrivateEndpointConnectionProperties(); + } + this.innerProperties().withPrivateLinkServiceConnectionState(privateLinkServiceConnectionState); + return this; + } + + /** + * Get the provisioningState property: State of the Private Endpoint Connection. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstancePrivateEndpointConnectionProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstancePrivateEndpointConnectionProperties.java new file mode 100644 index 0000000000000..379f91b3955e0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstancePrivateEndpointConnectionProperties.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.models.ManagedInstancePrivateEndpointProperty; +import com.azure.resourcemanager.sql.generated.models.ManagedInstancePrivateLinkServiceConnectionStateProperty; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a private endpoint connection. */ +@Fluent +public final class ManagedInstancePrivateEndpointConnectionProperties { + /* + * Private endpoint which the connection belongs to. + */ + @JsonProperty(value = "privateEndpoint") + private ManagedInstancePrivateEndpointProperty privateEndpoint; + + /* + * Connection State of the Private Endpoint Connection. + */ + @JsonProperty(value = "privateLinkServiceConnectionState") + private ManagedInstancePrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState; + + /* + * State of the Private Endpoint Connection. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** Creates an instance of ManagedInstancePrivateEndpointConnectionProperties class. */ + public ManagedInstancePrivateEndpointConnectionProperties() { + } + + /** + * Get the privateEndpoint property: Private endpoint which the connection belongs to. + * + * @return the privateEndpoint value. + */ + public ManagedInstancePrivateEndpointProperty privateEndpoint() { + return this.privateEndpoint; + } + + /** + * Set the privateEndpoint property: Private endpoint which the connection belongs to. + * + * @param privateEndpoint the privateEndpoint value to set. + * @return the ManagedInstancePrivateEndpointConnectionProperties object itself. + */ + public ManagedInstancePrivateEndpointConnectionProperties withPrivateEndpoint( + ManagedInstancePrivateEndpointProperty privateEndpoint) { + this.privateEndpoint = privateEndpoint; + return this; + } + + /** + * Get the privateLinkServiceConnectionState property: Connection State of the Private Endpoint Connection. + * + * @return the privateLinkServiceConnectionState value. + */ + public ManagedInstancePrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState() { + return this.privateLinkServiceConnectionState; + } + + /** + * Set the privateLinkServiceConnectionState property: Connection State of the Private Endpoint Connection. + * + * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set. + * @return the ManagedInstancePrivateEndpointConnectionProperties object itself. + */ + public ManagedInstancePrivateEndpointConnectionProperties withPrivateLinkServiceConnectionState( + ManagedInstancePrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState) { + this.privateLinkServiceConnectionState = privateLinkServiceConnectionState; + return this; + } + + /** + * Get the provisioningState property: State of the Private Endpoint Connection. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (privateEndpoint() != null) { + privateEndpoint().validate(); + } + if (privateLinkServiceConnectionState() != null) { + privateLinkServiceConnectionState().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstancePrivateLinkInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstancePrivateLinkInner.java new file mode 100644 index 0000000000000..14f395637bea3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstancePrivateLinkInner.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.ManagedInstancePrivateLinkProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A private link resource. */ +@Immutable +public final class ManagedInstancePrivateLinkInner extends ProxyResource { + /* + * The private link resource group id. + */ + @JsonProperty(value = "properties", access = JsonProperty.Access.WRITE_ONLY) + private ManagedInstancePrivateLinkProperties properties; + + /** Creates an instance of ManagedInstancePrivateLinkInner class. */ + public ManagedInstancePrivateLinkInner() { + } + + /** + * Get the properties property: The private link resource group id. + * + * @return the properties value. + */ + public ManagedInstancePrivateLinkProperties properties() { + return this.properties; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceProperties.java new file mode 100644 index 0000000000000..688db7957d9dc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceProperties.java @@ -0,0 +1,793 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceExternalAdministrator; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceLicenseType; +import com.azure.resourcemanager.sql.generated.models.ManagedInstancePecProperty; +import com.azure.resourcemanager.sql.generated.models.ManagedInstancePropertiesProvisioningState; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceProxyOverride; +import com.azure.resourcemanager.sql.generated.models.ManagedServerCreateMode; +import com.azure.resourcemanager.sql.generated.models.ServicePrincipal; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** The properties of a managed instance. */ +@Fluent +public final class ManagedInstanceProperties { + /* + * The provisioningState property. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ManagedInstancePropertiesProvisioningState provisioningState; + + /* + * Specifies the mode of database creation. + * + * Default: Regular instance creation. + * + * Restore: Creates an instance by restoring a set of backups to specific point in time. RestorePointInTime and + * SourceManagedInstanceId must be specified. + */ + @JsonProperty(value = "managedInstanceCreateMode") + private ManagedServerCreateMode managedInstanceCreateMode; + + /* + * The fully qualified domain name of the managed instance. + */ + @JsonProperty(value = "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 = "administratorLogin") + private String administratorLogin; + + /* + * The administrator login password (required for managed instance creation). + */ + @JsonProperty(value = "administratorLoginPassword") + private String administratorLoginPassword; + + /* + * Subnet resource ID for the managed instance. + */ + @JsonProperty(value = "subnetId") + private String subnetId; + + /* + * The state of the managed instance. + */ + @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) + private String state; + + /* + * The license type. Possible values are 'LicenseIncluded' (regular price inclusive of a new SQL license) and + * 'BasePrice' (discounted AHB price for bringing your own SQL licenses). + */ + @JsonProperty(value = "licenseType") + private ManagedInstanceLicenseType licenseType; + + /* + * The number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80. + */ + @JsonProperty(value = "vCores") + private Integer vCores; + + /* + * Storage size in GB. Minimum value: 32. Maximum value: 8192. Increments of 32 GB allowed only. + */ + @JsonProperty(value = "storageSizeInGB") + private Integer storageSizeInGB; + + /* + * Collation of the managed instance. + */ + @JsonProperty(value = "collation") + private String collation; + + /* + * The Dns Zone that the managed instance is in. + */ + @JsonProperty(value = "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 = "dnsZonePartner") + private String dnsZonePartner; + + /* + * Whether or not the public data endpoint is enabled. + */ + @JsonProperty(value = "publicDataEndpointEnabled") + private Boolean publicDataEndpointEnabled; + + /* + * The resource identifier of the source managed instance associated with create operation of this instance. + */ + @JsonProperty(value = "sourceManagedInstanceId") + private String sourceManagedInstanceId; + + /* + * Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new + * database. + */ + @JsonProperty(value = "restorePointInTime") + private OffsetDateTime restorePointInTime; + + /* + * Connection type used for connecting to the instance. + */ + @JsonProperty(value = "proxyOverride") + private ManagedInstanceProxyOverride proxyOverride; + + /* + * Id of the timezone. Allowed values are timezones supported by Windows. + * Windows keeps details on supported timezones, including the id, in registry under + * KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones. + * You can get those registry values via SQL Server by querying SELECT name AS timezone_id FROM sys.time_zone_info. + * List of Ids can also be obtained by executing [System.TimeZoneInfo]::GetSystemTimeZones() in PowerShell. + * An example of valid timezone id is "Pacific Standard Time" or "W. Europe Standard Time". + */ + @JsonProperty(value = "timezoneId") + private String timezoneId; + + /* + * The Id of the instance pool this managed server belongs to. + */ + @JsonProperty(value = "instancePoolId") + private String instancePoolId; + + /* + * Specifies maintenance configuration id to apply to this managed instance. + */ + @JsonProperty(value = "maintenanceConfigurationId") + private String maintenanceConfigurationId; + + /* + * List of private endpoint connections on a managed instance. + */ + @JsonProperty(value = "privateEndpointConnections", access = JsonProperty.Access.WRITE_ONLY) + private List privateEndpointConnections; + + /* + * Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2' + */ + @JsonProperty(value = "minimalTlsVersion") + private String minimalTlsVersion; + + /* + * The storage account type used to store backups for this instance. The options are Local + * (LocallyRedundantStorage), Zone (ZoneRedundantStorage), Geo (GeoRedundantStorage) and + * GeoZone(GeoZoneRedundantStorage) + */ + @JsonProperty(value = "currentBackupStorageRedundancy", access = JsonProperty.Access.WRITE_ONLY) + private BackupStorageRedundancy currentBackupStorageRedundancy; + + /* + * The storage account type to be used to store backups for this instance. The options are Local + * (LocallyRedundantStorage), Zone (ZoneRedundantStorage), Geo (GeoRedundantStorage) and + * GeoZone(GeoZoneRedundantStorage) + */ + @JsonProperty(value = "requestedBackupStorageRedundancy") + private BackupStorageRedundancy requestedBackupStorageRedundancy; + + /* + * Whether or not the multi-az is enabled. + */ + @JsonProperty(value = "zoneRedundant") + private Boolean zoneRedundant; + + /* + * The resource id of a user assigned identity to be used by default. + */ + @JsonProperty(value = "primaryUserAssignedIdentityId") + private String primaryUserAssignedIdentityId; + + /* + * A CMK URI of the key to use for encryption. + */ + @JsonProperty(value = "keyId") + private String keyId; + + /* + * The Azure Active Directory administrator of the server. + */ + @JsonProperty(value = "administrators") + private ManagedInstanceExternalAdministrator administrators; + + /* + * The managed instance's service principal. + */ + @JsonProperty(value = "servicePrincipal") + private ServicePrincipal servicePrincipal; + + /** Creates an instance of ManagedInstanceProperties class. */ + public ManagedInstanceProperties() { + } + + /** + * Get the provisioningState property: The provisioningState property. + * + * @return the provisioningState value. + */ + public ManagedInstancePropertiesProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the managedInstanceCreateMode property: Specifies the mode of database creation. + * + *

Default: Regular instance creation. + * + *

Restore: Creates an instance by restoring a set of backups to specific point in time. RestorePointInTime and + * SourceManagedInstanceId must be specified. + * + * @return the managedInstanceCreateMode value. + */ + public ManagedServerCreateMode managedInstanceCreateMode() { + return this.managedInstanceCreateMode; + } + + /** + * Set the managedInstanceCreateMode property: Specifies the mode of database creation. + * + *

Default: Regular instance creation. + * + *

Restore: Creates an instance by restoring a set of backups to specific point in time. RestorePointInTime and + * SourceManagedInstanceId must be specified. + * + * @param managedInstanceCreateMode the managedInstanceCreateMode value to set. + * @return the ManagedInstanceProperties object itself. + */ + public ManagedInstanceProperties withManagedInstanceCreateMode(ManagedServerCreateMode managedInstanceCreateMode) { + this.managedInstanceCreateMode = managedInstanceCreateMode; + return this; + } + + /** + * Get the fullyQualifiedDomainName property: The fully qualified domain name of the managed instance. + * + * @return the fullyQualifiedDomainName value. + */ + public String fullyQualifiedDomainName() { + return this.fullyQualifiedDomainName; + } + + /** + * Get the administratorLogin property: 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 the administratorLogin property: 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 ManagedInstanceProperties object itself. + */ + public ManagedInstanceProperties withAdministratorLogin(String administratorLogin) { + this.administratorLogin = administratorLogin; + return this; + } + + /** + * Get the administratorLoginPassword property: The administrator login password (required for managed instance + * creation). + * + * @return the administratorLoginPassword value. + */ + public String administratorLoginPassword() { + return this.administratorLoginPassword; + } + + /** + * Set the administratorLoginPassword property: The administrator login password (required for managed instance + * creation). + * + * @param administratorLoginPassword the administratorLoginPassword value to set. + * @return the ManagedInstanceProperties object itself. + */ + public ManagedInstanceProperties withAdministratorLoginPassword(String administratorLoginPassword) { + this.administratorLoginPassword = administratorLoginPassword; + return this; + } + + /** + * Get the subnetId property: Subnet resource ID for the managed instance. + * + * @return the subnetId value. + */ + public String subnetId() { + return this.subnetId; + } + + /** + * Set the subnetId property: Subnet resource ID for the managed instance. + * + * @param subnetId the subnetId value to set. + * @return the ManagedInstanceProperties object itself. + */ + public ManagedInstanceProperties withSubnetId(String subnetId) { + this.subnetId = subnetId; + return this; + } + + /** + * Get the state property: The state of the managed instance. + * + * @return the state value. + */ + public String state() { + return this.state; + } + + /** + * Get the licenseType property: The license type. Possible values are 'LicenseIncluded' (regular price inclusive of + * a new SQL license) and 'BasePrice' (discounted AHB price for bringing your own SQL licenses). + * + * @return the licenseType value. + */ + public ManagedInstanceLicenseType licenseType() { + return this.licenseType; + } + + /** + * Set the licenseType property: The license type. Possible values are 'LicenseIncluded' (regular price inclusive of + * a new SQL license) and 'BasePrice' (discounted AHB price for bringing your own SQL licenses). + * + * @param licenseType the licenseType value to set. + * @return the ManagedInstanceProperties object itself. + */ + public ManagedInstanceProperties withLicenseType(ManagedInstanceLicenseType licenseType) { + this.licenseType = licenseType; + return this; + } + + /** + * Get the vCores property: The number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80. + * + * @return the vCores value. + */ + public Integer vCores() { + return this.vCores; + } + + /** + * Set the vCores property: The number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80. + * + * @param vCores the vCores value to set. + * @return the ManagedInstanceProperties object itself. + */ + public ManagedInstanceProperties withVCores(Integer vCores) { + this.vCores = vCores; + return this; + } + + /** + * Get the storageSizeInGB property: Storage size in GB. Minimum value: 32. Maximum value: 8192. Increments of 32 GB + * allowed only. + * + * @return the storageSizeInGB value. + */ + public Integer storageSizeInGB() { + return this.storageSizeInGB; + } + + /** + * Set the storageSizeInGB property: Storage size in GB. Minimum value: 32. Maximum value: 8192. Increments of 32 GB + * allowed only. + * + * @param storageSizeInGB the storageSizeInGB value to set. + * @return the ManagedInstanceProperties object itself. + */ + public ManagedInstanceProperties withStorageSizeInGB(Integer storageSizeInGB) { + this.storageSizeInGB = storageSizeInGB; + return this; + } + + /** + * Get the collation property: Collation of the managed instance. + * + * @return the collation value. + */ + public String collation() { + return this.collation; + } + + /** + * Set the collation property: Collation of the managed instance. + * + * @param collation the collation value to set. + * @return the ManagedInstanceProperties object itself. + */ + public ManagedInstanceProperties withCollation(String collation) { + this.collation = collation; + return this; + } + + /** + * Get the dnsZone property: The Dns Zone that the managed instance is in. + * + * @return the dnsZone value. + */ + public String dnsZone() { + return this.dnsZone; + } + + /** + * Get the dnsZonePartner property: 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 dnsZonePartner property: 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 ManagedInstanceProperties object itself. + */ + public ManagedInstanceProperties withDnsZonePartner(String dnsZonePartner) { + this.dnsZonePartner = dnsZonePartner; + return this; + } + + /** + * Get the publicDataEndpointEnabled property: Whether or not the public data endpoint is enabled. + * + * @return the publicDataEndpointEnabled value. + */ + public Boolean publicDataEndpointEnabled() { + return this.publicDataEndpointEnabled; + } + + /** + * Set the publicDataEndpointEnabled property: Whether or not the public data endpoint is enabled. + * + * @param publicDataEndpointEnabled the publicDataEndpointEnabled value to set. + * @return the ManagedInstanceProperties object itself. + */ + public ManagedInstanceProperties withPublicDataEndpointEnabled(Boolean publicDataEndpointEnabled) { + this.publicDataEndpointEnabled = publicDataEndpointEnabled; + return this; + } + + /** + * Get the sourceManagedInstanceId property: The resource identifier of the source managed instance associated with + * create operation of this instance. + * + * @return the sourceManagedInstanceId value. + */ + public String sourceManagedInstanceId() { + return this.sourceManagedInstanceId; + } + + /** + * Set the sourceManagedInstanceId property: The resource identifier of the source managed instance associated with + * create operation of this instance. + * + * @param sourceManagedInstanceId the sourceManagedInstanceId value to set. + * @return the ManagedInstanceProperties object itself. + */ + public ManagedInstanceProperties withSourceManagedInstanceId(String sourceManagedInstanceId) { + this.sourceManagedInstanceId = sourceManagedInstanceId; + return this; + } + + /** + * Get the restorePointInTime property: Specifies the point in time (ISO8601 format) of the source database that + * will be restored to create the new database. + * + * @return the restorePointInTime value. + */ + public OffsetDateTime restorePointInTime() { + return this.restorePointInTime; + } + + /** + * Set the restorePointInTime property: 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 ManagedInstanceProperties object itself. + */ + public ManagedInstanceProperties withRestorePointInTime(OffsetDateTime restorePointInTime) { + this.restorePointInTime = restorePointInTime; + return this; + } + + /** + * Get the proxyOverride property: Connection type used for connecting to the instance. + * + * @return the proxyOverride value. + */ + public ManagedInstanceProxyOverride proxyOverride() { + return this.proxyOverride; + } + + /** + * Set the proxyOverride property: Connection type used for connecting to the instance. + * + * @param proxyOverride the proxyOverride value to set. + * @return the ManagedInstanceProperties object itself. + */ + public ManagedInstanceProperties withProxyOverride(ManagedInstanceProxyOverride proxyOverride) { + this.proxyOverride = proxyOverride; + return this; + } + + /** + * Get the timezoneId property: Id of the timezone. Allowed values are timezones supported by Windows. Windows keeps + * details on supported timezones, including the id, in registry under KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows + * NT\CurrentVersion\Time Zones. You can get those registry values via SQL Server by querying SELECT name AS + * timezone_id FROM sys.time_zone_info. List of Ids can also be obtained by executing + * [System.TimeZoneInfo]::GetSystemTimeZones() in PowerShell. An example of valid timezone id is "Pacific Standard + * Time" or "W. Europe Standard Time". + * + * @return the timezoneId value. + */ + public String timezoneId() { + return this.timezoneId; + } + + /** + * Set the timezoneId property: Id of the timezone. Allowed values are timezones supported by Windows. Windows keeps + * details on supported timezones, including the id, in registry under KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows + * NT\CurrentVersion\Time Zones. You can get those registry values via SQL Server by querying SELECT name AS + * timezone_id FROM sys.time_zone_info. List of Ids can also be obtained by executing + * [System.TimeZoneInfo]::GetSystemTimeZones() in PowerShell. An example of valid timezone id is "Pacific Standard + * Time" or "W. Europe Standard Time". + * + * @param timezoneId the timezoneId value to set. + * @return the ManagedInstanceProperties object itself. + */ + public ManagedInstanceProperties withTimezoneId(String timezoneId) { + this.timezoneId = timezoneId; + return this; + } + + /** + * Get the instancePoolId property: The Id of the instance pool this managed server belongs to. + * + * @return the instancePoolId value. + */ + public String instancePoolId() { + return this.instancePoolId; + } + + /** + * Set the instancePoolId property: The Id of the instance pool this managed server belongs to. + * + * @param instancePoolId the instancePoolId value to set. + * @return the ManagedInstanceProperties object itself. + */ + public ManagedInstanceProperties withInstancePoolId(String instancePoolId) { + this.instancePoolId = instancePoolId; + return this; + } + + /** + * Get the maintenanceConfigurationId property: Specifies maintenance configuration id to apply to this managed + * instance. + * + * @return the maintenanceConfigurationId value. + */ + public String maintenanceConfigurationId() { + return this.maintenanceConfigurationId; + } + + /** + * Set the maintenanceConfigurationId property: Specifies maintenance configuration id to apply to this managed + * instance. + * + * @param maintenanceConfigurationId the maintenanceConfigurationId value to set. + * @return the ManagedInstanceProperties object itself. + */ + public ManagedInstanceProperties withMaintenanceConfigurationId(String maintenanceConfigurationId) { + this.maintenanceConfigurationId = maintenanceConfigurationId; + return this; + } + + /** + * Get the privateEndpointConnections property: List of private endpoint connections on a managed instance. + * + * @return the privateEndpointConnections value. + */ + public List privateEndpointConnections() { + return this.privateEndpointConnections; + } + + /** + * Get the minimalTlsVersion property: Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2'. + * + * @return the minimalTlsVersion value. + */ + public String minimalTlsVersion() { + return this.minimalTlsVersion; + } + + /** + * Set the minimalTlsVersion property: Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2'. + * + * @param minimalTlsVersion the minimalTlsVersion value to set. + * @return the ManagedInstanceProperties object itself. + */ + public ManagedInstanceProperties withMinimalTlsVersion(String minimalTlsVersion) { + this.minimalTlsVersion = minimalTlsVersion; + return this; + } + + /** + * Get the currentBackupStorageRedundancy property: The storage account type used to store backups for this + * instance. The options are Local (LocallyRedundantStorage), Zone (ZoneRedundantStorage), Geo (GeoRedundantStorage) + * and GeoZone(GeoZoneRedundantStorage). + * + * @return the currentBackupStorageRedundancy value. + */ + public BackupStorageRedundancy currentBackupStorageRedundancy() { + return this.currentBackupStorageRedundancy; + } + + /** + * Get the requestedBackupStorageRedundancy property: The storage account type to be used to store backups for this + * instance. The options are Local (LocallyRedundantStorage), Zone (ZoneRedundantStorage), Geo (GeoRedundantStorage) + * and GeoZone(GeoZoneRedundantStorage). + * + * @return the requestedBackupStorageRedundancy value. + */ + public BackupStorageRedundancy requestedBackupStorageRedundancy() { + return this.requestedBackupStorageRedundancy; + } + + /** + * Set the requestedBackupStorageRedundancy property: The storage account type to be used to store backups for this + * instance. The options are Local (LocallyRedundantStorage), Zone (ZoneRedundantStorage), Geo (GeoRedundantStorage) + * and GeoZone(GeoZoneRedundantStorage). + * + * @param requestedBackupStorageRedundancy the requestedBackupStorageRedundancy value to set. + * @return the ManagedInstanceProperties object itself. + */ + public ManagedInstanceProperties withRequestedBackupStorageRedundancy( + BackupStorageRedundancy requestedBackupStorageRedundancy) { + this.requestedBackupStorageRedundancy = requestedBackupStorageRedundancy; + return this; + } + + /** + * Get the zoneRedundant property: Whether or not the multi-az is enabled. + * + * @return the zoneRedundant value. + */ + public Boolean zoneRedundant() { + return this.zoneRedundant; + } + + /** + * Set the zoneRedundant property: Whether or not the multi-az is enabled. + * + * @param zoneRedundant the zoneRedundant value to set. + * @return the ManagedInstanceProperties object itself. + */ + public ManagedInstanceProperties withZoneRedundant(Boolean zoneRedundant) { + this.zoneRedundant = zoneRedundant; + return this; + } + + /** + * Get the primaryUserAssignedIdentityId property: The resource id of a user assigned identity to be used by + * default. + * + * @return the primaryUserAssignedIdentityId value. + */ + public String primaryUserAssignedIdentityId() { + return this.primaryUserAssignedIdentityId; + } + + /** + * Set the primaryUserAssignedIdentityId property: The resource id of a user assigned identity to be used by + * default. + * + * @param primaryUserAssignedIdentityId the primaryUserAssignedIdentityId value to set. + * @return the ManagedInstanceProperties object itself. + */ + public ManagedInstanceProperties withPrimaryUserAssignedIdentityId(String primaryUserAssignedIdentityId) { + this.primaryUserAssignedIdentityId = primaryUserAssignedIdentityId; + return this; + } + + /** + * Get the keyId property: A CMK URI of the key to use for encryption. + * + * @return the keyId value. + */ + public String keyId() { + return this.keyId; + } + + /** + * Set the keyId property: A CMK URI of the key to use for encryption. + * + * @param keyId the keyId value to set. + * @return the ManagedInstanceProperties object itself. + */ + public ManagedInstanceProperties withKeyId(String keyId) { + this.keyId = keyId; + return this; + } + + /** + * Get the administrators property: The Azure Active Directory administrator of the server. + * + * @return the administrators value. + */ + public ManagedInstanceExternalAdministrator administrators() { + return this.administrators; + } + + /** + * Set the administrators property: The Azure Active Directory administrator of the server. + * + * @param administrators the administrators value to set. + * @return the ManagedInstanceProperties object itself. + */ + public ManagedInstanceProperties withAdministrators(ManagedInstanceExternalAdministrator administrators) { + this.administrators = administrators; + return this; + } + + /** + * Get the servicePrincipal property: The managed instance's service principal. + * + * @return the servicePrincipal value. + */ + public ServicePrincipal servicePrincipal() { + return this.servicePrincipal; + } + + /** + * Set the servicePrincipal property: The managed instance's service principal. + * + * @param servicePrincipal the servicePrincipal value to set. + * @return the ManagedInstanceProperties object itself. + */ + public ManagedInstanceProperties withServicePrincipal(ServicePrincipal servicePrincipal) { + this.servicePrincipal = servicePrincipal; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (privateEndpointConnections() != null) { + privateEndpointConnections().forEach(e -> e.validate()); + } + if (administrators() != null) { + administrators().validate(); + } + if (servicePrincipal() != null) { + servicePrincipal().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceQueryInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceQueryInner.java new file mode 100644 index 0000000000000..d14f39d8d00bb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceQueryInner.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Database query. */ +@Fluent +public final class ManagedInstanceQueryInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private QueryProperties innerProperties; + + /** Creates an instance of ManagedInstanceQueryInner class. */ + public ManagedInstanceQueryInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private QueryProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the queryText property: Query text. + * + * @return the queryText value. + */ + public String queryText() { + return this.innerProperties() == null ? null : this.innerProperties().queryText(); + } + + /** + * Set the queryText property: Query text. + * + * @param queryText the queryText value to set. + * @return the ManagedInstanceQueryInner object itself. + */ + public ManagedInstanceQueryInner withQueryText(String queryText) { + if (this.innerProperties() == null) { + this.innerProperties = new QueryProperties(); + } + this.innerProperties().withQueryText(queryText); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceVulnerabilityAssessmentInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceVulnerabilityAssessmentInner.java new file mode 100644 index 0000000000000..192485d8063aa --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceVulnerabilityAssessmentInner.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentRecurringScansProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A managed instance vulnerability assessment. */ +@Fluent +public final class ManagedInstanceVulnerabilityAssessmentInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ManagedInstanceVulnerabilityAssessmentProperties innerProperties; + + /** Creates an instance of ManagedInstanceVulnerabilityAssessmentInner class. */ + public ManagedInstanceVulnerabilityAssessmentInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ManagedInstanceVulnerabilityAssessmentProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the storageContainerPath property: 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.innerProperties() == null ? null : this.innerProperties().storageContainerPath(); + } + + /** + * Set the storageContainerPath property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceVulnerabilityAssessmentProperties(); + } + this.innerProperties().withStorageContainerPath(storageContainerPath); + return this; + } + + /** + * Get the storageContainerSasKey property: 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. Applies only if the storage account is not behind a Vnet or a firewall. + * + * @return the storageContainerSasKey value. + */ + public String storageContainerSasKey() { + return this.innerProperties() == null ? null : this.innerProperties().storageContainerSasKey(); + } + + /** + * Set the storageContainerSasKey property: 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. Applies only if the storage account is not behind a Vnet or a firewall. + * + * @param storageContainerSasKey the storageContainerSasKey value to set. + * @return the ManagedInstanceVulnerabilityAssessmentInner object itself. + */ + public ManagedInstanceVulnerabilityAssessmentInner withStorageContainerSasKey(String storageContainerSasKey) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceVulnerabilityAssessmentProperties(); + } + this.innerProperties().withStorageContainerSasKey(storageContainerSasKey); + return this; + } + + /** + * Get the storageAccountAccessKey property: Specifies the identifier key of the storage account for vulnerability + * assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. + * Applies only if the storage account is not behind a Vnet or a firewall. + * + * @return the storageAccountAccessKey value. + */ + public String storageAccountAccessKey() { + return this.innerProperties() == null ? null : this.innerProperties().storageAccountAccessKey(); + } + + /** + * Set the storageAccountAccessKey property: Specifies the identifier key of the storage account for vulnerability + * assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. + * Applies only if the storage account is not behind a Vnet or a firewall. + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set. + * @return the ManagedInstanceVulnerabilityAssessmentInner object itself. + */ + public ManagedInstanceVulnerabilityAssessmentInner withStorageAccountAccessKey(String storageAccountAccessKey) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceVulnerabilityAssessmentProperties(); + } + this.innerProperties().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + /** + * Get the recurringScans property: The recurring scans settings. + * + * @return the recurringScans value. + */ + public VulnerabilityAssessmentRecurringScansProperties recurringScans() { + return this.innerProperties() == null ? null : this.innerProperties().recurringScans(); + } + + /** + * Set the recurringScans property: The recurring scans settings. + * + * @param recurringScans the recurringScans value to set. + * @return the ManagedInstanceVulnerabilityAssessmentInner object itself. + */ + public ManagedInstanceVulnerabilityAssessmentInner withRecurringScans( + VulnerabilityAssessmentRecurringScansProperties recurringScans) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceVulnerabilityAssessmentProperties(); + } + this.innerProperties().withRecurringScans(recurringScans); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceVulnerabilityAssessmentProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceVulnerabilityAssessmentProperties.java new file mode 100644 index 0000000000000..c0c3a0303988b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedInstanceVulnerabilityAssessmentProperties.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentRecurringScansProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a managed instance vulnerability assessment. */ +@Fluent +public final class ManagedInstanceVulnerabilityAssessmentProperties { + /* + * A blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). + */ + @JsonProperty(value = "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. Applies only if the storage account is not behind a Vnet or a firewall + */ + @JsonProperty(value = "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. Applies only if the storage + * account is not behind a Vnet or a firewall + */ + @JsonProperty(value = "storageAccountAccessKey") + private String storageAccountAccessKey; + + /* + * The recurring scans settings + */ + @JsonProperty(value = "recurringScans") + private VulnerabilityAssessmentRecurringScansProperties recurringScans; + + /** Creates an instance of ManagedInstanceVulnerabilityAssessmentProperties class. */ + public ManagedInstanceVulnerabilityAssessmentProperties() { + } + + /** + * Get the storageContainerPath property: 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 the storageContainerPath property: 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 ManagedInstanceVulnerabilityAssessmentProperties object itself. + */ + public ManagedInstanceVulnerabilityAssessmentProperties withStorageContainerPath(String storageContainerPath) { + this.storageContainerPath = storageContainerPath; + return this; + } + + /** + * Get the storageContainerSasKey property: 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. Applies only if the storage account is not behind a Vnet or a firewall. + * + * @return the storageContainerSasKey value. + */ + public String storageContainerSasKey() { + return this.storageContainerSasKey; + } + + /** + * Set the storageContainerSasKey property: 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. Applies only if the storage account is not behind a Vnet or a firewall. + * + * @param storageContainerSasKey the storageContainerSasKey value to set. + * @return the ManagedInstanceVulnerabilityAssessmentProperties object itself. + */ + public ManagedInstanceVulnerabilityAssessmentProperties withStorageContainerSasKey(String storageContainerSasKey) { + this.storageContainerSasKey = storageContainerSasKey; + return this; + } + + /** + * Get the storageAccountAccessKey property: Specifies the identifier key of the storage account for vulnerability + * assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. + * Applies only if the storage account is not behind a Vnet or a firewall. + * + * @return the storageAccountAccessKey value. + */ + public String storageAccountAccessKey() { + return this.storageAccountAccessKey; + } + + /** + * Set the storageAccountAccessKey property: Specifies the identifier key of the storage account for vulnerability + * assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. + * Applies only if the storage account is not behind a Vnet or a firewall. + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set. + * @return the ManagedInstanceVulnerabilityAssessmentProperties object itself. + */ + public ManagedInstanceVulnerabilityAssessmentProperties withStorageAccountAccessKey( + String storageAccountAccessKey) { + this.storageAccountAccessKey = storageAccountAccessKey; + return this; + } + + /** + * Get the recurringScans property: The recurring scans settings. + * + * @return the recurringScans value. + */ + public VulnerabilityAssessmentRecurringScansProperties recurringScans() { + return this.recurringScans; + } + + /** + * Set the recurringScans property: The recurring scans settings. + * + * @param recurringScans the recurringScans value to set. + * @return the ManagedInstanceVulnerabilityAssessmentProperties object itself. + */ + public ManagedInstanceVulnerabilityAssessmentProperties withRecurringScans( + VulnerabilityAssessmentRecurringScansProperties recurringScans) { + this.recurringScans = recurringScans; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (storageContainerPath() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property storageContainerPath in model" + + " ManagedInstanceVulnerabilityAssessmentProperties")); + } + if (recurringScans() != null) { + recurringScans().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ManagedInstanceVulnerabilityAssessmentProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedServerDnsAliasInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedServerDnsAliasInner.java new file mode 100644 index 0000000000000..85e58f6a08e58 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedServerDnsAliasInner.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A managed server DNS alias. */ +@Immutable +public final class ManagedServerDnsAliasInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ManagedServerDnsAliasProperties innerProperties; + + /** Creates an instance of ManagedServerDnsAliasInner class. */ + public ManagedServerDnsAliasInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ManagedServerDnsAliasProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the azureDnsRecord property: The fully qualified DNS record for managed server alias. + * + * @return the azureDnsRecord value. + */ + public String azureDnsRecord() { + return this.innerProperties() == null ? null : this.innerProperties().azureDnsRecord(); + } + + /** + * Get the publicAzureDnsRecord property: The fully qualified public DNS record for managed server alias. + * + * @return the publicAzureDnsRecord value. + */ + public String publicAzureDnsRecord() { + return this.innerProperties() == null ? null : this.innerProperties().publicAzureDnsRecord(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedServerDnsAliasProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedServerDnsAliasProperties.java new file mode 100644 index 0000000000000..a44ac36289da5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedServerDnsAliasProperties.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a managed server DNS alias. */ +@Immutable +public final class ManagedServerDnsAliasProperties { + /* + * The fully qualified DNS record for managed server alias + */ + @JsonProperty(value = "azureDnsRecord", access = JsonProperty.Access.WRITE_ONLY) + private String azureDnsRecord; + + /* + * The fully qualified public DNS record for managed server alias + */ + @JsonProperty(value = "publicAzureDnsRecord", access = JsonProperty.Access.WRITE_ONLY) + private String publicAzureDnsRecord; + + /** Creates an instance of ManagedServerDnsAliasProperties class. */ + public ManagedServerDnsAliasProperties() { + } + + /** + * Get the azureDnsRecord property: The fully qualified DNS record for managed server alias. + * + * @return the azureDnsRecord value. + */ + public String azureDnsRecord() { + return this.azureDnsRecord; + } + + /** + * Get the publicAzureDnsRecord property: The fully qualified public DNS record for managed server alias. + * + * @return the publicAzureDnsRecord value. + */ + public String publicAzureDnsRecord() { + return this.publicAzureDnsRecord; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedServerSecurityAlertPolicyInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedServerSecurityAlertPolicyInner.java new file mode 100644 index 0000000000000..51f88fc16681f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedServerSecurityAlertPolicyInner.java @@ -0,0 +1,240 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertsPolicyState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** A managed server security alert policy. */ +@Fluent +public final class ManagedServerSecurityAlertPolicyInner extends ProxyResource { + /* + * SystemData of SecurityAlertPolicyResource. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private SecurityAlertsPolicyProperties innerProperties; + + /** Creates an instance of ManagedServerSecurityAlertPolicyInner class. */ + public ManagedServerSecurityAlertPolicyInner() { + } + + /** + * Get the systemData property: SystemData of SecurityAlertPolicyResource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private SecurityAlertsPolicyProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the state property: Specifies the state of the policy, whether it is enabled or disabled or a policy has not + * been applied yet on the specific database. + * + * @return the state value. + */ + public SecurityAlertsPolicyState state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Set the state property: Specifies the state of the policy, whether it is enabled or disabled or a policy has not + * been applied yet on the specific database. + * + * @param state the state value to set. + * @return the ManagedServerSecurityAlertPolicyInner object itself. + */ + public ManagedServerSecurityAlertPolicyInner withState(SecurityAlertsPolicyState state) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertsPolicyProperties(); + } + this.innerProperties().withState(state); + return this; + } + + /** + * Get the disabledAlerts property: Specifies an array of alerts that are disabled. Allowed values are: + * Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action, Brute_Force. + * + * @return the disabledAlerts value. + */ + public List disabledAlerts() { + return this.innerProperties() == null ? null : this.innerProperties().disabledAlerts(); + } + + /** + * Set the disabledAlerts property: Specifies an array of alerts that are disabled. Allowed values are: + * Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action, Brute_Force. + * + * @param disabledAlerts the disabledAlerts value to set. + * @return the ManagedServerSecurityAlertPolicyInner object itself. + */ + public ManagedServerSecurityAlertPolicyInner withDisabledAlerts(List disabledAlerts) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertsPolicyProperties(); + } + this.innerProperties().withDisabledAlerts(disabledAlerts); + return this; + } + + /** + * Get the emailAddresses property: Specifies an array of e-mail addresses to which the alert is sent. + * + * @return the emailAddresses value. + */ + public List emailAddresses() { + return this.innerProperties() == null ? null : this.innerProperties().emailAddresses(); + } + + /** + * Set the emailAddresses property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertsPolicyProperties(); + } + this.innerProperties().withEmailAddresses(emailAddresses); + return this; + } + + /** + * Get the emailAccountAdmins property: Specifies that the alert is sent to the account administrators. + * + * @return the emailAccountAdmins value. + */ + public Boolean emailAccountAdmins() { + return this.innerProperties() == null ? null : this.innerProperties().emailAccountAdmins(); + } + + /** + * Set the emailAccountAdmins property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertsPolicyProperties(); + } + this.innerProperties().withEmailAccountAdmins(emailAccountAdmins); + return this; + } + + /** + * Get the storageEndpoint property: 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.innerProperties() == null ? null : this.innerProperties().storageEndpoint(); + } + + /** + * Set the storageEndpoint property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertsPolicyProperties(); + } + this.innerProperties().withStorageEndpoint(storageEndpoint); + return this; + } + + /** + * Get the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection audit storage + * account. + * + * @return the storageAccountAccessKey value. + */ + public String storageAccountAccessKey() { + return this.innerProperties() == null ? null : this.innerProperties().storageAccountAccessKey(); + } + + /** + * Set the storageAccountAccessKey property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertsPolicyProperties(); + } + this.innerProperties().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + /** + * Get the retentionDays property: Specifies the number of days to keep in the Threat Detection audit logs. + * + * @return the retentionDays value. + */ + public Integer retentionDays() { + return this.innerProperties() == null ? null : this.innerProperties().retentionDays(); + } + + /** + * Set the retentionDays property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertsPolicyProperties(); + } + this.innerProperties().withRetentionDays(retentionDays); + return this; + } + + /** + * Get the creationTime property: Specifies the UTC creation time of the policy. + * + * @return the creationTime value. + */ + public OffsetDateTime creationTime() { + return this.innerProperties() == null ? null : this.innerProperties().creationTime(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedTransparentDataEncryptionInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedTransparentDataEncryptionInner.java new file mode 100644 index 0000000000000..cff947489937e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedTransparentDataEncryptionInner.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A managed database transparent data encryption state. */ +@Fluent +public final class ManagedTransparentDataEncryptionInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ManagedTransparentDataEncryptionProperties innerProperties; + + /** Creates an instance of ManagedTransparentDataEncryptionInner class. */ + public ManagedTransparentDataEncryptionInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ManagedTransparentDataEncryptionProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the state property: Specifies the state of the transparent data encryption. + * + * @return the state value. + */ + public TransparentDataEncryptionState state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Set the state property: Specifies the state of the transparent data encryption. + * + * @param state the state value to set. + * @return the ManagedTransparentDataEncryptionInner object itself. + */ + public ManagedTransparentDataEncryptionInner withState(TransparentDataEncryptionState state) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedTransparentDataEncryptionProperties(); + } + this.innerProperties().withState(state); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedTransparentDataEncryptionProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedTransparentDataEncryptionProperties.java new file mode 100644 index 0000000000000..27c4793602434 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ManagedTransparentDataEncryptionProperties.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a transparent data encryption. */ +@Fluent +public final class ManagedTransparentDataEncryptionProperties { + /* + * Specifies the state of the transparent data encryption. + */ + @JsonProperty(value = "state", required = true) + private TransparentDataEncryptionState state; + + /** Creates an instance of ManagedTransparentDataEncryptionProperties class. */ + public ManagedTransparentDataEncryptionProperties() { + } + + /** + * Get the state property: Specifies the state of the transparent data encryption. + * + * @return the state value. + */ + public TransparentDataEncryptionState state() { + return this.state; + } + + /** + * Set the state property: Specifies the state of the transparent data encryption. + * + * @param state the state value to set. + * @return the ManagedTransparentDataEncryptionProperties object itself. + */ + public ManagedTransparentDataEncryptionProperties withState(TransparentDataEncryptionState state) { + this.state = state; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (state() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property state in model ManagedTransparentDataEncryptionProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ManagedTransparentDataEncryptionProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/MetricDefinitionInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/MetricDefinitionInner.java new file mode 100644 index 0000000000000..91a65909341f6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/MetricDefinitionInner.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.models.MetricAvailability; +import com.azure.resourcemanager.sql.generated.models.MetricName; +import com.azure.resourcemanager.sql.generated.models.PrimaryAggregationType; +import com.azure.resourcemanager.sql.generated.models.UnitDefinitionType; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A database metric definition. */ +@Immutable +public final 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. + */ + @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. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private UnitDefinitionType unit; + + /* + * The list of database metric availabilities for the metric. + */ + @JsonProperty(value = "metricAvailabilities", access = JsonProperty.Access.WRITE_ONLY) + private List metricAvailabilities; + + /** Creates an instance of MetricDefinitionInner class. */ + public MetricDefinitionInner() { + } + + /** + * Get the name property: The name information for the metric. + * + * @return the name value. + */ + public MetricName name() { + return this.name; + } + + /** + * Get the primaryAggregationType property: The primary aggregation type defining how metric values are displayed. + * + * @return the primaryAggregationType value. + */ + public PrimaryAggregationType primaryAggregationType() { + return this.primaryAggregationType; + } + + /** + * Get the resourceUri property: The resource uri of the database. + * + * @return the resourceUri value. + */ + public String resourceUri() { + return this.resourceUri; + } + + /** + * Get the unit property: The unit of the metric. + * + * @return the unit value. + */ + public UnitDefinitionType unit() { + return this.unit; + } + + /** + * Get the metricAvailabilities property: The list of database metric availabilities for the metric. + * + * @return the metricAvailabilities value. + */ + public List metricAvailabilities() { + return this.metricAvailabilities; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() != null) { + name().validate(); + } + if (metricAvailabilities() != null) { + metricAvailabilities().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/MetricInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/MetricInner.java new file mode 100644 index 0000000000000..724cfd0bbb9c6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/MetricInner.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.models.MetricName; +import com.azure.resourcemanager.sql.generated.models.MetricValue; +import com.azure.resourcemanager.sql.generated.models.UnitType; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Database metrics. */ +@Immutable +public final class MetricInner { + /* + * The start time for the metric (ISO-8601 format). + */ + @JsonProperty(value = "startTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime startTime; + + /* + * The end time for the metric (ISO-8601 format). + */ + @JsonProperty(value = "endTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime 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. + */ + @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; + + /** Creates an instance of MetricInner class. */ + public MetricInner() { + } + + /** + * Get the startTime property: The start time for the metric (ISO-8601 format). + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Get the endTime property: The end time for the metric (ISO-8601 format). + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Get the timeGrain property: The time step to be used to summarize the metric values. + * + * @return the timeGrain value. + */ + public String timeGrain() { + return this.timeGrain; + } + + /** + * Get the unit property: The unit of the metric. + * + * @return the unit value. + */ + public UnitType unit() { + return this.unit; + } + + /** + * Get the name property: The name information for the metric. + * + * @return the name value. + */ + public MetricName name() { + return this.name; + } + + /** + * Get the metricValues property: The metric values for the specified time window and timestep. + * + * @return the metricValues value. + */ + public List metricValues() { + return this.metricValues; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() != null) { + name().validate(); + } + if (metricValues() != null) { + metricValues().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/OperationInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/OperationInner.java new file mode 100644 index 0000000000000..ce276d0189c7b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/OperationInner.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.models.OperationDisplay; +import com.azure.resourcemanager.sql.generated.models.OperationOrigin; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** SQL REST API operation definition. */ +@Immutable +public final 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. + */ + @JsonProperty(value = "origin", access = JsonProperty.Access.WRITE_ONLY) + private OperationOrigin origin; + + /* + * Additional descriptions for the operation. + */ + @JsonProperty(value = "properties", access = JsonProperty.Access.WRITE_ONLY) + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map properties; + + /** Creates an instance of OperationInner class. */ + public OperationInner() { + } + + /** + * Get the name property: The name of the operation being performed on this particular object. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the display property: The localized display information for this particular operation / action. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Get the origin property: The intended executor of the operation. + * + * @return the origin value. + */ + public OperationOrigin origin() { + return this.origin; + } + + /** + * Get the properties property: Additional descriptions for the operation. + * + * @return the properties value. + */ + public Map properties() { + return this.properties; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/OutboundFirewallRuleInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/OutboundFirewallRuleInner.java new file mode 100644 index 0000000000000..cc7b495ea871d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/OutboundFirewallRuleInner.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An Azure SQL DB Server Outbound Firewall Rule. */ +@Immutable +public final class OutboundFirewallRuleInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private OutboundFirewallRuleProperties innerProperties; + + /** Creates an instance of OutboundFirewallRuleInner class. */ + public OutboundFirewallRuleInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private OutboundFirewallRuleProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the provisioningState property: The state of the outbound rule. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/OutboundFirewallRuleProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/OutboundFirewallRuleProperties.java new file mode 100644 index 0000000000000..c7d949410aaa9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/OutboundFirewallRuleProperties.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of an outbound firewall rule. */ +@Immutable +public final class OutboundFirewallRuleProperties { + /* + * The state of the outbound rule. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** Creates an instance of OutboundFirewallRuleProperties class. */ + public OutboundFirewallRuleProperties() { + } + + /** + * Get the provisioningState property: The state of the outbound rule. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/PrivateEndpointConnectionInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/PrivateEndpointConnectionInner.java new file mode 100644 index 0000000000000..1a8a3e63fdefc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/PrivateEndpointConnectionInner.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.PrivateEndpointProperty; +import com.azure.resourcemanager.sql.generated.models.PrivateEndpointProvisioningState; +import com.azure.resourcemanager.sql.generated.models.PrivateLinkServiceConnectionStateProperty; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A private endpoint connection. */ +@Fluent +public final class PrivateEndpointConnectionInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private PrivateEndpointConnectionProperties innerProperties; + + /** Creates an instance of PrivateEndpointConnectionInner class. */ + public PrivateEndpointConnectionInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private PrivateEndpointConnectionProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the privateEndpoint property: Private endpoint which the connection belongs to. + * + * @return the privateEndpoint value. + */ + public PrivateEndpointProperty privateEndpoint() { + return this.innerProperties() == null ? null : this.innerProperties().privateEndpoint(); + } + + /** + * Set the privateEndpoint property: Private endpoint which the connection belongs to. + * + * @param privateEndpoint the privateEndpoint value to set. + * @return the PrivateEndpointConnectionInner object itself. + */ + public PrivateEndpointConnectionInner withPrivateEndpoint(PrivateEndpointProperty privateEndpoint) { + if (this.innerProperties() == null) { + this.innerProperties = new PrivateEndpointConnectionProperties(); + } + this.innerProperties().withPrivateEndpoint(privateEndpoint); + return this; + } + + /** + * Get the privateLinkServiceConnectionState property: Connection state of the private endpoint connection. + * + * @return the privateLinkServiceConnectionState value. + */ + public PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState() { + return this.innerProperties() == null ? null : this.innerProperties().privateLinkServiceConnectionState(); + } + + /** + * Set the privateLinkServiceConnectionState property: Connection state of the private endpoint connection. + * + * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set. + * @return the PrivateEndpointConnectionInner object itself. + */ + public PrivateEndpointConnectionInner withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState) { + if (this.innerProperties() == null) { + this.innerProperties = new PrivateEndpointConnectionProperties(); + } + this.innerProperties().withPrivateLinkServiceConnectionState(privateLinkServiceConnectionState); + return this; + } + + /** + * Get the provisioningState property: State of the private endpoint connection. + * + * @return the provisioningState value. + */ + public PrivateEndpointProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/PrivateEndpointConnectionProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/PrivateEndpointConnectionProperties.java new file mode 100644 index 0000000000000..59568fd3381c5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/PrivateEndpointConnectionProperties.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.models.PrivateEndpointProperty; +import com.azure.resourcemanager.sql.generated.models.PrivateEndpointProvisioningState; +import com.azure.resourcemanager.sql.generated.models.PrivateLinkServiceConnectionStateProperty; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a private endpoint connection. */ +@Fluent +public final class PrivateEndpointConnectionProperties { + /* + * Private endpoint which the connection belongs to. + */ + @JsonProperty(value = "privateEndpoint") + private PrivateEndpointProperty privateEndpoint; + + /* + * Connection state of the private endpoint connection. + */ + @JsonProperty(value = "privateLinkServiceConnectionState") + private PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState; + + /* + * State of the private endpoint connection. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private PrivateEndpointProvisioningState provisioningState; + + /** Creates an instance of PrivateEndpointConnectionProperties class. */ + public PrivateEndpointConnectionProperties() { + } + + /** + * Get the privateEndpoint property: Private endpoint which the connection belongs to. + * + * @return the privateEndpoint value. + */ + public PrivateEndpointProperty privateEndpoint() { + return this.privateEndpoint; + } + + /** + * Set the privateEndpoint property: Private endpoint which the connection belongs to. + * + * @param privateEndpoint the privateEndpoint value to set. + * @return the PrivateEndpointConnectionProperties object itself. + */ + public PrivateEndpointConnectionProperties withPrivateEndpoint(PrivateEndpointProperty privateEndpoint) { + this.privateEndpoint = privateEndpoint; + return this; + } + + /** + * Get the privateLinkServiceConnectionState property: Connection state of the private endpoint connection. + * + * @return the privateLinkServiceConnectionState value. + */ + public PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState() { + return this.privateLinkServiceConnectionState; + } + + /** + * Set the privateLinkServiceConnectionState property: Connection state of the private endpoint connection. + * + * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set. + * @return the PrivateEndpointConnectionProperties object itself. + */ + public PrivateEndpointConnectionProperties withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState) { + this.privateLinkServiceConnectionState = privateLinkServiceConnectionState; + return this; + } + + /** + * Get the provisioningState property: State of the private endpoint connection. + * + * @return the provisioningState value. + */ + public PrivateEndpointProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (privateEndpoint() != null) { + privateEndpoint().validate(); + } + if (privateLinkServiceConnectionState() != null) { + privateLinkServiceConnectionState().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/PrivateLinkResourceInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/PrivateLinkResourceInner.java new file mode 100644 index 0000000000000..2045dd52468dd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/PrivateLinkResourceInner.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.PrivateLinkResourceProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A private link resource. */ +@Immutable +public final class PrivateLinkResourceInner extends ProxyResource { + /* + * The private link resource group id. + */ + @JsonProperty(value = "properties", access = JsonProperty.Access.WRITE_ONLY) + private PrivateLinkResourceProperties properties; + + /** Creates an instance of PrivateLinkResourceInner class. */ + public PrivateLinkResourceInner() { + } + + /** + * Get the properties property: The private link resource group id. + * + * @return the properties value. + */ + public PrivateLinkResourceProperties properties() { + return this.properties; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/QueryProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/QueryProperties.java new file mode 100644 index 0000000000000..7a59c7aeebb00 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/QueryProperties.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a database query. */ +@Fluent +public final class QueryProperties { + /* + * Query text. + */ + @JsonProperty(value = "queryText") + private String queryText; + + /** Creates an instance of QueryProperties class. */ + public QueryProperties() { + } + + /** + * Get the queryText property: Query text. + * + * @return the queryText value. + */ + public String queryText() { + return this.queryText; + } + + /** + * Set the queryText property: Query text. + * + * @param queryText the queryText value to set. + * @return the QueryProperties object itself. + */ + public QueryProperties withQueryText(String queryText) { + this.queryText = queryText; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/QueryStatisticsInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/QueryStatisticsInner.java new file mode 100644 index 0000000000000..0d1cddb242d4a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/QueryStatisticsInner.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.QueryMetricInterval; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The QueryStatistics model. */ +@Fluent +public final class QueryStatisticsInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private QueryStatisticsProperties innerProperties; + + /** Creates an instance of QueryStatisticsInner class. */ + public QueryStatisticsInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private QueryStatisticsProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the databaseName property: Database name of the database in which this query was executed. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.innerProperties() == null ? null : this.innerProperties().databaseName(); + } + + /** + * Get the queryId property: Unique query id (unique within one database). + * + * @return the queryId value. + */ + public String queryId() { + return this.innerProperties() == null ? null : this.innerProperties().queryId(); + } + + /** + * Get the startTime property: The start time for the metric (ISO-8601 format). + * + * @return the startTime value. + */ + public String startTime() { + return this.innerProperties() == null ? null : this.innerProperties().startTime(); + } + + /** + * Get the endTime property: The end time for the metric (ISO-8601 format). + * + * @return the endTime value. + */ + public String endTime() { + return this.innerProperties() == null ? null : this.innerProperties().endTime(); + } + + /** + * Get the intervals property: List of intervals with appropriate metric data. + * + * @return the intervals value. + */ + public List intervals() { + return this.innerProperties() == null ? null : this.innerProperties().intervals(); + } + + /** + * Set the intervals property: List of intervals with appropriate metric data. + * + * @param intervals the intervals value to set. + * @return the QueryStatisticsInner object itself. + */ + public QueryStatisticsInner withIntervals(List intervals) { + if (this.innerProperties() == null) { + this.innerProperties = new QueryStatisticsProperties(); + } + this.innerProperties().withIntervals(intervals); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/QueryStatisticsProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/QueryStatisticsProperties.java new file mode 100644 index 0000000000000..1b7396a244d56 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/QueryStatisticsProperties.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.models.QueryMetricInterval; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of a query execution statistics. */ +@Fluent +public final class QueryStatisticsProperties { + /* + * Database name of the database in which this query was executed. + */ + @JsonProperty(value = "databaseName", access = JsonProperty.Access.WRITE_ONLY) + private String databaseName; + + /* + * Unique query id (unique within one database). + */ + @JsonProperty(value = "queryId", access = JsonProperty.Access.WRITE_ONLY) + private String queryId; + + /* + * The start time for the metric (ISO-8601 format). + */ + @JsonProperty(value = "startTime", access = JsonProperty.Access.WRITE_ONLY) + private String startTime; + + /* + * The end time for the metric (ISO-8601 format). + */ + @JsonProperty(value = "endTime", access = JsonProperty.Access.WRITE_ONLY) + private String endTime; + + /* + * List of intervals with appropriate metric data + */ + @JsonProperty(value = "intervals") + private List intervals; + + /** Creates an instance of QueryStatisticsProperties class. */ + public QueryStatisticsProperties() { + } + + /** + * Get the databaseName property: Database name of the database in which this query was executed. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Get the queryId property: Unique query id (unique within one database). + * + * @return the queryId value. + */ + public String queryId() { + return this.queryId; + } + + /** + * Get the startTime property: The start time for the metric (ISO-8601 format). + * + * @return the startTime value. + */ + public String startTime() { + return this.startTime; + } + + /** + * Get the endTime property: The end time for the metric (ISO-8601 format). + * + * @return the endTime value. + */ + public String endTime() { + return this.endTime; + } + + /** + * Get the intervals property: List of intervals with appropriate metric data. + * + * @return the intervals value. + */ + public List intervals() { + return this.intervals; + } + + /** + * Set the intervals property: List of intervals with appropriate metric data. + * + * @param intervals the intervals value to set. + * @return the QueryStatisticsProperties object itself. + */ + public QueryStatisticsProperties withIntervals(List intervals) { + this.intervals = intervals; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (intervals() != null) { + intervals().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RecommendedActionInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RecommendedActionInner.java new file mode 100644 index 0000000000000..1bd51e6739c8e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RecommendedActionInner.java @@ -0,0 +1,316 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.RecommendedActionErrorInfo; +import com.azure.resourcemanager.sql.generated.models.RecommendedActionImpactRecord; +import com.azure.resourcemanager.sql.generated.models.RecommendedActionImplementationInfo; +import com.azure.resourcemanager.sql.generated.models.RecommendedActionInitiatedBy; +import com.azure.resourcemanager.sql.generated.models.RecommendedActionMetricInfo; +import com.azure.resourcemanager.sql.generated.models.RecommendedActionStateInfo; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** Database, Server or Elastic Pool Recommended Action. */ +@Fluent +public final 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; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private RecommendedActionProperties innerProperties; + + /** Creates an instance of RecommendedActionInner class. */ + public RecommendedActionInner() { + } + + /** + * Get the kind property: Resource kind. + * + * @return the kind value. + */ + public String kind() { + return this.kind; + } + + /** + * Get the location property: Resource location. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private RecommendedActionProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the recommendationReason property: Gets the reason for recommending this action. e.g., DuplicateIndex. + * + * @return the recommendationReason value. + */ + public String recommendationReason() { + return this.innerProperties() == null ? null : this.innerProperties().recommendationReason(); + } + + /** + * Get the validSince property: Gets the time since when this recommended action is valid. + * + * @return the validSince value. + */ + public OffsetDateTime validSince() { + return this.innerProperties() == null ? null : this.innerProperties().validSince(); + } + + /** + * Get the lastRefresh property: Gets time when this recommended action was last refreshed. + * + * @return the lastRefresh value. + */ + public OffsetDateTime lastRefresh() { + return this.innerProperties() == null ? null : this.innerProperties().lastRefresh(); + } + + /** + * Get the state property: Gets the info of the current state the recommended action is in. + * + * @return the state value. + */ + public RecommendedActionStateInfo state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Set the state property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new RecommendedActionProperties(); + } + this.innerProperties().withState(state); + return this; + } + + /** + * Get the isExecutableAction property: Gets if this recommended action is actionable by user. + * + * @return the isExecutableAction value. + */ + public Boolean isExecutableAction() { + return this.innerProperties() == null ? null : this.innerProperties().isExecutableAction(); + } + + /** + * Get the isRevertableAction property: Gets if changes applied by this recommended action can be reverted by user. + * + * @return the isRevertableAction value. + */ + public Boolean isRevertableAction() { + return this.innerProperties() == null ? null : this.innerProperties().isRevertableAction(); + } + + /** + * Get the isArchivedAction property: 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.innerProperties() == null ? null : this.innerProperties().isArchivedAction(); + } + + /** + * Get the executeActionStartTime property: 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 OffsetDateTime executeActionStartTime() { + return this.innerProperties() == null ? null : this.innerProperties().executeActionStartTime(); + } + + /** + * Get the executeActionDuration property: 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.innerProperties() == null ? null : this.innerProperties().executeActionDuration(); + } + + /** + * Get the revertActionStartTime property: 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 OffsetDateTime revertActionStartTime() { + return this.innerProperties() == null ? null : this.innerProperties().revertActionStartTime(); + } + + /** + * Get the revertActionDuration property: 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.innerProperties() == null ? null : this.innerProperties().revertActionDuration(); + } + + /** + * Get the executeActionInitiatedBy property: Gets if approval for applying this recommended action was given by + * user/system. + * + * @return the executeActionInitiatedBy value. + */ + public RecommendedActionInitiatedBy executeActionInitiatedBy() { + return this.innerProperties() == null ? null : this.innerProperties().executeActionInitiatedBy(); + } + + /** + * Get the executeActionInitiatedTime property: Gets the time when this recommended action was approved for + * execution. + * + * @return the executeActionInitiatedTime value. + */ + public OffsetDateTime executeActionInitiatedTime() { + return this.innerProperties() == null ? null : this.innerProperties().executeActionInitiatedTime(); + } + + /** + * Get the revertActionInitiatedBy property: Gets if approval for reverting this recommended action was given by + * user/system. + * + * @return the revertActionInitiatedBy value. + */ + public RecommendedActionInitiatedBy revertActionInitiatedBy() { + return this.innerProperties() == null ? null : this.innerProperties().revertActionInitiatedBy(); + } + + /** + * Get the revertActionInitiatedTime property: Gets the time when this recommended action was approved for revert. + * + * @return the revertActionInitiatedTime value. + */ + public OffsetDateTime revertActionInitiatedTime() { + return this.innerProperties() == null ? null : this.innerProperties().revertActionInitiatedTime(); + } + + /** + * Get the score property: 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.innerProperties() == null ? null : this.innerProperties().score(); + } + + /** + * Get the implementationDetails property: Gets the implementation details of this recommended action for user to + * apply it manually. + * + * @return the implementationDetails value. + */ + public RecommendedActionImplementationInfo implementationDetails() { + return this.innerProperties() == null ? null : this.innerProperties().implementationDetails(); + } + + /** + * Get the errorDetails property: Gets the error details if and why this recommended action is put to error state. + * + * @return the errorDetails value. + */ + public RecommendedActionErrorInfo errorDetails() { + return this.innerProperties() == null ? null : this.innerProperties().errorDetails(); + } + + /** + * Get the estimatedImpact property: 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.innerProperties() == null ? null : this.innerProperties().estimatedImpact(); + } + + /** + * Get the observedImpact property: 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.innerProperties() == null ? null : this.innerProperties().observedImpact(); + } + + /** + * Get the timeSeries property: 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.innerProperties() == null ? null : this.innerProperties().timeSeries(); + } + + /** + * Get the linkedObjects property: Gets the linked objects, if any. + * + * @return the linkedObjects value. + */ + public List linkedObjects() { + return this.innerProperties() == null ? null : this.innerProperties().linkedObjects(); + } + + /** + * Get the details property: Gets additional details specific to this recommended action. + * + * @return the details value. + */ + public Map details() { + return this.innerProperties() == null ? null : this.innerProperties().details(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RecommendedActionProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RecommendedActionProperties.java new file mode 100644 index 0000000000000..511647a7913d9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RecommendedActionProperties.java @@ -0,0 +1,435 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.RecommendedActionErrorInfo; +import com.azure.resourcemanager.sql.generated.models.RecommendedActionImpactRecord; +import com.azure.resourcemanager.sql.generated.models.RecommendedActionImplementationInfo; +import com.azure.resourcemanager.sql.generated.models.RecommendedActionInitiatedBy; +import com.azure.resourcemanager.sql.generated.models.RecommendedActionMetricInfo; +import com.azure.resourcemanager.sql.generated.models.RecommendedActionStateInfo; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** Properties for a Database, Server or Elastic Pool Recommended Action. */ +@Fluent +public final class RecommendedActionProperties { + /* + * Gets the reason for recommending this action. e.g., DuplicateIndex + */ + @JsonProperty(value = "recommendationReason", access = JsonProperty.Access.WRITE_ONLY) + private String recommendationReason; + + /* + * Gets the time since when this recommended action is valid. + */ + @JsonProperty(value = "validSince", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime validSince; + + /* + * Gets time when this recommended action was last refreshed. + */ + @JsonProperty(value = "lastRefresh", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastRefresh; + + /* + * Gets the info of the current state the recommended action is in. + */ + @JsonProperty(value = "state", required = true) + private RecommendedActionStateInfo state; + + /* + * Gets if this recommended action is actionable by user + */ + @JsonProperty(value = "isExecutableAction", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isExecutableAction; + + /* + * Gets if changes applied by this recommended action can be reverted by user + */ + @JsonProperty(value = "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 = "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 = "executeActionStartTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime executeActionStartTime; + + /* + * Gets the time taken for applying this recommended action on user resource. e.g., time taken for index creation + */ + @JsonProperty(value = "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 = "revertActionStartTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime 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 = "revertActionDuration", access = JsonProperty.Access.WRITE_ONLY) + private String revertActionDuration; + + /* + * Gets if approval for applying this recommended action was given by user/system. + */ + @JsonProperty(value = "executeActionInitiatedBy", access = JsonProperty.Access.WRITE_ONLY) + private RecommendedActionInitiatedBy executeActionInitiatedBy; + + /* + * Gets the time when this recommended action was approved for execution. + */ + @JsonProperty(value = "executeActionInitiatedTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime executeActionInitiatedTime; + + /* + * Gets if approval for reverting this recommended action was given by user/system. + */ + @JsonProperty(value = "revertActionInitiatedBy", access = JsonProperty.Access.WRITE_ONLY) + private RecommendedActionInitiatedBy revertActionInitiatedBy; + + /* + * Gets the time when this recommended action was approved for revert. + */ + @JsonProperty(value = "revertActionInitiatedTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime revertActionInitiatedTime; + + /* + * Gets the impact of this recommended action. Possible values are 1 - Low impact, 2 - Medium Impact and 3 - High + * Impact + */ + @JsonProperty(value = "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 = "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 = "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 = "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 = "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 = "timeSeries", access = JsonProperty.Access.WRITE_ONLY) + private List timeSeries; + + /* + * Gets the linked objects, if any. + */ + @JsonProperty(value = "linkedObjects", access = JsonProperty.Access.WRITE_ONLY) + private List linkedObjects; + + /* + * Gets additional details specific to this recommended action. + */ + @JsonProperty(value = "details", access = JsonProperty.Access.WRITE_ONLY) + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map details; + + /** Creates an instance of RecommendedActionProperties class. */ + public RecommendedActionProperties() { + } + + /** + * Get the recommendationReason property: Gets the reason for recommending this action. e.g., DuplicateIndex. + * + * @return the recommendationReason value. + */ + public String recommendationReason() { + return this.recommendationReason; + } + + /** + * Get the validSince property: Gets the time since when this recommended action is valid. + * + * @return the validSince value. + */ + public OffsetDateTime validSince() { + return this.validSince; + } + + /** + * Get the lastRefresh property: Gets time when this recommended action was last refreshed. + * + * @return the lastRefresh value. + */ + public OffsetDateTime lastRefresh() { + return this.lastRefresh; + } + + /** + * Get the state property: Gets the info of the current state the recommended action is in. + * + * @return the state value. + */ + public RecommendedActionStateInfo state() { + return this.state; + } + + /** + * Set the state property: Gets the info of the current state the recommended action is in. + * + * @param state the state value to set. + * @return the RecommendedActionProperties object itself. + */ + public RecommendedActionProperties withState(RecommendedActionStateInfo state) { + this.state = state; + return this; + } + + /** + * Get the isExecutableAction property: Gets if this recommended action is actionable by user. + * + * @return the isExecutableAction value. + */ + public Boolean isExecutableAction() { + return this.isExecutableAction; + } + + /** + * Get the isRevertableAction property: Gets if changes applied by this recommended action can be reverted by user. + * + * @return the isRevertableAction value. + */ + public Boolean isRevertableAction() { + return this.isRevertableAction; + } + + /** + * Get the isArchivedAction property: 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 the executeActionStartTime property: 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 OffsetDateTime executeActionStartTime() { + return this.executeActionStartTime; + } + + /** + * Get the executeActionDuration property: 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 the revertActionStartTime property: 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 OffsetDateTime revertActionStartTime() { + return this.revertActionStartTime; + } + + /** + * Get the revertActionDuration property: 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 the executeActionInitiatedBy property: Gets if approval for applying this recommended action was given by + * user/system. + * + * @return the executeActionInitiatedBy value. + */ + public RecommendedActionInitiatedBy executeActionInitiatedBy() { + return this.executeActionInitiatedBy; + } + + /** + * Get the executeActionInitiatedTime property: Gets the time when this recommended action was approved for + * execution. + * + * @return the executeActionInitiatedTime value. + */ + public OffsetDateTime executeActionInitiatedTime() { + return this.executeActionInitiatedTime; + } + + /** + * Get the revertActionInitiatedBy property: Gets if approval for reverting this recommended action was given by + * user/system. + * + * @return the revertActionInitiatedBy value. + */ + public RecommendedActionInitiatedBy revertActionInitiatedBy() { + return this.revertActionInitiatedBy; + } + + /** + * Get the revertActionInitiatedTime property: Gets the time when this recommended action was approved for revert. + * + * @return the revertActionInitiatedTime value. + */ + public OffsetDateTime revertActionInitiatedTime() { + return this.revertActionInitiatedTime; + } + + /** + * Get the score property: 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 the implementationDetails property: 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 the errorDetails property: 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 the estimatedImpact property: 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 the observedImpact property: 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 the timeSeries property: 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 the linkedObjects property: Gets the linked objects, if any. + * + * @return the linkedObjects value. + */ + public List linkedObjects() { + return this.linkedObjects; + } + + /** + * Get the details property: Gets additional details specific to this recommended action. + * + * @return the details value. + */ + public Map details() { + return this.details; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (state() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property state in model RecommendedActionProperties")); + } else { + state().validate(); + } + if (implementationDetails() != null) { + implementationDetails().validate(); + } + if (errorDetails() != null) { + errorDetails().validate(); + } + if (estimatedImpact() != null) { + estimatedImpact().forEach(e -> e.validate()); + } + if (observedImpact() != null) { + observedImpact().forEach(e -> e.validate()); + } + if (timeSeries() != null) { + timeSeries().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(RecommendedActionProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RecommendedSensitivityLabelUpdateProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RecommendedSensitivityLabelUpdateProperties.java new file mode 100644 index 0000000000000..48025e86b9a07 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RecommendedSensitivityLabelUpdateProperties.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.RecommendedSensitivityLabelUpdateKind; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of an operation executed on a recommended sensitivity label. */ +@Fluent +public final class RecommendedSensitivityLabelUpdateProperties { + /* + * The op property. + */ + @JsonProperty(value = "op", required = true) + private RecommendedSensitivityLabelUpdateKind op; + + /* + * Schema name of the column to update. + */ + @JsonProperty(value = "schema", required = true) + private String schema; + + /* + * Table name of the column to update. + */ + @JsonProperty(value = "table", required = true) + private String table; + + /* + * Column name to update. + */ + @JsonProperty(value = "column", required = true) + private String column; + + /** Creates an instance of RecommendedSensitivityLabelUpdateProperties class. */ + public RecommendedSensitivityLabelUpdateProperties() { + } + + /** + * Get the op property: The op property. + * + * @return the op value. + */ + public RecommendedSensitivityLabelUpdateKind op() { + return this.op; + } + + /** + * Set the op property: The op property. + * + * @param op the op value to set. + * @return the RecommendedSensitivityLabelUpdateProperties object itself. + */ + public RecommendedSensitivityLabelUpdateProperties withOp(RecommendedSensitivityLabelUpdateKind op) { + this.op = op; + return this; + } + + /** + * Get the schema property: Schema name of the column to update. + * + * @return the schema value. + */ + public String schema() { + return this.schema; + } + + /** + * Set the schema property: Schema name of the column to update. + * + * @param schema the schema value to set. + * @return the RecommendedSensitivityLabelUpdateProperties object itself. + */ + public RecommendedSensitivityLabelUpdateProperties withSchema(String schema) { + this.schema = schema; + return this; + } + + /** + * Get the table property: Table name of the column to update. + * + * @return the table value. + */ + public String table() { + return this.table; + } + + /** + * Set the table property: Table name of the column to update. + * + * @param table the table value to set. + * @return the RecommendedSensitivityLabelUpdateProperties object itself. + */ + public RecommendedSensitivityLabelUpdateProperties withTable(String table) { + this.table = table; + return this; + } + + /** + * Get the column property: Column name to update. + * + * @return the column value. + */ + public String column() { + return this.column; + } + + /** + * Set the column property: Column name to update. + * + * @param column the column value to set. + * @return the RecommendedSensitivityLabelUpdateProperties object itself. + */ + public RecommendedSensitivityLabelUpdateProperties withColumn(String column) { + this.column = column; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (op() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property op in model RecommendedSensitivityLabelUpdateProperties")); + } + if (schema() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property schema in model RecommendedSensitivityLabelUpdateProperties")); + } + if (table() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property table in model RecommendedSensitivityLabelUpdateProperties")); + } + if (column() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property column in model RecommendedSensitivityLabelUpdateProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(RecommendedSensitivityLabelUpdateProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RecoverableDatabaseInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RecoverableDatabaseInner.java new file mode 100644 index 0000000000000..0b1b780b91546 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RecoverableDatabaseInner.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** A recoverable database. */ +@Immutable +public final class RecoverableDatabaseInner extends ProxyResource { + /* + * The properties of a recoverable database + */ + @JsonProperty(value = "properties") + private RecoverableDatabaseProperties innerProperties; + + /** Creates an instance of RecoverableDatabaseInner class. */ + public RecoverableDatabaseInner() { + } + + /** + * Get the innerProperties property: The properties of a recoverable database. + * + * @return the innerProperties value. + */ + private RecoverableDatabaseProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the edition property: The edition of the database. + * + * @return the edition value. + */ + public String edition() { + return this.innerProperties() == null ? null : this.innerProperties().edition(); + } + + /** + * Get the serviceLevelObjective property: The service level objective name of the database. + * + * @return the serviceLevelObjective value. + */ + public String serviceLevelObjective() { + return this.innerProperties() == null ? null : this.innerProperties().serviceLevelObjective(); + } + + /** + * Get the elasticPoolName property: The elastic pool name of the database. + * + * @return the elasticPoolName value. + */ + public String elasticPoolName() { + return this.innerProperties() == null ? null : this.innerProperties().elasticPoolName(); + } + + /** + * Get the lastAvailableBackupDate property: The last available backup date of the database (ISO8601 format). + * + * @return the lastAvailableBackupDate value. + */ + public OffsetDateTime lastAvailableBackupDate() { + return this.innerProperties() == null ? null : this.innerProperties().lastAvailableBackupDate(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RecoverableDatabaseProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RecoverableDatabaseProperties.java new file mode 100644 index 0000000000000..2df8b13b4e019 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RecoverableDatabaseProperties.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The properties of a recoverable database. */ +@Immutable +public final class RecoverableDatabaseProperties { + /* + * The edition of the database + */ + @JsonProperty(value = "edition", access = JsonProperty.Access.WRITE_ONLY) + private String edition; + + /* + * The service level objective name of the database + */ + @JsonProperty(value = "serviceLevelObjective", access = JsonProperty.Access.WRITE_ONLY) + private String serviceLevelObjective; + + /* + * The elastic pool name of the database + */ + @JsonProperty(value = "elasticPoolName", access = JsonProperty.Access.WRITE_ONLY) + private String elasticPoolName; + + /* + * The last available backup date of the database (ISO8601 format) + */ + @JsonProperty(value = "lastAvailableBackupDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastAvailableBackupDate; + + /** Creates an instance of RecoverableDatabaseProperties class. */ + public RecoverableDatabaseProperties() { + } + + /** + * Get the edition property: The edition of the database. + * + * @return the edition value. + */ + public String edition() { + return this.edition; + } + + /** + * Get the serviceLevelObjective property: The service level objective name of the database. + * + * @return the serviceLevelObjective value. + */ + public String serviceLevelObjective() { + return this.serviceLevelObjective; + } + + /** + * Get the elasticPoolName property: The elastic pool name of the database. + * + * @return the elasticPoolName value. + */ + public String elasticPoolName() { + return this.elasticPoolName; + } + + /** + * Get the lastAvailableBackupDate property: The last available backup date of the database (ISO8601 format). + * + * @return the lastAvailableBackupDate value. + */ + public OffsetDateTime lastAvailableBackupDate() { + return this.lastAvailableBackupDate; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RecoverableManagedDatabaseInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RecoverableManagedDatabaseInner.java new file mode 100644 index 0000000000000..cc50bf7bd6fe2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RecoverableManagedDatabaseInner.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A recoverable managed database resource. */ +@Immutable +public final class RecoverableManagedDatabaseInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private RecoverableManagedDatabaseProperties innerProperties; + + /** Creates an instance of RecoverableManagedDatabaseInner class. */ + public RecoverableManagedDatabaseInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private RecoverableManagedDatabaseProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the lastAvailableBackupDate property: The last available backup date. + * + * @return the lastAvailableBackupDate value. + */ + public String lastAvailableBackupDate() { + return this.innerProperties() == null ? null : this.innerProperties().lastAvailableBackupDate(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RecoverableManagedDatabaseProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RecoverableManagedDatabaseProperties.java new file mode 100644 index 0000000000000..8c89eb4c9ba41 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RecoverableManagedDatabaseProperties.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The recoverable managed database's properties. */ +@Immutable +public final class RecoverableManagedDatabaseProperties { + /* + * The last available backup date. + */ + @JsonProperty(value = "lastAvailableBackupDate", access = JsonProperty.Access.WRITE_ONLY) + private String lastAvailableBackupDate; + + /** Creates an instance of RecoverableManagedDatabaseProperties class. */ + public RecoverableManagedDatabaseProperties() { + } + + /** + * Get the lastAvailableBackupDate property: The last available backup date. + * + * @return the lastAvailableBackupDate value. + */ + public String lastAvailableBackupDate() { + return this.lastAvailableBackupDate; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ReplicationLinkInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ReplicationLinkInner.java new file mode 100644 index 0000000000000..301066fbec7ed --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ReplicationLinkInner.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.ReplicationLinkType; +import com.azure.resourcemanager.sql.generated.models.ReplicationRole; +import com.azure.resourcemanager.sql.generated.models.ReplicationState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** A replication link. */ +@Immutable +public final class ReplicationLinkInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ReplicationLinkProperties innerProperties; + + /** Creates an instance of ReplicationLinkInner class. */ + public ReplicationLinkInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ReplicationLinkProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the partnerServer property: Resource partner server. + * + * @return the partnerServer value. + */ + public String partnerServer() { + return this.innerProperties() == null ? null : this.innerProperties().partnerServer(); + } + + /** + * Get the partnerDatabase property: Resource partner database. + * + * @return the partnerDatabase value. + */ + public String partnerDatabase() { + return this.innerProperties() == null ? null : this.innerProperties().partnerDatabase(); + } + + /** + * Get the partnerLocation property: Resource partner location. + * + * @return the partnerLocation value. + */ + public String partnerLocation() { + return this.innerProperties() == null ? null : this.innerProperties().partnerLocation(); + } + + /** + * Get the role property: Local replication role. + * + * @return the role value. + */ + public ReplicationRole role() { + return this.innerProperties() == null ? null : this.innerProperties().role(); + } + + /** + * Get the partnerRole property: Partner replication role. + * + * @return the partnerRole value. + */ + public ReplicationRole partnerRole() { + return this.innerProperties() == null ? null : this.innerProperties().partnerRole(); + } + + /** + * Get the replicationMode property: Replication mode. + * + * @return the replicationMode value. + */ + public String replicationMode() { + return this.innerProperties() == null ? null : this.innerProperties().replicationMode(); + } + + /** + * Get the startTime property: Time at which the link was created. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.innerProperties() == null ? null : this.innerProperties().startTime(); + } + + /** + * Get the percentComplete property: Seeding completion percentage for the link. + * + * @return the percentComplete value. + */ + public Integer percentComplete() { + return this.innerProperties() == null ? null : this.innerProperties().percentComplete(); + } + + /** + * Get the replicationState property: Replication state (PENDING, SEEDING, CATCHUP, SUSPENDED). + * + * @return the replicationState value. + */ + public ReplicationState replicationState() { + return this.innerProperties() == null ? null : this.innerProperties().replicationState(); + } + + /** + * Get the isTerminationAllowed property: Whether the user is currently allowed to terminate the link. + * + * @return the isTerminationAllowed value. + */ + public Boolean isTerminationAllowed() { + return this.innerProperties() == null ? null : this.innerProperties().isTerminationAllowed(); + } + + /** + * Get the linkType property: Link type (GEO, NAMED, STANDBY). + * + * @return the linkType value. + */ + public ReplicationLinkType linkType() { + return this.innerProperties() == null ? null : this.innerProperties().linkType(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ReplicationLinkProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ReplicationLinkProperties.java new file mode 100644 index 0000000000000..5245635485002 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ReplicationLinkProperties.java @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.models.ReplicationLinkType; +import com.azure.resourcemanager.sql.generated.models.ReplicationRole; +import com.azure.resourcemanager.sql.generated.models.ReplicationState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Properties of a replication link. */ +@Immutable +public final class ReplicationLinkProperties { + /* + * Resource partner server. + */ + @JsonProperty(value = "partnerServer", access = JsonProperty.Access.WRITE_ONLY) + private String partnerServer; + + /* + * Resource partner database. + */ + @JsonProperty(value = "partnerDatabase", access = JsonProperty.Access.WRITE_ONLY) + private String partnerDatabase; + + /* + * Resource partner location. + */ + @JsonProperty(value = "partnerLocation", access = JsonProperty.Access.WRITE_ONLY) + private String partnerLocation; + + /* + * Local replication role. + */ + @JsonProperty(value = "role", access = JsonProperty.Access.WRITE_ONLY) + private ReplicationRole role; + + /* + * Partner replication role. + */ + @JsonProperty(value = "partnerRole", access = JsonProperty.Access.WRITE_ONLY) + private ReplicationRole partnerRole; + + /* + * Replication mode. + */ + @JsonProperty(value = "replicationMode", access = JsonProperty.Access.WRITE_ONLY) + private String replicationMode; + + /* + * Time at which the link was created. + */ + @JsonProperty(value = "startTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime startTime; + + /* + * Seeding completion percentage for the link. + */ + @JsonProperty(value = "percentComplete", access = JsonProperty.Access.WRITE_ONLY) + private Integer percentComplete; + + /* + * Replication state (PENDING, SEEDING, CATCHUP, SUSPENDED). + */ + @JsonProperty(value = "replicationState", access = JsonProperty.Access.WRITE_ONLY) + private ReplicationState replicationState; + + /* + * Whether the user is currently allowed to terminate the link. + */ + @JsonProperty(value = "isTerminationAllowed", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isTerminationAllowed; + + /* + * Link type (GEO, NAMED, STANDBY). + */ + @JsonProperty(value = "linkType", access = JsonProperty.Access.WRITE_ONLY) + private ReplicationLinkType linkType; + + /** Creates an instance of ReplicationLinkProperties class. */ + public ReplicationLinkProperties() { + } + + /** + * Get the partnerServer property: Resource partner server. + * + * @return the partnerServer value. + */ + public String partnerServer() { + return this.partnerServer; + } + + /** + * Get the partnerDatabase property: Resource partner database. + * + * @return the partnerDatabase value. + */ + public String partnerDatabase() { + return this.partnerDatabase; + } + + /** + * Get the partnerLocation property: Resource partner location. + * + * @return the partnerLocation value. + */ + public String partnerLocation() { + return this.partnerLocation; + } + + /** + * Get the role property: Local replication role. + * + * @return the role value. + */ + public ReplicationRole role() { + return this.role; + } + + /** + * Get the partnerRole property: Partner replication role. + * + * @return the partnerRole value. + */ + public ReplicationRole partnerRole() { + return this.partnerRole; + } + + /** + * Get the replicationMode property: Replication mode. + * + * @return the replicationMode value. + */ + public String replicationMode() { + return this.replicationMode; + } + + /** + * Get the startTime property: Time at which the link was created. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Get the percentComplete property: Seeding completion percentage for the link. + * + * @return the percentComplete value. + */ + public Integer percentComplete() { + return this.percentComplete; + } + + /** + * Get the replicationState property: Replication state (PENDING, SEEDING, CATCHUP, SUSPENDED). + * + * @return the replicationState value. + */ + public ReplicationState replicationState() { + return this.replicationState; + } + + /** + * Get the isTerminationAllowed property: Whether the user is currently allowed to terminate the link. + * + * @return the isTerminationAllowed value. + */ + public Boolean isTerminationAllowed() { + return this.isTerminationAllowed; + } + + /** + * Get the linkType property: Link type (GEO, NAMED, STANDBY). + * + * @return the linkType value. + */ + public ReplicationLinkType linkType() { + return this.linkType; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RestorableDroppedDatabaseInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RestorableDroppedDatabaseInner.java new file mode 100644 index 0000000000000..53185aba32553 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RestorableDroppedDatabaseInner.java @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.azure.resourcemanager.sql.generated.models.Sku; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.Map; + +/** A restorable dropped database resource. */ +@Fluent +public final class RestorableDroppedDatabaseInner extends ProxyResource { + /* + * The name and tier of the SKU. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /* + * Resource location. + */ + @JsonProperty(value = "location") + private String location; + + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private RestorableDroppedDatabaseProperties innerProperties; + + /** Creates an instance of RestorableDroppedDatabaseInner class. */ + public RestorableDroppedDatabaseInner() { + } + + /** + * Get the sku property: The name and tier of the SKU. + * + * @return the sku value. + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku property: The name and tier of the SKU. + * + * @param sku the sku value to set. + * @return the RestorableDroppedDatabaseInner object itself. + */ + public RestorableDroppedDatabaseInner withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the location property: Resource location. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: Resource location. + * + * @param location the location value to set. + * @return the RestorableDroppedDatabaseInner object itself. + */ + public RestorableDroppedDatabaseInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the RestorableDroppedDatabaseInner object itself. + */ + public RestorableDroppedDatabaseInner withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private RestorableDroppedDatabaseProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the databaseName property: The name of the database. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.innerProperties() == null ? null : this.innerProperties().databaseName(); + } + + /** + * Get the maxSizeBytes property: The max size of the database expressed in bytes. + * + * @return the maxSizeBytes value. + */ + public Long maxSizeBytes() { + return this.innerProperties() == null ? null : this.innerProperties().maxSizeBytes(); + } + + /** + * Get the creationDate property: The creation date of the database (ISO8601 format). + * + * @return the creationDate value. + */ + public OffsetDateTime creationDate() { + return this.innerProperties() == null ? null : this.innerProperties().creationDate(); + } + + /** + * Get the deletionDate property: The deletion date of the database (ISO8601 format). + * + * @return the deletionDate value. + */ + public OffsetDateTime deletionDate() { + return this.innerProperties() == null ? null : this.innerProperties().deletionDate(); + } + + /** + * Get the earliestRestoreDate property: The earliest restore date of the database (ISO8601 format). + * + * @return the earliestRestoreDate value. + */ + public OffsetDateTime earliestRestoreDate() { + return this.innerProperties() == null ? null : this.innerProperties().earliestRestoreDate(); + } + + /** + * Get the backupStorageRedundancy property: The storage account type used to store backups for this database. + * + * @return the backupStorageRedundancy value. + */ + public BackupStorageRedundancy backupStorageRedundancy() { + return this.innerProperties() == null ? null : this.innerProperties().backupStorageRedundancy(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RestorableDroppedDatabaseProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RestorableDroppedDatabaseProperties.java new file mode 100644 index 0000000000000..acf5bb8b458e4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RestorableDroppedDatabaseProperties.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The restorable dropped database's properties. */ +@Immutable +public final class RestorableDroppedDatabaseProperties { + /* + * The name of the database. + */ + @JsonProperty(value = "databaseName", access = JsonProperty.Access.WRITE_ONLY) + private String databaseName; + + /* + * The max size of the database expressed in bytes. + */ + @JsonProperty(value = "maxSizeBytes", access = JsonProperty.Access.WRITE_ONLY) + private Long maxSizeBytes; + + /* + * The creation date of the database (ISO8601 format). + */ + @JsonProperty(value = "creationDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime creationDate; + + /* + * The deletion date of the database (ISO8601 format). + */ + @JsonProperty(value = "deletionDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime deletionDate; + + /* + * The earliest restore date of the database (ISO8601 format). + */ + @JsonProperty(value = "earliestRestoreDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime earliestRestoreDate; + + /* + * The storage account type used to store backups for this database. + */ + @JsonProperty(value = "backupStorageRedundancy", access = JsonProperty.Access.WRITE_ONLY) + private BackupStorageRedundancy backupStorageRedundancy; + + /** Creates an instance of RestorableDroppedDatabaseProperties class. */ + public RestorableDroppedDatabaseProperties() { + } + + /** + * Get the databaseName property: The name of the database. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Get the maxSizeBytes property: The max size of the database expressed in bytes. + * + * @return the maxSizeBytes value. + */ + public Long maxSizeBytes() { + return this.maxSizeBytes; + } + + /** + * Get the creationDate property: The creation date of the database (ISO8601 format). + * + * @return the creationDate value. + */ + public OffsetDateTime creationDate() { + return this.creationDate; + } + + /** + * Get the deletionDate property: The deletion date of the database (ISO8601 format). + * + * @return the deletionDate value. + */ + public OffsetDateTime deletionDate() { + return this.deletionDate; + } + + /** + * Get the earliestRestoreDate property: The earliest restore date of the database (ISO8601 format). + * + * @return the earliestRestoreDate value. + */ + public OffsetDateTime earliestRestoreDate() { + return this.earliestRestoreDate; + } + + /** + * Get the backupStorageRedundancy property: The storage account type used to store backups for this database. + * + * @return the backupStorageRedundancy value. + */ + public BackupStorageRedundancy backupStorageRedundancy() { + return this.backupStorageRedundancy; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RestorableDroppedManagedDatabaseInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RestorableDroppedManagedDatabaseInner.java new file mode 100644 index 0000000000000..52645235442a2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RestorableDroppedManagedDatabaseInner.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.Map; + +/** A restorable dropped managed database resource. */ +@Fluent +public final class RestorableDroppedManagedDatabaseInner extends Resource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private RestorableDroppedManagedDatabaseProperties innerProperties; + + /** Creates an instance of RestorableDroppedManagedDatabaseInner class. */ + public RestorableDroppedManagedDatabaseInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private RestorableDroppedManagedDatabaseProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public RestorableDroppedManagedDatabaseInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public RestorableDroppedManagedDatabaseInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the databaseName property: The name of the database. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.innerProperties() == null ? null : this.innerProperties().databaseName(); + } + + /** + * Get the creationDate property: The creation date of the database (ISO8601 format). + * + * @return the creationDate value. + */ + public OffsetDateTime creationDate() { + return this.innerProperties() == null ? null : this.innerProperties().creationDate(); + } + + /** + * Get the deletionDate property: The deletion date of the database (ISO8601 format). + * + * @return the deletionDate value. + */ + public OffsetDateTime deletionDate() { + return this.innerProperties() == null ? null : this.innerProperties().deletionDate(); + } + + /** + * Get the earliestRestoreDate property: The earliest restore date of the database (ISO8601 format). + * + * @return the earliestRestoreDate value. + */ + public OffsetDateTime earliestRestoreDate() { + return this.innerProperties() == null ? null : this.innerProperties().earliestRestoreDate(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RestorableDroppedManagedDatabaseProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RestorableDroppedManagedDatabaseProperties.java new file mode 100644 index 0000000000000..4457115ad3977 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RestorableDroppedManagedDatabaseProperties.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The restorable dropped managed database's properties. */ +@Immutable +public final class RestorableDroppedManagedDatabaseProperties { + /* + * The name of the database. + */ + @JsonProperty(value = "databaseName", access = JsonProperty.Access.WRITE_ONLY) + private String databaseName; + + /* + * The creation date of the database (ISO8601 format). + */ + @JsonProperty(value = "creationDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime creationDate; + + /* + * The deletion date of the database (ISO8601 format). + */ + @JsonProperty(value = "deletionDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime deletionDate; + + /* + * The earliest restore date of the database (ISO8601 format). + */ + @JsonProperty(value = "earliestRestoreDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime earliestRestoreDate; + + /** Creates an instance of RestorableDroppedManagedDatabaseProperties class. */ + public RestorableDroppedManagedDatabaseProperties() { + } + + /** + * Get the databaseName property: The name of the database. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Get the creationDate property: The creation date of the database (ISO8601 format). + * + * @return the creationDate value. + */ + public OffsetDateTime creationDate() { + return this.creationDate; + } + + /** + * Get the deletionDate property: The deletion date of the database (ISO8601 format). + * + * @return the deletionDate value. + */ + public OffsetDateTime deletionDate() { + return this.deletionDate; + } + + /** + * Get the earliestRestoreDate property: The earliest restore date of the database (ISO8601 format). + * + * @return the earliestRestoreDate value. + */ + public OffsetDateTime earliestRestoreDate() { + return this.earliestRestoreDate; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RestorePointInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RestorePointInner.java new file mode 100644 index 0000000000000..740b802e521f5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RestorePointInner.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.RestorePointType; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Database restore points. */ +@Immutable +public final class RestorePointInner extends ProxyResource { + /* + * Resource location. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private RestorePointProperties innerProperties; + + /** Creates an instance of RestorePointInner class. */ + public RestorePointInner() { + } + + /** + * Get the location property: Resource location. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private RestorePointProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the restorePointType property: The type of restore point. + * + * @return the restorePointType value. + */ + public RestorePointType restorePointType() { + return this.innerProperties() == null ? null : this.innerProperties().restorePointType(); + } + + /** + * Get the earliestRestoreDate property: The earliest time to which this database can be restored. + * + * @return the earliestRestoreDate value. + */ + public OffsetDateTime earliestRestoreDate() { + return this.innerProperties() == null ? null : this.innerProperties().earliestRestoreDate(); + } + + /** + * Get the restorePointCreationDate property: The time the backup was taken. + * + * @return the restorePointCreationDate value. + */ + public OffsetDateTime restorePointCreationDate() { + return this.innerProperties() == null ? null : this.innerProperties().restorePointCreationDate(); + } + + /** + * Get the restorePointLabel property: The label of restore point for backup request by user. + * + * @return the restorePointLabel value. + */ + public String restorePointLabel() { + return this.innerProperties() == null ? null : this.innerProperties().restorePointLabel(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RestorePointProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RestorePointProperties.java new file mode 100644 index 0000000000000..3a97e2a1c6451 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/RestorePointProperties.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.models.RestorePointType; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Properties of a database restore point. */ +@Immutable +public final class RestorePointProperties { + /* + * The type of restore point + */ + @JsonProperty(value = "restorePointType", access = JsonProperty.Access.WRITE_ONLY) + private RestorePointType restorePointType; + + /* + * The earliest time to which this database can be restored + */ + @JsonProperty(value = "earliestRestoreDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime earliestRestoreDate; + + /* + * The time the backup was taken + */ + @JsonProperty(value = "restorePointCreationDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime restorePointCreationDate; + + /* + * The label of restore point for backup request by user + */ + @JsonProperty(value = "restorePointLabel", access = JsonProperty.Access.WRITE_ONLY) + private String restorePointLabel; + + /** Creates an instance of RestorePointProperties class. */ + public RestorePointProperties() { + } + + /** + * Get the restorePointType property: The type of restore point. + * + * @return the restorePointType value. + */ + public RestorePointType restorePointType() { + return this.restorePointType; + } + + /** + * Get the earliestRestoreDate property: The earliest time to which this database can be restored. + * + * @return the earliestRestoreDate value. + */ + public OffsetDateTime earliestRestoreDate() { + return this.earliestRestoreDate; + } + + /** + * Get the restorePointCreationDate property: The time the backup was taken. + * + * @return the restorePointCreationDate value. + */ + public OffsetDateTime restorePointCreationDate() { + return this.restorePointCreationDate; + } + + /** + * Get the restorePointLabel property: The label of restore point for backup request by user. + * + * @return the restorePointLabel value. + */ + public String restorePointLabel() { + return this.restorePointLabel; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SecurityAlertPolicyProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SecurityAlertPolicyProperties.java new file mode 100644 index 0000000000000..2ba6859773a9a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SecurityAlertPolicyProperties.java @@ -0,0 +1,244 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Properties of a security alert policy. */ +@Fluent +public final class SecurityAlertPolicyProperties { + /* + * Specifies the state of the policy, whether it is enabled or disabled or a policy has not been applied yet on the + * specific database. + */ + @JsonProperty(value = "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, Brute_Force + */ + @JsonProperty(value = "disabledAlerts") + private List disabledAlerts; + + /* + * Specifies an array of e-mail addresses to which the alert is sent. + */ + @JsonProperty(value = "emailAddresses") + private List emailAddresses; + + /* + * Specifies that the alert is sent to the account administrators. + */ + @JsonProperty(value = "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 = "storageEndpoint") + private String storageEndpoint; + + /* + * Specifies the identifier key of the Threat Detection audit storage account. + */ + @JsonProperty(value = "storageAccountAccessKey") + private String storageAccountAccessKey; + + /* + * Specifies the number of days to keep in the Threat Detection audit logs. + */ + @JsonProperty(value = "retentionDays") + private Integer retentionDays; + + /* + * Specifies the UTC creation time of the policy. + */ + @JsonProperty(value = "creationTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime creationTime; + + /** Creates an instance of SecurityAlertPolicyProperties class. */ + public SecurityAlertPolicyProperties() { + } + + /** + * Get the state property: Specifies the state of the policy, whether it is enabled or disabled or a policy has not + * been applied yet on the specific database. + * + * @return the state value. + */ + public SecurityAlertPolicyState state() { + return this.state; + } + + /** + * Set the state property: Specifies the state of the policy, whether it is enabled or disabled or a policy has not + * been applied yet on the specific database. + * + * @param state the state value to set. + * @return the SecurityAlertPolicyProperties object itself. + */ + public SecurityAlertPolicyProperties withState(SecurityAlertPolicyState state) { + this.state = state; + return this; + } + + /** + * Get the disabledAlerts property: Specifies an array of alerts that are disabled. Allowed values are: + * Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action, Brute_Force. + * + * @return the disabledAlerts value. + */ + public List disabledAlerts() { + return this.disabledAlerts; + } + + /** + * Set the disabledAlerts property: Specifies an array of alerts that are disabled. Allowed values are: + * Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action, Brute_Force. + * + * @param disabledAlerts the disabledAlerts value to set. + * @return the SecurityAlertPolicyProperties object itself. + */ + public SecurityAlertPolicyProperties withDisabledAlerts(List disabledAlerts) { + this.disabledAlerts = disabledAlerts; + return this; + } + + /** + * Get the emailAddresses property: Specifies an array of e-mail addresses to which the alert is sent. + * + * @return the emailAddresses value. + */ + public List emailAddresses() { + return this.emailAddresses; + } + + /** + * Set the emailAddresses property: Specifies an array of e-mail addresses to which the alert is sent. + * + * @param emailAddresses the emailAddresses value to set. + * @return the SecurityAlertPolicyProperties object itself. + */ + public SecurityAlertPolicyProperties withEmailAddresses(List emailAddresses) { + this.emailAddresses = emailAddresses; + return this; + } + + /** + * Get the emailAccountAdmins property: Specifies that the alert is sent to the account administrators. + * + * @return the emailAccountAdmins value. + */ + public Boolean emailAccountAdmins() { + return this.emailAccountAdmins; + } + + /** + * Set the emailAccountAdmins property: Specifies that the alert is sent to the account administrators. + * + * @param emailAccountAdmins the emailAccountAdmins value to set. + * @return the SecurityAlertPolicyProperties object itself. + */ + public SecurityAlertPolicyProperties withEmailAccountAdmins(Boolean emailAccountAdmins) { + this.emailAccountAdmins = emailAccountAdmins; + return this; + } + + /** + * Get the storageEndpoint property: 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 the storageEndpoint property: 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 SecurityAlertPolicyProperties object itself. + */ + public SecurityAlertPolicyProperties withStorageEndpoint(String storageEndpoint) { + this.storageEndpoint = storageEndpoint; + return this; + } + + /** + * Get the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection audit storage + * account. + * + * @return the storageAccountAccessKey value. + */ + public String storageAccountAccessKey() { + return this.storageAccountAccessKey; + } + + /** + * Set the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection audit storage + * account. + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set. + * @return the SecurityAlertPolicyProperties object itself. + */ + public SecurityAlertPolicyProperties withStorageAccountAccessKey(String storageAccountAccessKey) { + this.storageAccountAccessKey = storageAccountAccessKey; + return this; + } + + /** + * Get the retentionDays property: Specifies the number of days to keep in the Threat Detection audit logs. + * + * @return the retentionDays value. + */ + public Integer retentionDays() { + return this.retentionDays; + } + + /** + * Set the retentionDays property: Specifies the number of days to keep in the Threat Detection audit logs. + * + * @param retentionDays the retentionDays value to set. + * @return the SecurityAlertPolicyProperties object itself. + */ + public SecurityAlertPolicyProperties withRetentionDays(Integer retentionDays) { + this.retentionDays = retentionDays; + return this; + } + + /** + * Get the creationTime property: Specifies the UTC creation time of the policy. + * + * @return the creationTime value. + */ + public OffsetDateTime creationTime() { + return this.creationTime; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (state() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property state in model SecurityAlertPolicyProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SecurityAlertPolicyProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SecurityAlertsPolicyProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SecurityAlertsPolicyProperties.java new file mode 100644 index 0000000000000..c64a0140a75d4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SecurityAlertsPolicyProperties.java @@ -0,0 +1,244 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertsPolicyState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Properties of a security alert policy. */ +@Fluent +public final class SecurityAlertsPolicyProperties { + /* + * Specifies the state of the policy, whether it is enabled or disabled or a policy has not been applied yet on the + * specific database. + */ + @JsonProperty(value = "state", required = true) + private SecurityAlertsPolicyState state; + + /* + * Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, + * Access_Anomaly, Data_Exfiltration, Unsafe_Action, Brute_Force + */ + @JsonProperty(value = "disabledAlerts") + private List disabledAlerts; + + /* + * Specifies an array of e-mail addresses to which the alert is sent. + */ + @JsonProperty(value = "emailAddresses") + private List emailAddresses; + + /* + * Specifies that the alert is sent to the account administrators. + */ + @JsonProperty(value = "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 = "storageEndpoint") + private String storageEndpoint; + + /* + * Specifies the identifier key of the Threat Detection audit storage account. + */ + @JsonProperty(value = "storageAccountAccessKey") + private String storageAccountAccessKey; + + /* + * Specifies the number of days to keep in the Threat Detection audit logs. + */ + @JsonProperty(value = "retentionDays") + private Integer retentionDays; + + /* + * Specifies the UTC creation time of the policy. + */ + @JsonProperty(value = "creationTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime creationTime; + + /** Creates an instance of SecurityAlertsPolicyProperties class. */ + public SecurityAlertsPolicyProperties() { + } + + /** + * Get the state property: Specifies the state of the policy, whether it is enabled or disabled or a policy has not + * been applied yet on the specific database. + * + * @return the state value. + */ + public SecurityAlertsPolicyState state() { + return this.state; + } + + /** + * Set the state property: Specifies the state of the policy, whether it is enabled or disabled or a policy has not + * been applied yet on the specific database. + * + * @param state the state value to set. + * @return the SecurityAlertsPolicyProperties object itself. + */ + public SecurityAlertsPolicyProperties withState(SecurityAlertsPolicyState state) { + this.state = state; + return this; + } + + /** + * Get the disabledAlerts property: Specifies an array of alerts that are disabled. Allowed values are: + * Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action, Brute_Force. + * + * @return the disabledAlerts value. + */ + public List disabledAlerts() { + return this.disabledAlerts; + } + + /** + * Set the disabledAlerts property: Specifies an array of alerts that are disabled. Allowed values are: + * Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action, Brute_Force. + * + * @param disabledAlerts the disabledAlerts value to set. + * @return the SecurityAlertsPolicyProperties object itself. + */ + public SecurityAlertsPolicyProperties withDisabledAlerts(List disabledAlerts) { + this.disabledAlerts = disabledAlerts; + return this; + } + + /** + * Get the emailAddresses property: Specifies an array of e-mail addresses to which the alert is sent. + * + * @return the emailAddresses value. + */ + public List emailAddresses() { + return this.emailAddresses; + } + + /** + * Set the emailAddresses property: Specifies an array of e-mail addresses to which the alert is sent. + * + * @param emailAddresses the emailAddresses value to set. + * @return the SecurityAlertsPolicyProperties object itself. + */ + public SecurityAlertsPolicyProperties withEmailAddresses(List emailAddresses) { + this.emailAddresses = emailAddresses; + return this; + } + + /** + * Get the emailAccountAdmins property: Specifies that the alert is sent to the account administrators. + * + * @return the emailAccountAdmins value. + */ + public Boolean emailAccountAdmins() { + return this.emailAccountAdmins; + } + + /** + * Set the emailAccountAdmins property: Specifies that the alert is sent to the account administrators. + * + * @param emailAccountAdmins the emailAccountAdmins value to set. + * @return the SecurityAlertsPolicyProperties object itself. + */ + public SecurityAlertsPolicyProperties withEmailAccountAdmins(Boolean emailAccountAdmins) { + this.emailAccountAdmins = emailAccountAdmins; + return this; + } + + /** + * Get the storageEndpoint property: 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 the storageEndpoint property: 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 SecurityAlertsPolicyProperties object itself. + */ + public SecurityAlertsPolicyProperties withStorageEndpoint(String storageEndpoint) { + this.storageEndpoint = storageEndpoint; + return this; + } + + /** + * Get the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection audit storage + * account. + * + * @return the storageAccountAccessKey value. + */ + public String storageAccountAccessKey() { + return this.storageAccountAccessKey; + } + + /** + * Set the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection audit storage + * account. + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set. + * @return the SecurityAlertsPolicyProperties object itself. + */ + public SecurityAlertsPolicyProperties withStorageAccountAccessKey(String storageAccountAccessKey) { + this.storageAccountAccessKey = storageAccountAccessKey; + return this; + } + + /** + * Get the retentionDays property: Specifies the number of days to keep in the Threat Detection audit logs. + * + * @return the retentionDays value. + */ + public Integer retentionDays() { + return this.retentionDays; + } + + /** + * Set the retentionDays property: Specifies the number of days to keep in the Threat Detection audit logs. + * + * @param retentionDays the retentionDays value to set. + * @return the SecurityAlertsPolicyProperties object itself. + */ + public SecurityAlertsPolicyProperties withRetentionDays(Integer retentionDays) { + this.retentionDays = retentionDays; + return this; + } + + /** + * Get the creationTime property: Specifies the UTC creation time of the policy. + * + * @return the creationTime value. + */ + public OffsetDateTime creationTime() { + return this.creationTime; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (state() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property state in model SecurityAlertsPolicyProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SecurityAlertsPolicyProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SecurityEventInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SecurityEventInner.java new file mode 100644 index 0000000000000..23ff626ef9ea0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SecurityEventInner.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.SecurityEventSqlInjectionAdditionalProperties; +import com.azure.resourcemanager.sql.generated.models.SecurityEventType; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** A security event. */ +@Immutable +public final class SecurityEventInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private SecurityEventProperties innerProperties; + + /** Creates an instance of SecurityEventInner class. */ + public SecurityEventInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private SecurityEventProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the eventTime property: The time when the security event occurred. + * + * @return the eventTime value. + */ + public OffsetDateTime eventTime() { + return this.innerProperties() == null ? null : this.innerProperties().eventTime(); + } + + /** + * Get the securityEventType property: The type of the security event. + * + * @return the securityEventType value. + */ + public SecurityEventType securityEventType() { + return this.innerProperties() == null ? null : this.innerProperties().securityEventType(); + } + + /** + * Get the subscription property: The subscription name. + * + * @return the subscription value. + */ + public String subscription() { + return this.innerProperties() == null ? null : this.innerProperties().subscription(); + } + + /** + * Get the server property: The server name. + * + * @return the server value. + */ + public String server() { + return this.innerProperties() == null ? null : this.innerProperties().server(); + } + + /** + * Get the database property: The database name. + * + * @return the database value. + */ + public String database() { + return this.innerProperties() == null ? null : this.innerProperties().database(); + } + + /** + * Get the clientIp property: The IP address of the client who executed the statement. + * + * @return the clientIp value. + */ + public String clientIp() { + return this.innerProperties() == null ? null : this.innerProperties().clientIp(); + } + + /** + * Get the applicationName property: The application used to execute the statement. + * + * @return the applicationName value. + */ + public String applicationName() { + return this.innerProperties() == null ? null : this.innerProperties().applicationName(); + } + + /** + * Get the principalName property: The principal user who executed the statement. + * + * @return the principalName value. + */ + public String principalName() { + return this.innerProperties() == null ? null : this.innerProperties().principalName(); + } + + /** + * Get the securityEventSqlInjectionAdditionalProperties property: The sql injection additional properties, + * populated only if the type of the security event is sql injection. + * + * @return the securityEventSqlInjectionAdditionalProperties value. + */ + public SecurityEventSqlInjectionAdditionalProperties securityEventSqlInjectionAdditionalProperties() { + return this.innerProperties() == null + ? null + : this.innerProperties().securityEventSqlInjectionAdditionalProperties(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SecurityEventProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SecurityEventProperties.java new file mode 100644 index 0000000000000..952deb135323d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SecurityEventProperties.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.models.SecurityEventSqlInjectionAdditionalProperties; +import com.azure.resourcemanager.sql.generated.models.SecurityEventType; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The properties of a security event. */ +@Immutable +public final class SecurityEventProperties { + /* + * The time when the security event occurred. + */ + @JsonProperty(value = "eventTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime eventTime; + + /* + * The type of the security event. + */ + @JsonProperty(value = "securityEventType", access = JsonProperty.Access.WRITE_ONLY) + private SecurityEventType securityEventType; + + /* + * The subscription name + */ + @JsonProperty(value = "subscription", access = JsonProperty.Access.WRITE_ONLY) + private String subscription; + + /* + * The server name + */ + @JsonProperty(value = "server", access = JsonProperty.Access.WRITE_ONLY) + private String server; + + /* + * The database name + */ + @JsonProperty(value = "database", access = JsonProperty.Access.WRITE_ONLY) + private String database; + + /* + * The IP address of the client who executed the statement. + */ + @JsonProperty(value = "clientIp", access = JsonProperty.Access.WRITE_ONLY) + private String clientIp; + + /* + * The application used to execute the statement. + */ + @JsonProperty(value = "applicationName", access = JsonProperty.Access.WRITE_ONLY) + private String applicationName; + + /* + * The principal user who executed the statement + */ + @JsonProperty(value = "principalName", access = JsonProperty.Access.WRITE_ONLY) + private String principalName; + + /* + * The sql injection additional properties, populated only if the type of the security event is sql injection. + */ + @JsonProperty(value = "securityEventSqlInjectionAdditionalProperties", access = JsonProperty.Access.WRITE_ONLY) + private SecurityEventSqlInjectionAdditionalProperties securityEventSqlInjectionAdditionalProperties; + + /** Creates an instance of SecurityEventProperties class. */ + public SecurityEventProperties() { + } + + /** + * Get the eventTime property: The time when the security event occurred. + * + * @return the eventTime value. + */ + public OffsetDateTime eventTime() { + return this.eventTime; + } + + /** + * Get the securityEventType property: The type of the security event. + * + * @return the securityEventType value. + */ + public SecurityEventType securityEventType() { + return this.securityEventType; + } + + /** + * Get the subscription property: The subscription name. + * + * @return the subscription value. + */ + public String subscription() { + return this.subscription; + } + + /** + * Get the server property: The server name. + * + * @return the server value. + */ + public String server() { + return this.server; + } + + /** + * Get the database property: The database name. + * + * @return the database value. + */ + public String database() { + return this.database; + } + + /** + * Get the clientIp property: The IP address of the client who executed the statement. + * + * @return the clientIp value. + */ + public String clientIp() { + return this.clientIp; + } + + /** + * Get the applicationName property: The application used to execute the statement. + * + * @return the applicationName value. + */ + public String applicationName() { + return this.applicationName; + } + + /** + * Get the principalName property: The principal user who executed the statement. + * + * @return the principalName value. + */ + public String principalName() { + return this.principalName; + } + + /** + * Get the securityEventSqlInjectionAdditionalProperties property: The sql injection additional properties, + * populated only if the type of the security event is sql injection. + * + * @return the securityEventSqlInjectionAdditionalProperties value. + */ + public SecurityEventSqlInjectionAdditionalProperties securityEventSqlInjectionAdditionalProperties() { + return this.securityEventSqlInjectionAdditionalProperties; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (securityEventSqlInjectionAdditionalProperties() != null) { + securityEventSqlInjectionAdditionalProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SensitivityLabelInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SensitivityLabelInner.java new file mode 100644 index 0000000000000..a946473136186 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SensitivityLabelInner.java @@ -0,0 +1,211 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelRank; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A sensitivity label. */ +@Fluent +public final class SensitivityLabelInner extends ProxyResource { + /* + * Resource that manages the sensitivity label. + */ + @JsonProperty(value = "managedBy", access = JsonProperty.Access.WRITE_ONLY) + private String managedBy; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private SensitivityLabelProperties innerProperties; + + /** Creates an instance of SensitivityLabelInner class. */ + public SensitivityLabelInner() { + } + + /** + * Get the managedBy property: Resource that manages the sensitivity label. + * + * @return the managedBy value. + */ + public String managedBy() { + return this.managedBy; + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private SensitivityLabelProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the schemaName property: The schema name. + * + * @return the schemaName value. + */ + public String schemaName() { + return this.innerProperties() == null ? null : this.innerProperties().schemaName(); + } + + /** + * Get the tableName property: The table name. + * + * @return the tableName value. + */ + public String tableName() { + return this.innerProperties() == null ? null : this.innerProperties().tableName(); + } + + /** + * Get the columnName property: The column name. + * + * @return the columnName value. + */ + public String columnName() { + return this.innerProperties() == null ? null : this.innerProperties().columnName(); + } + + /** + * Get the labelName property: The label name. + * + * @return the labelName value. + */ + public String labelName() { + return this.innerProperties() == null ? null : this.innerProperties().labelName(); + } + + /** + * Set the labelName property: The label name. + * + * @param labelName the labelName value to set. + * @return the SensitivityLabelInner object itself. + */ + public SensitivityLabelInner withLabelName(String labelName) { + if (this.innerProperties() == null) { + this.innerProperties = new SensitivityLabelProperties(); + } + this.innerProperties().withLabelName(labelName); + return this; + } + + /** + * Get the labelId property: The label ID. + * + * @return the labelId value. + */ + public String labelId() { + return this.innerProperties() == null ? null : this.innerProperties().labelId(); + } + + /** + * Set the labelId property: The label ID. + * + * @param labelId the labelId value to set. + * @return the SensitivityLabelInner object itself. + */ + public SensitivityLabelInner withLabelId(String labelId) { + if (this.innerProperties() == null) { + this.innerProperties = new SensitivityLabelProperties(); + } + this.innerProperties().withLabelId(labelId); + return this; + } + + /** + * Get the informationType property: The information type. + * + * @return the informationType value. + */ + public String informationType() { + return this.innerProperties() == null ? null : this.innerProperties().informationType(); + } + + /** + * Set the informationType property: The information type. + * + * @param informationType the informationType value to set. + * @return the SensitivityLabelInner object itself. + */ + public SensitivityLabelInner withInformationType(String informationType) { + if (this.innerProperties() == null) { + this.innerProperties = new SensitivityLabelProperties(); + } + this.innerProperties().withInformationType(informationType); + return this; + } + + /** + * Get the informationTypeId property: The information type ID. + * + * @return the informationTypeId value. + */ + public String informationTypeId() { + return this.innerProperties() == null ? null : this.innerProperties().informationTypeId(); + } + + /** + * Set the informationTypeId property: The information type ID. + * + * @param informationTypeId the informationTypeId value to set. + * @return the SensitivityLabelInner object itself. + */ + public SensitivityLabelInner withInformationTypeId(String informationTypeId) { + if (this.innerProperties() == null) { + this.innerProperties = new SensitivityLabelProperties(); + } + this.innerProperties().withInformationTypeId(informationTypeId); + return this; + } + + /** + * Get the isDisabled property: Is sensitivity recommendation disabled. Applicable for recommended sensitivity label + * only. Specifies whether the sensitivity recommendation on this column is disabled (dismissed) or not. + * + * @return the isDisabled value. + */ + public Boolean isDisabled() { + return this.innerProperties() == null ? null : this.innerProperties().isDisabled(); + } + + /** + * Get the rank property: The rank property. + * + * @return the rank value. + */ + public SensitivityLabelRank rank() { + return this.innerProperties() == null ? null : this.innerProperties().rank(); + } + + /** + * Set the rank property: The rank property. + * + * @param rank the rank value to set. + * @return the SensitivityLabelInner object itself. + */ + public SensitivityLabelInner withRank(SensitivityLabelRank rank) { + if (this.innerProperties() == null) { + this.innerProperties = new SensitivityLabelProperties(); + } + this.innerProperties().withRank(rank); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SensitivityLabelProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SensitivityLabelProperties.java new file mode 100644 index 0000000000000..a4dbf2c3fe229 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SensitivityLabelProperties.java @@ -0,0 +1,217 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelRank; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a sensitivity label. */ +@Fluent +public final class SensitivityLabelProperties { + /* + * The schema name. + */ + @JsonProperty(value = "schemaName", access = JsonProperty.Access.WRITE_ONLY) + private String schemaName; + + /* + * The table name. + */ + @JsonProperty(value = "tableName", access = JsonProperty.Access.WRITE_ONLY) + private String tableName; + + /* + * The column name. + */ + @JsonProperty(value = "columnName", access = JsonProperty.Access.WRITE_ONLY) + private String columnName; + + /* + * The label name. + */ + @JsonProperty(value = "labelName") + private String labelName; + + /* + * The label ID. + */ + @JsonProperty(value = "labelId") + private String labelId; + + /* + * The information type. + */ + @JsonProperty(value = "informationType") + private String informationType; + + /* + * The information type ID. + */ + @JsonProperty(value = "informationTypeId") + private String informationTypeId; + + /* + * Is sensitivity recommendation disabled. Applicable for recommended sensitivity label only. Specifies whether the + * sensitivity recommendation on this column is disabled (dismissed) or not. + */ + @JsonProperty(value = "isDisabled", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isDisabled; + + /* + * The rank property. + */ + @JsonProperty(value = "rank") + private SensitivityLabelRank rank; + + /** Creates an instance of SensitivityLabelProperties class. */ + public SensitivityLabelProperties() { + } + + /** + * Get the schemaName property: The schema name. + * + * @return the schemaName value. + */ + public String schemaName() { + return this.schemaName; + } + + /** + * Get the tableName property: The table name. + * + * @return the tableName value. + */ + public String tableName() { + return this.tableName; + } + + /** + * Get the columnName property: The column name. + * + * @return the columnName value. + */ + public String columnName() { + return this.columnName; + } + + /** + * Get the labelName property: The label name. + * + * @return the labelName value. + */ + public String labelName() { + return this.labelName; + } + + /** + * Set the labelName property: The label name. + * + * @param labelName the labelName value to set. + * @return the SensitivityLabelProperties object itself. + */ + public SensitivityLabelProperties withLabelName(String labelName) { + this.labelName = labelName; + return this; + } + + /** + * Get the labelId property: The label ID. + * + * @return the labelId value. + */ + public String labelId() { + return this.labelId; + } + + /** + * Set the labelId property: The label ID. + * + * @param labelId the labelId value to set. + * @return the SensitivityLabelProperties object itself. + */ + public SensitivityLabelProperties withLabelId(String labelId) { + this.labelId = labelId; + return this; + } + + /** + * Get the informationType property: The information type. + * + * @return the informationType value. + */ + public String informationType() { + return this.informationType; + } + + /** + * Set the informationType property: The information type. + * + * @param informationType the informationType value to set. + * @return the SensitivityLabelProperties object itself. + */ + public SensitivityLabelProperties withInformationType(String informationType) { + this.informationType = informationType; + return this; + } + + /** + * Get the informationTypeId property: The information type ID. + * + * @return the informationTypeId value. + */ + public String informationTypeId() { + return this.informationTypeId; + } + + /** + * Set the informationTypeId property: The information type ID. + * + * @param informationTypeId the informationTypeId value to set. + * @return the SensitivityLabelProperties object itself. + */ + public SensitivityLabelProperties withInformationTypeId(String informationTypeId) { + this.informationTypeId = informationTypeId; + return this; + } + + /** + * Get the isDisabled property: Is sensitivity recommendation disabled. Applicable for recommended sensitivity label + * only. Specifies whether the sensitivity recommendation on this column is disabled (dismissed) or not. + * + * @return the isDisabled value. + */ + public Boolean isDisabled() { + return this.isDisabled; + } + + /** + * Get the rank property: The rank property. + * + * @return the rank value. + */ + public SensitivityLabelRank rank() { + return this.rank; + } + + /** + * Set the rank property: The rank property. + * + * @param rank the rank value to set. + * @return the SensitivityLabelProperties object itself. + */ + public SensitivityLabelProperties withRank(SensitivityLabelRank rank) { + this.rank = rank; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SensitivityLabelUpdateInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SensitivityLabelUpdateInner.java new file mode 100644 index 0000000000000..e78e7550d9747 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SensitivityLabelUpdateInner.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelUpdateKind; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A sensitivity label update operation. */ +@Fluent +public final class SensitivityLabelUpdateInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private SensitivityLabelUpdatePropertiesInner innerProperties; + + /** Creates an instance of SensitivityLabelUpdateInner class. */ + public SensitivityLabelUpdateInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private SensitivityLabelUpdatePropertiesInner innerProperties() { + return this.innerProperties; + } + + /** + * Get the op property: The op property. + * + * @return the op value. + */ + public SensitivityLabelUpdateKind op() { + return this.innerProperties() == null ? null : this.innerProperties().op(); + } + + /** + * Set the op property: The op property. + * + * @param op the op value to set. + * @return the SensitivityLabelUpdateInner object itself. + */ + public SensitivityLabelUpdateInner withOp(SensitivityLabelUpdateKind op) { + if (this.innerProperties() == null) { + this.innerProperties = new SensitivityLabelUpdatePropertiesInner(); + } + this.innerProperties().withOp(op); + return this; + } + + /** + * Get the schema property: Schema name of the column to update. + * + * @return the schema value. + */ + public String schema() { + return this.innerProperties() == null ? null : this.innerProperties().schema(); + } + + /** + * Set the schema property: Schema name of the column to update. + * + * @param schema the schema value to set. + * @return the SensitivityLabelUpdateInner object itself. + */ + public SensitivityLabelUpdateInner withSchema(String schema) { + if (this.innerProperties() == null) { + this.innerProperties = new SensitivityLabelUpdatePropertiesInner(); + } + this.innerProperties().withSchema(schema); + return this; + } + + /** + * Get the table property: Table name of the column to update. + * + * @return the table value. + */ + public String table() { + return this.innerProperties() == null ? null : this.innerProperties().table(); + } + + /** + * Set the table property: Table name of the column to update. + * + * @param table the table value to set. + * @return the SensitivityLabelUpdateInner object itself. + */ + public SensitivityLabelUpdateInner withTable(String table) { + if (this.innerProperties() == null) { + this.innerProperties = new SensitivityLabelUpdatePropertiesInner(); + } + this.innerProperties().withTable(table); + return this; + } + + /** + * Get the column property: Column name to update. + * + * @return the column value. + */ + public String column() { + return this.innerProperties() == null ? null : this.innerProperties().column(); + } + + /** + * Set the column property: Column name to update. + * + * @param column the column value to set. + * @return the SensitivityLabelUpdateInner object itself. + */ + public SensitivityLabelUpdateInner withColumn(String column) { + if (this.innerProperties() == null) { + this.innerProperties = new SensitivityLabelUpdatePropertiesInner(); + } + this.innerProperties().withColumn(column); + return this; + } + + /** + * Get the sensitivityLabel property: The sensitivity label information to apply on a column. + * + * @return the sensitivityLabel value. + */ + public SensitivityLabelInner sensitivityLabel() { + return this.innerProperties() == null ? null : this.innerProperties().sensitivityLabel(); + } + + /** + * Set the sensitivityLabel property: The sensitivity label information to apply on a column. + * + * @param sensitivityLabel the sensitivityLabel value to set. + * @return the SensitivityLabelUpdateInner object itself. + */ + public SensitivityLabelUpdateInner withSensitivityLabel(SensitivityLabelInner sensitivityLabel) { + if (this.innerProperties() == null) { + this.innerProperties = new SensitivityLabelUpdatePropertiesInner(); + } + this.innerProperties().withSensitivityLabel(sensitivityLabel); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SensitivityLabelUpdatePropertiesInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SensitivityLabelUpdatePropertiesInner.java new file mode 100644 index 0000000000000..3179a6a8d7f09 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SensitivityLabelUpdatePropertiesInner.java @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelUpdateKind; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of an operation executed on a sensitivity label. */ +@Fluent +public final class SensitivityLabelUpdatePropertiesInner { + /* + * The op property. + */ + @JsonProperty(value = "op", required = true) + private SensitivityLabelUpdateKind op; + + /* + * Schema name of the column to update. + */ + @JsonProperty(value = "schema", required = true) + private String schema; + + /* + * Table name of the column to update. + */ + @JsonProperty(value = "table", required = true) + private String table; + + /* + * Column name to update. + */ + @JsonProperty(value = "column", required = true) + private String column; + + /* + * The sensitivity label information to apply on a column. + */ + @JsonProperty(value = "sensitivityLabel") + private SensitivityLabelInner sensitivityLabel; + + /** Creates an instance of SensitivityLabelUpdatePropertiesInner class. */ + public SensitivityLabelUpdatePropertiesInner() { + } + + /** + * Get the op property: The op property. + * + * @return the op value. + */ + public SensitivityLabelUpdateKind op() { + return this.op; + } + + /** + * Set the op property: The op property. + * + * @param op the op value to set. + * @return the SensitivityLabelUpdatePropertiesInner object itself. + */ + public SensitivityLabelUpdatePropertiesInner withOp(SensitivityLabelUpdateKind op) { + this.op = op; + return this; + } + + /** + * Get the schema property: Schema name of the column to update. + * + * @return the schema value. + */ + public String schema() { + return this.schema; + } + + /** + * Set the schema property: Schema name of the column to update. + * + * @param schema the schema value to set. + * @return the SensitivityLabelUpdatePropertiesInner object itself. + */ + public SensitivityLabelUpdatePropertiesInner withSchema(String schema) { + this.schema = schema; + return this; + } + + /** + * Get the table property: Table name of the column to update. + * + * @return the table value. + */ + public String table() { + return this.table; + } + + /** + * Set the table property: Table name of the column to update. + * + * @param table the table value to set. + * @return the SensitivityLabelUpdatePropertiesInner object itself. + */ + public SensitivityLabelUpdatePropertiesInner withTable(String table) { + this.table = table; + return this; + } + + /** + * Get the column property: Column name to update. + * + * @return the column value. + */ + public String column() { + return this.column; + } + + /** + * Set the column property: Column name to update. + * + * @param column the column value to set. + * @return the SensitivityLabelUpdatePropertiesInner object itself. + */ + public SensitivityLabelUpdatePropertiesInner withColumn(String column) { + this.column = column; + return this; + } + + /** + * Get the sensitivityLabel property: The sensitivity label information to apply on a column. + * + * @return the sensitivityLabel value. + */ + public SensitivityLabelInner sensitivityLabel() { + return this.sensitivityLabel; + } + + /** + * Set the sensitivityLabel property: The sensitivity label information to apply on a column. + * + * @param sensitivityLabel the sensitivityLabel value to set. + * @return the SensitivityLabelUpdatePropertiesInner object itself. + */ + public SensitivityLabelUpdatePropertiesInner withSensitivityLabel(SensitivityLabelInner sensitivityLabel) { + this.sensitivityLabel = sensitivityLabel; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (op() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property op in model SensitivityLabelUpdatePropertiesInner")); + } + if (schema() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property schema in model SensitivityLabelUpdatePropertiesInner")); + } + if (table() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property table in model SensitivityLabelUpdatePropertiesInner")); + } + if (column() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property column in model SensitivityLabelUpdatePropertiesInner")); + } + if (sensitivityLabel() != null) { + sensitivityLabel().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SensitivityLabelUpdatePropertiesInner.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerAdvancedThreatProtectionInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerAdvancedThreatProtectionInner.java new file mode 100644 index 0000000000000..a08f35a291378 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerAdvancedThreatProtectionInner.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.sql.generated.models.AdvancedThreatProtectionState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** A server Advanced Threat Protection. */ +@Fluent +public final class ServerAdvancedThreatProtectionInner extends ProxyResource { + /* + * SystemData of AdvancedThreatProtectionResource. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private AdvancedThreatProtectionProperties innerProperties; + + /** Creates an instance of ServerAdvancedThreatProtectionInner class. */ + public ServerAdvancedThreatProtectionInner() { + } + + /** + * Get the systemData property: SystemData of AdvancedThreatProtectionResource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private AdvancedThreatProtectionProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the state property: Specifies the state of the Advanced Threat Protection, whether it is enabled or disabled + * or a state has not been applied yet on the specific database or server. + * + * @return the state value. + */ + public AdvancedThreatProtectionState state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Set the state property: Specifies the state of the Advanced Threat Protection, whether it is enabled or disabled + * or a state has not been applied yet on the specific database or server. + * + * @param state the state value to set. + * @return the ServerAdvancedThreatProtectionInner object itself. + */ + public ServerAdvancedThreatProtectionInner withState(AdvancedThreatProtectionState state) { + if (this.innerProperties() == null) { + this.innerProperties = new AdvancedThreatProtectionProperties(); + } + this.innerProperties().withState(state); + return this; + } + + /** + * Get the creationTime property: Specifies the UTC creation time of the policy. + * + * @return the creationTime value. + */ + public OffsetDateTime creationTime() { + return this.innerProperties() == null ? null : this.innerProperties().creationTime(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerAutomaticTuningInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerAutomaticTuningInner.java new file mode 100644 index 0000000000000..4674319f064ed --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerAutomaticTuningInner.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.AutomaticTuningServerMode; +import com.azure.resourcemanager.sql.generated.models.AutomaticTuningServerOptions; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Server-level Automatic Tuning. */ +@Fluent +public final class ServerAutomaticTuningInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private AutomaticTuningServerProperties innerProperties; + + /** Creates an instance of ServerAutomaticTuningInner class. */ + public ServerAutomaticTuningInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private AutomaticTuningServerProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the desiredState property: Automatic tuning desired state. + * + * @return the desiredState value. + */ + public AutomaticTuningServerMode desiredState() { + return this.innerProperties() == null ? null : this.innerProperties().desiredState(); + } + + /** + * Set the desiredState property: Automatic tuning desired state. + * + * @param desiredState the desiredState value to set. + * @return the ServerAutomaticTuningInner object itself. + */ + public ServerAutomaticTuningInner withDesiredState(AutomaticTuningServerMode desiredState) { + if (this.innerProperties() == null) { + this.innerProperties = new AutomaticTuningServerProperties(); + } + this.innerProperties().withDesiredState(desiredState); + return this; + } + + /** + * Get the actualState property: Automatic tuning actual state. + * + * @return the actualState value. + */ + public AutomaticTuningServerMode actualState() { + return this.innerProperties() == null ? null : this.innerProperties().actualState(); + } + + /** + * Get the options property: Automatic tuning options definition. + * + * @return the options value. + */ + public Map options() { + return this.innerProperties() == null ? null : this.innerProperties().options(); + } + + /** + * Set the options property: Automatic tuning options definition. + * + * @param options the options value to set. + * @return the ServerAutomaticTuningInner object itself. + */ + public ServerAutomaticTuningInner withOptions(Map options) { + if (this.innerProperties() == null) { + this.innerProperties = new AutomaticTuningServerProperties(); + } + this.innerProperties().withOptions(options); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerAzureADAdministratorInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerAzureADAdministratorInner.java new file mode 100644 index 0000000000000..c630ce2ac9311 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerAzureADAdministratorInner.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.AdministratorType; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +/** Azure Active Directory administrator. */ +@Fluent +public final class ServerAzureADAdministratorInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private AdministratorProperties innerProperties; + + /** Creates an instance of ServerAzureADAdministratorInner class. */ + public ServerAzureADAdministratorInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private AdministratorProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the administratorType property: Type of the sever administrator. + * + * @return the administratorType value. + */ + public AdministratorType administratorType() { + return this.innerProperties() == null ? null : this.innerProperties().administratorType(); + } + + /** + * Set the administratorType property: Type of the sever administrator. + * + * @param administratorType the administratorType value to set. + * @return the ServerAzureADAdministratorInner object itself. + */ + public ServerAzureADAdministratorInner withAdministratorType(AdministratorType administratorType) { + if (this.innerProperties() == null) { + this.innerProperties = new AdministratorProperties(); + } + this.innerProperties().withAdministratorType(administratorType); + return this; + } + + /** + * Get the login property: Login name of the server administrator. + * + * @return the login value. + */ + public String login() { + return this.innerProperties() == null ? null : this.innerProperties().login(); + } + + /** + * Set the login property: Login name of the server administrator. + * + * @param login the login value to set. + * @return the ServerAzureADAdministratorInner object itself. + */ + public ServerAzureADAdministratorInner withLogin(String login) { + if (this.innerProperties() == null) { + this.innerProperties = new AdministratorProperties(); + } + this.innerProperties().withLogin(login); + return this; + } + + /** + * Get the sid property: SID (object ID) of the server administrator. + * + * @return the sid value. + */ + public UUID sid() { + return this.innerProperties() == null ? null : this.innerProperties().sid(); + } + + /** + * Set the sid property: SID (object ID) of the server administrator. + * + * @param sid the sid value to set. + * @return the ServerAzureADAdministratorInner object itself. + */ + public ServerAzureADAdministratorInner withSid(UUID sid) { + if (this.innerProperties() == null) { + this.innerProperties = new AdministratorProperties(); + } + this.innerProperties().withSid(sid); + return this; + } + + /** + * Get the tenantId property: Tenant ID of the administrator. + * + * @return the tenantId value. + */ + public UUID tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().tenantId(); + } + + /** + * Set the tenantId property: Tenant ID of the administrator. + * + * @param tenantId the tenantId value to set. + * @return the ServerAzureADAdministratorInner object itself. + */ + public ServerAzureADAdministratorInner withTenantId(UUID tenantId) { + if (this.innerProperties() == null) { + this.innerProperties = new AdministratorProperties(); + } + this.innerProperties().withTenantId(tenantId); + return this; + } + + /** + * Get the azureADOnlyAuthentication property: Azure Active Directory only Authentication enabled. + * + * @return the azureADOnlyAuthentication value. + */ + public Boolean azureADOnlyAuthentication() { + return this.innerProperties() == null ? null : this.innerProperties().azureADOnlyAuthentication(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerAzureADOnlyAuthenticationInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerAzureADOnlyAuthenticationInner.java new file mode 100644 index 0000000000000..7206d78961552 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerAzureADOnlyAuthenticationInner.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Azure Active Directory only authentication. */ +@Fluent +public final class ServerAzureADOnlyAuthenticationInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private AzureADOnlyAuthProperties innerProperties; + + /** Creates an instance of ServerAzureADOnlyAuthenticationInner class. */ + public ServerAzureADOnlyAuthenticationInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private AzureADOnlyAuthProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the azureADOnlyAuthentication property: Azure Active Directory only Authentication enabled. + * + * @return the azureADOnlyAuthentication value. + */ + public Boolean azureADOnlyAuthentication() { + return this.innerProperties() == null ? null : this.innerProperties().azureADOnlyAuthentication(); + } + + /** + * Set the azureADOnlyAuthentication property: Azure Active Directory only Authentication enabled. + * + * @param azureADOnlyAuthentication the azureADOnlyAuthentication value to set. + * @return the ServerAzureADOnlyAuthenticationInner object itself. + */ + public ServerAzureADOnlyAuthenticationInner withAzureADOnlyAuthentication(Boolean azureADOnlyAuthentication) { + if (this.innerProperties() == null) { + this.innerProperties = new AzureADOnlyAuthProperties(); + } + this.innerProperties().withAzureADOnlyAuthentication(azureADOnlyAuthentication); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerBlobAuditingPolicyInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerBlobAuditingPolicyInner.java new file mode 100644 index 0000000000000..1246197fc46a9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerBlobAuditingPolicyInner.java @@ -0,0 +1,447 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.BlobAuditingPolicyState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.UUID; + +/** A server blob auditing policy. */ +@Fluent +public final class ServerBlobAuditingPolicyInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ServerBlobAuditingPolicyProperties innerProperties; + + /** Creates an instance of ServerBlobAuditingPolicyInner class. */ + public ServerBlobAuditingPolicyInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ServerBlobAuditingPolicyProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the isDevopsAuditEnabled property: Specifies the state of devops audit. If state is Enabled, devops logs will + * be sent to Azure Monitor. In order to send the events to Azure Monitor, specify 'State' as 'Enabled', + * 'IsAzureMonitorTargetEnabled' as true and 'IsDevopsAuditEnabled' as true + * + *

When using REST API to configure auditing, Diagnostic Settings with 'DevOpsOperationsAudit' diagnostic logs + * category on the master database should also be created. + * + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/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 isDevopsAuditEnabled value. + */ + public Boolean isDevopsAuditEnabled() { + return this.innerProperties() == null ? null : this.innerProperties().isDevopsAuditEnabled(); + } + + /** + * Set the isDevopsAuditEnabled property: Specifies the state of devops audit. If state is Enabled, devops logs will + * be sent to Azure Monitor. In order to send the events to Azure Monitor, specify 'State' as 'Enabled', + * 'IsAzureMonitorTargetEnabled' as true and 'IsDevopsAuditEnabled' as true + * + *

When using REST API to configure auditing, Diagnostic Settings with 'DevOpsOperationsAudit' diagnostic logs + * category on the master database should also be created. + * + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/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 isDevopsAuditEnabled the isDevopsAuditEnabled value to set. + * @return the ServerBlobAuditingPolicyInner object itself. + */ + public ServerBlobAuditingPolicyInner withIsDevopsAuditEnabled(Boolean isDevopsAuditEnabled) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerBlobAuditingPolicyProperties(); + } + this.innerProperties().withIsDevopsAuditEnabled(isDevopsAuditEnabled); + return this; + } + + /** + * Get the retentionDays property: Specifies the number of days to keep in the audit logs in the storage account. + * + * @return the retentionDays value. + */ + public Integer retentionDays() { + return this.innerProperties() == null ? null : this.innerProperties().retentionDays(); + } + + /** + * Set the retentionDays property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerBlobAuditingPolicyProperties(); + } + this.innerProperties().withRetentionDays(retentionDays); + return this; + } + + /** + * Get the auditActionsAndGroups property: 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 + * DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP LEDGER_OPERATION_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.innerProperties() == null ? null : this.innerProperties().auditActionsAndGroups(); + } + + /** + * Set the auditActionsAndGroups property: 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 + * DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP LEDGER_OPERATION_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) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerBlobAuditingPolicyProperties(); + } + this.innerProperties().withAuditActionsAndGroups(auditActionsAndGroups); + return this; + } + + /** + * Get the isStorageSecondaryKeyInUse property: Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + * + * @return the isStorageSecondaryKeyInUse value. + */ + public Boolean isStorageSecondaryKeyInUse() { + return this.innerProperties() == null ? null : this.innerProperties().isStorageSecondaryKeyInUse(); + } + + /** + * Set the isStorageSecondaryKeyInUse property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerBlobAuditingPolicyProperties(); + } + this.innerProperties().withIsStorageSecondaryKeyInUse(isStorageSecondaryKeyInUse); + return this; + } + + /** + * Get the isAzureMonitorTargetEnabled property: 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.innerProperties() == null ? null : this.innerProperties().isAzureMonitorTargetEnabled(); + } + + /** + * Set the isAzureMonitorTargetEnabled property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerBlobAuditingPolicyProperties(); + } + this.innerProperties().withIsAzureMonitorTargetEnabled(isAzureMonitorTargetEnabled); + return this; + } + + /** + * Get the queueDelayMs property: Specifies the amount of time in milliseconds that can elapse before audit actions + * are forced to be processed. The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + * + * @return the queueDelayMs value. + */ + public Integer queueDelayMs() { + return this.innerProperties() == null ? null : this.innerProperties().queueDelayMs(); + } + + /** + * Set the queueDelayMs property: Specifies the amount of time in milliseconds that can elapse before audit actions + * are forced to be processed. The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + * + * @param queueDelayMs the queueDelayMs value to set. + * @return the ServerBlobAuditingPolicyInner object itself. + */ + public ServerBlobAuditingPolicyInner withQueueDelayMs(Integer queueDelayMs) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerBlobAuditingPolicyProperties(); + } + this.innerProperties().withQueueDelayMs(queueDelayMs); + return this; + } + + /** + * Get the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob storage. + * + * @return the isManagedIdentityInUse value. + */ + public Boolean isManagedIdentityInUse() { + return this.innerProperties() == null ? null : this.innerProperties().isManagedIdentityInUse(); + } + + /** + * Set the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob storage. + * + * @param isManagedIdentityInUse the isManagedIdentityInUse value to set. + * @return the ServerBlobAuditingPolicyInner object itself. + */ + public ServerBlobAuditingPolicyInner withIsManagedIdentityInUse(Boolean isManagedIdentityInUse) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerBlobAuditingPolicyProperties(); + } + this.innerProperties().withIsManagedIdentityInUse(isManagedIdentityInUse); + return this; + } + + /** + * Get the state property: Specifies the state of the audit. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * + * @return the state value. + */ + public BlobAuditingPolicyState state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Set the state property: Specifies the state of the audit. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * + * @param state the state value to set. + * @return the ServerBlobAuditingPolicyInner object itself. + */ + public ServerBlobAuditingPolicyInner withState(BlobAuditingPolicyState state) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerBlobAuditingPolicyProperties(); + } + this.innerProperties().withState(state); + return this; + } + + /** + * Get the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is + * required. + * + * @return the storageEndpoint value. + */ + public String storageEndpoint() { + return this.innerProperties() == null ? null : this.innerProperties().storageEndpoint(); + } + + /** + * Set the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is + * required. + * + * @param storageEndpoint the storageEndpoint value to set. + * @return the ServerBlobAuditingPolicyInner object itself. + */ + public ServerBlobAuditingPolicyInner withStorageEndpoint(String storageEndpoint) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerBlobAuditingPolicyProperties(); + } + this.innerProperties().withStorageEndpoint(storageEndpoint); + return this; + } + + /** + * Get the storageAccountAccessKey property: Specifies the identifier key of the auditing storage account. If state + * is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server + * system-assigned managed identity to access the storage. Prerequisites for using managed identity authentication: + * 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). 2. Grant SQL Server + * identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server + * identity. For more information, see [Auditing to storage using Managed Identity + * authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @return the storageAccountAccessKey value. + */ + public String storageAccountAccessKey() { + return this.innerProperties() == null ? null : this.innerProperties().storageAccountAccessKey(); + } + + /** + * Set the storageAccountAccessKey property: Specifies the identifier key of the auditing storage account. If state + * is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server + * system-assigned managed identity to access the storage. Prerequisites for using managed identity authentication: + * 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). 2. Grant SQL Server + * identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server + * identity. For more information, see [Auditing to storage using Managed Identity + * authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set. + * @return the ServerBlobAuditingPolicyInner object itself. + */ + public ServerBlobAuditingPolicyInner withStorageAccountAccessKey(String storageAccountAccessKey) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerBlobAuditingPolicyProperties(); + } + this.innerProperties().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + /** + * Get the storageAccountSubscriptionId property: Specifies the blob storage subscription Id. + * + * @return the storageAccountSubscriptionId value. + */ + public UUID storageAccountSubscriptionId() { + return this.innerProperties() == null ? null : this.innerProperties().storageAccountSubscriptionId(); + } + + /** + * Set the storageAccountSubscriptionId property: Specifies the blob storage subscription Id. + * + * @param storageAccountSubscriptionId the storageAccountSubscriptionId value to set. + * @return the ServerBlobAuditingPolicyInner object itself. + */ + public ServerBlobAuditingPolicyInner withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerBlobAuditingPolicyProperties(); + } + this.innerProperties().withStorageAccountSubscriptionId(storageAccountSubscriptionId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerBlobAuditingPolicyProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerBlobAuditingPolicyProperties.java new file mode 100644 index 0000000000000..fb28cf0d18d52 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerBlobAuditingPolicyProperties.java @@ -0,0 +1,577 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.BlobAuditingPolicyState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.UUID; + +/** Properties of a server blob auditing policy. */ +@Fluent +public final class ServerBlobAuditingPolicyProperties { + /* + * Specifies the state of devops audit. If state is Enabled, devops logs will be sent to Azure Monitor. + * In order to send the events to Azure Monitor, specify 'State' as 'Enabled', 'IsAzureMonitorTargetEnabled' as + * true and 'IsDevopsAuditEnabled' as true + * + * When using REST API to configure auditing, Diagnostic Settings with 'DevOpsOperationsAudit' diagnostic logs + * category on the master database should also be created. + * + * Diagnostic Settings URI format: + * PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/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 = "isDevopsAuditEnabled") + private Boolean isDevopsAuditEnabled; + + /* + * Specifies the number of days to keep in the audit logs in the storage account. + */ + @JsonProperty(value = "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 + * DBCC_GROUP + * DATABASE_OWNERSHIP_CHANGE_GROUP + * DATABASE_CHANGE_GROUP + * LEDGER_OPERATION_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 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 = "auditActionsAndGroups") + private List auditActionsAndGroups; + + /* + * Specifies whether storageAccountAccessKey value is the storage's secondary key. + */ + @JsonProperty(value = "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 = "isAzureMonitorTargetEnabled") + private Boolean isAzureMonitorTargetEnabled; + + /* + * Specifies the amount of time in milliseconds that can elapse before audit actions are forced to be processed. + * The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + */ + @JsonProperty(value = "queueDelayMs") + private Integer queueDelayMs; + + /* + * Specifies whether Managed Identity is used to access blob storage + */ + @JsonProperty(value = "isManagedIdentityInUse") + private Boolean isManagedIdentityInUse; + + /* + * Specifies the state of the audit. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are + * required. + */ + @JsonProperty(value = "state", required = true) + private BlobAuditingPolicyState state; + + /* + * Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, + * storageEndpoint or isAzureMonitorTargetEnabled is required. + */ + @JsonProperty(value = "storageEndpoint") + private String storageEndpoint; + + /* + * Specifies the identifier key of the auditing storage account. + * If state is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL + * server system-assigned managed identity to access the storage. + * Prerequisites for using managed identity authentication: + * 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). + * 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role + * to the server identity. + * For more information, see [Auditing to storage using Managed Identity + * authentication](https://go.microsoft.com/fwlink/?linkid=2114355) + */ + @JsonProperty(value = "storageAccountAccessKey") + private String storageAccountAccessKey; + + /* + * Specifies the blob storage subscription Id. + */ + @JsonProperty(value = "storageAccountSubscriptionId") + private UUID storageAccountSubscriptionId; + + /** Creates an instance of ServerBlobAuditingPolicyProperties class. */ + public ServerBlobAuditingPolicyProperties() { + } + + /** + * Get the isDevopsAuditEnabled property: Specifies the state of devops audit. If state is Enabled, devops logs will + * be sent to Azure Monitor. In order to send the events to Azure Monitor, specify 'State' as 'Enabled', + * 'IsAzureMonitorTargetEnabled' as true and 'IsDevopsAuditEnabled' as true + * + *

When using REST API to configure auditing, Diagnostic Settings with 'DevOpsOperationsAudit' diagnostic logs + * category on the master database should also be created. + * + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/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 isDevopsAuditEnabled value. + */ + public Boolean isDevopsAuditEnabled() { + return this.isDevopsAuditEnabled; + } + + /** + * Set the isDevopsAuditEnabled property: Specifies the state of devops audit. If state is Enabled, devops logs will + * be sent to Azure Monitor. In order to send the events to Azure Monitor, specify 'State' as 'Enabled', + * 'IsAzureMonitorTargetEnabled' as true and 'IsDevopsAuditEnabled' as true + * + *

When using REST API to configure auditing, Diagnostic Settings with 'DevOpsOperationsAudit' diagnostic logs + * category on the master database should also be created. + * + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/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 isDevopsAuditEnabled the isDevopsAuditEnabled value to set. + * @return the ServerBlobAuditingPolicyProperties object itself. + */ + public ServerBlobAuditingPolicyProperties withIsDevopsAuditEnabled(Boolean isDevopsAuditEnabled) { + this.isDevopsAuditEnabled = isDevopsAuditEnabled; + return this; + } + + /** + * Get the retentionDays property: 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 the retentionDays property: Specifies the number of days to keep in the audit logs in the storage account. + * + * @param retentionDays the retentionDays value to set. + * @return the ServerBlobAuditingPolicyProperties object itself. + */ + public ServerBlobAuditingPolicyProperties withRetentionDays(Integer retentionDays) { + this.retentionDays = retentionDays; + return this; + } + + /** + * Get the auditActionsAndGroups property: 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 + * DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP LEDGER_OPERATION_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 the auditActionsAndGroups property: 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 + * DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP LEDGER_OPERATION_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 ServerBlobAuditingPolicyProperties object itself. + */ + public ServerBlobAuditingPolicyProperties withAuditActionsAndGroups(List auditActionsAndGroups) { + this.auditActionsAndGroups = auditActionsAndGroups; + return this; + } + + /** + * Get the isStorageSecondaryKeyInUse property: Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + * + * @return the isStorageSecondaryKeyInUse value. + */ + public Boolean isStorageSecondaryKeyInUse() { + return this.isStorageSecondaryKeyInUse; + } + + /** + * Set the isStorageSecondaryKeyInUse property: Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + * + * @param isStorageSecondaryKeyInUse the isStorageSecondaryKeyInUse value to set. + * @return the ServerBlobAuditingPolicyProperties object itself. + */ + public ServerBlobAuditingPolicyProperties withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse) { + this.isStorageSecondaryKeyInUse = isStorageSecondaryKeyInUse; + return this; + } + + /** + * Get the isAzureMonitorTargetEnabled property: 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 the isAzureMonitorTargetEnabled property: 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 ServerBlobAuditingPolicyProperties object itself. + */ + public ServerBlobAuditingPolicyProperties withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled) { + this.isAzureMonitorTargetEnabled = isAzureMonitorTargetEnabled; + return this; + } + + /** + * Get the queueDelayMs property: Specifies the amount of time in milliseconds that can elapse before audit actions + * are forced to be processed. The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + * + * @return the queueDelayMs value. + */ + public Integer queueDelayMs() { + return this.queueDelayMs; + } + + /** + * Set the queueDelayMs property: Specifies the amount of time in milliseconds that can elapse before audit actions + * are forced to be processed. The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + * + * @param queueDelayMs the queueDelayMs value to set. + * @return the ServerBlobAuditingPolicyProperties object itself. + */ + public ServerBlobAuditingPolicyProperties withQueueDelayMs(Integer queueDelayMs) { + this.queueDelayMs = queueDelayMs; + return this; + } + + /** + * Get the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob storage. + * + * @return the isManagedIdentityInUse value. + */ + public Boolean isManagedIdentityInUse() { + return this.isManagedIdentityInUse; + } + + /** + * Set the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob storage. + * + * @param isManagedIdentityInUse the isManagedIdentityInUse value to set. + * @return the ServerBlobAuditingPolicyProperties object itself. + */ + public ServerBlobAuditingPolicyProperties withIsManagedIdentityInUse(Boolean isManagedIdentityInUse) { + this.isManagedIdentityInUse = isManagedIdentityInUse; + return this; + } + + /** + * Get the state property: Specifies the state of the audit. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * + * @return the state value. + */ + public BlobAuditingPolicyState state() { + return this.state; + } + + /** + * Set the state property: Specifies the state of the audit. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * + * @param state the state value to set. + * @return the ServerBlobAuditingPolicyProperties object itself. + */ + public ServerBlobAuditingPolicyProperties withState(BlobAuditingPolicyState state) { + this.state = state; + return this; + } + + /** + * Get the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is + * required. + * + * @return the storageEndpoint value. + */ + public String storageEndpoint() { + return this.storageEndpoint; + } + + /** + * Set the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is + * required. + * + * @param storageEndpoint the storageEndpoint value to set. + * @return the ServerBlobAuditingPolicyProperties object itself. + */ + public ServerBlobAuditingPolicyProperties withStorageEndpoint(String storageEndpoint) { + this.storageEndpoint = storageEndpoint; + return this; + } + + /** + * Get the storageAccountAccessKey property: Specifies the identifier key of the auditing storage account. If state + * is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server + * system-assigned managed identity to access the storage. Prerequisites for using managed identity authentication: + * 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). 2. Grant SQL Server + * identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server + * identity. For more information, see [Auditing to storage using Managed Identity + * authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @return the storageAccountAccessKey value. + */ + public String storageAccountAccessKey() { + return this.storageAccountAccessKey; + } + + /** + * Set the storageAccountAccessKey property: Specifies the identifier key of the auditing storage account. If state + * is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server + * system-assigned managed identity to access the storage. Prerequisites for using managed identity authentication: + * 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). 2. Grant SQL Server + * identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server + * identity. For more information, see [Auditing to storage using Managed Identity + * authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set. + * @return the ServerBlobAuditingPolicyProperties object itself. + */ + public ServerBlobAuditingPolicyProperties withStorageAccountAccessKey(String storageAccountAccessKey) { + this.storageAccountAccessKey = storageAccountAccessKey; + return this; + } + + /** + * Get the storageAccountSubscriptionId property: Specifies the blob storage subscription Id. + * + * @return the storageAccountSubscriptionId value. + */ + public UUID storageAccountSubscriptionId() { + return this.storageAccountSubscriptionId; + } + + /** + * Set the storageAccountSubscriptionId property: Specifies the blob storage subscription Id. + * + * @param storageAccountSubscriptionId the storageAccountSubscriptionId value to set. + * @return the ServerBlobAuditingPolicyProperties object itself. + */ + public ServerBlobAuditingPolicyProperties withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId) { + this.storageAccountSubscriptionId = storageAccountSubscriptionId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (state() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property state in model ServerBlobAuditingPolicyProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ServerBlobAuditingPolicyProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerCommunicationLinkInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerCommunicationLinkInner.java new file mode 100644 index 0000000000000..e08baf8beb755 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerCommunicationLinkInner.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Server communication link. */ +@Fluent +public final class ServerCommunicationLinkInner extends ProxyResource { + /* + * The properties of resource. + */ + @JsonProperty(value = "properties") + private ServerCommunicationLinkProperties innerProperties; + + /* + * 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; + + /** Creates an instance of ServerCommunicationLinkInner class. */ + public ServerCommunicationLinkInner() { + } + + /** + * Get the innerProperties property: The properties of resource. + * + * @return the innerProperties value. + */ + private ServerCommunicationLinkProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the location property: Communication link location. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Get the kind property: Communication link kind. This property is used for Azure Portal metadata. + * + * @return the kind value. + */ + public String kind() { + return this.kind; + } + + /** + * Get the state property: The state. + * + * @return the state value. + */ + public String state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Get the partnerServer property: The name of the partner server. + * + * @return the partnerServer value. + */ + public String partnerServer() { + return this.innerProperties() == null ? null : this.innerProperties().partnerServer(); + } + + /** + * Set the partnerServer property: The name of the partner server. + * + * @param partnerServer the partnerServer value to set. + * @return the ServerCommunicationLinkInner object itself. + */ + public ServerCommunicationLinkInner withPartnerServer(String partnerServer) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerCommunicationLinkProperties(); + } + this.innerProperties().withPartnerServer(partnerServer); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerCommunicationLinkProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerCommunicationLinkProperties.java new file mode 100644 index 0000000000000..55479917d9c98 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerCommunicationLinkProperties.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of a server communication link. */ +@Fluent +public final class ServerCommunicationLinkProperties { + /* + * The state. + */ + @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) + private String state; + + /* + * The name of the partner server. + */ + @JsonProperty(value = "partnerServer", required = true) + private String partnerServer; + + /** Creates an instance of ServerCommunicationLinkProperties class. */ + public ServerCommunicationLinkProperties() { + } + + /** + * Get the state property: The state. + * + * @return the state value. + */ + public String state() { + return this.state; + } + + /** + * Get the partnerServer property: The name of the partner server. + * + * @return the partnerServer value. + */ + public String partnerServer() { + return this.partnerServer; + } + + /** + * Set the partnerServer property: The name of the partner server. + * + * @param partnerServer the partnerServer value to set. + * @return the ServerCommunicationLinkProperties object itself. + */ + public ServerCommunicationLinkProperties withPartnerServer(String partnerServer) { + this.partnerServer = partnerServer; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (partnerServer() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property partnerServer in model ServerCommunicationLinkProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ServerCommunicationLinkProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerConnectionPolicyInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerConnectionPolicyInner.java new file mode 100644 index 0000000000000..f805261da106e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerConnectionPolicyInner.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.ServerConnectionType; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A server connection policy. */ +@Fluent +public final class ServerConnectionPolicyInner extends ProxyResource { + /* + * Resource location. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /* + * Metadata used for the Azure portal experience. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ServerConnectionPolicyProperties innerProperties; + + /** Creates an instance of ServerConnectionPolicyInner class. */ + public ServerConnectionPolicyInner() { + } + + /** + * Get the location property: Resource location. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Get the kind property: Metadata used for the Azure portal experience. + * + * @return the kind value. + */ + public String kind() { + return this.kind; + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ServerConnectionPolicyProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the connectionType property: The server connection type. + * + * @return the connectionType value. + */ + public ServerConnectionType connectionType() { + return this.innerProperties() == null ? null : this.innerProperties().connectionType(); + } + + /** + * Set the connectionType property: The server connection type. + * + * @param connectionType the connectionType value to set. + * @return the ServerConnectionPolicyInner object itself. + */ + public ServerConnectionPolicyInner withConnectionType(ServerConnectionType connectionType) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerConnectionPolicyProperties(); + } + this.innerProperties().withConnectionType(connectionType); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerConnectionPolicyProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerConnectionPolicyProperties.java new file mode 100644 index 0000000000000..0fa5e0d29277d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerConnectionPolicyProperties.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.ServerConnectionType; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of a server connection policy. */ +@Fluent +public final class ServerConnectionPolicyProperties { + /* + * The server connection type. + */ + @JsonProperty(value = "connectionType", required = true) + private ServerConnectionType connectionType; + + /** Creates an instance of ServerConnectionPolicyProperties class. */ + public ServerConnectionPolicyProperties() { + } + + /** + * Get the connectionType property: The server connection type. + * + * @return the connectionType value. + */ + public ServerConnectionType connectionType() { + return this.connectionType; + } + + /** + * Set the connectionType property: The server connection type. + * + * @param connectionType the connectionType value to set. + * @return the ServerConnectionPolicyProperties object itself. + */ + public ServerConnectionPolicyProperties withConnectionType(ServerConnectionType connectionType) { + this.connectionType = connectionType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (connectionType() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property connectionType in model ServerConnectionPolicyProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ServerConnectionPolicyProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerDevOpsAuditSettingsProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerDevOpsAuditSettingsProperties.java new file mode 100644 index 0000000000000..49f03d268bb3a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerDevOpsAuditSettingsProperties.java @@ -0,0 +1,254 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.BlobAuditingPolicyState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +/** Properties of a server DevOps audit settings. */ +@Fluent +public final class ServerDevOpsAuditSettingsProperties { + /* + * Specifies whether DevOps 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 DevOps audit, Diagnostic Settings with 'DevOpsOperationsAudit' diagnostic logs + * category on the master database should be also created. + * + * Diagnostic Settings URI format: + * PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/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 = "isAzureMonitorTargetEnabled") + private Boolean isAzureMonitorTargetEnabled; + + /* + * Specifies whether Managed Identity is used to access blob storage + */ + @JsonProperty(value = "isManagedIdentityInUse") + private Boolean isManagedIdentityInUse; + + /* + * Specifies the state of the audit. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are + * required. + */ + @JsonProperty(value = "state", required = true) + private BlobAuditingPolicyState state; + + /* + * Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, + * storageEndpoint or isAzureMonitorTargetEnabled is required. + */ + @JsonProperty(value = "storageEndpoint") + private String storageEndpoint; + + /* + * Specifies the identifier key of the auditing storage account. + * If state is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL + * server system-assigned managed identity to access the storage. + * Prerequisites for using managed identity authentication: + * 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). + * 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role + * to the server identity. + * For more information, see [Auditing to storage using Managed Identity + * authentication](https://go.microsoft.com/fwlink/?linkid=2114355) + */ + @JsonProperty(value = "storageAccountAccessKey") + private String storageAccountAccessKey; + + /* + * Specifies the blob storage subscription Id. + */ + @JsonProperty(value = "storageAccountSubscriptionId") + private UUID storageAccountSubscriptionId; + + /** Creates an instance of ServerDevOpsAuditSettingsProperties class. */ + public ServerDevOpsAuditSettingsProperties() { + } + + /** + * Get the isAzureMonitorTargetEnabled property: Specifies whether DevOps 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 DevOps audit, Diagnostic Settings with 'DevOpsOperationsAudit' diagnostic + * logs category on the master database should be also created. + * + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/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 the isAzureMonitorTargetEnabled property: Specifies whether DevOps 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 DevOps audit, Diagnostic Settings with 'DevOpsOperationsAudit' diagnostic + * logs category on the master database should be also created. + * + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/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 ServerDevOpsAuditSettingsProperties object itself. + */ + public ServerDevOpsAuditSettingsProperties withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled) { + this.isAzureMonitorTargetEnabled = isAzureMonitorTargetEnabled; + return this; + } + + /** + * Get the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob storage. + * + * @return the isManagedIdentityInUse value. + */ + public Boolean isManagedIdentityInUse() { + return this.isManagedIdentityInUse; + } + + /** + * Set the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob storage. + * + * @param isManagedIdentityInUse the isManagedIdentityInUse value to set. + * @return the ServerDevOpsAuditSettingsProperties object itself. + */ + public ServerDevOpsAuditSettingsProperties withIsManagedIdentityInUse(Boolean isManagedIdentityInUse) { + this.isManagedIdentityInUse = isManagedIdentityInUse; + return this; + } + + /** + * Get the state property: Specifies the state of the audit. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * + * @return the state value. + */ + public BlobAuditingPolicyState state() { + return this.state; + } + + /** + * Set the state property: Specifies the state of the audit. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * + * @param state the state value to set. + * @return the ServerDevOpsAuditSettingsProperties object itself. + */ + public ServerDevOpsAuditSettingsProperties withState(BlobAuditingPolicyState state) { + this.state = state; + return this; + } + + /** + * Get the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is + * required. + * + * @return the storageEndpoint value. + */ + public String storageEndpoint() { + return this.storageEndpoint; + } + + /** + * Set the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is + * required. + * + * @param storageEndpoint the storageEndpoint value to set. + * @return the ServerDevOpsAuditSettingsProperties object itself. + */ + public ServerDevOpsAuditSettingsProperties withStorageEndpoint(String storageEndpoint) { + this.storageEndpoint = storageEndpoint; + return this; + } + + /** + * Get the storageAccountAccessKey property: Specifies the identifier key of the auditing storage account. If state + * is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server + * system-assigned managed identity to access the storage. Prerequisites for using managed identity authentication: + * 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). 2. Grant SQL Server + * identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server + * identity. For more information, see [Auditing to storage using Managed Identity + * authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @return the storageAccountAccessKey value. + */ + public String storageAccountAccessKey() { + return this.storageAccountAccessKey; + } + + /** + * Set the storageAccountAccessKey property: Specifies the identifier key of the auditing storage account. If state + * is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server + * system-assigned managed identity to access the storage. Prerequisites for using managed identity authentication: + * 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). 2. Grant SQL Server + * identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server + * identity. For more information, see [Auditing to storage using Managed Identity + * authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set. + * @return the ServerDevOpsAuditSettingsProperties object itself. + */ + public ServerDevOpsAuditSettingsProperties withStorageAccountAccessKey(String storageAccountAccessKey) { + this.storageAccountAccessKey = storageAccountAccessKey; + return this; + } + + /** + * Get the storageAccountSubscriptionId property: Specifies the blob storage subscription Id. + * + * @return the storageAccountSubscriptionId value. + */ + public UUID storageAccountSubscriptionId() { + return this.storageAccountSubscriptionId; + } + + /** + * Set the storageAccountSubscriptionId property: Specifies the blob storage subscription Id. + * + * @param storageAccountSubscriptionId the storageAccountSubscriptionId value to set. + * @return the ServerDevOpsAuditSettingsProperties object itself. + */ + public ServerDevOpsAuditSettingsProperties withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId) { + this.storageAccountSubscriptionId = storageAccountSubscriptionId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (state() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property state in model ServerDevOpsAuditSettingsProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ServerDevOpsAuditSettingsProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerDevOpsAuditingSettingsInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerDevOpsAuditingSettingsInner.java new file mode 100644 index 0000000000000..650d0e426a3c3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerDevOpsAuditingSettingsInner.java @@ -0,0 +1,239 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.sql.generated.models.BlobAuditingPolicyState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +/** A server DevOps auditing settings. */ +@Fluent +public final class ServerDevOpsAuditingSettingsInner extends ProxyResource { + /* + * SystemData of ServerDevOpsAuditSettingsResource. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ServerDevOpsAuditSettingsProperties innerProperties; + + /** Creates an instance of ServerDevOpsAuditingSettingsInner class. */ + public ServerDevOpsAuditingSettingsInner() { + } + + /** + * Get the systemData property: SystemData of ServerDevOpsAuditSettingsResource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ServerDevOpsAuditSettingsProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the isAzureMonitorTargetEnabled property: Specifies whether DevOps 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 DevOps audit, Diagnostic Settings with 'DevOpsOperationsAudit' diagnostic + * logs category on the master database should be also created. + * + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/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.innerProperties() == null ? null : this.innerProperties().isAzureMonitorTargetEnabled(); + } + + /** + * Set the isAzureMonitorTargetEnabled property: Specifies whether DevOps 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 DevOps audit, Diagnostic Settings with 'DevOpsOperationsAudit' diagnostic + * logs category on the master database should be also created. + * + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/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 ServerDevOpsAuditingSettingsInner object itself. + */ + public ServerDevOpsAuditingSettingsInner withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerDevOpsAuditSettingsProperties(); + } + this.innerProperties().withIsAzureMonitorTargetEnabled(isAzureMonitorTargetEnabled); + return this; + } + + /** + * Get the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob storage. + * + * @return the isManagedIdentityInUse value. + */ + public Boolean isManagedIdentityInUse() { + return this.innerProperties() == null ? null : this.innerProperties().isManagedIdentityInUse(); + } + + /** + * Set the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob storage. + * + * @param isManagedIdentityInUse the isManagedIdentityInUse value to set. + * @return the ServerDevOpsAuditingSettingsInner object itself. + */ + public ServerDevOpsAuditingSettingsInner withIsManagedIdentityInUse(Boolean isManagedIdentityInUse) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerDevOpsAuditSettingsProperties(); + } + this.innerProperties().withIsManagedIdentityInUse(isManagedIdentityInUse); + return this; + } + + /** + * Get the state property: Specifies the state of the audit. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * + * @return the state value. + */ + public BlobAuditingPolicyState state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Set the state property: Specifies the state of the audit. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * + * @param state the state value to set. + * @return the ServerDevOpsAuditingSettingsInner object itself. + */ + public ServerDevOpsAuditingSettingsInner withState(BlobAuditingPolicyState state) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerDevOpsAuditSettingsProperties(); + } + this.innerProperties().withState(state); + return this; + } + + /** + * Get the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is + * required. + * + * @return the storageEndpoint value. + */ + public String storageEndpoint() { + return this.innerProperties() == null ? null : this.innerProperties().storageEndpoint(); + } + + /** + * Set the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is + * required. + * + * @param storageEndpoint the storageEndpoint value to set. + * @return the ServerDevOpsAuditingSettingsInner object itself. + */ + public ServerDevOpsAuditingSettingsInner withStorageEndpoint(String storageEndpoint) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerDevOpsAuditSettingsProperties(); + } + this.innerProperties().withStorageEndpoint(storageEndpoint); + return this; + } + + /** + * Get the storageAccountAccessKey property: Specifies the identifier key of the auditing storage account. If state + * is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server + * system-assigned managed identity to access the storage. Prerequisites for using managed identity authentication: + * 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). 2. Grant SQL Server + * identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server + * identity. For more information, see [Auditing to storage using Managed Identity + * authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @return the storageAccountAccessKey value. + */ + public String storageAccountAccessKey() { + return this.innerProperties() == null ? null : this.innerProperties().storageAccountAccessKey(); + } + + /** + * Set the storageAccountAccessKey property: Specifies the identifier key of the auditing storage account. If state + * is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server + * system-assigned managed identity to access the storage. Prerequisites for using managed identity authentication: + * 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). 2. Grant SQL Server + * identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server + * identity. For more information, see [Auditing to storage using Managed Identity + * authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set. + * @return the ServerDevOpsAuditingSettingsInner object itself. + */ + public ServerDevOpsAuditingSettingsInner withStorageAccountAccessKey(String storageAccountAccessKey) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerDevOpsAuditSettingsProperties(); + } + this.innerProperties().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + /** + * Get the storageAccountSubscriptionId property: Specifies the blob storage subscription Id. + * + * @return the storageAccountSubscriptionId value. + */ + public UUID storageAccountSubscriptionId() { + return this.innerProperties() == null ? null : this.innerProperties().storageAccountSubscriptionId(); + } + + /** + * Set the storageAccountSubscriptionId property: Specifies the blob storage subscription Id. + * + * @param storageAccountSubscriptionId the storageAccountSubscriptionId value to set. + * @return the ServerDevOpsAuditingSettingsInner object itself. + */ + public ServerDevOpsAuditingSettingsInner withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerDevOpsAuditSettingsProperties(); + } + this.innerProperties().withStorageAccountSubscriptionId(storageAccountSubscriptionId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerDnsAliasInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerDnsAliasInner.java new file mode 100644 index 0000000000000..255863a4c96a5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerDnsAliasInner.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A server DNS alias. */ +@Immutable +public final class ServerDnsAliasInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ServerDnsAliasProperties innerProperties; + + /** Creates an instance of ServerDnsAliasInner class. */ + public ServerDnsAliasInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ServerDnsAliasProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the azureDnsRecord property: The fully qualified DNS record for alias. + * + * @return the azureDnsRecord value. + */ + public String azureDnsRecord() { + return this.innerProperties() == null ? null : this.innerProperties().azureDnsRecord(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerDnsAliasProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerDnsAliasProperties.java new file mode 100644 index 0000000000000..1d98efb8ca778 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerDnsAliasProperties.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a server DNS alias. */ +@Immutable +public final class ServerDnsAliasProperties { + /* + * The fully qualified DNS record for alias + */ + @JsonProperty(value = "azureDnsRecord", access = JsonProperty.Access.WRITE_ONLY) + private String azureDnsRecord; + + /** Creates an instance of ServerDnsAliasProperties class. */ + public ServerDnsAliasProperties() { + } + + /** + * Get the azureDnsRecord property: The fully qualified DNS record for alias. + * + * @return the azureDnsRecord value. + */ + public String azureDnsRecord() { + return this.azureDnsRecord; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerFirewallRuleProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerFirewallRuleProperties.java new file mode 100644 index 0000000000000..419fc95445736 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerFirewallRuleProperties.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of a server firewall rule. */ +@Fluent +public final class ServerFirewallRuleProperties { + /* + * 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 = "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 = "endIpAddress") + private String endIpAddress; + + /** Creates an instance of ServerFirewallRuleProperties class. */ + public ServerFirewallRuleProperties() { + } + + /** + * Get the startIpAddress property: 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 startIpAddress property: 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 ServerFirewallRuleProperties object itself. + */ + public ServerFirewallRuleProperties withStartIpAddress(String startIpAddress) { + this.startIpAddress = startIpAddress; + return this; + } + + /** + * Get the endIpAddress property: 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 endIpAddress property: 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 ServerFirewallRuleProperties object itself. + */ + public ServerFirewallRuleProperties withEndIpAddress(String endIpAddress) { + this.endIpAddress = endIpAddress; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerInner.java new file mode 100644 index 0000000000000..d204cdd886c82 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerInner.java @@ -0,0 +1,382 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.resourcemanager.sql.generated.models.ResourceIdentity; +import com.azure.resourcemanager.sql.generated.models.ServerExternalAdministrator; +import com.azure.resourcemanager.sql.generated.models.ServerNetworkAccessFlag; +import com.azure.resourcemanager.sql.generated.models.ServerPrivateEndpointConnection; +import com.azure.resourcemanager.sql.generated.models.ServerWorkspaceFeature; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +/** An Azure SQL Database server. */ +@Fluent +public final 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; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ServerProperties innerProperties; + + /** Creates an instance of ServerInner class. */ + public ServerInner() { + } + + /** + * Get the identity property: The Azure Active Directory identity of the server. + * + * @return the identity value. + */ + public ResourceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: 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 the kind property: 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 innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ServerProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public ServerInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the administratorLogin property: Administrator username for the server. Once created it cannot be changed. + * + * @return the administratorLogin value. + */ + public String administratorLogin() { + return this.innerProperties() == null ? null : this.innerProperties().administratorLogin(); + } + + /** + * Set the administratorLogin property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerProperties(); + } + this.innerProperties().withAdministratorLogin(administratorLogin); + return this; + } + + /** + * Get the administratorLoginPassword property: The administrator login password (required for server creation). + * + * @return the administratorLoginPassword value. + */ + public String administratorLoginPassword() { + return this.innerProperties() == null ? null : this.innerProperties().administratorLoginPassword(); + } + + /** + * Set the administratorLoginPassword property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerProperties(); + } + this.innerProperties().withAdministratorLoginPassword(administratorLoginPassword); + return this; + } + + /** + * Get the version property: The version of the server. + * + * @return the version value. + */ + public String version() { + return this.innerProperties() == null ? null : this.innerProperties().version(); + } + + /** + * Set the version property: The version of the server. + * + * @param version the version value to set. + * @return the ServerInner object itself. + */ + public ServerInner withVersion(String version) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerProperties(); + } + this.innerProperties().withVersion(version); + return this; + } + + /** + * Get the state property: The state of the server. + * + * @return the state value. + */ + public String state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Get the fullyQualifiedDomainName property: The fully qualified domain name of the server. + * + * @return the fullyQualifiedDomainName value. + */ + public String fullyQualifiedDomainName() { + return this.innerProperties() == null ? null : this.innerProperties().fullyQualifiedDomainName(); + } + + /** + * Get the privateEndpointConnections property: List of private endpoint connections on a server. + * + * @return the privateEndpointConnections value. + */ + public List privateEndpointConnections() { + return this.innerProperties() == null ? null : this.innerProperties().privateEndpointConnections(); + } + + /** + * Get the minimalTlsVersion property: Minimal TLS version. Allowed values: '1.0', '1.1', '1.2'. + * + * @return the minimalTlsVersion value. + */ + public String minimalTlsVersion() { + return this.innerProperties() == null ? null : this.innerProperties().minimalTlsVersion(); + } + + /** + * Set the minimalTlsVersion property: Minimal TLS version. Allowed values: '1.0', '1.1', '1.2'. + * + * @param minimalTlsVersion the minimalTlsVersion value to set. + * @return the ServerInner object itself. + */ + public ServerInner withMinimalTlsVersion(String minimalTlsVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerProperties(); + } + this.innerProperties().withMinimalTlsVersion(minimalTlsVersion); + return this; + } + + /** + * Get the publicNetworkAccess property: Whether or not public endpoint access is allowed for this server. Value is + * optional but if passed in, must be 'Enabled' or 'Disabled'. + * + * @return the publicNetworkAccess value. + */ + public ServerNetworkAccessFlag publicNetworkAccess() { + return this.innerProperties() == null ? null : this.innerProperties().publicNetworkAccess(); + } + + /** + * Set the publicNetworkAccess property: Whether or not public endpoint access is allowed for this server. Value is + * optional but if passed in, must be 'Enabled' or 'Disabled'. + * + * @param publicNetworkAccess the publicNetworkAccess value to set. + * @return the ServerInner object itself. + */ + public ServerInner withPublicNetworkAccess(ServerNetworkAccessFlag publicNetworkAccess) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerProperties(); + } + this.innerProperties().withPublicNetworkAccess(publicNetworkAccess); + return this; + } + + /** + * Get the workspaceFeature property: Whether or not existing server has a workspace created and if it allows + * connection from workspace. + * + * @return the workspaceFeature value. + */ + public ServerWorkspaceFeature workspaceFeature() { + return this.innerProperties() == null ? null : this.innerProperties().workspaceFeature(); + } + + /** + * Get the primaryUserAssignedIdentityId property: The resource id of a user assigned identity to be used by + * default. + * + * @return the primaryUserAssignedIdentityId value. + */ + public String primaryUserAssignedIdentityId() { + return this.innerProperties() == null ? null : this.innerProperties().primaryUserAssignedIdentityId(); + } + + /** + * Set the primaryUserAssignedIdentityId property: The resource id of a user assigned identity to be used by + * default. + * + * @param primaryUserAssignedIdentityId the primaryUserAssignedIdentityId value to set. + * @return the ServerInner object itself. + */ + public ServerInner withPrimaryUserAssignedIdentityId(String primaryUserAssignedIdentityId) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerProperties(); + } + this.innerProperties().withPrimaryUserAssignedIdentityId(primaryUserAssignedIdentityId); + return this; + } + + /** + * Get the federatedClientId property: The Client id used for cross tenant CMK scenario. + * + * @return the federatedClientId value. + */ + public UUID federatedClientId() { + return this.innerProperties() == null ? null : this.innerProperties().federatedClientId(); + } + + /** + * Set the federatedClientId property: The Client id used for cross tenant CMK scenario. + * + * @param federatedClientId the federatedClientId value to set. + * @return the ServerInner object itself. + */ + public ServerInner withFederatedClientId(UUID federatedClientId) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerProperties(); + } + this.innerProperties().withFederatedClientId(federatedClientId); + return this; + } + + /** + * Get the keyId property: A CMK URI of the key to use for encryption. + * + * @return the keyId value. + */ + public String keyId() { + return this.innerProperties() == null ? null : this.innerProperties().keyId(); + } + + /** + * Set the keyId property: A CMK URI of the key to use for encryption. + * + * @param keyId the keyId value to set. + * @return the ServerInner object itself. + */ + public ServerInner withKeyId(String keyId) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerProperties(); + } + this.innerProperties().withKeyId(keyId); + return this; + } + + /** + * Get the administrators property: The Azure Active Directory identity of the server. + * + * @return the administrators value. + */ + public ServerExternalAdministrator administrators() { + return this.innerProperties() == null ? null : this.innerProperties().administrators(); + } + + /** + * Set the administrators property: The Azure Active Directory identity of the server. + * + * @param administrators the administrators value to set. + * @return the ServerInner object itself. + */ + public ServerInner withAdministrators(ServerExternalAdministrator administrators) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerProperties(); + } + this.innerProperties().withAdministrators(administrators); + return this; + } + + /** + * Get the restrictOutboundNetworkAccess property: Whether or not to restrict outbound network access for this + * server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. + * + * @return the restrictOutboundNetworkAccess value. + */ + public ServerNetworkAccessFlag restrictOutboundNetworkAccess() { + return this.innerProperties() == null ? null : this.innerProperties().restrictOutboundNetworkAccess(); + } + + /** + * Set the restrictOutboundNetworkAccess property: Whether or not to restrict outbound network access for this + * server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. + * + * @param restrictOutboundNetworkAccess the restrictOutboundNetworkAccess value to set. + * @return the ServerInner object itself. + */ + public ServerInner withRestrictOutboundNetworkAccess(ServerNetworkAccessFlag restrictOutboundNetworkAccess) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerProperties(); + } + this.innerProperties().withRestrictOutboundNetworkAccess(restrictOutboundNetworkAccess); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (identity() != null) { + identity().validate(); + } + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerKeyInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerKeyInner.java new file mode 100644 index 0000000000000..84fb9a15166a9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerKeyInner.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.ServerKeyType; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** A server key. */ +@Fluent +public final class ServerKeyInner 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; + + /* + * Resource location. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ServerKeyProperties innerProperties; + + /** Creates an instance of ServerKeyInner class. */ + public ServerKeyInner() { + } + + /** + * Get the kind property: 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 location property: Resource location. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ServerKeyProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the subregion property: Subregion of the server key. + * + * @return the subregion value. + */ + public String subregion() { + return this.innerProperties() == null ? null : this.innerProperties().subregion(); + } + + /** + * Get the serverKeyType property: The server key type like 'ServiceManaged', 'AzureKeyVault'. + * + * @return the serverKeyType value. + */ + public ServerKeyType serverKeyType() { + return this.innerProperties() == null ? null : this.innerProperties().serverKeyType(); + } + + /** + * Set the serverKeyType property: The server key type like 'ServiceManaged', 'AzureKeyVault'. + * + * @param serverKeyType the serverKeyType value to set. + * @return the ServerKeyInner object itself. + */ + public ServerKeyInner withServerKeyType(ServerKeyType serverKeyType) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerKeyProperties(); + } + this.innerProperties().withServerKeyType(serverKeyType); + return this; + } + + /** + * Get the uri property: The URI of the server key. If the ServerKeyType is AzureKeyVault, then the URI is required. + * + * @return the uri value. + */ + public String uri() { + return this.innerProperties() == null ? null : this.innerProperties().uri(); + } + + /** + * Set the uri property: The URI of the server key. If the ServerKeyType is AzureKeyVault, then the URI is required. + * + * @param uri the uri value to set. + * @return the ServerKeyInner object itself. + */ + public ServerKeyInner withUri(String uri) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerKeyProperties(); + } + this.innerProperties().withUri(uri); + return this; + } + + /** + * Get the thumbprint property: Thumbprint of the server key. + * + * @return the thumbprint value. + */ + public String thumbprint() { + return this.innerProperties() == null ? null : this.innerProperties().thumbprint(); + } + + /** + * Get the creationDate property: The server key creation date. + * + * @return the creationDate value. + */ + public OffsetDateTime creationDate() { + return this.innerProperties() == null ? null : this.innerProperties().creationDate(); + } + + /** + * Get the autoRotationEnabled property: Key auto rotation opt-in flag. Either true or false. + * + * @return the autoRotationEnabled value. + */ + public Boolean autoRotationEnabled() { + return this.innerProperties() == null ? null : this.innerProperties().autoRotationEnabled(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerKeyProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerKeyProperties.java new file mode 100644 index 0000000000000..c3b8d1e25b67a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerKeyProperties.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.ServerKeyType; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Properties for a server key execution. */ +@Fluent +public final class ServerKeyProperties { + /* + * Subregion of the server key. + */ + @JsonProperty(value = "subregion", access = JsonProperty.Access.WRITE_ONLY) + private String subregion; + + /* + * The server key type like 'ServiceManaged', 'AzureKeyVault'. + */ + @JsonProperty(value = "serverKeyType", required = true) + private ServerKeyType serverKeyType; + + /* + * The URI of the server key. If the ServerKeyType is AzureKeyVault, then the URI is required. + */ + @JsonProperty(value = "uri") + private String uri; + + /* + * Thumbprint of the server key. + */ + @JsonProperty(value = "thumbprint", access = JsonProperty.Access.WRITE_ONLY) + private String thumbprint; + + /* + * The server key creation date. + */ + @JsonProperty(value = "creationDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime creationDate; + + /* + * Key auto rotation opt-in flag. Either true or false. + */ + @JsonProperty(value = "autoRotationEnabled", access = JsonProperty.Access.WRITE_ONLY) + private Boolean autoRotationEnabled; + + /** Creates an instance of ServerKeyProperties class. */ + public ServerKeyProperties() { + } + + /** + * Get the subregion property: Subregion of the server key. + * + * @return the subregion value. + */ + public String subregion() { + return this.subregion; + } + + /** + * Get the serverKeyType property: The server key type like 'ServiceManaged', 'AzureKeyVault'. + * + * @return the serverKeyType value. + */ + public ServerKeyType serverKeyType() { + return this.serverKeyType; + } + + /** + * Set the serverKeyType property: The server key type like 'ServiceManaged', 'AzureKeyVault'. + * + * @param serverKeyType the serverKeyType value to set. + * @return the ServerKeyProperties object itself. + */ + public ServerKeyProperties withServerKeyType(ServerKeyType serverKeyType) { + this.serverKeyType = serverKeyType; + return this; + } + + /** + * Get the uri property: The URI of the server key. If the ServerKeyType is AzureKeyVault, then the URI is required. + * + * @return the uri value. + */ + public String uri() { + return this.uri; + } + + /** + * Set the uri property: The URI of the server key. If the ServerKeyType is AzureKeyVault, then the URI is required. + * + * @param uri the uri value to set. + * @return the ServerKeyProperties object itself. + */ + public ServerKeyProperties withUri(String uri) { + this.uri = uri; + return this; + } + + /** + * Get the thumbprint property: Thumbprint of the server key. + * + * @return the thumbprint value. + */ + public String thumbprint() { + return this.thumbprint; + } + + /** + * Get the creationDate property: The server key creation date. + * + * @return the creationDate value. + */ + public OffsetDateTime creationDate() { + return this.creationDate; + } + + /** + * Get the autoRotationEnabled property: Key auto rotation opt-in flag. Either true or false. + * + * @return the autoRotationEnabled value. + */ + public Boolean autoRotationEnabled() { + return this.autoRotationEnabled; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (serverKeyType() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property serverKeyType in model ServerKeyProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ServerKeyProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerOperationInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerOperationInner.java new file mode 100644 index 0000000000000..788cf2db878cd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerOperationInner.java @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.ManagementOperationState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** A server operation. */ +@Immutable +public final class ServerOperationInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ServerOperationProperties innerProperties; + + /** Creates an instance of ServerOperationInner class. */ + public ServerOperationInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ServerOperationProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the operation property: The name of operation. + * + * @return the operation value. + */ + public String operation() { + return this.innerProperties() == null ? null : this.innerProperties().operation(); + } + + /** + * Get the operationFriendlyName property: The friendly name of operation. + * + * @return the operationFriendlyName value. + */ + public String operationFriendlyName() { + return this.innerProperties() == null ? null : this.innerProperties().operationFriendlyName(); + } + + /** + * Get the percentComplete property: The percentage of the operation completed. + * + * @return the percentComplete value. + */ + public Integer percentComplete() { + return this.innerProperties() == null ? null : this.innerProperties().percentComplete(); + } + + /** + * Get the serverName property: The name of the server. + * + * @return the serverName value. + */ + public String serverName() { + return this.innerProperties() == null ? null : this.innerProperties().serverName(); + } + + /** + * Get the startTime property: The operation start time. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.innerProperties() == null ? null : this.innerProperties().startTime(); + } + + /** + * Get the state property: The operation state. + * + * @return the state value. + */ + public ManagementOperationState state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Get the errorCode property: The operation error code. + * + * @return the errorCode value. + */ + public Integer errorCode() { + return this.innerProperties() == null ? null : this.innerProperties().errorCode(); + } + + /** + * Get the errorDescription property: The operation error description. + * + * @return the errorDescription value. + */ + public String errorDescription() { + return this.innerProperties() == null ? null : this.innerProperties().errorDescription(); + } + + /** + * Get the errorSeverity property: The operation error severity. + * + * @return the errorSeverity value. + */ + public Integer errorSeverity() { + return this.innerProperties() == null ? null : this.innerProperties().errorSeverity(); + } + + /** + * Get the isUserError property: Whether or not the error is a user error. + * + * @return the isUserError value. + */ + public Boolean isUserError() { + return this.innerProperties() == null ? null : this.innerProperties().isUserError(); + } + + /** + * Get the estimatedCompletionTime property: The estimated completion time of the operation. + * + * @return the estimatedCompletionTime value. + */ + public OffsetDateTime estimatedCompletionTime() { + return this.innerProperties() == null ? null : this.innerProperties().estimatedCompletionTime(); + } + + /** + * Get the description property: The operation description. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Get the isCancellable property: Whether the operation can be cancelled. + * + * @return the isCancellable value. + */ + public Boolean isCancellable() { + return this.innerProperties() == null ? null : this.innerProperties().isCancellable(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerOperationProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerOperationProperties.java new file mode 100644 index 0000000000000..d1363fdc94bab --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerOperationProperties.java @@ -0,0 +1,221 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.models.ManagementOperationState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The properties of a server operation. */ +@Immutable +public final class ServerOperationProperties { + /* + * The name of operation. + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /* + * The friendly name of operation. + */ + @JsonProperty(value = "operationFriendlyName", access = JsonProperty.Access.WRITE_ONLY) + private String operationFriendlyName; + + /* + * The percentage of the operation completed. + */ + @JsonProperty(value = "percentComplete", access = JsonProperty.Access.WRITE_ONLY) + private Integer percentComplete; + + /* + * The name of the server. + */ + @JsonProperty(value = "serverName", access = JsonProperty.Access.WRITE_ONLY) + private String serverName; + + /* + * The operation start time. + */ + @JsonProperty(value = "startTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime startTime; + + /* + * The operation state. + */ + @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) + private ManagementOperationState state; + + /* + * The operation error code. + */ + @JsonProperty(value = "errorCode", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorCode; + + /* + * The operation error description. + */ + @JsonProperty(value = "errorDescription", access = JsonProperty.Access.WRITE_ONLY) + private String errorDescription; + + /* + * The operation error severity. + */ + @JsonProperty(value = "errorSeverity", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorSeverity; + + /* + * Whether or not the error is a user error. + */ + @JsonProperty(value = "isUserError", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isUserError; + + /* + * The estimated completion time of the operation. + */ + @JsonProperty(value = "estimatedCompletionTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime estimatedCompletionTime; + + /* + * The operation description. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /* + * Whether the operation can be cancelled. + */ + @JsonProperty(value = "isCancellable", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isCancellable; + + /** Creates an instance of ServerOperationProperties class. */ + public ServerOperationProperties() { + } + + /** + * Get the operation property: The name of operation. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the operationFriendlyName property: The friendly name of operation. + * + * @return the operationFriendlyName value. + */ + public String operationFriendlyName() { + return this.operationFriendlyName; + } + + /** + * Get the percentComplete property: The percentage of the operation completed. + * + * @return the percentComplete value. + */ + public Integer percentComplete() { + return this.percentComplete; + } + + /** + * Get the serverName property: The name of the server. + * + * @return the serverName value. + */ + public String serverName() { + return this.serverName; + } + + /** + * Get the startTime property: The operation start time. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Get the state property: The operation state. + * + * @return the state value. + */ + public ManagementOperationState state() { + return this.state; + } + + /** + * Get the errorCode property: The operation error code. + * + * @return the errorCode value. + */ + public Integer errorCode() { + return this.errorCode; + } + + /** + * Get the errorDescription property: The operation error description. + * + * @return the errorDescription value. + */ + public String errorDescription() { + return this.errorDescription; + } + + /** + * Get the errorSeverity property: The operation error severity. + * + * @return the errorSeverity value. + */ + public Integer errorSeverity() { + return this.errorSeverity; + } + + /** + * Get the isUserError property: Whether or not the error is a user error. + * + * @return the isUserError value. + */ + public Boolean isUserError() { + return this.isUserError; + } + + /** + * Get the estimatedCompletionTime property: The estimated completion time of the operation. + * + * @return the estimatedCompletionTime value. + */ + public OffsetDateTime estimatedCompletionTime() { + return this.estimatedCompletionTime; + } + + /** + * Get the description property: The operation description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the isCancellable property: Whether the operation can be cancelled. + * + * @return the isCancellable value. + */ + public Boolean isCancellable() { + return this.isCancellable; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerProperties.java new file mode 100644 index 0000000000000..b7ec1be5bf449 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerProperties.java @@ -0,0 +1,365 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.models.ServerExternalAdministrator; +import com.azure.resourcemanager.sql.generated.models.ServerNetworkAccessFlag; +import com.azure.resourcemanager.sql.generated.models.ServerPrivateEndpointConnection; +import com.azure.resourcemanager.sql.generated.models.ServerWorkspaceFeature; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.UUID; + +/** The properties of a server. */ +@Fluent +public final class ServerProperties { + /* + * Administrator username for the server. Once created it cannot be changed. + */ + @JsonProperty(value = "administratorLogin") + private String administratorLogin; + + /* + * The administrator login password (required for server creation). + */ + @JsonProperty(value = "administratorLoginPassword") + private String administratorLoginPassword; + + /* + * The version of the server. + */ + @JsonProperty(value = "version") + private String version; + + /* + * The state of the server. + */ + @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) + private String state; + + /* + * The fully qualified domain name of the server. + */ + @JsonProperty(value = "fullyQualifiedDomainName", access = JsonProperty.Access.WRITE_ONLY) + private String fullyQualifiedDomainName; + + /* + * List of private endpoint connections on a server + */ + @JsonProperty(value = "privateEndpointConnections", access = JsonProperty.Access.WRITE_ONLY) + private List privateEndpointConnections; + + /* + * Minimal TLS version. Allowed values: '1.0', '1.1', '1.2' + */ + @JsonProperty(value = "minimalTlsVersion") + private String minimalTlsVersion; + + /* + * Whether or not public endpoint access is allowed for this server. Value is optional but if passed in, must be + * 'Enabled' or 'Disabled' + */ + @JsonProperty(value = "publicNetworkAccess") + private ServerNetworkAccessFlag publicNetworkAccess; + + /* + * Whether or not existing server has a workspace created and if it allows connection from workspace + */ + @JsonProperty(value = "workspaceFeature", access = JsonProperty.Access.WRITE_ONLY) + private ServerWorkspaceFeature workspaceFeature; + + /* + * The resource id of a user assigned identity to be used by default. + */ + @JsonProperty(value = "primaryUserAssignedIdentityId") + private String primaryUserAssignedIdentityId; + + /* + * The Client id used for cross tenant CMK scenario + */ + @JsonProperty(value = "federatedClientId") + private UUID federatedClientId; + + /* + * A CMK URI of the key to use for encryption. + */ + @JsonProperty(value = "keyId") + private String keyId; + + /* + * The Azure Active Directory identity of the server. + */ + @JsonProperty(value = "administrators") + private ServerExternalAdministrator administrators; + + /* + * Whether or not to restrict outbound network access for this server. Value is optional but if passed in, must be + * 'Enabled' or 'Disabled' + */ + @JsonProperty(value = "restrictOutboundNetworkAccess") + private ServerNetworkAccessFlag restrictOutboundNetworkAccess; + + /** Creates an instance of ServerProperties class. */ + public ServerProperties() { + } + + /** + * Get the administratorLogin property: Administrator username for the server. Once created it cannot be changed. + * + * @return the administratorLogin value. + */ + public String administratorLogin() { + return this.administratorLogin; + } + + /** + * Set the administratorLogin property: Administrator username for the server. Once created it cannot be changed. + * + * @param administratorLogin the administratorLogin value to set. + * @return the ServerProperties object itself. + */ + public ServerProperties withAdministratorLogin(String administratorLogin) { + this.administratorLogin = administratorLogin; + return this; + } + + /** + * Get the administratorLoginPassword property: The administrator login password (required for server creation). + * + * @return the administratorLoginPassword value. + */ + public String administratorLoginPassword() { + return this.administratorLoginPassword; + } + + /** + * Set the administratorLoginPassword property: The administrator login password (required for server creation). + * + * @param administratorLoginPassword the administratorLoginPassword value to set. + * @return the ServerProperties object itself. + */ + public ServerProperties withAdministratorLoginPassword(String administratorLoginPassword) { + this.administratorLoginPassword = administratorLoginPassword; + return this; + } + + /** + * Get the version property: The version of the server. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: The version of the server. + * + * @param version the version value to set. + * @return the ServerProperties object itself. + */ + public ServerProperties withVersion(String version) { + this.version = version; + return this; + } + + /** + * Get the state property: The state of the server. + * + * @return the state value. + */ + public String state() { + return this.state; + } + + /** + * Get the fullyQualifiedDomainName property: The fully qualified domain name of the server. + * + * @return the fullyQualifiedDomainName value. + */ + public String fullyQualifiedDomainName() { + return this.fullyQualifiedDomainName; + } + + /** + * Get the privateEndpointConnections property: List of private endpoint connections on a server. + * + * @return the privateEndpointConnections value. + */ + public List privateEndpointConnections() { + return this.privateEndpointConnections; + } + + /** + * Get the minimalTlsVersion property: Minimal TLS version. Allowed values: '1.0', '1.1', '1.2'. + * + * @return the minimalTlsVersion value. + */ + public String minimalTlsVersion() { + return this.minimalTlsVersion; + } + + /** + * Set the minimalTlsVersion property: Minimal TLS version. Allowed values: '1.0', '1.1', '1.2'. + * + * @param minimalTlsVersion the minimalTlsVersion value to set. + * @return the ServerProperties object itself. + */ + public ServerProperties withMinimalTlsVersion(String minimalTlsVersion) { + this.minimalTlsVersion = minimalTlsVersion; + return this; + } + + /** + * Get the publicNetworkAccess property: Whether or not public endpoint access is allowed for this server. Value is + * optional but if passed in, must be 'Enabled' or 'Disabled'. + * + * @return the publicNetworkAccess value. + */ + public ServerNetworkAccessFlag publicNetworkAccess() { + return this.publicNetworkAccess; + } + + /** + * Set the publicNetworkAccess property: Whether or not public endpoint access is allowed for this server. Value is + * optional but if passed in, must be 'Enabled' or 'Disabled'. + * + * @param publicNetworkAccess the publicNetworkAccess value to set. + * @return the ServerProperties object itself. + */ + public ServerProperties withPublicNetworkAccess(ServerNetworkAccessFlag publicNetworkAccess) { + this.publicNetworkAccess = publicNetworkAccess; + return this; + } + + /** + * Get the workspaceFeature property: Whether or not existing server has a workspace created and if it allows + * connection from workspace. + * + * @return the workspaceFeature value. + */ + public ServerWorkspaceFeature workspaceFeature() { + return this.workspaceFeature; + } + + /** + * Get the primaryUserAssignedIdentityId property: The resource id of a user assigned identity to be used by + * default. + * + * @return the primaryUserAssignedIdentityId value. + */ + public String primaryUserAssignedIdentityId() { + return this.primaryUserAssignedIdentityId; + } + + /** + * Set the primaryUserAssignedIdentityId property: The resource id of a user assigned identity to be used by + * default. + * + * @param primaryUserAssignedIdentityId the primaryUserAssignedIdentityId value to set. + * @return the ServerProperties object itself. + */ + public ServerProperties withPrimaryUserAssignedIdentityId(String primaryUserAssignedIdentityId) { + this.primaryUserAssignedIdentityId = primaryUserAssignedIdentityId; + return this; + } + + /** + * Get the federatedClientId property: The Client id used for cross tenant CMK scenario. + * + * @return the federatedClientId value. + */ + public UUID federatedClientId() { + return this.federatedClientId; + } + + /** + * Set the federatedClientId property: The Client id used for cross tenant CMK scenario. + * + * @param federatedClientId the federatedClientId value to set. + * @return the ServerProperties object itself. + */ + public ServerProperties withFederatedClientId(UUID federatedClientId) { + this.federatedClientId = federatedClientId; + return this; + } + + /** + * Get the keyId property: A CMK URI of the key to use for encryption. + * + * @return the keyId value. + */ + public String keyId() { + return this.keyId; + } + + /** + * Set the keyId property: A CMK URI of the key to use for encryption. + * + * @param keyId the keyId value to set. + * @return the ServerProperties object itself. + */ + public ServerProperties withKeyId(String keyId) { + this.keyId = keyId; + return this; + } + + /** + * Get the administrators property: The Azure Active Directory identity of the server. + * + * @return the administrators value. + */ + public ServerExternalAdministrator administrators() { + return this.administrators; + } + + /** + * Set the administrators property: The Azure Active Directory identity of the server. + * + * @param administrators the administrators value to set. + * @return the ServerProperties object itself. + */ + public ServerProperties withAdministrators(ServerExternalAdministrator administrators) { + this.administrators = administrators; + return this; + } + + /** + * Get the restrictOutboundNetworkAccess property: Whether or not to restrict outbound network access for this + * server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. + * + * @return the restrictOutboundNetworkAccess value. + */ + public ServerNetworkAccessFlag restrictOutboundNetworkAccess() { + return this.restrictOutboundNetworkAccess; + } + + /** + * Set the restrictOutboundNetworkAccess property: Whether or not to restrict outbound network access for this + * server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. + * + * @param restrictOutboundNetworkAccess the restrictOutboundNetworkAccess value to set. + * @return the ServerProperties object itself. + */ + public ServerProperties withRestrictOutboundNetworkAccess(ServerNetworkAccessFlag restrictOutboundNetworkAccess) { + this.restrictOutboundNetworkAccess = restrictOutboundNetworkAccess; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (privateEndpointConnections() != null) { + privateEndpointConnections().forEach(e -> e.validate()); + } + if (administrators() != null) { + administrators().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerSecurityAlertPolicyInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerSecurityAlertPolicyInner.java new file mode 100644 index 0000000000000..7e19ba4041cbe --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerSecurityAlertPolicyInner.java @@ -0,0 +1,240 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertsPolicyState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** A server security alert policy. */ +@Fluent +public final class ServerSecurityAlertPolicyInner extends ProxyResource { + /* + * SystemData of SecurityAlertPolicyResource. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private SecurityAlertsPolicyProperties innerProperties; + + /** Creates an instance of ServerSecurityAlertPolicyInner class. */ + public ServerSecurityAlertPolicyInner() { + } + + /** + * Get the systemData property: SystemData of SecurityAlertPolicyResource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private SecurityAlertsPolicyProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the state property: Specifies the state of the policy, whether it is enabled or disabled or a policy has not + * been applied yet on the specific database. + * + * @return the state value. + */ + public SecurityAlertsPolicyState state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Set the state property: Specifies the state of the policy, whether it is enabled or disabled or a policy has not + * been applied yet on the specific database. + * + * @param state the state value to set. + * @return the ServerSecurityAlertPolicyInner object itself. + */ + public ServerSecurityAlertPolicyInner withState(SecurityAlertsPolicyState state) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertsPolicyProperties(); + } + this.innerProperties().withState(state); + return this; + } + + /** + * Get the disabledAlerts property: Specifies an array of alerts that are disabled. Allowed values are: + * Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action, Brute_Force. + * + * @return the disabledAlerts value. + */ + public List disabledAlerts() { + return this.innerProperties() == null ? null : this.innerProperties().disabledAlerts(); + } + + /** + * Set the disabledAlerts property: Specifies an array of alerts that are disabled. Allowed values are: + * Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action, Brute_Force. + * + * @param disabledAlerts the disabledAlerts value to set. + * @return the ServerSecurityAlertPolicyInner object itself. + */ + public ServerSecurityAlertPolicyInner withDisabledAlerts(List disabledAlerts) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertsPolicyProperties(); + } + this.innerProperties().withDisabledAlerts(disabledAlerts); + return this; + } + + /** + * Get the emailAddresses property: Specifies an array of e-mail addresses to which the alert is sent. + * + * @return the emailAddresses value. + */ + public List emailAddresses() { + return this.innerProperties() == null ? null : this.innerProperties().emailAddresses(); + } + + /** + * Set the emailAddresses property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertsPolicyProperties(); + } + this.innerProperties().withEmailAddresses(emailAddresses); + return this; + } + + /** + * Get the emailAccountAdmins property: Specifies that the alert is sent to the account administrators. + * + * @return the emailAccountAdmins value. + */ + public Boolean emailAccountAdmins() { + return this.innerProperties() == null ? null : this.innerProperties().emailAccountAdmins(); + } + + /** + * Set the emailAccountAdmins property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertsPolicyProperties(); + } + this.innerProperties().withEmailAccountAdmins(emailAccountAdmins); + return this; + } + + /** + * Get the storageEndpoint property: 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.innerProperties() == null ? null : this.innerProperties().storageEndpoint(); + } + + /** + * Set the storageEndpoint property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertsPolicyProperties(); + } + this.innerProperties().withStorageEndpoint(storageEndpoint); + return this; + } + + /** + * Get the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection audit storage + * account. + * + * @return the storageAccountAccessKey value. + */ + public String storageAccountAccessKey() { + return this.innerProperties() == null ? null : this.innerProperties().storageAccountAccessKey(); + } + + /** + * Set the storageAccountAccessKey property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertsPolicyProperties(); + } + this.innerProperties().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + /** + * Get the retentionDays property: Specifies the number of days to keep in the Threat Detection audit logs. + * + * @return the retentionDays value. + */ + public Integer retentionDays() { + return this.innerProperties() == null ? null : this.innerProperties().retentionDays(); + } + + /** + * Set the retentionDays property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new SecurityAlertsPolicyProperties(); + } + this.innerProperties().withRetentionDays(retentionDays); + return this; + } + + /** + * Get the creationTime property: Specifies the UTC creation time of the policy. + * + * @return the creationTime value. + */ + public OffsetDateTime creationTime() { + return this.innerProperties() == null ? null : this.innerProperties().creationTime(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerTrustCertificateInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerTrustCertificateInner.java new file mode 100644 index 0000000000000..6badd2b6de5de --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerTrustCertificateInner.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Server trust certificate imported from box to enable connection between box and Sql Managed Instance. */ +@Fluent +public final class ServerTrustCertificateInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ServerTrustCertificateProperties innerProperties; + + /** Creates an instance of ServerTrustCertificateInner class. */ + public ServerTrustCertificateInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ServerTrustCertificateProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the publicBlob property: The certificate public blob. + * + * @return the publicBlob value. + */ + public String publicBlob() { + return this.innerProperties() == null ? null : this.innerProperties().publicBlob(); + } + + /** + * Set the publicBlob property: The certificate public blob. + * + * @param publicBlob the publicBlob value to set. + * @return the ServerTrustCertificateInner object itself. + */ + public ServerTrustCertificateInner withPublicBlob(String publicBlob) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerTrustCertificateProperties(); + } + this.innerProperties().withPublicBlob(publicBlob); + return this; + } + + /** + * Get the thumbprint property: The certificate thumbprint. + * + * @return the thumbprint value. + */ + public String thumbprint() { + return this.innerProperties() == null ? null : this.innerProperties().thumbprint(); + } + + /** + * Get the certificateName property: The certificate name. + * + * @return the certificateName value. + */ + public String certificateName() { + return this.innerProperties() == null ? null : this.innerProperties().certificateName(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerTrustCertificateProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerTrustCertificateProperties.java new file mode 100644 index 0000000000000..d453709068bf8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerTrustCertificateProperties.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of a server trust certificate. */ +@Fluent +public final class ServerTrustCertificateProperties { + /* + * The certificate public blob + */ + @JsonProperty(value = "publicBlob") + private String publicBlob; + + /* + * The certificate thumbprint + */ + @JsonProperty(value = "thumbprint", access = JsonProperty.Access.WRITE_ONLY) + private String thumbprint; + + /* + * The certificate name + */ + @JsonProperty(value = "certificateName", access = JsonProperty.Access.WRITE_ONLY) + private String certificateName; + + /** Creates an instance of ServerTrustCertificateProperties class. */ + public ServerTrustCertificateProperties() { + } + + /** + * Get the publicBlob property: The certificate public blob. + * + * @return the publicBlob value. + */ + public String publicBlob() { + return this.publicBlob; + } + + /** + * Set the publicBlob property: The certificate public blob. + * + * @param publicBlob the publicBlob value to set. + * @return the ServerTrustCertificateProperties object itself. + */ + public ServerTrustCertificateProperties withPublicBlob(String publicBlob) { + this.publicBlob = publicBlob; + return this; + } + + /** + * Get the thumbprint property: The certificate thumbprint. + * + * @return the thumbprint value. + */ + public String thumbprint() { + return this.thumbprint; + } + + /** + * Get the certificateName property: The certificate name. + * + * @return the certificateName value. + */ + public String certificateName() { + return this.certificateName; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerTrustGroupInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerTrustGroupInner.java new file mode 100644 index 0000000000000..c21d0437fe51b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerTrustGroupInner.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.ServerInfo; +import com.azure.resourcemanager.sql.generated.models.ServerTrustGroupPropertiesTrustScopesItem; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A server trust group. */ +@Fluent +public final class ServerTrustGroupInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ServerTrustGroupProperties innerProperties; + + /** Creates an instance of ServerTrustGroupInner class. */ + public ServerTrustGroupInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ServerTrustGroupProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the groupMembers property: Group members information for the server trust group. + * + * @return the groupMembers value. + */ + public List groupMembers() { + return this.innerProperties() == null ? null : this.innerProperties().groupMembers(); + } + + /** + * Set the groupMembers property: Group members information for the server trust group. + * + * @param groupMembers the groupMembers value to set. + * @return the ServerTrustGroupInner object itself. + */ + public ServerTrustGroupInner withGroupMembers(List groupMembers) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerTrustGroupProperties(); + } + this.innerProperties().withGroupMembers(groupMembers); + return this; + } + + /** + * Get the trustScopes property: Trust scope of the server trust group. + * + * @return the trustScopes value. + */ + public List trustScopes() { + return this.innerProperties() == null ? null : this.innerProperties().trustScopes(); + } + + /** + * Set the trustScopes property: Trust scope of the server trust group. + * + * @param trustScopes the trustScopes value to set. + * @return the ServerTrustGroupInner object itself. + */ + public ServerTrustGroupInner withTrustScopes(List trustScopes) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerTrustGroupProperties(); + } + this.innerProperties().withTrustScopes(trustScopes); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerTrustGroupProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerTrustGroupProperties.java new file mode 100644 index 0000000000000..d44508f34120b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerTrustGroupProperties.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.ServerInfo; +import com.azure.resourcemanager.sql.generated.models.ServerTrustGroupPropertiesTrustScopesItem; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of a server trust group. */ +@Fluent +public final class ServerTrustGroupProperties { + /* + * Group members information for the server trust group. + */ + @JsonProperty(value = "groupMembers", required = true) + private List groupMembers; + + /* + * Trust scope of the server trust group. + */ + @JsonProperty(value = "trustScopes", required = true) + private List trustScopes; + + /** Creates an instance of ServerTrustGroupProperties class. */ + public ServerTrustGroupProperties() { + } + + /** + * Get the groupMembers property: Group members information for the server trust group. + * + * @return the groupMembers value. + */ + public List groupMembers() { + return this.groupMembers; + } + + /** + * Set the groupMembers property: Group members information for the server trust group. + * + * @param groupMembers the groupMembers value to set. + * @return the ServerTrustGroupProperties object itself. + */ + public ServerTrustGroupProperties withGroupMembers(List groupMembers) { + this.groupMembers = groupMembers; + return this; + } + + /** + * Get the trustScopes property: Trust scope of the server trust group. + * + * @return the trustScopes value. + */ + public List trustScopes() { + return this.trustScopes; + } + + /** + * Set the trustScopes property: Trust scope of the server trust group. + * + * @param trustScopes the trustScopes value to set. + * @return the ServerTrustGroupProperties object itself. + */ + public ServerTrustGroupProperties withTrustScopes(List trustScopes) { + this.trustScopes = trustScopes; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (groupMembers() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property groupMembers in model ServerTrustGroupProperties")); + } else { + groupMembers().forEach(e -> e.validate()); + } + if (trustScopes() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property trustScopes in model ServerTrustGroupProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ServerTrustGroupProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerUsageInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerUsageInner.java new file mode 100644 index 0000000000000..3ec6308f3690e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerUsageInner.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Represents server metrics. */ +@Immutable +public final 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 OffsetDateTime nextResetTime; + + /** Creates an instance of ServerUsageInner class. */ + public ServerUsageInner() { + } + + /** + * Get the name property: Name of the server usage metric. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the resourceName property: The name of the resource. + * + * @return the resourceName value. + */ + public String resourceName() { + return this.resourceName; + } + + /** + * Get the displayName property: The metric display name. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the currentValue property: The current value of the metric. + * + * @return the currentValue value. + */ + public Double currentValue() { + return this.currentValue; + } + + /** + * Get the limit property: The current limit of the metric. + * + * @return the limit value. + */ + public Double limit() { + return this.limit; + } + + /** + * Get the unit property: The units of the metric. + * + * @return the unit value. + */ + public String unit() { + return this.unit; + } + + /** + * Get the nextResetTime property: The next reset time for the metric (ISO8601 format). + * + * @return the nextResetTime value. + */ + public OffsetDateTime nextResetTime() { + return this.nextResetTime; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerVulnerabilityAssessmentInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerVulnerabilityAssessmentInner.java new file mode 100644 index 0000000000000..0d49769019ad8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerVulnerabilityAssessmentInner.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentRecurringScansProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A server vulnerability assessment. */ +@Fluent +public final class ServerVulnerabilityAssessmentInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ServerVulnerabilityAssessmentProperties innerProperties; + + /** Creates an instance of ServerVulnerabilityAssessmentInner class. */ + public ServerVulnerabilityAssessmentInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ServerVulnerabilityAssessmentProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the storageContainerPath property: 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.innerProperties() == null ? null : this.innerProperties().storageContainerPath(); + } + + /** + * Set the storageContainerPath property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerVulnerabilityAssessmentProperties(); + } + this.innerProperties().withStorageContainerPath(storageContainerPath); + return this; + } + + /** + * Get the storageContainerSasKey property: 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. Applies only if the storage account is not behind a Vnet or a firewall. + * + * @return the storageContainerSasKey value. + */ + public String storageContainerSasKey() { + return this.innerProperties() == null ? null : this.innerProperties().storageContainerSasKey(); + } + + /** + * Set the storageContainerSasKey property: 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. Applies only if the storage account is not behind a Vnet or a firewall. + * + * @param storageContainerSasKey the storageContainerSasKey value to set. + * @return the ServerVulnerabilityAssessmentInner object itself. + */ + public ServerVulnerabilityAssessmentInner withStorageContainerSasKey(String storageContainerSasKey) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerVulnerabilityAssessmentProperties(); + } + this.innerProperties().withStorageContainerSasKey(storageContainerSasKey); + return this; + } + + /** + * Get the storageAccountAccessKey property: Specifies the identifier key of the storage account for vulnerability + * assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. + * Applies only if the storage account is not behind a Vnet or a firewall. + * + * @return the storageAccountAccessKey value. + */ + public String storageAccountAccessKey() { + return this.innerProperties() == null ? null : this.innerProperties().storageAccountAccessKey(); + } + + /** + * Set the storageAccountAccessKey property: Specifies the identifier key of the storage account for vulnerability + * assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. + * Applies only if the storage account is not behind a Vnet or a firewall. + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set. + * @return the ServerVulnerabilityAssessmentInner object itself. + */ + public ServerVulnerabilityAssessmentInner withStorageAccountAccessKey(String storageAccountAccessKey) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerVulnerabilityAssessmentProperties(); + } + this.innerProperties().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + /** + * Get the recurringScans property: The recurring scans settings. + * + * @return the recurringScans value. + */ + public VulnerabilityAssessmentRecurringScansProperties recurringScans() { + return this.innerProperties() == null ? null : this.innerProperties().recurringScans(); + } + + /** + * Set the recurringScans property: The recurring scans settings. + * + * @param recurringScans the recurringScans value to set. + * @return the ServerVulnerabilityAssessmentInner object itself. + */ + public ServerVulnerabilityAssessmentInner withRecurringScans( + VulnerabilityAssessmentRecurringScansProperties recurringScans) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerVulnerabilityAssessmentProperties(); + } + this.innerProperties().withRecurringScans(recurringScans); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerVulnerabilityAssessmentProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerVulnerabilityAssessmentProperties.java new file mode 100644 index 0000000000000..99f4a87425dba --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServerVulnerabilityAssessmentProperties.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentRecurringScansProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a server Vulnerability Assessment. */ +@Fluent +public final class ServerVulnerabilityAssessmentProperties { + /* + * A blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). + */ + @JsonProperty(value = "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. Applies only if the storage account is not behind a Vnet or a firewall + */ + @JsonProperty(value = "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. Applies only if the storage + * account is not behind a Vnet or a firewall + */ + @JsonProperty(value = "storageAccountAccessKey") + private String storageAccountAccessKey; + + /* + * The recurring scans settings + */ + @JsonProperty(value = "recurringScans") + private VulnerabilityAssessmentRecurringScansProperties recurringScans; + + /** Creates an instance of ServerVulnerabilityAssessmentProperties class. */ + public ServerVulnerabilityAssessmentProperties() { + } + + /** + * Get the storageContainerPath property: 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 the storageContainerPath property: 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 ServerVulnerabilityAssessmentProperties object itself. + */ + public ServerVulnerabilityAssessmentProperties withStorageContainerPath(String storageContainerPath) { + this.storageContainerPath = storageContainerPath; + return this; + } + + /** + * Get the storageContainerSasKey property: 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. Applies only if the storage account is not behind a Vnet or a firewall. + * + * @return the storageContainerSasKey value. + */ + public String storageContainerSasKey() { + return this.storageContainerSasKey; + } + + /** + * Set the storageContainerSasKey property: 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. Applies only if the storage account is not behind a Vnet or a firewall. + * + * @param storageContainerSasKey the storageContainerSasKey value to set. + * @return the ServerVulnerabilityAssessmentProperties object itself. + */ + public ServerVulnerabilityAssessmentProperties withStorageContainerSasKey(String storageContainerSasKey) { + this.storageContainerSasKey = storageContainerSasKey; + return this; + } + + /** + * Get the storageAccountAccessKey property: Specifies the identifier key of the storage account for vulnerability + * assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. + * Applies only if the storage account is not behind a Vnet or a firewall. + * + * @return the storageAccountAccessKey value. + */ + public String storageAccountAccessKey() { + return this.storageAccountAccessKey; + } + + /** + * Set the storageAccountAccessKey property: Specifies the identifier key of the storage account for vulnerability + * assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. + * Applies only if the storage account is not behind a Vnet or a firewall. + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set. + * @return the ServerVulnerabilityAssessmentProperties object itself. + */ + public ServerVulnerabilityAssessmentProperties withStorageAccountAccessKey(String storageAccountAccessKey) { + this.storageAccountAccessKey = storageAccountAccessKey; + return this; + } + + /** + * Get the recurringScans property: The recurring scans settings. + * + * @return the recurringScans value. + */ + public VulnerabilityAssessmentRecurringScansProperties recurringScans() { + return this.recurringScans; + } + + /** + * Set the recurringScans property: The recurring scans settings. + * + * @param recurringScans the recurringScans value to set. + * @return the ServerVulnerabilityAssessmentProperties object itself. + */ + public ServerVulnerabilityAssessmentProperties withRecurringScans( + VulnerabilityAssessmentRecurringScansProperties recurringScans) { + this.recurringScans = recurringScans; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (storageContainerPath() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property storageContainerPath in model" + + " ServerVulnerabilityAssessmentProperties")); + } + if (recurringScans() != null) { + recurringScans().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ServerVulnerabilityAssessmentProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServiceObjectiveInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServiceObjectiveInner.java new file mode 100644 index 0000000000000..5c9947a9cc98c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServiceObjectiveInner.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents a database service objective. */ +@Immutable +public final class ServiceObjectiveInner extends ProxyResource { + /* + * Represents the properties of the resource. + */ + @JsonProperty(value = "properties") + private ServiceObjectiveProperties innerProperties; + + /** Creates an instance of ServiceObjectiveInner class. */ + public ServiceObjectiveInner() { + } + + /** + * Get the innerProperties property: Represents the properties of the resource. + * + * @return the innerProperties value. + */ + private ServiceObjectiveProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the serviceObjectiveName property: The name for the service objective. + * + * @return the serviceObjectiveName value. + */ + public String serviceObjectiveName() { + return this.innerProperties() == null ? null : this.innerProperties().serviceObjectiveName(); + } + + /** + * Get the isDefault property: Gets whether the service level objective is the default service objective. + * + * @return the isDefault value. + */ + public Boolean isDefault() { + return this.innerProperties() == null ? null : this.innerProperties().isDefault(); + } + + /** + * Get the isSystem property: Gets whether the service level objective is a system service objective. + * + * @return the isSystem value. + */ + public Boolean isSystem() { + return this.innerProperties() == null ? null : this.innerProperties().isSystem(); + } + + /** + * Get the description property: The description for the service level objective. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Get the enabled property: Gets whether the service level objective is enabled. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.innerProperties() == null ? null : this.innerProperties().enabled(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServiceObjectiveProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServiceObjectiveProperties.java new file mode 100644 index 0000000000000..b9c9118afc539 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/ServiceObjectiveProperties.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents the properties of a database service objective. */ +@Immutable +public final class ServiceObjectiveProperties { + /* + * The name for the service objective. + */ + @JsonProperty(value = "serviceObjectiveName", access = JsonProperty.Access.WRITE_ONLY) + private String serviceObjectiveName; + + /* + * Gets whether the service level objective is the default service objective. + */ + @JsonProperty(value = "isDefault", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isDefault; + + /* + * Gets whether the service level objective is a system service objective. + */ + @JsonProperty(value = "isSystem", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isSystem; + + /* + * The description for the service level objective. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /* + * Gets whether the service level objective is enabled. + */ + @JsonProperty(value = "enabled", access = JsonProperty.Access.WRITE_ONLY) + private Boolean enabled; + + /** Creates an instance of ServiceObjectiveProperties class. */ + public ServiceObjectiveProperties() { + } + + /** + * Get the serviceObjectiveName property: The name for the service objective. + * + * @return the serviceObjectiveName value. + */ + public String serviceObjectiveName() { + return this.serviceObjectiveName; + } + + /** + * Get the isDefault property: Gets whether the service level objective is the default service objective. + * + * @return the isDefault value. + */ + public Boolean isDefault() { + return this.isDefault; + } + + /** + * Get the isSystem property: Gets whether the service level objective is a system service objective. + * + * @return the isSystem value. + */ + public Boolean isSystem() { + return this.isSystem; + } + + /** + * Get the description property: The description for the service level objective. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the enabled property: Gets whether the service level objective is enabled. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SqlAgentConfigurationInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SqlAgentConfigurationInner.java new file mode 100644 index 0000000000000..681dd29816974 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SqlAgentConfigurationInner.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.SqlAgentConfigurationPropertiesState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A recoverable managed database resource. */ +@Fluent +public final class SqlAgentConfigurationInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private SqlAgentConfigurationProperties innerProperties; + + /** Creates an instance of SqlAgentConfigurationInner class. */ + public SqlAgentConfigurationInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private SqlAgentConfigurationProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the state property: The state of Sql Agent. + * + * @return the state value. + */ + public SqlAgentConfigurationPropertiesState state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Set the state property: The state of Sql Agent. + * + * @param state the state value to set. + * @return the SqlAgentConfigurationInner object itself. + */ + public SqlAgentConfigurationInner withState(SqlAgentConfigurationPropertiesState state) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlAgentConfigurationProperties(); + } + this.innerProperties().withState(state); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SqlAgentConfigurationProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SqlAgentConfigurationProperties.java new file mode 100644 index 0000000000000..88d0a40dbc9c6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SqlAgentConfigurationProperties.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.models.SqlAgentConfigurationPropertiesState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Sql agent configuration properties. */ +@Fluent +public final class SqlAgentConfigurationProperties { + /* + * The state of Sql Agent. + */ + @JsonProperty(value = "state") + private SqlAgentConfigurationPropertiesState state; + + /** Creates an instance of SqlAgentConfigurationProperties class. */ + public SqlAgentConfigurationProperties() { + } + + /** + * Get the state property: The state of Sql Agent. + * + * @return the state value. + */ + public SqlAgentConfigurationPropertiesState state() { + return this.state; + } + + /** + * Set the state property: The state of Sql Agent. + * + * @param state the state value to set. + * @return the SqlAgentConfigurationProperties object itself. + */ + public SqlAgentConfigurationProperties withState(SqlAgentConfigurationPropertiesState state) { + this.state = state; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SqlVulnerabilityAssessmentInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SqlVulnerabilityAssessmentInner.java new file mode 100644 index 0000000000000..fe9f325ede4da --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SqlVulnerabilityAssessmentInner.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A SQL Vulnerability Assessment. */ +@Fluent +public final class SqlVulnerabilityAssessmentInner extends ProxyResource { + /* + * SystemData of SqlVulnerabilityAssessmentResource. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private SqlVulnerabilityAssessmentPolicyProperties innerProperties; + + /** Creates an instance of SqlVulnerabilityAssessmentInner class. */ + public SqlVulnerabilityAssessmentInner() { + } + + /** + * Get the systemData property: SystemData of SqlVulnerabilityAssessmentResource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private SqlVulnerabilityAssessmentPolicyProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the state property: Specifies the state of the SQL Vulnerability Assessment, whether it is enabled or + * disabled or a state has not been applied yet on the specific database or server. + * + * @return the state value. + */ + public SqlVulnerabilityAssessmentState state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Set the state property: Specifies the state of the SQL Vulnerability Assessment, whether it is enabled or + * disabled or a state has not been applied yet on the specific database or server. + * + * @param state the state value to set. + * @return the SqlVulnerabilityAssessmentInner object itself. + */ + public SqlVulnerabilityAssessmentInner withState(SqlVulnerabilityAssessmentState state) { + if (this.innerProperties() == null) { + this.innerProperties = new SqlVulnerabilityAssessmentPolicyProperties(); + } + this.innerProperties().withState(state); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SqlVulnerabilityAssessmentPolicyProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SqlVulnerabilityAssessmentPolicyProperties.java new file mode 100644 index 0000000000000..ee7a5b4fb011b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SqlVulnerabilityAssessmentPolicyProperties.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The SqlVulnerabilityAssessmentPolicyProperties model. */ +@Fluent +public final class SqlVulnerabilityAssessmentPolicyProperties { + /* + * Specifies the state of the SQL Vulnerability Assessment, whether it is enabled or disabled or a state has not + * been applied yet on the specific database or server. + */ + @JsonProperty(value = "state") + private SqlVulnerabilityAssessmentState state; + + /** Creates an instance of SqlVulnerabilityAssessmentPolicyProperties class. */ + public SqlVulnerabilityAssessmentPolicyProperties() { + } + + /** + * Get the state property: Specifies the state of the SQL Vulnerability Assessment, whether it is enabled or + * disabled or a state has not been applied yet on the specific database or server. + * + * @return the state value. + */ + public SqlVulnerabilityAssessmentState state() { + return this.state; + } + + /** + * Set the state property: Specifies the state of the SQL Vulnerability Assessment, whether it is enabled or + * disabled or a state has not been applied yet on the specific database or server. + * + * @param state the state value to set. + * @return the SqlVulnerabilityAssessmentPolicyProperties object itself. + */ + public SqlVulnerabilityAssessmentPolicyProperties withState(SqlVulnerabilityAssessmentState state) { + this.state = state; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SqlVulnerabilityAssessmentScanRecordInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SqlVulnerabilityAssessmentScanRecordInner.java new file mode 100644 index 0000000000000..ab2eec06c10d9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SqlVulnerabilityAssessmentScanRecordInner.java @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentScanError; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentScanState; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentScanTriggerType; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** A vulnerability assessment scan record. */ +@Immutable +public final class SqlVulnerabilityAssessmentScanRecordInner extends ProxyResource { + /* + * SystemData of SqlVulnerabilityAssessmentScanRecordResource. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private SqlVulnerabilityAssessmentScanRecordProperties innerProperties; + + /** Creates an instance of SqlVulnerabilityAssessmentScanRecordInner class. */ + public SqlVulnerabilityAssessmentScanRecordInner() { + } + + /** + * Get the systemData property: SystemData of SqlVulnerabilityAssessmentScanRecordResource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private SqlVulnerabilityAssessmentScanRecordProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the scanId property: The scan ID. + * + * @return the scanId value. + */ + public String scanId() { + return this.innerProperties() == null ? null : this.innerProperties().scanId(); + } + + /** + * Get the triggerType property: The scan trigger type. + * + * @return the triggerType value. + */ + public VulnerabilityAssessmentScanTriggerType triggerType() { + return this.innerProperties() == null ? null : this.innerProperties().triggerType(); + } + + /** + * Get the state property: The scan status. + * + * @return the state value. + */ + public VulnerabilityAssessmentScanState state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Get the startTime property: The scan start time (UTC). + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.innerProperties() == null ? null : this.innerProperties().startTime(); + } + + /** + * Get the endTime property: The scan end time (UTC). + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.innerProperties() == null ? null : this.innerProperties().endTime(); + } + + /** + * Get the errors property: The scan errors. + * + * @return the errors value. + */ + public List errors() { + return this.innerProperties() == null ? null : this.innerProperties().errors(); + } + + /** + * Get the server property: The server name. + * + * @return the server value. + */ + public String server() { + return this.innerProperties() == null ? null : this.innerProperties().server(); + } + + /** + * Get the database property: The database name. + * + * @return the database value. + */ + public String database() { + return this.innerProperties() == null ? null : this.innerProperties().database(); + } + + /** + * Get the sqlVersion property: The SQL version. + * + * @return the sqlVersion value. + */ + public String sqlVersion() { + return this.innerProperties() == null ? null : this.innerProperties().sqlVersion(); + } + + /** + * Get the highSeverityFailedRulesCount property: The number of failed rules with high severity. + * + * @return the highSeverityFailedRulesCount value. + */ + public Integer highSeverityFailedRulesCount() { + return this.innerProperties() == null ? null : this.innerProperties().highSeverityFailedRulesCount(); + } + + /** + * Get the mediumSeverityFailedRulesCount property: The number of failed rules with medium severity. + * + * @return the mediumSeverityFailedRulesCount value. + */ + public Integer mediumSeverityFailedRulesCount() { + return this.innerProperties() == null ? null : this.innerProperties().mediumSeverityFailedRulesCount(); + } + + /** + * Get the lowSeverityFailedRulesCount property: The number of failed rules with low severity. + * + * @return the lowSeverityFailedRulesCount value. + */ + public Integer lowSeverityFailedRulesCount() { + return this.innerProperties() == null ? null : this.innerProperties().lowSeverityFailedRulesCount(); + } + + /** + * Get the totalPassedRulesCount property: The number of total passed rules. + * + * @return the totalPassedRulesCount value. + */ + public Integer totalPassedRulesCount() { + return this.innerProperties() == null ? null : this.innerProperties().totalPassedRulesCount(); + } + + /** + * Get the totalFailedRulesCount property: The number of total failed rules. + * + * @return the totalFailedRulesCount value. + */ + public Integer totalFailedRulesCount() { + return this.innerProperties() == null ? null : this.innerProperties().totalFailedRulesCount(); + } + + /** + * Get the totalRulesCount property: The number of total rules assessed. + * + * @return the totalRulesCount value. + */ + public Integer totalRulesCount() { + return this.innerProperties() == null ? null : this.innerProperties().totalRulesCount(); + } + + /** + * Get the isBaselineApplied property: Baseline created for this database, and has one or more rules. + * + * @return the isBaselineApplied value. + */ + public Boolean isBaselineApplied() { + return this.innerProperties() == null ? null : this.innerProperties().isBaselineApplied(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SqlVulnerabilityAssessmentScanRecordProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SqlVulnerabilityAssessmentScanRecordProperties.java new file mode 100644 index 0000000000000..a74c8606d5045 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SqlVulnerabilityAssessmentScanRecordProperties.java @@ -0,0 +1,272 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentScanError; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentScanState; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentScanTriggerType; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Properties of a vulnerability assessment scan record. */ +@Immutable +public final class SqlVulnerabilityAssessmentScanRecordProperties { + /* + * The scan ID. + */ + @JsonProperty(value = "scanId", access = JsonProperty.Access.WRITE_ONLY) + private String scanId; + + /* + * The scan trigger type. + */ + @JsonProperty(value = "triggerType", access = JsonProperty.Access.WRITE_ONLY) + private VulnerabilityAssessmentScanTriggerType triggerType; + + /* + * The scan status. + */ + @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) + private VulnerabilityAssessmentScanState state; + + /* + * The scan start time (UTC). + */ + @JsonProperty(value = "startTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime startTime; + + /* + * The scan end time (UTC). + */ + @JsonProperty(value = "endTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime endTime; + + /* + * The scan errors. + */ + @JsonProperty(value = "errors", access = JsonProperty.Access.WRITE_ONLY) + private List errors; + + /* + * The server name. + */ + @JsonProperty(value = "server", access = JsonProperty.Access.WRITE_ONLY) + private String server; + + /* + * The database name. + */ + @JsonProperty(value = "database", access = JsonProperty.Access.WRITE_ONLY) + private String database; + + /* + * The SQL version. + */ + @JsonProperty(value = "sqlVersion", access = JsonProperty.Access.WRITE_ONLY) + private String sqlVersion; + + /* + * The number of failed rules with high severity. + */ + @JsonProperty(value = "highSeverityFailedRulesCount", access = JsonProperty.Access.WRITE_ONLY) + private Integer highSeverityFailedRulesCount; + + /* + * The number of failed rules with medium severity. + */ + @JsonProperty(value = "mediumSeverityFailedRulesCount", access = JsonProperty.Access.WRITE_ONLY) + private Integer mediumSeverityFailedRulesCount; + + /* + * The number of failed rules with low severity. + */ + @JsonProperty(value = "lowSeverityFailedRulesCount", access = JsonProperty.Access.WRITE_ONLY) + private Integer lowSeverityFailedRulesCount; + + /* + * The number of total passed rules. + */ + @JsonProperty(value = "totalPassedRulesCount", access = JsonProperty.Access.WRITE_ONLY) + private Integer totalPassedRulesCount; + + /* + * The number of total failed rules. + */ + @JsonProperty(value = "totalFailedRulesCount", access = JsonProperty.Access.WRITE_ONLY) + private Integer totalFailedRulesCount; + + /* + * The number of total rules assessed. + */ + @JsonProperty(value = "totalRulesCount", access = JsonProperty.Access.WRITE_ONLY) + private Integer totalRulesCount; + + /* + * Baseline created for this database, and has one or more rules. + */ + @JsonProperty(value = "isBaselineApplied", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isBaselineApplied; + + /** Creates an instance of SqlVulnerabilityAssessmentScanRecordProperties class. */ + public SqlVulnerabilityAssessmentScanRecordProperties() { + } + + /** + * Get the scanId property: The scan ID. + * + * @return the scanId value. + */ + public String scanId() { + return this.scanId; + } + + /** + * Get the triggerType property: The scan trigger type. + * + * @return the triggerType value. + */ + public VulnerabilityAssessmentScanTriggerType triggerType() { + return this.triggerType; + } + + /** + * Get the state property: The scan status. + * + * @return the state value. + */ + public VulnerabilityAssessmentScanState state() { + return this.state; + } + + /** + * Get the startTime property: The scan start time (UTC). + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Get the endTime property: The scan end time (UTC). + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Get the errors property: The scan errors. + * + * @return the errors value. + */ + public List errors() { + return this.errors; + } + + /** + * Get the server property: The server name. + * + * @return the server value. + */ + public String server() { + return this.server; + } + + /** + * Get the database property: The database name. + * + * @return the database value. + */ + public String database() { + return this.database; + } + + /** + * Get the sqlVersion property: The SQL version. + * + * @return the sqlVersion value. + */ + public String sqlVersion() { + return this.sqlVersion; + } + + /** + * Get the highSeverityFailedRulesCount property: The number of failed rules with high severity. + * + * @return the highSeverityFailedRulesCount value. + */ + public Integer highSeverityFailedRulesCount() { + return this.highSeverityFailedRulesCount; + } + + /** + * Get the mediumSeverityFailedRulesCount property: The number of failed rules with medium severity. + * + * @return the mediumSeverityFailedRulesCount value. + */ + public Integer mediumSeverityFailedRulesCount() { + return this.mediumSeverityFailedRulesCount; + } + + /** + * Get the lowSeverityFailedRulesCount property: The number of failed rules with low severity. + * + * @return the lowSeverityFailedRulesCount value. + */ + public Integer lowSeverityFailedRulesCount() { + return this.lowSeverityFailedRulesCount; + } + + /** + * Get the totalPassedRulesCount property: The number of total passed rules. + * + * @return the totalPassedRulesCount value. + */ + public Integer totalPassedRulesCount() { + return this.totalPassedRulesCount; + } + + /** + * Get the totalFailedRulesCount property: The number of total failed rules. + * + * @return the totalFailedRulesCount value. + */ + public Integer totalFailedRulesCount() { + return this.totalFailedRulesCount; + } + + /** + * Get the totalRulesCount property: The number of total rules assessed. + * + * @return the totalRulesCount value. + */ + public Integer totalRulesCount() { + return this.totalRulesCount; + } + + /** + * Get the isBaselineApplied property: Baseline created for this database, and has one or more rules. + * + * @return the isBaselineApplied value. + */ + public Boolean isBaselineApplied() { + return this.isBaselineApplied; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (errors() != null) { + errors().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SqlVulnerabilityAssessmentScanResultProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SqlVulnerabilityAssessmentScanResultProperties.java new file mode 100644 index 0000000000000..b37032bca6c5f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SqlVulnerabilityAssessmentScanResultProperties.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.models.BaselineAdjustedResult; +import com.azure.resourcemanager.sql.generated.models.Remediation; +import com.azure.resourcemanager.sql.generated.models.RuleStatus; +import com.azure.resourcemanager.sql.generated.models.VaRule; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** SQL Vulnerability Assessment scan result properties for a single rule. */ +@Immutable +public final class SqlVulnerabilityAssessmentScanResultProperties { + /* + * SQL Vulnerability Assessment rule Id. + */ + @JsonProperty(value = "ruleId", access = JsonProperty.Access.WRITE_ONLY) + private String ruleId; + + /* + * SQL Vulnerability Assessment rule result status. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private RuleStatus status; + + /* + * SQL Vulnerability Assessment error message. + */ + @JsonProperty(value = "errorMessage", access = JsonProperty.Access.WRITE_ONLY) + private String errorMessage; + + /* + * SQL Vulnerability Assessment is the query results trimmed. + */ + @JsonProperty(value = "isTrimmed", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isTrimmed; + + /* + * SQL Vulnerability Assessment query results that was run. + */ + @JsonProperty(value = "queryResults", access = JsonProperty.Access.WRITE_ONLY) + private List> queryResults; + + /* + * SQL Vulnerability Assessment the remediation details. + */ + @JsonProperty(value = "remediation", access = JsonProperty.Access.WRITE_ONLY) + private Remediation remediation; + + /* + * SQL Vulnerability Assessment rule result adjusted with baseline. + */ + @JsonProperty(value = "baselineAdjustedResult", access = JsonProperty.Access.WRITE_ONLY) + private BaselineAdjustedResult baselineAdjustedResult; + + /* + * SQL Vulnerability Assessment rule metadata. + */ + @JsonProperty(value = "ruleMetadata", access = JsonProperty.Access.WRITE_ONLY) + private VaRule ruleMetadata; + + /** Creates an instance of SqlVulnerabilityAssessmentScanResultProperties class. */ + public SqlVulnerabilityAssessmentScanResultProperties() { + } + + /** + * Get the ruleId property: SQL Vulnerability Assessment rule Id. + * + * @return the ruleId value. + */ + public String ruleId() { + return this.ruleId; + } + + /** + * Get the status property: SQL Vulnerability Assessment rule result status. + * + * @return the status value. + */ + public RuleStatus status() { + return this.status; + } + + /** + * Get the errorMessage property: SQL Vulnerability Assessment error message. + * + * @return the errorMessage value. + */ + public String errorMessage() { + return this.errorMessage; + } + + /** + * Get the isTrimmed property: SQL Vulnerability Assessment is the query results trimmed. + * + * @return the isTrimmed value. + */ + public Boolean isTrimmed() { + return this.isTrimmed; + } + + /** + * Get the queryResults property: SQL Vulnerability Assessment query results that was run. + * + * @return the queryResults value. + */ + public List> queryResults() { + return this.queryResults; + } + + /** + * Get the remediation property: SQL Vulnerability Assessment the remediation details. + * + * @return the remediation value. + */ + public Remediation remediation() { + return this.remediation; + } + + /** + * Get the baselineAdjustedResult property: SQL Vulnerability Assessment rule result adjusted with baseline. + * + * @return the baselineAdjustedResult value. + */ + public BaselineAdjustedResult baselineAdjustedResult() { + return this.baselineAdjustedResult; + } + + /** + * Get the ruleMetadata property: SQL Vulnerability Assessment rule metadata. + * + * @return the ruleMetadata value. + */ + public VaRule ruleMetadata() { + return this.ruleMetadata; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (remediation() != null) { + remediation().validate(); + } + if (baselineAdjustedResult() != null) { + baselineAdjustedResult().validate(); + } + if (ruleMetadata() != null) { + ruleMetadata().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SqlVulnerabilityAssessmentScanResultsInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SqlVulnerabilityAssessmentScanResultsInner.java new file mode 100644 index 0000000000000..aa7b46b2fb74c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SqlVulnerabilityAssessmentScanResultsInner.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.sql.generated.models.BaselineAdjustedResult; +import com.azure.resourcemanager.sql.generated.models.Remediation; +import com.azure.resourcemanager.sql.generated.models.RuleStatus; +import com.azure.resourcemanager.sql.generated.models.VaRule; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The SqlVulnerabilityAssessmentScanResults model. */ +@Immutable +public final class SqlVulnerabilityAssessmentScanResultsInner extends ProxyResource { + /* + * SystemData of AdvancedThreatProtectionResource. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private SqlVulnerabilityAssessmentScanResultProperties innerProperties; + + /** Creates an instance of SqlVulnerabilityAssessmentScanResultsInner class. */ + public SqlVulnerabilityAssessmentScanResultsInner() { + } + + /** + * Get the systemData property: SystemData of AdvancedThreatProtectionResource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private SqlVulnerabilityAssessmentScanResultProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the ruleId property: SQL Vulnerability Assessment rule Id. + * + * @return the ruleId value. + */ + public String ruleId() { + return this.innerProperties() == null ? null : this.innerProperties().ruleId(); + } + + /** + * Get the status property: SQL Vulnerability Assessment rule result status. + * + * @return the status value. + */ + public RuleStatus status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); + } + + /** + * Get the errorMessage property: SQL Vulnerability Assessment error message. + * + * @return the errorMessage value. + */ + public String errorMessage() { + return this.innerProperties() == null ? null : this.innerProperties().errorMessage(); + } + + /** + * Get the isTrimmed property: SQL Vulnerability Assessment is the query results trimmed. + * + * @return the isTrimmed value. + */ + public Boolean isTrimmed() { + return this.innerProperties() == null ? null : this.innerProperties().isTrimmed(); + } + + /** + * Get the queryResults property: SQL Vulnerability Assessment query results that was run. + * + * @return the queryResults value. + */ + public List> queryResults() { + return this.innerProperties() == null ? null : this.innerProperties().queryResults(); + } + + /** + * Get the remediation property: SQL Vulnerability Assessment the remediation details. + * + * @return the remediation value. + */ + public Remediation remediation() { + return this.innerProperties() == null ? null : this.innerProperties().remediation(); + } + + /** + * Get the baselineAdjustedResult property: SQL Vulnerability Assessment rule result adjusted with baseline. + * + * @return the baselineAdjustedResult value. + */ + public BaselineAdjustedResult baselineAdjustedResult() { + return this.innerProperties() == null ? null : this.innerProperties().baselineAdjustedResult(); + } + + /** + * Get the ruleMetadata property: SQL Vulnerability Assessment rule metadata. + * + * @return the ruleMetadata value. + */ + public VaRule ruleMetadata() { + return this.innerProperties() == null ? null : this.innerProperties().ruleMetadata(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SubscriptionUsageInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SubscriptionUsageInner.java new file mode 100644 index 0000000000000..3b6d7480542dd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SubscriptionUsageInner.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Usage Metric of a Subscription in a Location. */ +@Immutable +public final class SubscriptionUsageInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private SubscriptionUsageProperties innerProperties; + + /** Creates an instance of SubscriptionUsageInner class. */ + public SubscriptionUsageInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private SubscriptionUsageProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the displayName property: User-readable name of the metric. + * + * @return the displayName value. + */ + public String displayName() { + return this.innerProperties() == null ? null : this.innerProperties().displayName(); + } + + /** + * Get the currentValue property: Current value of the metric. + * + * @return the currentValue value. + */ + public Double currentValue() { + return this.innerProperties() == null ? null : this.innerProperties().currentValue(); + } + + /** + * Get the limit property: Boundary value of the metric. + * + * @return the limit value. + */ + public Double limit() { + return this.innerProperties() == null ? null : this.innerProperties().limit(); + } + + /** + * Get the unit property: Unit of the metric. + * + * @return the unit value. + */ + public String unit() { + return this.innerProperties() == null ? null : this.innerProperties().unit(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SubscriptionUsageProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SubscriptionUsageProperties.java new file mode 100644 index 0000000000000..4e306b72ce225 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SubscriptionUsageProperties.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a subscription usage. */ +@Immutable +public final class SubscriptionUsageProperties { + /* + * User-readable name of the metric. + */ + @JsonProperty(value = "displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /* + * Current value of the metric. + */ + @JsonProperty(value = "currentValue", access = JsonProperty.Access.WRITE_ONLY) + private Double currentValue; + + /* + * Boundary value of the metric. + */ + @JsonProperty(value = "limit", access = JsonProperty.Access.WRITE_ONLY) + private Double limit; + + /* + * Unit of the metric. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private String unit; + + /** Creates an instance of SubscriptionUsageProperties class. */ + public SubscriptionUsageProperties() { + } + + /** + * Get the displayName property: User-readable name of the metric. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the currentValue property: Current value of the metric. + * + * @return the currentValue value. + */ + public Double currentValue() { + return this.currentValue; + } + + /** + * Get the limit property: Boundary value of the metric. + * + * @return the limit value. + */ + public Double limit() { + return this.limit; + } + + /** + * Get the unit property: Unit of the metric. + * + * @return the unit value. + */ + public String unit() { + return this.unit; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SynapseLinkWorkspaceInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SynapseLinkWorkspaceInner.java new file mode 100644 index 0000000000000..1f759a5e6d52f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SynapseLinkWorkspaceInner.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.SynapseLinkWorkspaceInfoProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Synapse link workspace resource. */ +@Fluent +public final class SynapseLinkWorkspaceInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private SynapseLinkWorkspaceProperties innerProperties; + + /** Creates an instance of SynapseLinkWorkspaceInner class. */ + public SynapseLinkWorkspaceInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private SynapseLinkWorkspaceProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the workspaces property: List of all synapselink workspaces. + * + * @return the workspaces value. + */ + public List workspaces() { + return this.innerProperties() == null ? null : this.innerProperties().workspaces(); + } + + /** + * Set the workspaces property: List of all synapselink workspaces. + * + * @param workspaces the workspaces value to set. + * @return the SynapseLinkWorkspaceInner object itself. + */ + public SynapseLinkWorkspaceInner withWorkspaces(List workspaces) { + if (this.innerProperties() == null) { + this.innerProperties = new SynapseLinkWorkspaceProperties(); + } + this.innerProperties().withWorkspaces(workspaces); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SynapseLinkWorkspaceProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SynapseLinkWorkspaceProperties.java new file mode 100644 index 0000000000000..2c1e8f69a0e2c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SynapseLinkWorkspaceProperties.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.models.SynapseLinkWorkspaceInfoProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of a Synapse link workspaces. */ +@Fluent +public final class SynapseLinkWorkspaceProperties { + /* + * List of all synapselink workspaces + */ + @JsonProperty(value = "workspaces") + private List workspaces; + + /** Creates an instance of SynapseLinkWorkspaceProperties class. */ + public SynapseLinkWorkspaceProperties() { + } + + /** + * Get the workspaces property: List of all synapselink workspaces. + * + * @return the workspaces value. + */ + public List workspaces() { + return this.workspaces; + } + + /** + * Set the workspaces property: List of all synapselink workspaces. + * + * @param workspaces the workspaces value to set. + * @return the SynapseLinkWorkspaceProperties object itself. + */ + public SynapseLinkWorkspaceProperties withWorkspaces(List workspaces) { + this.workspaces = workspaces; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (workspaces() != null) { + workspaces().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncAgentInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncAgentInner.java new file mode 100644 index 0000000000000..77226156dfbf8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncAgentInner.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.SyncAgentState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** An Azure SQL Database sync agent. */ +@Fluent +public final class SyncAgentInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private SyncAgentProperties innerProperties; + + /** Creates an instance of SyncAgentInner class. */ + public SyncAgentInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private SyncAgentProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the name property: Name of the sync agent. + * + * @return the name value. + */ + public String namePropertiesName() { + return this.innerProperties() == null ? null : this.innerProperties().name(); + } + + /** + * Get the syncDatabaseId property: ARM resource id of the sync database in the sync agent. + * + * @return the syncDatabaseId value. + */ + public String syncDatabaseId() { + return this.innerProperties() == null ? null : this.innerProperties().syncDatabaseId(); + } + + /** + * Set the syncDatabaseId property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new SyncAgentProperties(); + } + this.innerProperties().withSyncDatabaseId(syncDatabaseId); + return this; + } + + /** + * Get the lastAliveTime property: Last alive time of the sync agent. + * + * @return the lastAliveTime value. + */ + public OffsetDateTime lastAliveTime() { + return this.innerProperties() == null ? null : this.innerProperties().lastAliveTime(); + } + + /** + * Get the state property: State of the sync agent. + * + * @return the state value. + */ + public SyncAgentState state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Get the isUpToDate property: If the sync agent version is up to date. + * + * @return the isUpToDate value. + */ + public Boolean isUpToDate() { + return this.innerProperties() == null ? null : this.innerProperties().isUpToDate(); + } + + /** + * Get the expiryTime property: Expiration time of the sync agent version. + * + * @return the expiryTime value. + */ + public OffsetDateTime expiryTime() { + return this.innerProperties() == null ? null : this.innerProperties().expiryTime(); + } + + /** + * Get the version property: Version of the sync agent. + * + * @return the version value. + */ + public String version() { + return this.innerProperties() == null ? null : this.innerProperties().version(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncAgentKeyPropertiesInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncAgentKeyPropertiesInner.java new file mode 100644 index 0000000000000..f9f74cf3eeda2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncAgentKeyPropertiesInner.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of an Azure SQL Database sync agent key. */ +@Immutable +public final class SyncAgentKeyPropertiesInner { + /* + * Key of sync agent. + */ + @JsonProperty(value = "syncAgentKey", access = JsonProperty.Access.WRITE_ONLY) + private String syncAgentKey; + + /** Creates an instance of SyncAgentKeyPropertiesInner class. */ + public SyncAgentKeyPropertiesInner() { + } + + /** + * Get the syncAgentKey property: Key of sync agent. + * + * @return the syncAgentKey value. + */ + public String syncAgentKey() { + return this.syncAgentKey; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncAgentLinkedDatabaseInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncAgentLinkedDatabaseInner.java new file mode 100644 index 0000000000000..f8e70badfc5b0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncAgentLinkedDatabaseInner.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.SyncMemberDbType; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An Azure SQL Database sync agent linked database. */ +@Immutable +public final class SyncAgentLinkedDatabaseInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private SyncAgentLinkedDatabaseProperties innerProperties; + + /** Creates an instance of SyncAgentLinkedDatabaseInner class. */ + public SyncAgentLinkedDatabaseInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private SyncAgentLinkedDatabaseProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the databaseType property: Type of the sync agent linked database. + * + * @return the databaseType value. + */ + public SyncMemberDbType databaseType() { + return this.innerProperties() == null ? null : this.innerProperties().databaseType(); + } + + /** + * Get the databaseId property: Id of the sync agent linked database. + * + * @return the databaseId value. + */ + public String databaseId() { + return this.innerProperties() == null ? null : this.innerProperties().databaseId(); + } + + /** + * Get the description property: Description of the sync agent linked database. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Get the serverName property: Server name of the sync agent linked database. + * + * @return the serverName value. + */ + public String serverName() { + return this.innerProperties() == null ? null : this.innerProperties().serverName(); + } + + /** + * Get the databaseName property: Database name of the sync agent linked database. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.innerProperties() == null ? null : this.innerProperties().databaseName(); + } + + /** + * Get the username property: User name of the sync agent linked database. + * + * @return the username value. + */ + public String username() { + return this.innerProperties() == null ? null : this.innerProperties().username(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncAgentLinkedDatabaseProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncAgentLinkedDatabaseProperties.java new file mode 100644 index 0000000000000..193ca2bcb5ce0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncAgentLinkedDatabaseProperties.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.models.SyncMemberDbType; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of an Azure SQL Database sync agent linked database. */ +@Immutable +public final class SyncAgentLinkedDatabaseProperties { + /* + * Type of the sync agent linked database. + */ + @JsonProperty(value = "databaseType", access = JsonProperty.Access.WRITE_ONLY) + private SyncMemberDbType databaseType; + + /* + * Id of the sync agent linked database. + */ + @JsonProperty(value = "databaseId", access = JsonProperty.Access.WRITE_ONLY) + private String databaseId; + + /* + * Description of the sync agent linked database. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /* + * Server name of the sync agent linked database. + */ + @JsonProperty(value = "serverName", access = JsonProperty.Access.WRITE_ONLY) + private String serverName; + + /* + * Database name of the sync agent linked database. + */ + @JsonProperty(value = "databaseName", access = JsonProperty.Access.WRITE_ONLY) + private String databaseName; + + /* + * User name of the sync agent linked database. + */ + @JsonProperty(value = "userName", access = JsonProperty.Access.WRITE_ONLY) + private String username; + + /** Creates an instance of SyncAgentLinkedDatabaseProperties class. */ + public SyncAgentLinkedDatabaseProperties() { + } + + /** + * Get the databaseType property: Type of the sync agent linked database. + * + * @return the databaseType value. + */ + public SyncMemberDbType databaseType() { + return this.databaseType; + } + + /** + * Get the databaseId property: Id of the sync agent linked database. + * + * @return the databaseId value. + */ + public String databaseId() { + return this.databaseId; + } + + /** + * Get the description property: Description of the sync agent linked database. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the serverName property: Server name of the sync agent linked database. + * + * @return the serverName value. + */ + public String serverName() { + return this.serverName; + } + + /** + * Get the databaseName property: Database name of the sync agent linked database. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Get the username property: User name of the sync agent linked database. + * + * @return the username value. + */ + public String username() { + return this.username; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncAgentProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncAgentProperties.java new file mode 100644 index 0000000000000..4d57bf2f72ef2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncAgentProperties.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.models.SyncAgentState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Properties of an Azure SQL Database sync agent. */ +@Fluent +public final class SyncAgentProperties { + /* + * Name of the sync agent. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * ARM resource id of the sync database in the sync agent. + */ + @JsonProperty(value = "syncDatabaseId") + private String syncDatabaseId; + + /* + * Last alive time of the sync agent. + */ + @JsonProperty(value = "lastAliveTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastAliveTime; + + /* + * State of the sync agent. + */ + @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) + private SyncAgentState state; + + /* + * If the sync agent version is up to date. + */ + @JsonProperty(value = "isUpToDate", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isUpToDate; + + /* + * Expiration time of the sync agent version. + */ + @JsonProperty(value = "expiryTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime expiryTime; + + /* + * Version of the sync agent. + */ + @JsonProperty(value = "version", access = JsonProperty.Access.WRITE_ONLY) + private String version; + + /** Creates an instance of SyncAgentProperties class. */ + public SyncAgentProperties() { + } + + /** + * Get the name property: Name of the sync agent. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the syncDatabaseId property: ARM resource id of the sync database in the sync agent. + * + * @return the syncDatabaseId value. + */ + public String syncDatabaseId() { + return this.syncDatabaseId; + } + + /** + * Set the syncDatabaseId property: ARM resource id of the sync database in the sync agent. + * + * @param syncDatabaseId the syncDatabaseId value to set. + * @return the SyncAgentProperties object itself. + */ + public SyncAgentProperties withSyncDatabaseId(String syncDatabaseId) { + this.syncDatabaseId = syncDatabaseId; + return this; + } + + /** + * Get the lastAliveTime property: Last alive time of the sync agent. + * + * @return the lastAliveTime value. + */ + public OffsetDateTime lastAliveTime() { + return this.lastAliveTime; + } + + /** + * Get the state property: State of the sync agent. + * + * @return the state value. + */ + public SyncAgentState state() { + return this.state; + } + + /** + * Get the isUpToDate property: If the sync agent version is up to date. + * + * @return the isUpToDate value. + */ + public Boolean isUpToDate() { + return this.isUpToDate; + } + + /** + * Get the expiryTime property: Expiration time of the sync agent version. + * + * @return the expiryTime value. + */ + public OffsetDateTime expiryTime() { + return this.expiryTime; + } + + /** + * Get the version property: Version of the sync agent. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncDatabaseIdPropertiesInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncDatabaseIdPropertiesInner.java new file mode 100644 index 0000000000000..687cba218dd63 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncDatabaseIdPropertiesInner.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of the sync database id. */ +@Immutable +public final class SyncDatabaseIdPropertiesInner { + /* + * ARM resource id of sync database. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** Creates an instance of SyncDatabaseIdPropertiesInner class. */ + public SyncDatabaseIdPropertiesInner() { + } + + /** + * Get the id property: ARM resource id of sync database. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncFullSchemaPropertiesInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncFullSchemaPropertiesInner.java new file mode 100644 index 0000000000000..3d64e317ee415 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncFullSchemaPropertiesInner.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.models.SyncFullSchemaTable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Properties of the database full schema. */ +@Immutable +public final 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 OffsetDateTime lastUpdateTime; + + /** Creates an instance of SyncFullSchemaPropertiesInner class. */ + public SyncFullSchemaPropertiesInner() { + } + + /** + * Get the tables property: List of tables in the database full schema. + * + * @return the tables value. + */ + public List tables() { + return this.tables; + } + + /** + * Get the lastUpdateTime property: Last update time of the database schema. + * + * @return the lastUpdateTime value. + */ + public OffsetDateTime lastUpdateTime() { + return this.lastUpdateTime; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (tables() != null) { + tables().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncGroupInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncGroupInner.java new file mode 100644 index 0000000000000..a45feb93c5709 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncGroupInner.java @@ -0,0 +1,312 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.Sku; +import com.azure.resourcemanager.sql.generated.models.SyncConflictResolutionPolicy; +import com.azure.resourcemanager.sql.generated.models.SyncGroupSchema; +import com.azure.resourcemanager.sql.generated.models.SyncGroupState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** An Azure SQL Database sync group. */ +@Fluent +public final class SyncGroupInner extends ProxyResource { + /* + * The name and capacity of the SKU. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private SyncGroupProperties innerProperties; + + /** Creates an instance of SyncGroupInner class. */ + public SyncGroupInner() { + } + + /** + * Get the sku property: The name and capacity of the SKU. + * + * @return the sku value. + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku property: The name and capacity of the SKU. + * + * @param sku the sku value to set. + * @return the SyncGroupInner object itself. + */ + public SyncGroupInner withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private SyncGroupProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the interval property: Sync interval of the sync group. + * + * @return the interval value. + */ + public Integer interval() { + return this.innerProperties() == null ? null : this.innerProperties().interval(); + } + + /** + * Set the interval property: Sync interval of the sync group. + * + * @param interval the interval value to set. + * @return the SyncGroupInner object itself. + */ + public SyncGroupInner withInterval(Integer interval) { + if (this.innerProperties() == null) { + this.innerProperties = new SyncGroupProperties(); + } + this.innerProperties().withInterval(interval); + return this; + } + + /** + * Get the lastSyncTime property: Last sync time of the sync group. + * + * @return the lastSyncTime value. + */ + public OffsetDateTime lastSyncTime() { + return this.innerProperties() == null ? null : this.innerProperties().lastSyncTime(); + } + + /** + * Get the conflictResolutionPolicy property: Conflict resolution policy of the sync group. + * + * @return the conflictResolutionPolicy value. + */ + public SyncConflictResolutionPolicy conflictResolutionPolicy() { + return this.innerProperties() == null ? null : this.innerProperties().conflictResolutionPolicy(); + } + + /** + * Set the conflictResolutionPolicy property: Conflict resolution policy of the sync group. + * + * @param conflictResolutionPolicy the conflictResolutionPolicy value to set. + * @return the SyncGroupInner object itself. + */ + public SyncGroupInner withConflictResolutionPolicy(SyncConflictResolutionPolicy conflictResolutionPolicy) { + if (this.innerProperties() == null) { + this.innerProperties = new SyncGroupProperties(); + } + this.innerProperties().withConflictResolutionPolicy(conflictResolutionPolicy); + return this; + } + + /** + * Get the syncDatabaseId property: ARM resource id of the sync database in the sync group. + * + * @return the syncDatabaseId value. + */ + public String syncDatabaseId() { + return this.innerProperties() == null ? null : this.innerProperties().syncDatabaseId(); + } + + /** + * Set the syncDatabaseId property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new SyncGroupProperties(); + } + this.innerProperties().withSyncDatabaseId(syncDatabaseId); + return this; + } + + /** + * Get the hubDatabaseUsername property: User name for the sync group hub database credential. + * + * @return the hubDatabaseUsername value. + */ + public String hubDatabaseUsername() { + return this.innerProperties() == null ? null : this.innerProperties().hubDatabaseUsername(); + } + + /** + * Set the hubDatabaseUsername property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new SyncGroupProperties(); + } + this.innerProperties().withHubDatabaseUsername(hubDatabaseUsername); + return this; + } + + /** + * Get the hubDatabasePassword property: Password for the sync group hub database credential. + * + * @return the hubDatabasePassword value. + */ + public String hubDatabasePassword() { + return this.innerProperties() == null ? null : this.innerProperties().hubDatabasePassword(); + } + + /** + * Set the hubDatabasePassword property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new SyncGroupProperties(); + } + this.innerProperties().withHubDatabasePassword(hubDatabasePassword); + return this; + } + + /** + * Get the syncState property: Sync state of the sync group. + * + * @return the syncState value. + */ + public SyncGroupState syncState() { + return this.innerProperties() == null ? null : this.innerProperties().syncState(); + } + + /** + * Get the schema property: Sync schema of the sync group. + * + * @return the schema value. + */ + public SyncGroupSchema schema() { + return this.innerProperties() == null ? null : this.innerProperties().schema(); + } + + /** + * Set the schema property: Sync schema of the sync group. + * + * @param schema the schema value to set. + * @return the SyncGroupInner object itself. + */ + public SyncGroupInner withSchema(SyncGroupSchema schema) { + if (this.innerProperties() == null) { + this.innerProperties = new SyncGroupProperties(); + } + this.innerProperties().withSchema(schema); + return this; + } + + /** + * Get the enableConflictLogging property: If conflict logging is enabled. + * + * @return the enableConflictLogging value. + */ + public Boolean enableConflictLogging() { + return this.innerProperties() == null ? null : this.innerProperties().enableConflictLogging(); + } + + /** + * Set the enableConflictLogging property: If conflict logging is enabled. + * + * @param enableConflictLogging the enableConflictLogging value to set. + * @return the SyncGroupInner object itself. + */ + public SyncGroupInner withEnableConflictLogging(Boolean enableConflictLogging) { + if (this.innerProperties() == null) { + this.innerProperties = new SyncGroupProperties(); + } + this.innerProperties().withEnableConflictLogging(enableConflictLogging); + return this; + } + + /** + * Get the conflictLoggingRetentionInDays property: Conflict logging retention period. + * + * @return the conflictLoggingRetentionInDays value. + */ + public Integer conflictLoggingRetentionInDays() { + return this.innerProperties() == null ? null : this.innerProperties().conflictLoggingRetentionInDays(); + } + + /** + * Set the conflictLoggingRetentionInDays property: Conflict logging retention period. + * + * @param conflictLoggingRetentionInDays the conflictLoggingRetentionInDays value to set. + * @return the SyncGroupInner object itself. + */ + public SyncGroupInner withConflictLoggingRetentionInDays(Integer conflictLoggingRetentionInDays) { + if (this.innerProperties() == null) { + this.innerProperties = new SyncGroupProperties(); + } + this.innerProperties().withConflictLoggingRetentionInDays(conflictLoggingRetentionInDays); + return this; + } + + /** + * Get the usePrivateLinkConnection property: If use private link connection is enabled. + * + * @return the usePrivateLinkConnection value. + */ + public Boolean usePrivateLinkConnection() { + return this.innerProperties() == null ? null : this.innerProperties().usePrivateLinkConnection(); + } + + /** + * Set the usePrivateLinkConnection property: If use private link connection is enabled. + * + * @param usePrivateLinkConnection the usePrivateLinkConnection value to set. + * @return the SyncGroupInner object itself. + */ + public SyncGroupInner withUsePrivateLinkConnection(Boolean usePrivateLinkConnection) { + if (this.innerProperties() == null) { + this.innerProperties = new SyncGroupProperties(); + } + this.innerProperties().withUsePrivateLinkConnection(usePrivateLinkConnection); + return this; + } + + /** + * Get the privateEndpointName property: Private endpoint name of the sync group if use private link connection is + * enabled. + * + * @return the privateEndpointName value. + */ + public String privateEndpointName() { + return this.innerProperties() == null ? null : this.innerProperties().privateEndpointName(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncGroupLogPropertiesInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncGroupLogPropertiesInner.java new file mode 100644 index 0000000000000..41e6d6344c8e5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncGroupLogPropertiesInner.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.models.SyncGroupLogType; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.UUID; + +/** Properties of an Azure SQL Database sync group log. */ +@Immutable +public final class SyncGroupLogPropertiesInner { + /* + * Timestamp of the sync group log. + */ + @JsonProperty(value = "timestamp", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime timestamp; + + /* + * Type of the sync group log. + */ + @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; + + /** Creates an instance of SyncGroupLogPropertiesInner class. */ + public SyncGroupLogPropertiesInner() { + } + + /** + * Get the timestamp property: Timestamp of the sync group log. + * + * @return the timestamp value. + */ + public OffsetDateTime timestamp() { + return this.timestamp; + } + + /** + * Get the type property: Type of the sync group log. + * + * @return the type value. + */ + public SyncGroupLogType type() { + return this.type; + } + + /** + * Get the source property: Source of the sync group log. + * + * @return the source value. + */ + public String source() { + return this.source; + } + + /** + * Get the details property: Details of the sync group log. + * + * @return the details value. + */ + public String details() { + return this.details; + } + + /** + * Get the tracingId property: TracingId of the sync group log. + * + * @return the tracingId value. + */ + public UUID tracingId() { + return this.tracingId; + } + + /** + * Get the operationStatus property: OperationStatus of the sync group log. + * + * @return the operationStatus value. + */ + public String operationStatus() { + return this.operationStatus; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncGroupProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncGroupProperties.java new file mode 100644 index 0000000000000..0c092bdd18264 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncGroupProperties.java @@ -0,0 +1,311 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.models.SyncConflictResolutionPolicy; +import com.azure.resourcemanager.sql.generated.models.SyncGroupSchema; +import com.azure.resourcemanager.sql.generated.models.SyncGroupState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Properties of a sync group. */ +@Fluent +public final class SyncGroupProperties { + /* + * Sync interval of the sync group. + */ + @JsonProperty(value = "interval") + private Integer interval; + + /* + * Last sync time of the sync group. + */ + @JsonProperty(value = "lastSyncTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastSyncTime; + + /* + * Conflict resolution policy of the sync group. + */ + @JsonProperty(value = "conflictResolutionPolicy") + private SyncConflictResolutionPolicy conflictResolutionPolicy; + + /* + * ARM resource id of the sync database in the sync group. + */ + @JsonProperty(value = "syncDatabaseId") + private String syncDatabaseId; + + /* + * User name for the sync group hub database credential. + */ + @JsonProperty(value = "hubDatabaseUserName") + private String hubDatabaseUsername; + + /* + * Password for the sync group hub database credential. + */ + @JsonProperty(value = "hubDatabasePassword") + private String hubDatabasePassword; + + /* + * Sync state of the sync group. + */ + @JsonProperty(value = "syncState", access = JsonProperty.Access.WRITE_ONLY) + private SyncGroupState syncState; + + /* + * Sync schema of the sync group. + */ + @JsonProperty(value = "schema") + private SyncGroupSchema schema; + + /* + * If conflict logging is enabled. + */ + @JsonProperty(value = "enableConflictLogging") + private Boolean enableConflictLogging; + + /* + * Conflict logging retention period. + */ + @JsonProperty(value = "conflictLoggingRetentionInDays") + private Integer conflictLoggingRetentionInDays; + + /* + * If use private link connection is enabled. + */ + @JsonProperty(value = "usePrivateLinkConnection") + private Boolean usePrivateLinkConnection; + + /* + * Private endpoint name of the sync group if use private link connection is enabled. + */ + @JsonProperty(value = "privateEndpointName", access = JsonProperty.Access.WRITE_ONLY) + private String privateEndpointName; + + /** Creates an instance of SyncGroupProperties class. */ + public SyncGroupProperties() { + } + + /** + * Get the interval property: Sync interval of the sync group. + * + * @return the interval value. + */ + public Integer interval() { + return this.interval; + } + + /** + * Set the interval property: Sync interval of the sync group. + * + * @param interval the interval value to set. + * @return the SyncGroupProperties object itself. + */ + public SyncGroupProperties withInterval(Integer interval) { + this.interval = interval; + return this; + } + + /** + * Get the lastSyncTime property: Last sync time of the sync group. + * + * @return the lastSyncTime value. + */ + public OffsetDateTime lastSyncTime() { + return this.lastSyncTime; + } + + /** + * Get the conflictResolutionPolicy property: Conflict resolution policy of the sync group. + * + * @return the conflictResolutionPolicy value. + */ + public SyncConflictResolutionPolicy conflictResolutionPolicy() { + return this.conflictResolutionPolicy; + } + + /** + * Set the conflictResolutionPolicy property: Conflict resolution policy of the sync group. + * + * @param conflictResolutionPolicy the conflictResolutionPolicy value to set. + * @return the SyncGroupProperties object itself. + */ + public SyncGroupProperties withConflictResolutionPolicy(SyncConflictResolutionPolicy conflictResolutionPolicy) { + this.conflictResolutionPolicy = conflictResolutionPolicy; + return this; + } + + /** + * Get the syncDatabaseId property: ARM resource id of the sync database in the sync group. + * + * @return the syncDatabaseId value. + */ + public String syncDatabaseId() { + return this.syncDatabaseId; + } + + /** + * Set the syncDatabaseId property: ARM resource id of the sync database in the sync group. + * + * @param syncDatabaseId the syncDatabaseId value to set. + * @return the SyncGroupProperties object itself. + */ + public SyncGroupProperties withSyncDatabaseId(String syncDatabaseId) { + this.syncDatabaseId = syncDatabaseId; + return this; + } + + /** + * Get the hubDatabaseUsername property: User name for the sync group hub database credential. + * + * @return the hubDatabaseUsername value. + */ + public String hubDatabaseUsername() { + return this.hubDatabaseUsername; + } + + /** + * Set the hubDatabaseUsername property: User name for the sync group hub database credential. + * + * @param hubDatabaseUsername the hubDatabaseUsername value to set. + * @return the SyncGroupProperties object itself. + */ + public SyncGroupProperties withHubDatabaseUsername(String hubDatabaseUsername) { + this.hubDatabaseUsername = hubDatabaseUsername; + return this; + } + + /** + * Get the hubDatabasePassword property: Password for the sync group hub database credential. + * + * @return the hubDatabasePassword value. + */ + public String hubDatabasePassword() { + return this.hubDatabasePassword; + } + + /** + * Set the hubDatabasePassword property: Password for the sync group hub database credential. + * + * @param hubDatabasePassword the hubDatabasePassword value to set. + * @return the SyncGroupProperties object itself. + */ + public SyncGroupProperties withHubDatabasePassword(String hubDatabasePassword) { + this.hubDatabasePassword = hubDatabasePassword; + return this; + } + + /** + * Get the syncState property: Sync state of the sync group. + * + * @return the syncState value. + */ + public SyncGroupState syncState() { + return this.syncState; + } + + /** + * Get the schema property: Sync schema of the sync group. + * + * @return the schema value. + */ + public SyncGroupSchema schema() { + return this.schema; + } + + /** + * Set the schema property: Sync schema of the sync group. + * + * @param schema the schema value to set. + * @return the SyncGroupProperties object itself. + */ + public SyncGroupProperties withSchema(SyncGroupSchema schema) { + this.schema = schema; + return this; + } + + /** + * Get the enableConflictLogging property: If conflict logging is enabled. + * + * @return the enableConflictLogging value. + */ + public Boolean enableConflictLogging() { + return this.enableConflictLogging; + } + + /** + * Set the enableConflictLogging property: If conflict logging is enabled. + * + * @param enableConflictLogging the enableConflictLogging value to set. + * @return the SyncGroupProperties object itself. + */ + public SyncGroupProperties withEnableConflictLogging(Boolean enableConflictLogging) { + this.enableConflictLogging = enableConflictLogging; + return this; + } + + /** + * Get the conflictLoggingRetentionInDays property: Conflict logging retention period. + * + * @return the conflictLoggingRetentionInDays value. + */ + public Integer conflictLoggingRetentionInDays() { + return this.conflictLoggingRetentionInDays; + } + + /** + * Set the conflictLoggingRetentionInDays property: Conflict logging retention period. + * + * @param conflictLoggingRetentionInDays the conflictLoggingRetentionInDays value to set. + * @return the SyncGroupProperties object itself. + */ + public SyncGroupProperties withConflictLoggingRetentionInDays(Integer conflictLoggingRetentionInDays) { + this.conflictLoggingRetentionInDays = conflictLoggingRetentionInDays; + return this; + } + + /** + * Get the usePrivateLinkConnection property: If use private link connection is enabled. + * + * @return the usePrivateLinkConnection value. + */ + public Boolean usePrivateLinkConnection() { + return this.usePrivateLinkConnection; + } + + /** + * Set the usePrivateLinkConnection property: If use private link connection is enabled. + * + * @param usePrivateLinkConnection the usePrivateLinkConnection value to set. + * @return the SyncGroupProperties object itself. + */ + public SyncGroupProperties withUsePrivateLinkConnection(Boolean usePrivateLinkConnection) { + this.usePrivateLinkConnection = usePrivateLinkConnection; + return this; + } + + /** + * Get the privateEndpointName property: Private endpoint name of the sync group if use private link connection is + * enabled. + * + * @return the privateEndpointName value. + */ + public String privateEndpointName() { + return this.privateEndpointName; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (schema() != null) { + schema().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncMemberInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncMemberInner.java new file mode 100644 index 0000000000000..9ab134d6d317c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncMemberInner.java @@ -0,0 +1,298 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.SyncDirection; +import com.azure.resourcemanager.sql.generated.models.SyncMemberDbType; +import com.azure.resourcemanager.sql.generated.models.SyncMemberState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +/** An Azure SQL Database sync member. */ +@Fluent +public final class SyncMemberInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private SyncMemberProperties innerProperties; + + /** Creates an instance of SyncMemberInner class. */ + public SyncMemberInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private SyncMemberProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the databaseType property: Database type of the sync member. + * + * @return the databaseType value. + */ + public SyncMemberDbType databaseType() { + return this.innerProperties() == null ? null : this.innerProperties().databaseType(); + } + + /** + * Set the databaseType property: Database type of the sync member. + * + * @param databaseType the databaseType value to set. + * @return the SyncMemberInner object itself. + */ + public SyncMemberInner withDatabaseType(SyncMemberDbType databaseType) { + if (this.innerProperties() == null) { + this.innerProperties = new SyncMemberProperties(); + } + this.innerProperties().withDatabaseType(databaseType); + return this; + } + + /** + * Get the syncAgentId property: ARM resource id of the sync agent in the sync member. + * + * @return the syncAgentId value. + */ + public String syncAgentId() { + return this.innerProperties() == null ? null : this.innerProperties().syncAgentId(); + } + + /** + * Set the syncAgentId property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new SyncMemberProperties(); + } + this.innerProperties().withSyncAgentId(syncAgentId); + return this; + } + + /** + * Get the sqlServerDatabaseId property: SQL Server database id of the sync member. + * + * @return the sqlServerDatabaseId value. + */ + public UUID sqlServerDatabaseId() { + return this.innerProperties() == null ? null : this.innerProperties().sqlServerDatabaseId(); + } + + /** + * Set the sqlServerDatabaseId property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new SyncMemberProperties(); + } + this.innerProperties().withSqlServerDatabaseId(sqlServerDatabaseId); + return this; + } + + /** + * Get the syncMemberAzureDatabaseResourceId property: ARM resource id of the sync member logical database, for sync + * members in Azure. + * + * @return the syncMemberAzureDatabaseResourceId value. + */ + public String syncMemberAzureDatabaseResourceId() { + return this.innerProperties() == null ? null : this.innerProperties().syncMemberAzureDatabaseResourceId(); + } + + /** + * Set the syncMemberAzureDatabaseResourceId property: ARM resource id of the sync member logical database, for sync + * members in Azure. + * + * @param syncMemberAzureDatabaseResourceId the syncMemberAzureDatabaseResourceId value to set. + * @return the SyncMemberInner object itself. + */ + public SyncMemberInner withSyncMemberAzureDatabaseResourceId(String syncMemberAzureDatabaseResourceId) { + if (this.innerProperties() == null) { + this.innerProperties = new SyncMemberProperties(); + } + this.innerProperties().withSyncMemberAzureDatabaseResourceId(syncMemberAzureDatabaseResourceId); + return this; + } + + /** + * Get the usePrivateLinkConnection property: Whether to use private link connection. + * + * @return the usePrivateLinkConnection value. + */ + public Boolean usePrivateLinkConnection() { + return this.innerProperties() == null ? null : this.innerProperties().usePrivateLinkConnection(); + } + + /** + * Set the usePrivateLinkConnection property: Whether to use private link connection. + * + * @param usePrivateLinkConnection the usePrivateLinkConnection value to set. + * @return the SyncMemberInner object itself. + */ + public SyncMemberInner withUsePrivateLinkConnection(Boolean usePrivateLinkConnection) { + if (this.innerProperties() == null) { + this.innerProperties = new SyncMemberProperties(); + } + this.innerProperties().withUsePrivateLinkConnection(usePrivateLinkConnection); + return this; + } + + /** + * Get the privateEndpointName property: Private endpoint name of the sync member if use private link connection is + * enabled, for sync members in Azure. + * + * @return the privateEndpointName value. + */ + public String privateEndpointName() { + return this.innerProperties() == null ? null : this.innerProperties().privateEndpointName(); + } + + /** + * Get the serverName property: Server name of the member database in the sync member. + * + * @return the serverName value. + */ + public String serverName() { + return this.innerProperties() == null ? null : this.innerProperties().serverName(); + } + + /** + * Set the serverName property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new SyncMemberProperties(); + } + this.innerProperties().withServerName(serverName); + return this; + } + + /** + * Get the databaseName property: Database name of the member database in the sync member. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.innerProperties() == null ? null : this.innerProperties().databaseName(); + } + + /** + * Set the databaseName property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new SyncMemberProperties(); + } + this.innerProperties().withDatabaseName(databaseName); + return this; + } + + /** + * Get the username property: User name of the member database in the sync member. + * + * @return the username value. + */ + public String username() { + return this.innerProperties() == null ? null : this.innerProperties().username(); + } + + /** + * Set the username property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new SyncMemberProperties(); + } + this.innerProperties().withUsername(username); + return this; + } + + /** + * Get the password property: Password of the member database in the sync member. + * + * @return the password value. + */ + public String password() { + return this.innerProperties() == null ? null : this.innerProperties().password(); + } + + /** + * Set the password property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new SyncMemberProperties(); + } + this.innerProperties().withPassword(password); + return this; + } + + /** + * Get the syncDirection property: Sync direction of the sync member. + * + * @return the syncDirection value. + */ + public SyncDirection syncDirection() { + return this.innerProperties() == null ? null : this.innerProperties().syncDirection(); + } + + /** + * Set the syncDirection property: Sync direction of the sync member. + * + * @param syncDirection the syncDirection value to set. + * @return the SyncMemberInner object itself. + */ + public SyncMemberInner withSyncDirection(SyncDirection syncDirection) { + if (this.innerProperties() == null) { + this.innerProperties = new SyncMemberProperties(); + } + this.innerProperties().withSyncDirection(syncDirection); + return this; + } + + /** + * Get the syncState property: Sync state of the sync member. + * + * @return the syncState value. + */ + public SyncMemberState syncState() { + return this.innerProperties() == null ? null : this.innerProperties().syncState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncMemberProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncMemberProperties.java new file mode 100644 index 0000000000000..a318288f52a52 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/SyncMemberProperties.java @@ -0,0 +1,321 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.models.SyncDirection; +import com.azure.resourcemanager.sql.generated.models.SyncMemberDbType; +import com.azure.resourcemanager.sql.generated.models.SyncMemberState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +/** Properties of a sync member. */ +@Fluent +public final class SyncMemberProperties { + /* + * Database type of the sync member. + */ + @JsonProperty(value = "databaseType") + private SyncMemberDbType databaseType; + + /* + * ARM resource id of the sync agent in the sync member. + */ + @JsonProperty(value = "syncAgentId") + private String syncAgentId; + + /* + * SQL Server database id of the sync member. + */ + @JsonProperty(value = "sqlServerDatabaseId") + private UUID sqlServerDatabaseId; + + /* + * ARM resource id of the sync member logical database, for sync members in Azure. + */ + @JsonProperty(value = "syncMemberAzureDatabaseResourceId") + private String syncMemberAzureDatabaseResourceId; + + /* + * Whether to use private link connection. + */ + @JsonProperty(value = "usePrivateLinkConnection") + private Boolean usePrivateLinkConnection; + + /* + * Private endpoint name of the sync member if use private link connection is enabled, for sync members in Azure. + */ + @JsonProperty(value = "privateEndpointName", access = JsonProperty.Access.WRITE_ONLY) + private String privateEndpointName; + + /* + * Server name of the member database in the sync member + */ + @JsonProperty(value = "serverName") + private String serverName; + + /* + * Database name of the member database in the sync member. + */ + @JsonProperty(value = "databaseName") + private String databaseName; + + /* + * User name of the member database in the sync member. + */ + @JsonProperty(value = "userName") + private String username; + + /* + * Password of the member database in the sync member. + */ + @JsonProperty(value = "password") + private String password; + + /* + * Sync direction of the sync member. + */ + @JsonProperty(value = "syncDirection") + private SyncDirection syncDirection; + + /* + * Sync state of the sync member. + */ + @JsonProperty(value = "syncState", access = JsonProperty.Access.WRITE_ONLY) + private SyncMemberState syncState; + + /** Creates an instance of SyncMemberProperties class. */ + public SyncMemberProperties() { + } + + /** + * Get the databaseType property: Database type of the sync member. + * + * @return the databaseType value. + */ + public SyncMemberDbType databaseType() { + return this.databaseType; + } + + /** + * Set the databaseType property: Database type of the sync member. + * + * @param databaseType the databaseType value to set. + * @return the SyncMemberProperties object itself. + */ + public SyncMemberProperties withDatabaseType(SyncMemberDbType databaseType) { + this.databaseType = databaseType; + return this; + } + + /** + * Get the syncAgentId property: ARM resource id of the sync agent in the sync member. + * + * @return the syncAgentId value. + */ + public String syncAgentId() { + return this.syncAgentId; + } + + /** + * Set the syncAgentId property: ARM resource id of the sync agent in the sync member. + * + * @param syncAgentId the syncAgentId value to set. + * @return the SyncMemberProperties object itself. + */ + public SyncMemberProperties withSyncAgentId(String syncAgentId) { + this.syncAgentId = syncAgentId; + return this; + } + + /** + * Get the sqlServerDatabaseId property: SQL Server database id of the sync member. + * + * @return the sqlServerDatabaseId value. + */ + public UUID sqlServerDatabaseId() { + return this.sqlServerDatabaseId; + } + + /** + * Set the sqlServerDatabaseId property: SQL Server database id of the sync member. + * + * @param sqlServerDatabaseId the sqlServerDatabaseId value to set. + * @return the SyncMemberProperties object itself. + */ + public SyncMemberProperties withSqlServerDatabaseId(UUID sqlServerDatabaseId) { + this.sqlServerDatabaseId = sqlServerDatabaseId; + return this; + } + + /** + * Get the syncMemberAzureDatabaseResourceId property: ARM resource id of the sync member logical database, for sync + * members in Azure. + * + * @return the syncMemberAzureDatabaseResourceId value. + */ + public String syncMemberAzureDatabaseResourceId() { + return this.syncMemberAzureDatabaseResourceId; + } + + /** + * Set the syncMemberAzureDatabaseResourceId property: ARM resource id of the sync member logical database, for sync + * members in Azure. + * + * @param syncMemberAzureDatabaseResourceId the syncMemberAzureDatabaseResourceId value to set. + * @return the SyncMemberProperties object itself. + */ + public SyncMemberProperties withSyncMemberAzureDatabaseResourceId(String syncMemberAzureDatabaseResourceId) { + this.syncMemberAzureDatabaseResourceId = syncMemberAzureDatabaseResourceId; + return this; + } + + /** + * Get the usePrivateLinkConnection property: Whether to use private link connection. + * + * @return the usePrivateLinkConnection value. + */ + public Boolean usePrivateLinkConnection() { + return this.usePrivateLinkConnection; + } + + /** + * Set the usePrivateLinkConnection property: Whether to use private link connection. + * + * @param usePrivateLinkConnection the usePrivateLinkConnection value to set. + * @return the SyncMemberProperties object itself. + */ + public SyncMemberProperties withUsePrivateLinkConnection(Boolean usePrivateLinkConnection) { + this.usePrivateLinkConnection = usePrivateLinkConnection; + return this; + } + + /** + * Get the privateEndpointName property: Private endpoint name of the sync member if use private link connection is + * enabled, for sync members in Azure. + * + * @return the privateEndpointName value. + */ + public String privateEndpointName() { + return this.privateEndpointName; + } + + /** + * Get the serverName property: Server name of the member database in the sync member. + * + * @return the serverName value. + */ + public String serverName() { + return this.serverName; + } + + /** + * Set the serverName property: Server name of the member database in the sync member. + * + * @param serverName the serverName value to set. + * @return the SyncMemberProperties object itself. + */ + public SyncMemberProperties withServerName(String serverName) { + this.serverName = serverName; + return this; + } + + /** + * Get the databaseName property: Database name of the member database in the sync member. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Set the databaseName property: Database name of the member database in the sync member. + * + * @param databaseName the databaseName value to set. + * @return the SyncMemberProperties object itself. + */ + public SyncMemberProperties withDatabaseName(String databaseName) { + this.databaseName = databaseName; + return this; + } + + /** + * Get the username property: User name of the member database in the sync member. + * + * @return the username value. + */ + public String username() { + return this.username; + } + + /** + * Set the username property: User name of the member database in the sync member. + * + * @param username the username value to set. + * @return the SyncMemberProperties object itself. + */ + public SyncMemberProperties withUsername(String username) { + this.username = username; + return this; + } + + /** + * Get the password property: Password of the member database in the sync member. + * + * @return the password value. + */ + public String password() { + return this.password; + } + + /** + * Set the password property: Password of the member database in the sync member. + * + * @param password the password value to set. + * @return the SyncMemberProperties object itself. + */ + public SyncMemberProperties withPassword(String password) { + this.password = password; + return this; + } + + /** + * Get the syncDirection property: Sync direction of the sync member. + * + * @return the syncDirection value. + */ + public SyncDirection syncDirection() { + return this.syncDirection; + } + + /** + * Set the syncDirection property: Sync direction of the sync member. + * + * @param syncDirection the syncDirection value to set. + * @return the SyncMemberProperties object itself. + */ + public SyncMemberProperties withSyncDirection(SyncDirection syncDirection) { + this.syncDirection = syncDirection; + return this; + } + + /** + * Get the syncState property: Sync state of the sync member. + * + * @return the syncState value. + */ + public SyncMemberState syncState() { + return this.syncState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/TdeCertificateProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/TdeCertificateProperties.java new file mode 100644 index 0000000000000..93382063b344f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/TdeCertificateProperties.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a TDE certificate. */ +@Fluent +public final class TdeCertificateProperties { + /* + * The base64 encoded certificate private blob. + */ + @JsonProperty(value = "privateBlob", required = true) + private String privateBlob; + + /* + * The certificate password. + */ + @JsonProperty(value = "certPassword") + private String certPassword; + + /** Creates an instance of TdeCertificateProperties class. */ + public TdeCertificateProperties() { + } + + /** + * Get the privateBlob property: The base64 encoded certificate private blob. + * + * @return the privateBlob value. + */ + public String privateBlob() { + return this.privateBlob; + } + + /** + * Set the privateBlob property: The base64 encoded certificate private blob. + * + * @param privateBlob the privateBlob value to set. + * @return the TdeCertificateProperties object itself. + */ + public TdeCertificateProperties withPrivateBlob(String privateBlob) { + this.privateBlob = privateBlob; + return this; + } + + /** + * Get the certPassword property: The certificate password. + * + * @return the certPassword value. + */ + public String certPassword() { + return this.certPassword; + } + + /** + * Set the certPassword property: The certificate password. + * + * @param certPassword the certPassword value to set. + * @return the TdeCertificateProperties object itself. + */ + public TdeCertificateProperties withCertPassword(String certPassword) { + this.certPassword = certPassword; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (privateBlob() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property privateBlob in model TdeCertificateProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(TdeCertificateProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/TimeZoneInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/TimeZoneInner.java new file mode 100644 index 0000000000000..bbaeb3595956d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/TimeZoneInner.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Time Zone. */ +@Immutable +public final class TimeZoneInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private TimeZoneProperties innerProperties; + + /** Creates an instance of TimeZoneInner class. */ + public TimeZoneInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private TimeZoneProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the timeZoneId property: The time zone id. + * + * @return the timeZoneId value. + */ + public String timeZoneId() { + return this.innerProperties() == null ? null : this.innerProperties().timeZoneId(); + } + + /** + * Get the displayName property: The time zone display name. + * + * @return the displayName value. + */ + public String displayName() { + return this.innerProperties() == null ? null : this.innerProperties().displayName(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/TimeZoneProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/TimeZoneProperties.java new file mode 100644 index 0000000000000..f098b3a23e48b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/TimeZoneProperties.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of a time zone. */ +@Immutable +public final class TimeZoneProperties { + /* + * The time zone id + */ + @JsonProperty(value = "timeZoneId", access = JsonProperty.Access.WRITE_ONLY) + private String timeZoneId; + + /* + * The time zone display name + */ + @JsonProperty(value = "displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /** Creates an instance of TimeZoneProperties class. */ + public TimeZoneProperties() { + } + + /** + * Get the timeZoneId property: The time zone id. + * + * @return the timeZoneId value. + */ + public String timeZoneId() { + return this.timeZoneId; + } + + /** + * Get the displayName property: The time zone display name. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/TopQueriesInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/TopQueriesInner.java new file mode 100644 index 0000000000000..c245e8bb1d60b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/TopQueriesInner.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.models.QueryTimeGrainType; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The TopQueries model. */ +@Fluent +public final class TopQueriesInner { + /* + * Requested number of top queries. + */ + @JsonProperty(value = "numberOfQueries", access = JsonProperty.Access.WRITE_ONLY) + private Integer numberOfQueries; + + /* + * Aggregation function used to calculate query metrics. + */ + @JsonProperty(value = "aggregationFunction", access = JsonProperty.Access.WRITE_ONLY) + private String aggregationFunction; + + /* + * Metric used to rank queries. + */ + @JsonProperty(value = "observationMetric", access = JsonProperty.Access.WRITE_ONLY) + private String observationMetric; + + /* + * Interval type (length). + */ + @JsonProperty(value = "intervalType", access = JsonProperty.Access.WRITE_ONLY) + private QueryTimeGrainType intervalType; + + /* + * The start time for the metric (ISO-8601 format). + */ + @JsonProperty(value = "startTime", access = JsonProperty.Access.WRITE_ONLY) + private String startTime; + + /* + * The end time for the metric (ISO-8601 format). + */ + @JsonProperty(value = "endTime", access = JsonProperty.Access.WRITE_ONLY) + private String endTime; + + /* + * List of top resource consuming queries with appropriate metric data + */ + @JsonProperty(value = "queries") + private List queries; + + /** Creates an instance of TopQueriesInner class. */ + public TopQueriesInner() { + } + + /** + * Get the numberOfQueries property: Requested number of top queries. + * + * @return the numberOfQueries value. + */ + public Integer numberOfQueries() { + return this.numberOfQueries; + } + + /** + * Get the aggregationFunction property: Aggregation function used to calculate query metrics. + * + * @return the aggregationFunction value. + */ + public String aggregationFunction() { + return this.aggregationFunction; + } + + /** + * Get the observationMetric property: Metric used to rank queries. + * + * @return the observationMetric value. + */ + public String observationMetric() { + return this.observationMetric; + } + + /** + * Get the intervalType property: Interval type (length). + * + * @return the intervalType value. + */ + public QueryTimeGrainType intervalType() { + return this.intervalType; + } + + /** + * Get the startTime property: The start time for the metric (ISO-8601 format). + * + * @return the startTime value. + */ + public String startTime() { + return this.startTime; + } + + /** + * Get the endTime property: The end time for the metric (ISO-8601 format). + * + * @return the endTime value. + */ + public String endTime() { + return this.endTime; + } + + /** + * Get the queries property: List of top resource consuming queries with appropriate metric data. + * + * @return the queries value. + */ + public List queries() { + return this.queries; + } + + /** + * Set the queries property: List of top resource consuming queries with appropriate metric data. + * + * @param queries the queries value to set. + * @return the TopQueriesInner object itself. + */ + public TopQueriesInner withQueries(List queries) { + this.queries = queries; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (queries() != null) { + queries().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/TransparentDataEncryptionProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/TransparentDataEncryptionProperties.java new file mode 100644 index 0000000000000..2f291228663a1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/TransparentDataEncryptionProperties.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a transparent data encryption. */ +@Fluent +public final class TransparentDataEncryptionProperties { + /* + * Specifies the state of the transparent data encryption. + */ + @JsonProperty(value = "state", required = true) + private TransparentDataEncryptionState state; + + /** Creates an instance of TransparentDataEncryptionProperties class. */ + public TransparentDataEncryptionProperties() { + } + + /** + * Get the state property: Specifies the state of the transparent data encryption. + * + * @return the state value. + */ + public TransparentDataEncryptionState state() { + return this.state; + } + + /** + * Set the state property: Specifies the state of the transparent data encryption. + * + * @param state the state value to set. + * @return the TransparentDataEncryptionProperties object itself. + */ + public TransparentDataEncryptionProperties withState(TransparentDataEncryptionState state) { + this.state = state; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (state() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property state in model TransparentDataEncryptionProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(TransparentDataEncryptionProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/UpdateLongTermRetentionBackupParametersProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/UpdateLongTermRetentionBackupParametersProperties.java new file mode 100644 index 0000000000000..64a5bc9eaafbc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/UpdateLongTermRetentionBackupParametersProperties.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Contains the properties to perform long term retention backup copy operation. */ +@Fluent +public final class UpdateLongTermRetentionBackupParametersProperties { + /* + * The storage redundancy type of the copied backup + */ + @JsonProperty(value = "requestedBackupStorageRedundancy") + private BackupStorageRedundancy requestedBackupStorageRedundancy; + + /** Creates an instance of UpdateLongTermRetentionBackupParametersProperties class. */ + public UpdateLongTermRetentionBackupParametersProperties() { + } + + /** + * Get the requestedBackupStorageRedundancy property: The storage redundancy type of the copied backup. + * + * @return the requestedBackupStorageRedundancy value. + */ + public BackupStorageRedundancy requestedBackupStorageRedundancy() { + return this.requestedBackupStorageRedundancy; + } + + /** + * Set the requestedBackupStorageRedundancy property: The storage redundancy type of the copied backup. + * + * @param requestedBackupStorageRedundancy the requestedBackupStorageRedundancy value to set. + * @return the UpdateLongTermRetentionBackupParametersProperties object itself. + */ + public UpdateLongTermRetentionBackupParametersProperties withRequestedBackupStorageRedundancy( + BackupStorageRedundancy requestedBackupStorageRedundancy) { + this.requestedBackupStorageRedundancy = requestedBackupStorageRedundancy; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/UpdateVirtualClusterDnsServersOperationInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/UpdateVirtualClusterDnsServersOperationInner.java new file mode 100644 index 0000000000000..70006b9f625be --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/UpdateVirtualClusterDnsServersOperationInner.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.DnsRefreshOperationStatus; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A refresh DNS servers operation. */ +@Immutable +public final class UpdateVirtualClusterDnsServersOperationInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private VirtualClusterDnsServersProperties innerProperties; + + /** Creates an instance of UpdateVirtualClusterDnsServersOperationInner class. */ + public UpdateVirtualClusterDnsServersOperationInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private VirtualClusterDnsServersProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the status property: The status of the DNS refresh operation. + * + * @return the status value. + */ + public DnsRefreshOperationStatus status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/UsageInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/UsageInner.java new file mode 100644 index 0000000000000..542cfc316dce7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/UsageInner.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.models.Name; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** ARM usage. */ +@Immutable +public final class UsageInner { + /* + * Resource ID. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * Resource name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private Name name; + + /* + * Resource type. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * Usage unit. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private String unit; + + /* + * Usage current value. + */ + @JsonProperty(value = "currentValue", access = JsonProperty.Access.WRITE_ONLY) + private Integer currentValue; + + /* + * Usage limit. + */ + @JsonProperty(value = "limit", access = JsonProperty.Access.WRITE_ONLY) + private Integer limit; + + /* + * Usage requested limit. + */ + @JsonProperty(value = "requestedLimit", access = JsonProperty.Access.WRITE_ONLY) + private Integer requestedLimit; + + /** Creates an instance of UsageInner class. */ + public UsageInner() { + } + + /** + * Get the id property: Resource ID. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the name property: Resource name. + * + * @return the name value. + */ + public Name name() { + return this.name; + } + + /** + * Get the type property: Resource type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the unit property: Usage unit. + * + * @return the unit value. + */ + public String unit() { + return this.unit; + } + + /** + * Get the currentValue property: Usage current value. + * + * @return the currentValue value. + */ + public Integer currentValue() { + return this.currentValue; + } + + /** + * Get the limit property: Usage limit. + * + * @return the limit value. + */ + public Integer limit() { + return this.limit; + } + + /** + * Get the requestedLimit property: Usage requested limit. + * + * @return the requestedLimit value. + */ + public Integer requestedLimit() { + return this.requestedLimit; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() != null) { + name().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/VirtualClusterDnsServersProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/VirtualClusterDnsServersProperties.java new file mode 100644 index 0000000000000..1482e7702af9e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/VirtualClusterDnsServersProperties.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.models.DnsRefreshOperationStatus; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of dns servers on virtual cluster. */ +@Immutable +public final class VirtualClusterDnsServersProperties { + /* + * The status of the DNS refresh operation. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private DnsRefreshOperationStatus status; + + /** Creates an instance of VirtualClusterDnsServersProperties class. */ + public VirtualClusterDnsServersProperties() { + } + + /** + * Get the status property: The status of the DNS refresh operation. + * + * @return the status value. + */ + public DnsRefreshOperationStatus status() { + return this.status; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/VirtualClusterInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/VirtualClusterInner.java new file mode 100644 index 0000000000000..1146e8f3b344e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/VirtualClusterInner.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** An Azure SQL virtual cluster. */ +@Fluent +public final class VirtualClusterInner extends Resource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private VirtualClusterProperties innerProperties; + + /** Creates an instance of VirtualClusterInner class. */ + public VirtualClusterInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private VirtualClusterProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public VirtualClusterInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public VirtualClusterInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the subnetId property: Subnet resource ID for the virtual cluster. + * + * @return the subnetId value. + */ + public String subnetId() { + return this.innerProperties() == null ? null : this.innerProperties().subnetId(); + } + + /** + * Get the version property: Virtual cluster version. + * + * @return the version value. + */ + public String version() { + return this.innerProperties() == null ? null : this.innerProperties().version(); + } + + /** + * Set the version property: Virtual cluster version. + * + * @param version the version value to set. + * @return the VirtualClusterInner object itself. + */ + public VirtualClusterInner withVersion(String version) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualClusterProperties(); + } + this.innerProperties().withVersion(version); + return this; + } + + /** + * Get the childResources property: List of resources in this virtual cluster. + * + * @return the childResources value. + */ + public List childResources() { + return this.innerProperties() == null ? null : this.innerProperties().childResources(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/VirtualClusterProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/VirtualClusterProperties.java new file mode 100644 index 0000000000000..5e2bdca7a2d2d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/VirtualClusterProperties.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The properties of a virtual cluster. */ +@Fluent +public final class VirtualClusterProperties { + /* + * Subnet resource ID for the virtual cluster. + */ + @JsonProperty(value = "subnetId", access = JsonProperty.Access.WRITE_ONLY) + private String subnetId; + + /* + * Virtual cluster version. + */ + @JsonProperty(value = "version") + private String version; + + /* + * List of resources in this virtual cluster. + */ + @JsonProperty(value = "childResources", access = JsonProperty.Access.WRITE_ONLY) + private List childResources; + + /** Creates an instance of VirtualClusterProperties class. */ + public VirtualClusterProperties() { + } + + /** + * Get the subnetId property: Subnet resource ID for the virtual cluster. + * + * @return the subnetId value. + */ + public String subnetId() { + return this.subnetId; + } + + /** + * Get the version property: Virtual cluster version. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: Virtual cluster version. + * + * @param version the version value to set. + * @return the VirtualClusterProperties object itself. + */ + public VirtualClusterProperties withVersion(String version) { + this.version = version; + return this; + } + + /** + * Get the childResources property: List of resources in this virtual cluster. + * + * @return the childResources value. + */ + public List childResources() { + return this.childResources; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/VirtualNetworkRuleInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/VirtualNetworkRuleInner.java new file mode 100644 index 0000000000000..5c335071262a7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/VirtualNetworkRuleInner.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.VirtualNetworkRuleState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A virtual network rule. */ +@Fluent +public final class VirtualNetworkRuleInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private VirtualNetworkRuleProperties innerProperties; + + /** Creates an instance of VirtualNetworkRuleInner class. */ + public VirtualNetworkRuleInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private VirtualNetworkRuleProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the virtualNetworkSubnetId property: The ARM resource id of the virtual network subnet. + * + * @return the virtualNetworkSubnetId value. + */ + public String virtualNetworkSubnetId() { + return this.innerProperties() == null ? null : this.innerProperties().virtualNetworkSubnetId(); + } + + /** + * Set the virtualNetworkSubnetId property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualNetworkRuleProperties(); + } + this.innerProperties().withVirtualNetworkSubnetId(virtualNetworkSubnetId); + return this; + } + + /** + * Get the ignoreMissingVnetServiceEndpoint property: Create firewall rule before the virtual network has vnet + * service endpoint enabled. + * + * @return the ignoreMissingVnetServiceEndpoint value. + */ + public Boolean ignoreMissingVnetServiceEndpoint() { + return this.innerProperties() == null ? null : this.innerProperties().ignoreMissingVnetServiceEndpoint(); + } + + /** + * Set the ignoreMissingVnetServiceEndpoint property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualNetworkRuleProperties(); + } + this.innerProperties().withIgnoreMissingVnetServiceEndpoint(ignoreMissingVnetServiceEndpoint); + return this; + } + + /** + * Get the state property: Virtual Network Rule State. + * + * @return the state value. + */ + public VirtualNetworkRuleState state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/VirtualNetworkRuleProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/VirtualNetworkRuleProperties.java new file mode 100644 index 0000000000000..cdd7fb9ac2a00 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/VirtualNetworkRuleProperties.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.models.VirtualNetworkRuleState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a virtual network rule. */ +@Fluent +public final class VirtualNetworkRuleProperties { + /* + * The ARM resource id of the virtual network subnet. + */ + @JsonProperty(value = "virtualNetworkSubnetId", required = true) + private String virtualNetworkSubnetId; + + /* + * Create firewall rule before the virtual network has vnet service endpoint enabled. + */ + @JsonProperty(value = "ignoreMissingVnetServiceEndpoint") + private Boolean ignoreMissingVnetServiceEndpoint; + + /* + * Virtual Network Rule State + */ + @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) + private VirtualNetworkRuleState state; + + /** Creates an instance of VirtualNetworkRuleProperties class. */ + public VirtualNetworkRuleProperties() { + } + + /** + * Get the virtualNetworkSubnetId property: The ARM resource id of the virtual network subnet. + * + * @return the virtualNetworkSubnetId value. + */ + public String virtualNetworkSubnetId() { + return this.virtualNetworkSubnetId; + } + + /** + * Set the virtualNetworkSubnetId property: The ARM resource id of the virtual network subnet. + * + * @param virtualNetworkSubnetId the virtualNetworkSubnetId value to set. + * @return the VirtualNetworkRuleProperties object itself. + */ + public VirtualNetworkRuleProperties withVirtualNetworkSubnetId(String virtualNetworkSubnetId) { + this.virtualNetworkSubnetId = virtualNetworkSubnetId; + return this; + } + + /** + * Get the ignoreMissingVnetServiceEndpoint property: Create firewall rule before the virtual network has vnet + * service endpoint enabled. + * + * @return the ignoreMissingVnetServiceEndpoint value. + */ + public Boolean ignoreMissingVnetServiceEndpoint() { + return this.ignoreMissingVnetServiceEndpoint; + } + + /** + * Set the ignoreMissingVnetServiceEndpoint property: Create firewall rule before the virtual network has vnet + * service endpoint enabled. + * + * @param ignoreMissingVnetServiceEndpoint the ignoreMissingVnetServiceEndpoint value to set. + * @return the VirtualNetworkRuleProperties object itself. + */ + public VirtualNetworkRuleProperties withIgnoreMissingVnetServiceEndpoint(Boolean ignoreMissingVnetServiceEndpoint) { + this.ignoreMissingVnetServiceEndpoint = ignoreMissingVnetServiceEndpoint; + return this; + } + + /** + * Get the state property: Virtual Network Rule State. + * + * @return the state value. + */ + public VirtualNetworkRuleState state() { + return this.state; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (virtualNetworkSubnetId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property virtualNetworkSubnetId in model VirtualNetworkRuleProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(VirtualNetworkRuleProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/VulnerabilityAssessmentScanRecordInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/VulnerabilityAssessmentScanRecordInner.java new file mode 100644 index 0000000000000..7573b3ec1f538 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/VulnerabilityAssessmentScanRecordInner.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentScanError; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentScanState; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentScanTriggerType; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** A vulnerability assessment scan record. */ +@Immutable +public final class VulnerabilityAssessmentScanRecordInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private VulnerabilityAssessmentScanRecordProperties innerProperties; + + /** Creates an instance of VulnerabilityAssessmentScanRecordInner class. */ + public VulnerabilityAssessmentScanRecordInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private VulnerabilityAssessmentScanRecordProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the scanId property: The scan ID. + * + * @return the scanId value. + */ + public String scanId() { + return this.innerProperties() == null ? null : this.innerProperties().scanId(); + } + + /** + * Get the triggerType property: The scan trigger type. + * + * @return the triggerType value. + */ + public VulnerabilityAssessmentScanTriggerType triggerType() { + return this.innerProperties() == null ? null : this.innerProperties().triggerType(); + } + + /** + * Get the state property: The scan status. + * + * @return the state value. + */ + public VulnerabilityAssessmentScanState state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Get the startTime property: The scan start time (UTC). + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.innerProperties() == null ? null : this.innerProperties().startTime(); + } + + /** + * Get the endTime property: The scan end time (UTC). + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.innerProperties() == null ? null : this.innerProperties().endTime(); + } + + /** + * Get the errors property: The scan errors. + * + * @return the errors value. + */ + public List errors() { + return this.innerProperties() == null ? null : this.innerProperties().errors(); + } + + /** + * Get the storageContainerPath property: The scan results storage container path. + * + * @return the storageContainerPath value. + */ + public String storageContainerPath() { + return this.innerProperties() == null ? null : this.innerProperties().storageContainerPath(); + } + + /** + * Get the numberOfFailedSecurityChecks property: The number of failed security checks. + * + * @return the numberOfFailedSecurityChecks value. + */ + public Integer numberOfFailedSecurityChecks() { + return this.innerProperties() == null ? null : this.innerProperties().numberOfFailedSecurityChecks(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/VulnerabilityAssessmentScanRecordProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/VulnerabilityAssessmentScanRecordProperties.java new file mode 100644 index 0000000000000..4edaf945f77c3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/VulnerabilityAssessmentScanRecordProperties.java @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentScanError; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentScanState; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentScanTriggerType; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Properties of a vulnerability assessment scan record. */ +@Immutable +public final class VulnerabilityAssessmentScanRecordProperties { + /* + * The scan ID. + */ + @JsonProperty(value = "scanId", access = JsonProperty.Access.WRITE_ONLY) + private String scanId; + + /* + * The scan trigger type. + */ + @JsonProperty(value = "triggerType", access = JsonProperty.Access.WRITE_ONLY) + private VulnerabilityAssessmentScanTriggerType triggerType; + + /* + * The scan status. + */ + @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) + private VulnerabilityAssessmentScanState state; + + /* + * The scan start time (UTC). + */ + @JsonProperty(value = "startTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime startTime; + + /* + * The scan end time (UTC). + */ + @JsonProperty(value = "endTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime endTime; + + /* + * The scan errors. + */ + @JsonProperty(value = "errors", access = JsonProperty.Access.WRITE_ONLY) + private List errors; + + /* + * The scan results storage container path. + */ + @JsonProperty(value = "storageContainerPath", access = JsonProperty.Access.WRITE_ONLY) + private String storageContainerPath; + + /* + * The number of failed security checks. + */ + @JsonProperty(value = "numberOfFailedSecurityChecks", access = JsonProperty.Access.WRITE_ONLY) + private Integer numberOfFailedSecurityChecks; + + /** Creates an instance of VulnerabilityAssessmentScanRecordProperties class. */ + public VulnerabilityAssessmentScanRecordProperties() { + } + + /** + * Get the scanId property: The scan ID. + * + * @return the scanId value. + */ + public String scanId() { + return this.scanId; + } + + /** + * Get the triggerType property: The scan trigger type. + * + * @return the triggerType value. + */ + public VulnerabilityAssessmentScanTriggerType triggerType() { + return this.triggerType; + } + + /** + * Get the state property: The scan status. + * + * @return the state value. + */ + public VulnerabilityAssessmentScanState state() { + return this.state; + } + + /** + * Get the startTime property: The scan start time (UTC). + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Get the endTime property: The scan end time (UTC). + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Get the errors property: The scan errors. + * + * @return the errors value. + */ + public List errors() { + return this.errors; + } + + /** + * Get the storageContainerPath property: The scan results storage container path. + * + * @return the storageContainerPath value. + */ + public String storageContainerPath() { + return this.storageContainerPath; + } + + /** + * Get the numberOfFailedSecurityChecks property: The number of failed security checks. + * + * @return the numberOfFailedSecurityChecks value. + */ + public Integer numberOfFailedSecurityChecks() { + return this.numberOfFailedSecurityChecks; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (errors() != null) { + errors().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/WorkloadClassifierInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/WorkloadClassifierInner.java new file mode 100644 index 0000000000000..ad4b4a2d2a473 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/WorkloadClassifierInner.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Workload classifier operations for a data warehouse. */ +@Fluent +public final class WorkloadClassifierInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private WorkloadClassifierProperties innerProperties; + + /** Creates an instance of WorkloadClassifierInner class. */ + public WorkloadClassifierInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private WorkloadClassifierProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the memberName property: The workload classifier member name. + * + * @return the memberName value. + */ + public String memberName() { + return this.innerProperties() == null ? null : this.innerProperties().memberName(); + } + + /** + * Set the memberName property: The workload classifier member name. + * + * @param memberName the memberName value to set. + * @return the WorkloadClassifierInner object itself. + */ + public WorkloadClassifierInner withMemberName(String memberName) { + if (this.innerProperties() == null) { + this.innerProperties = new WorkloadClassifierProperties(); + } + this.innerProperties().withMemberName(memberName); + return this; + } + + /** + * Get the label property: The workload classifier label. + * + * @return the label value. + */ + public String label() { + return this.innerProperties() == null ? null : this.innerProperties().label(); + } + + /** + * Set the label property: The workload classifier label. + * + * @param label the label value to set. + * @return the WorkloadClassifierInner object itself. + */ + public WorkloadClassifierInner withLabel(String label) { + if (this.innerProperties() == null) { + this.innerProperties = new WorkloadClassifierProperties(); + } + this.innerProperties().withLabel(label); + return this; + } + + /** + * Get the context property: The workload classifier context. + * + * @return the context value. + */ + public String context() { + return this.innerProperties() == null ? null : this.innerProperties().context(); + } + + /** + * Set the context property: The workload classifier context. + * + * @param context the context value to set. + * @return the WorkloadClassifierInner object itself. + */ + public WorkloadClassifierInner withContext(String context) { + if (this.innerProperties() == null) { + this.innerProperties = new WorkloadClassifierProperties(); + } + this.innerProperties().withContext(context); + return this; + } + + /** + * Get the startTime property: The workload classifier start time for classification. + * + * @return the startTime value. + */ + public String startTime() { + return this.innerProperties() == null ? null : this.innerProperties().startTime(); + } + + /** + * Set the startTime property: The workload classifier start time for classification. + * + * @param startTime the startTime value to set. + * @return the WorkloadClassifierInner object itself. + */ + public WorkloadClassifierInner withStartTime(String startTime) { + if (this.innerProperties() == null) { + this.innerProperties = new WorkloadClassifierProperties(); + } + this.innerProperties().withStartTime(startTime); + return this; + } + + /** + * Get the endTime property: The workload classifier end time for classification. + * + * @return the endTime value. + */ + public String endTime() { + return this.innerProperties() == null ? null : this.innerProperties().endTime(); + } + + /** + * Set the endTime property: The workload classifier end time for classification. + * + * @param endTime the endTime value to set. + * @return the WorkloadClassifierInner object itself. + */ + public WorkloadClassifierInner withEndTime(String endTime) { + if (this.innerProperties() == null) { + this.innerProperties = new WorkloadClassifierProperties(); + } + this.innerProperties().withEndTime(endTime); + return this; + } + + /** + * Get the importance property: The workload classifier importance. + * + * @return the importance value. + */ + public String importance() { + return this.innerProperties() == null ? null : this.innerProperties().importance(); + } + + /** + * Set the importance property: The workload classifier importance. + * + * @param importance the importance value to set. + * @return the WorkloadClassifierInner object itself. + */ + public WorkloadClassifierInner withImportance(String importance) { + if (this.innerProperties() == null) { + this.innerProperties = new WorkloadClassifierProperties(); + } + this.innerProperties().withImportance(importance); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/WorkloadClassifierProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/WorkloadClassifierProperties.java new file mode 100644 index 0000000000000..2fba009e8310f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/WorkloadClassifierProperties.java @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Workload classifier definition. For more information look at sys.workload_management_workload_classifiers (DMV). */ +@Fluent +public final class WorkloadClassifierProperties { + /* + * The workload classifier member name. + */ + @JsonProperty(value = "memberName", required = true) + private String memberName; + + /* + * The workload classifier label. + */ + @JsonProperty(value = "label") + private String label; + + /* + * The workload classifier context. + */ + @JsonProperty(value = "context") + private String context; + + /* + * The workload classifier start time for classification. + */ + @JsonProperty(value = "startTime") + private String startTime; + + /* + * The workload classifier end time for classification. + */ + @JsonProperty(value = "endTime") + private String endTime; + + /* + * The workload classifier importance. + */ + @JsonProperty(value = "importance") + private String importance; + + /** Creates an instance of WorkloadClassifierProperties class. */ + public WorkloadClassifierProperties() { + } + + /** + * Get the memberName property: The workload classifier member name. + * + * @return the memberName value. + */ + public String memberName() { + return this.memberName; + } + + /** + * Set the memberName property: The workload classifier member name. + * + * @param memberName the memberName value to set. + * @return the WorkloadClassifierProperties object itself. + */ + public WorkloadClassifierProperties withMemberName(String memberName) { + this.memberName = memberName; + return this; + } + + /** + * Get the label property: The workload classifier label. + * + * @return the label value. + */ + public String label() { + return this.label; + } + + /** + * Set the label property: The workload classifier label. + * + * @param label the label value to set. + * @return the WorkloadClassifierProperties object itself. + */ + public WorkloadClassifierProperties withLabel(String label) { + this.label = label; + return this; + } + + /** + * Get the context property: The workload classifier context. + * + * @return the context value. + */ + public String context() { + return this.context; + } + + /** + * Set the context property: The workload classifier context. + * + * @param context the context value to set. + * @return the WorkloadClassifierProperties object itself. + */ + public WorkloadClassifierProperties withContext(String context) { + this.context = context; + return this; + } + + /** + * Get the startTime property: The workload classifier start time for classification. + * + * @return the startTime value. + */ + public String startTime() { + return this.startTime; + } + + /** + * Set the startTime property: The workload classifier start time for classification. + * + * @param startTime the startTime value to set. + * @return the WorkloadClassifierProperties object itself. + */ + public WorkloadClassifierProperties withStartTime(String startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the endTime property: The workload classifier end time for classification. + * + * @return the endTime value. + */ + public String endTime() { + return this.endTime; + } + + /** + * Set the endTime property: The workload classifier end time for classification. + * + * @param endTime the endTime value to set. + * @return the WorkloadClassifierProperties object itself. + */ + public WorkloadClassifierProperties withEndTime(String endTime) { + this.endTime = endTime; + return this; + } + + /** + * Get the importance property: The workload classifier importance. + * + * @return the importance value. + */ + public String importance() { + return this.importance; + } + + /** + * Set the importance property: The workload classifier importance. + * + * @param importance the importance value to set. + * @return the WorkloadClassifierProperties object itself. + */ + public WorkloadClassifierProperties withImportance(String importance) { + this.importance = importance; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (memberName() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property memberName in model WorkloadClassifierProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(WorkloadClassifierProperties.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/WorkloadGroupInner.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/WorkloadGroupInner.java new file mode 100644 index 0000000000000..7181281bde082 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/WorkloadGroupInner.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Workload group operations for a data warehouse. */ +@Fluent +public final class WorkloadGroupInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private WorkloadGroupProperties innerProperties; + + /** Creates an instance of WorkloadGroupInner class. */ + public WorkloadGroupInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private WorkloadGroupProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the minResourcePercent property: The workload group minimum percentage resource. + * + * @return the minResourcePercent value. + */ + public Integer minResourcePercent() { + return this.innerProperties() == null ? null : this.innerProperties().minResourcePercent(); + } + + /** + * Set the minResourcePercent property: The workload group minimum percentage resource. + * + * @param minResourcePercent the minResourcePercent value to set. + * @return the WorkloadGroupInner object itself. + */ + public WorkloadGroupInner withMinResourcePercent(Integer minResourcePercent) { + if (this.innerProperties() == null) { + this.innerProperties = new WorkloadGroupProperties(); + } + this.innerProperties().withMinResourcePercent(minResourcePercent); + return this; + } + + /** + * Get the maxResourcePercent property: The workload group cap percentage resource. + * + * @return the maxResourcePercent value. + */ + public Integer maxResourcePercent() { + return this.innerProperties() == null ? null : this.innerProperties().maxResourcePercent(); + } + + /** + * Set the maxResourcePercent property: The workload group cap percentage resource. + * + * @param maxResourcePercent the maxResourcePercent value to set. + * @return the WorkloadGroupInner object itself. + */ + public WorkloadGroupInner withMaxResourcePercent(Integer maxResourcePercent) { + if (this.innerProperties() == null) { + this.innerProperties = new WorkloadGroupProperties(); + } + this.innerProperties().withMaxResourcePercent(maxResourcePercent); + return this; + } + + /** + * Get the minResourcePercentPerRequest property: The workload group request minimum grant percentage. + * + * @return the minResourcePercentPerRequest value. + */ + public Double minResourcePercentPerRequest() { + return this.innerProperties() == null ? null : this.innerProperties().minResourcePercentPerRequest(); + } + + /** + * Set the minResourcePercentPerRequest property: The workload group request minimum grant percentage. + * + * @param minResourcePercentPerRequest the minResourcePercentPerRequest value to set. + * @return the WorkloadGroupInner object itself. + */ + public WorkloadGroupInner withMinResourcePercentPerRequest(Double minResourcePercentPerRequest) { + if (this.innerProperties() == null) { + this.innerProperties = new WorkloadGroupProperties(); + } + this.innerProperties().withMinResourcePercentPerRequest(minResourcePercentPerRequest); + return this; + } + + /** + * Get the maxResourcePercentPerRequest property: The workload group request maximum grant percentage. + * + * @return the maxResourcePercentPerRequest value. + */ + public Double maxResourcePercentPerRequest() { + return this.innerProperties() == null ? null : this.innerProperties().maxResourcePercentPerRequest(); + } + + /** + * Set the maxResourcePercentPerRequest property: The workload group request maximum grant percentage. + * + * @param maxResourcePercentPerRequest the maxResourcePercentPerRequest value to set. + * @return the WorkloadGroupInner object itself. + */ + public WorkloadGroupInner withMaxResourcePercentPerRequest(Double maxResourcePercentPerRequest) { + if (this.innerProperties() == null) { + this.innerProperties = new WorkloadGroupProperties(); + } + this.innerProperties().withMaxResourcePercentPerRequest(maxResourcePercentPerRequest); + return this; + } + + /** + * Get the importance property: The workload group importance level. + * + * @return the importance value. + */ + public String importance() { + return this.innerProperties() == null ? null : this.innerProperties().importance(); + } + + /** + * Set the importance property: The workload group importance level. + * + * @param importance the importance value to set. + * @return the WorkloadGroupInner object itself. + */ + public WorkloadGroupInner withImportance(String importance) { + if (this.innerProperties() == null) { + this.innerProperties = new WorkloadGroupProperties(); + } + this.innerProperties().withImportance(importance); + return this; + } + + /** + * Get the queryExecutionTimeout property: The workload group query execution timeout. + * + * @return the queryExecutionTimeout value. + */ + public Integer queryExecutionTimeout() { + return this.innerProperties() == null ? null : this.innerProperties().queryExecutionTimeout(); + } + + /** + * Set the queryExecutionTimeout property: The workload group query execution timeout. + * + * @param queryExecutionTimeout the queryExecutionTimeout value to set. + * @return the WorkloadGroupInner object itself. + */ + public WorkloadGroupInner withQueryExecutionTimeout(Integer queryExecutionTimeout) { + if (this.innerProperties() == null) { + this.innerProperties = new WorkloadGroupProperties(); + } + this.innerProperties().withQueryExecutionTimeout(queryExecutionTimeout); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/WorkloadGroupProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/WorkloadGroupProperties.java new file mode 100644 index 0000000000000..ea3556536a657 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/WorkloadGroupProperties.java @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Workload group definition. For more information look at sys.workload_management_workload_groups (DMV). */ +@Fluent +public final class WorkloadGroupProperties { + /* + * The workload group minimum percentage resource. + */ + @JsonProperty(value = "minResourcePercent", required = true) + private int minResourcePercent; + + /* + * The workload group cap percentage resource. + */ + @JsonProperty(value = "maxResourcePercent", required = true) + private int maxResourcePercent; + + /* + * The workload group request minimum grant percentage. + */ + @JsonProperty(value = "minResourcePercentPerRequest", required = true) + private double minResourcePercentPerRequest; + + /* + * The workload group request maximum grant percentage. + */ + @JsonProperty(value = "maxResourcePercentPerRequest") + private Double maxResourcePercentPerRequest; + + /* + * The workload group importance level. + */ + @JsonProperty(value = "importance") + private String importance; + + /* + * The workload group query execution timeout. + */ + @JsonProperty(value = "queryExecutionTimeout") + private Integer queryExecutionTimeout; + + /** Creates an instance of WorkloadGroupProperties class. */ + public WorkloadGroupProperties() { + } + + /** + * Get the minResourcePercent property: The workload group minimum percentage resource. + * + * @return the minResourcePercent value. + */ + public int minResourcePercent() { + return this.minResourcePercent; + } + + /** + * Set the minResourcePercent property: The workload group minimum percentage resource. + * + * @param minResourcePercent the minResourcePercent value to set. + * @return the WorkloadGroupProperties object itself. + */ + public WorkloadGroupProperties withMinResourcePercent(int minResourcePercent) { + this.minResourcePercent = minResourcePercent; + return this; + } + + /** + * Get the maxResourcePercent property: The workload group cap percentage resource. + * + * @return the maxResourcePercent value. + */ + public int maxResourcePercent() { + return this.maxResourcePercent; + } + + /** + * Set the maxResourcePercent property: The workload group cap percentage resource. + * + * @param maxResourcePercent the maxResourcePercent value to set. + * @return the WorkloadGroupProperties object itself. + */ + public WorkloadGroupProperties withMaxResourcePercent(int maxResourcePercent) { + this.maxResourcePercent = maxResourcePercent; + return this; + } + + /** + * Get the minResourcePercentPerRequest property: The workload group request minimum grant percentage. + * + * @return the minResourcePercentPerRequest value. + */ + public double minResourcePercentPerRequest() { + return this.minResourcePercentPerRequest; + } + + /** + * Set the minResourcePercentPerRequest property: The workload group request minimum grant percentage. + * + * @param minResourcePercentPerRequest the minResourcePercentPerRequest value to set. + * @return the WorkloadGroupProperties object itself. + */ + public WorkloadGroupProperties withMinResourcePercentPerRequest(double minResourcePercentPerRequest) { + this.minResourcePercentPerRequest = minResourcePercentPerRequest; + return this; + } + + /** + * Get the maxResourcePercentPerRequest property: The workload group request maximum grant percentage. + * + * @return the maxResourcePercentPerRequest value. + */ + public Double maxResourcePercentPerRequest() { + return this.maxResourcePercentPerRequest; + } + + /** + * Set the maxResourcePercentPerRequest property: The workload group request maximum grant percentage. + * + * @param maxResourcePercentPerRequest the maxResourcePercentPerRequest value to set. + * @return the WorkloadGroupProperties object itself. + */ + public WorkloadGroupProperties withMaxResourcePercentPerRequest(Double maxResourcePercentPerRequest) { + this.maxResourcePercentPerRequest = maxResourcePercentPerRequest; + return this; + } + + /** + * Get the importance property: The workload group importance level. + * + * @return the importance value. + */ + public String importance() { + return this.importance; + } + + /** + * Set the importance property: The workload group importance level. + * + * @param importance the importance value to set. + * @return the WorkloadGroupProperties object itself. + */ + public WorkloadGroupProperties withImportance(String importance) { + this.importance = importance; + return this; + } + + /** + * Get the queryExecutionTimeout property: The workload group query execution timeout. + * + * @return the queryExecutionTimeout value. + */ + public Integer queryExecutionTimeout() { + return this.queryExecutionTimeout; + } + + /** + * Set the queryExecutionTimeout property: The workload group query execution timeout. + * + * @param queryExecutionTimeout the queryExecutionTimeout value to set. + * @return the WorkloadGroupProperties object itself. + */ + public WorkloadGroupProperties withQueryExecutionTimeout(Integer queryExecutionTimeout) { + this.queryExecutionTimeout = queryExecutionTimeout; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/package-info.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/package-info.java new file mode 100644 index 0000000000000..ebc86f768cad9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/models/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the inner data models 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.azure.resourcemanager.sql.generated.fluent.models; diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/package-info.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/package-info.java new file mode 100644 index 0000000000000..bbe2809928add --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/fluent/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the service clients 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.azure.resourcemanager.sql.generated.fluent; diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/AdvisorImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/AdvisorImpl.java new file mode 100644 index 0000000000000..a24ba78f2aefe --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/AdvisorImpl.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.AdvisorInner; +import com.azure.resourcemanager.sql.generated.fluent.models.RecommendedActionInner; +import com.azure.resourcemanager.sql.generated.models.Advisor; +import com.azure.resourcemanager.sql.generated.models.AdvisorStatus; +import com.azure.resourcemanager.sql.generated.models.AutoExecuteStatus; +import com.azure.resourcemanager.sql.generated.models.AutoExecuteStatusInheritedFrom; +import com.azure.resourcemanager.sql.generated.models.RecommendedAction; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class AdvisorImpl implements Advisor { + private AdvisorInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + AdvisorImpl(AdvisorInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String kind() { + return this.innerModel().kind(); + } + + public String location() { + return this.innerModel().location(); + } + + public AdvisorStatus advisorStatus() { + return this.innerModel().advisorStatus(); + } + + public AutoExecuteStatus autoExecuteStatus() { + return this.innerModel().autoExecuteStatus(); + } + + public AutoExecuteStatusInheritedFrom autoExecuteStatusInheritedFrom() { + return this.innerModel().autoExecuteStatusInheritedFrom(); + } + + public String recommendationsStatus() { + return this.innerModel().recommendationsStatus(); + } + + public OffsetDateTime lastChecked() { + return this.innerModel().lastChecked(); + } + + public List recommendedActions() { + List inner = this.innerModel().recommendedActions(); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new RecommendedActionImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public AdvisorInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/BackupShortTermRetentionPoliciesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/BackupShortTermRetentionPoliciesClientImpl.java new file mode 100644 index 0000000000000..0a0cd7fe968c4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/BackupShortTermRetentionPoliciesClientImpl.java @@ -0,0 +1,1362 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.BackupShortTermRetentionPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.BackupShortTermRetentionPolicyInner; +import com.azure.resourcemanager.sql.generated.models.BackupShortTermRetentionPolicyListResult; +import com.azure.resourcemanager.sql.generated.models.ShortTermRetentionPolicyName; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in BackupShortTermRetentionPoliciesClient. + */ +public final class BackupShortTermRetentionPoliciesClientImpl implements BackupShortTermRetentionPoliciesClient { + /** The proxy service used to perform REST calls. */ + private final BackupShortTermRetentionPoliciesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of BackupShortTermRetentionPoliciesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + BackupShortTermRetentionPoliciesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + BackupShortTermRetentionPoliciesService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientBackupShortTermRetentionPolicies to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientB") + public interface BackupShortTermRetentionPoliciesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/backupShortTermRetentionPolicies/{policyName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("policyName") ShortTermRetentionPolicyName policyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/backupShortTermRetentionPolicies/{policyName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("policyName") ShortTermRetentionPolicyName policyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") BackupShortTermRetentionPolicyInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/backupShortTermRetentionPolicies/{policyName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("policyName") ShortTermRetentionPolicyName policyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") BackupShortTermRetentionPolicyInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/backupShortTermRetentionPolicies") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabaseNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 policyName The policy name. Should always be "default". + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's short term retention policy along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, ShortTermRetentionPolicyName policyName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + policyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 policyName The policy name. Should always be "default". + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's short term retention policy along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + policyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 policyName The policy name. Should always be "default". + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's short term retention policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String databaseName, ShortTermRetentionPolicyName policyName) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, policyName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 policyName The policy name. Should always be "default". + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's short term retention policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + Context context) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, policyName, context).block(); + } + + /** + * 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 policyName The policy name. Should always be "default". + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BackupShortTermRetentionPolicyInner get( + String resourceGroupName, String serverName, String databaseName, ShortTermRetentionPolicyName policyName) { + return getWithResponse(resourceGroupName, serverName, databaseName, policyName, Context.NONE).getValue(); + } + + /** + * 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 policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a short term retention policy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + BackupShortTermRetentionPolicyInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + policyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a short term retention policy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + BackupShortTermRetentionPolicyInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + policyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, BackupShortTermRetentionPolicyInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + BackupShortTermRetentionPolicyInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, databaseName, policyName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + BackupShortTermRetentionPolicyInner.class, + BackupShortTermRetentionPolicyInner.class, + this.client.getContext()); + } + + /** + * 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 policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, BackupShortTermRetentionPolicyInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + BackupShortTermRetentionPolicyInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, serverName, databaseName, policyName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + BackupShortTermRetentionPolicyInner.class, + BackupShortTermRetentionPolicyInner.class, + context); + } + + /** + * 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 policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, BackupShortTermRetentionPolicyInner> + beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + BackupShortTermRetentionPolicyInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, policyName, parameters) + .getSyncPoller(); + } + + /** + * 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 policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, BackupShortTermRetentionPolicyInner> + beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + BackupShortTermRetentionPolicyInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, policyName, parameters, context) + .getSyncPoller(); + } + + /** + * 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 policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a short term retention policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + BackupShortTermRetentionPolicyInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, policyName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a short term retention policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + BackupShortTermRetentionPolicyInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, policyName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BackupShortTermRetentionPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + BackupShortTermRetentionPolicyInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, databaseName, policyName, parameters).block(); + } + + /** + * 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 policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BackupShortTermRetentionPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + BackupShortTermRetentionPolicyInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, databaseName, policyName, parameters, context) + .block(); + } + + /** + * 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 policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a short term retention policy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + BackupShortTermRetentionPolicyInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + policyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a short term retention policy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + BackupShortTermRetentionPolicyInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + policyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, BackupShortTermRetentionPolicyInner> + beginUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + BackupShortTermRetentionPolicyInner parameters) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, serverName, databaseName, policyName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + BackupShortTermRetentionPolicyInner.class, + BackupShortTermRetentionPolicyInner.class, + this.client.getContext()); + } + + /** + * 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 policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, BackupShortTermRetentionPolicyInner> + beginUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + BackupShortTermRetentionPolicyInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, serverName, databaseName, policyName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + BackupShortTermRetentionPolicyInner.class, + BackupShortTermRetentionPolicyInner.class, + context); + } + + /** + * 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 policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, BackupShortTermRetentionPolicyInner> beginUpdate( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + BackupShortTermRetentionPolicyInner parameters) { + return beginUpdateAsync(resourceGroupName, serverName, databaseName, policyName, parameters).getSyncPoller(); + } + + /** + * 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 policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, BackupShortTermRetentionPolicyInner> beginUpdate( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + BackupShortTermRetentionPolicyInner parameters, + Context context) { + return beginUpdateAsync(resourceGroupName, serverName, databaseName, policyName, parameters, context) + .getSyncPoller(); + } + + /** + * 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 policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a short term retention policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + BackupShortTermRetentionPolicyInner parameters) { + return beginUpdateAsync(resourceGroupName, serverName, databaseName, policyName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a short term retention policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + BackupShortTermRetentionPolicyInner parameters, + Context context) { + return beginUpdateAsync(resourceGroupName, serverName, databaseName, policyName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BackupShortTermRetentionPolicyInner update( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + BackupShortTermRetentionPolicyInner parameters) { + return updateAsync(resourceGroupName, serverName, databaseName, policyName, parameters).block(); + } + + /** + * 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 policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BackupShortTermRetentionPolicyInner update( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + BackupShortTermRetentionPolicyInner parameters, + Context context) { + return updateAsync(resourceGroupName, serverName, databaseName, policyName, parameters, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's short term retention policy along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's short term retention policy along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's short term retention policy as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's short term retention policy as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, context), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's short term retention policy as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's short term retention policy as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of short term retention policies along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of short term retention policies along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/BackupShortTermRetentionPoliciesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/BackupShortTermRetentionPoliciesImpl.java new file mode 100644 index 0000000000000..32914c9ed5630 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/BackupShortTermRetentionPoliciesImpl.java @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.BackupShortTermRetentionPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.BackupShortTermRetentionPolicyInner; +import com.azure.resourcemanager.sql.generated.models.BackupShortTermRetentionPolicies; +import com.azure.resourcemanager.sql.generated.models.BackupShortTermRetentionPolicy; +import com.azure.resourcemanager.sql.generated.models.ShortTermRetentionPolicyName; + +public final class BackupShortTermRetentionPoliciesImpl implements BackupShortTermRetentionPolicies { + private static final ClientLogger LOGGER = new ClientLogger(BackupShortTermRetentionPoliciesImpl.class); + + private final BackupShortTermRetentionPoliciesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public BackupShortTermRetentionPoliciesImpl( + BackupShortTermRetentionPoliciesClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, databaseName, policyName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new BackupShortTermRetentionPolicyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public BackupShortTermRetentionPolicy get( + String resourceGroupName, String serverName, String databaseName, ShortTermRetentionPolicyName policyName) { + BackupShortTermRetentionPolicyInner inner = + this.serviceClient().get(resourceGroupName, serverName, databaseName, policyName); + if (inner != null) { + return new BackupShortTermRetentionPolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName); + return Utils.mapPage(inner, inner1 -> new BackupShortTermRetentionPolicyImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName, context); + return Utils.mapPage(inner, inner1 -> new BackupShortTermRetentionPolicyImpl(inner1, this.manager())); + } + + public BackupShortTermRetentionPolicy getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String policyNameLocal = Utils.getValueFromIdByName(id, "backupShortTermRetentionPolicies"); + if (policyNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment" + + " 'backupShortTermRetentionPolicies'.", + id))); + } + ShortTermRetentionPolicyName policyName = ShortTermRetentionPolicyName.fromString(policyNameLocal); + return this.getWithResponse(resourceGroupName, serverName, databaseName, policyName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String policyNameLocal = Utils.getValueFromIdByName(id, "backupShortTermRetentionPolicies"); + if (policyNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment" + + " 'backupShortTermRetentionPolicies'.", + id))); + } + ShortTermRetentionPolicyName policyName = ShortTermRetentionPolicyName.fromString(policyNameLocal); + return this.getWithResponse(resourceGroupName, serverName, databaseName, policyName, context); + } + + private BackupShortTermRetentionPoliciesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public BackupShortTermRetentionPolicyImpl define(ShortTermRetentionPolicyName name) { + return new BackupShortTermRetentionPolicyImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/BackupShortTermRetentionPolicyImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/BackupShortTermRetentionPolicyImpl.java new file mode 100644 index 0000000000000..0328d0bddb598 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/BackupShortTermRetentionPolicyImpl.java @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.BackupShortTermRetentionPolicyInner; +import com.azure.resourcemanager.sql.generated.models.BackupShortTermRetentionPolicy; +import com.azure.resourcemanager.sql.generated.models.DiffBackupIntervalInHours; +import com.azure.resourcemanager.sql.generated.models.ShortTermRetentionPolicyName; + +public final class BackupShortTermRetentionPolicyImpl + implements BackupShortTermRetentionPolicy, + BackupShortTermRetentionPolicy.Definition, + BackupShortTermRetentionPolicy.Update { + private BackupShortTermRetentionPolicyInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public Integer retentionDays() { + return this.innerModel().retentionDays(); + } + + public DiffBackupIntervalInHours diffBackupIntervalInHours() { + return this.innerModel().diffBackupIntervalInHours(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public BackupShortTermRetentionPolicyInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String databaseName; + + private ShortTermRetentionPolicyName policyName; + + public BackupShortTermRetentionPolicyImpl withExistingDatabase( + String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + + public BackupShortTermRetentionPolicy create() { + this.innerObject = + serviceManager + .serviceClient() + .getBackupShortTermRetentionPolicies() + .createOrUpdate( + resourceGroupName, serverName, databaseName, policyName, this.innerModel(), Context.NONE); + return this; + } + + public BackupShortTermRetentionPolicy create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getBackupShortTermRetentionPolicies() + .createOrUpdate(resourceGroupName, serverName, databaseName, policyName, this.innerModel(), context); + return this; + } + + BackupShortTermRetentionPolicyImpl( + ShortTermRetentionPolicyName name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new BackupShortTermRetentionPolicyInner(); + this.serviceManager = serviceManager; + this.policyName = name; + } + + public BackupShortTermRetentionPolicyImpl update() { + return this; + } + + public BackupShortTermRetentionPolicy apply() { + this.innerObject = + serviceManager + .serviceClient() + .getBackupShortTermRetentionPolicies() + .update(resourceGroupName, serverName, databaseName, policyName, this.innerModel(), Context.NONE); + return this; + } + + public BackupShortTermRetentionPolicy apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getBackupShortTermRetentionPolicies() + .update(resourceGroupName, serverName, databaseName, policyName, this.innerModel(), context); + return this; + } + + BackupShortTermRetentionPolicyImpl( + BackupShortTermRetentionPolicyInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "databases"); + this.policyName = + ShortTermRetentionPolicyName + .fromString(Utils.getValueFromIdByName(innerObject.id(), "backupShortTermRetentionPolicies")); + } + + public BackupShortTermRetentionPolicy refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getBackupShortTermRetentionPolicies() + .getWithResponse(resourceGroupName, serverName, databaseName, policyName, Context.NONE) + .getValue(); + return this; + } + + public BackupShortTermRetentionPolicy refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getBackupShortTermRetentionPolicies() + .getWithResponse(resourceGroupName, serverName, databaseName, policyName, context) + .getValue(); + return this; + } + + public BackupShortTermRetentionPolicyImpl withRetentionDays(Integer retentionDays) { + this.innerModel().withRetentionDays(retentionDays); + return this; + } + + public BackupShortTermRetentionPolicyImpl withDiffBackupIntervalInHours( + DiffBackupIntervalInHours diffBackupIntervalInHours) { + this.innerModel().withDiffBackupIntervalInHours(diffBackupIntervalInHours); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/CapabilitiesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/CapabilitiesClientImpl.java new file mode 100644 index 0000000000000..bf6440dafe303 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/CapabilitiesClientImpl.java @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.CapabilitiesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.LocationCapabilitiesInner; +import com.azure.resourcemanager.sql.generated.models.CapabilityGroup; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in CapabilitiesClient. */ +public final class CapabilitiesClientImpl implements CapabilitiesClient { + /** The proxy service used to perform REST calls. */ + private final CapabilitiesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of CapabilitiesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CapabilitiesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(CapabilitiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientCapabilities to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientC") + public interface CapabilitiesService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/capabilities") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByLocation( + @HostParam("$host") String endpoint, + @PathParam("locationName") String locationName, + @QueryParam("include") CapabilityGroup include, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the subscription capabilities available for the specified location along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationWithResponseAsync( + String locationName, CapabilityGroup include) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByLocation( + this.client.getEndpoint(), + locationName, + include, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the subscription capabilities available for the specified location along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationWithResponseAsync( + String locationName, CapabilityGroup include, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByLocation( + this.client.getEndpoint(), + locationName, + include, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the subscription capabilities available for the specified location on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listByLocationAsync(String locationName) { + final CapabilityGroup include = null; + return listByLocationWithResponseAsync(locationName, include).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the subscription capabilities available for the specified location along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listByLocationWithResponse( + String locationName, CapabilityGroup include, Context context) { + return listByLocationWithResponseAsync(locationName, include, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the subscription capabilities available for the specified location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LocationCapabilitiesInner listByLocation(String locationName) { + final CapabilityGroup include = null; + return listByLocationWithResponse(locationName, include, Context.NONE).getValue(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/CapabilitiesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/CapabilitiesImpl.java new file mode 100644 index 0000000000000..01766434c20e1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/CapabilitiesImpl.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.CapabilitiesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.LocationCapabilitiesInner; +import com.azure.resourcemanager.sql.generated.models.Capabilities; +import com.azure.resourcemanager.sql.generated.models.CapabilityGroup; +import com.azure.resourcemanager.sql.generated.models.LocationCapabilities; + +public final class CapabilitiesImpl implements Capabilities { + private static final ClientLogger LOGGER = new ClientLogger(CapabilitiesImpl.class); + + private final CapabilitiesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public CapabilitiesImpl( + CapabilitiesClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response listByLocationWithResponse( + String locationName, CapabilityGroup include, Context context) { + Response inner = + this.serviceClient().listByLocationWithResponse(locationName, include, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new LocationCapabilitiesImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public LocationCapabilities listByLocation(String locationName) { + LocationCapabilitiesInner inner = this.serviceClient().listByLocation(locationName); + if (inner != null) { + return new LocationCapabilitiesImpl(inner, this.manager()); + } else { + return null; + } + } + + private CapabilitiesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/CheckNameAvailabilityResponseImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/CheckNameAvailabilityResponseImpl.java new file mode 100644 index 0000000000000..7cf6c13597372 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/CheckNameAvailabilityResponseImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.CheckNameAvailabilityResponseInner; +import com.azure.resourcemanager.sql.generated.models.CheckNameAvailabilityReason; +import com.azure.resourcemanager.sql.generated.models.CheckNameAvailabilityResponse; + +public final class CheckNameAvailabilityResponseImpl implements CheckNameAvailabilityResponse { + private CheckNameAvailabilityResponseInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + CheckNameAvailabilityResponseImpl( + CheckNameAvailabilityResponseInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public Boolean available() { + return this.innerModel().available(); + } + + public CheckNameAvailabilityReason reason() { + return this.innerModel().reason(); + } + + public String message() { + return this.innerModel().message(); + } + + public CheckNameAvailabilityResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataMaskingPoliciesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataMaskingPoliciesClientImpl.java new file mode 100644 index 0000000000000..dcf10efc6fddd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataMaskingPoliciesClientImpl.java @@ -0,0 +1,454 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.DataMaskingPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DataMaskingPolicyInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DataMaskingPoliciesClient. */ +public final class DataMaskingPoliciesClientImpl implements DataMaskingPoliciesClient { + /** The proxy service used to perform REST calls. */ + private final DataMaskingPoliciesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of DataMaskingPoliciesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DataMaskingPoliciesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(DataMaskingPoliciesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientDataMaskingPolicies to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientD") + public interface DataMaskingPoliciesService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("dataMaskingPolicyName") String dataMaskingPolicyName, + @BodyParam("application/json") DataMaskingPolicyInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("dataMaskingPolicyName") String dataMaskingPolicyName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a database data masking policy along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, DataMaskingPolicyInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2014-04-01"; + final String dataMaskingPolicyName = "Default"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + dataMaskingPolicyName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a database data masking policy along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + DataMaskingPolicyInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2014-04-01"; + final String dataMaskingPolicyName = "Default"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + dataMaskingPolicyName, + parameters, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a database data masking policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serverName, String databaseName, DataMaskingPolicyInner parameters) { + return createOrUpdateWithResponseAsync(resourceGroupName, serverName, databaseName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a database data masking policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + DataMaskingPolicyInner parameters, + Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, serverName, databaseName, parameters, context) + .block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a database data masking policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DataMaskingPolicyInner createOrUpdate( + String resourceGroupName, String serverName, String databaseName, DataMaskingPolicyInner parameters) { + return createOrUpdateWithResponse(resourceGroupName, serverName, databaseName, parameters, Context.NONE) + .getValue(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database data masking policy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String dataMaskingPolicyName = "Default"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + dataMaskingPolicyName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database data masking policy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String dataMaskingPolicyName = "Default"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + dataMaskingPolicyName, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database data masking policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serverName, String databaseName) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database data masking policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database data masking policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DataMaskingPolicyInner get(String resourceGroupName, String serverName, String databaseName) { + return getWithResponse(resourceGroupName, serverName, databaseName, Context.NONE).getValue(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataMaskingPoliciesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataMaskingPoliciesImpl.java new file mode 100644 index 0000000000000..32d95a0e82b4d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataMaskingPoliciesImpl.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.DataMaskingPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DataMaskingPolicyInner; +import com.azure.resourcemanager.sql.generated.models.DataMaskingPolicies; +import com.azure.resourcemanager.sql.generated.models.DataMaskingPolicy; + +public final class DataMaskingPoliciesImpl implements DataMaskingPolicies { + private static final ClientLogger LOGGER = new ClientLogger(DataMaskingPoliciesImpl.class); + + private final DataMaskingPoliciesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public DataMaskingPoliciesImpl( + DataMaskingPoliciesClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, databaseName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DataMaskingPolicyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DataMaskingPolicy get(String resourceGroupName, String serverName, String databaseName) { + DataMaskingPolicyInner inner = this.serviceClient().get(resourceGroupName, serverName, databaseName); + if (inner != null) { + return new DataMaskingPolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public DataMaskingPolicy getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, databaseName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, databaseName, context); + } + + private DataMaskingPoliciesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public DataMaskingPolicyImpl define() { + return new DataMaskingPolicyImpl(this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataMaskingPolicyImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataMaskingPolicyImpl.java new file mode 100644 index 0000000000000..a1f88967f8e1b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataMaskingPolicyImpl.java @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DataMaskingPolicyInner; +import com.azure.resourcemanager.sql.generated.models.DataMaskingPolicy; +import com.azure.resourcemanager.sql.generated.models.DataMaskingState; + +public final class DataMaskingPolicyImpl + implements DataMaskingPolicy, DataMaskingPolicy.Definition, DataMaskingPolicy.Update { + private DataMaskingPolicyInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public String kind() { + return this.innerModel().kind(); + } + + public DataMaskingState dataMaskingState() { + return this.innerModel().dataMaskingState(); + } + + public String exemptPrincipals() { + return this.innerModel().exemptPrincipals(); + } + + public String applicationPrincipals() { + return this.innerModel().applicationPrincipals(); + } + + public String maskingLevel() { + return this.innerModel().maskingLevel(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public DataMaskingPolicyInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String databaseName; + + public DataMaskingPolicyImpl withExistingDatabase( + String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + + public DataMaskingPolicy create() { + this.innerObject = + serviceManager + .serviceClient() + .getDataMaskingPolicies() + .createOrUpdateWithResponse( + resourceGroupName, serverName, databaseName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public DataMaskingPolicy create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDataMaskingPolicies() + .createOrUpdateWithResponse(resourceGroupName, serverName, databaseName, this.innerModel(), context) + .getValue(); + return this; + } + + DataMaskingPolicyImpl(com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new DataMaskingPolicyInner(); + this.serviceManager = serviceManager; + } + + public DataMaskingPolicyImpl update() { + return this; + } + + public DataMaskingPolicy apply() { + this.innerObject = + serviceManager + .serviceClient() + .getDataMaskingPolicies() + .createOrUpdateWithResponse( + resourceGroupName, serverName, databaseName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public DataMaskingPolicy apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDataMaskingPolicies() + .createOrUpdateWithResponse(resourceGroupName, serverName, databaseName, this.innerModel(), context) + .getValue(); + return this; + } + + DataMaskingPolicyImpl( + DataMaskingPolicyInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "databases"); + } + + public DataMaskingPolicy refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getDataMaskingPolicies() + .getWithResponse(resourceGroupName, serverName, databaseName, Context.NONE) + .getValue(); + return this; + } + + public DataMaskingPolicy refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDataMaskingPolicies() + .getWithResponse(resourceGroupName, serverName, databaseName, context) + .getValue(); + return this; + } + + public DataMaskingPolicyImpl withDataMaskingState(DataMaskingState dataMaskingState) { + this.innerModel().withDataMaskingState(dataMaskingState); + return this; + } + + public DataMaskingPolicyImpl withExemptPrincipals(String exemptPrincipals) { + this.innerModel().withExemptPrincipals(exemptPrincipals); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataMaskingRuleImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataMaskingRuleImpl.java new file mode 100644 index 0000000000000..4ded2cd987357 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataMaskingRuleImpl.java @@ -0,0 +1,240 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DataMaskingRuleInner; +import com.azure.resourcemanager.sql.generated.models.DataMaskingFunction; +import com.azure.resourcemanager.sql.generated.models.DataMaskingRule; +import com.azure.resourcemanager.sql.generated.models.DataMaskingRuleState; + +public final class DataMaskingRuleImpl implements DataMaskingRule, DataMaskingRule.Definition, DataMaskingRule.Update { + private DataMaskingRuleInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public String kind() { + return this.innerModel().kind(); + } + + public String idPropertiesId() { + return this.innerModel().idPropertiesId(); + } + + public String aliasName() { + return this.innerModel().aliasName(); + } + + public DataMaskingRuleState ruleState() { + return this.innerModel().ruleState(); + } + + public String schemaName() { + return this.innerModel().schemaName(); + } + + public String tableName() { + return this.innerModel().tableName(); + } + + public String columnName() { + return this.innerModel().columnName(); + } + + public DataMaskingFunction maskingFunction() { + return this.innerModel().maskingFunction(); + } + + public String numberFrom() { + return this.innerModel().numberFrom(); + } + + public String numberTo() { + return this.innerModel().numberTo(); + } + + public String prefixSize() { + return this.innerModel().prefixSize(); + } + + public String suffixSize() { + return this.innerModel().suffixSize(); + } + + public String replacementString() { + return this.innerModel().replacementString(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public DataMaskingRuleInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String databaseName; + + private String dataMaskingRuleName; + + public DataMaskingRuleImpl withExistingDatabase(String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + + public DataMaskingRule create() { + this.innerObject = + serviceManager + .serviceClient() + .getDataMaskingRules() + .createOrUpdateWithResponse( + resourceGroupName, serverName, databaseName, dataMaskingRuleName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public DataMaskingRule create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDataMaskingRules() + .createOrUpdateWithResponse( + resourceGroupName, serverName, databaseName, dataMaskingRuleName, this.innerModel(), context) + .getValue(); + return this; + } + + DataMaskingRuleImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new DataMaskingRuleInner(); + this.serviceManager = serviceManager; + this.dataMaskingRuleName = name; + } + + public DataMaskingRuleImpl update() { + return this; + } + + public DataMaskingRule apply() { + this.innerObject = + serviceManager + .serviceClient() + .getDataMaskingRules() + .createOrUpdateWithResponse( + resourceGroupName, serverName, databaseName, dataMaskingRuleName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public DataMaskingRule apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDataMaskingRules() + .createOrUpdateWithResponse( + resourceGroupName, serverName, databaseName, dataMaskingRuleName, this.innerModel(), context) + .getValue(); + return this; + } + + DataMaskingRuleImpl( + DataMaskingRuleInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "databases"); + this.dataMaskingRuleName = Utils.getValueFromIdByName(innerObject.id(), "rules"); + } + + public DataMaskingRuleImpl withAliasName(String aliasName) { + this.innerModel().withAliasName(aliasName); + return this; + } + + public DataMaskingRuleImpl withRuleState(DataMaskingRuleState ruleState) { + this.innerModel().withRuleState(ruleState); + return this; + } + + public DataMaskingRuleImpl withSchemaName(String schemaName) { + this.innerModel().withSchemaName(schemaName); + return this; + } + + public DataMaskingRuleImpl withTableName(String tableName) { + this.innerModel().withTableName(tableName); + return this; + } + + public DataMaskingRuleImpl withColumnName(String columnName) { + this.innerModel().withColumnName(columnName); + return this; + } + + public DataMaskingRuleImpl withMaskingFunction(DataMaskingFunction maskingFunction) { + this.innerModel().withMaskingFunction(maskingFunction); + return this; + } + + public DataMaskingRuleImpl withNumberFrom(String numberFrom) { + this.innerModel().withNumberFrom(numberFrom); + return this; + } + + public DataMaskingRuleImpl withNumberTo(String numberTo) { + this.innerModel().withNumberTo(numberTo); + return this; + } + + public DataMaskingRuleImpl withPrefixSize(String prefixSize) { + this.innerModel().withPrefixSize(prefixSize); + return this; + } + + public DataMaskingRuleImpl withSuffixSize(String suffixSize) { + this.innerModel().withSuffixSize(suffixSize); + return this; + } + + public DataMaskingRuleImpl withReplacementString(String replacementString) { + this.innerModel().withReplacementString(replacementString); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataMaskingRulesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataMaskingRulesClientImpl.java new file mode 100644 index 0000000000000..735ca8a4945ed --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataMaskingRulesClientImpl.java @@ -0,0 +1,524 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.DataMaskingRulesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DataMaskingRuleInner; +import com.azure.resourcemanager.sql.generated.models.DataMaskingRuleListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DataMaskingRulesClient. */ +public final class DataMaskingRulesClientImpl implements DataMaskingRulesClient { + /** The proxy service used to perform REST calls. */ + private final DataMaskingRulesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of DataMaskingRulesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DataMaskingRulesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(DataMaskingRulesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientDataMaskingRules to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientD") + public interface DataMaskingRulesService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName}/rules" + + "/{dataMaskingRuleName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("dataMaskingPolicyName") String dataMaskingPolicyName, + @PathParam("dataMaskingRuleName") String dataMaskingRuleName, + @BodyParam("application/json") DataMaskingRuleInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/dataMaskingPolicies/{dataMaskingPolicyName}/rules") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("dataMaskingPolicyName") String dataMaskingPolicyName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a database data masking rule along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String dataMaskingRuleName, + DataMaskingRuleInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (dataMaskingRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter dataMaskingRuleName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2014-04-01"; + final String dataMaskingPolicyName = "Default"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + dataMaskingPolicyName, + dataMaskingRuleName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a database data masking rule along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String dataMaskingRuleName, + DataMaskingRuleInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (dataMaskingRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter dataMaskingRuleName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2014-04-01"; + final String dataMaskingPolicyName = "Default"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + dataMaskingPolicyName, + dataMaskingRuleName, + parameters, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a database data masking rule on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String dataMaskingRuleName, + DataMaskingRuleInner parameters) { + return createOrUpdateWithResponseAsync( + resourceGroupName, serverName, databaseName, dataMaskingRuleName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a database data masking rule along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String dataMaskingRuleName, + DataMaskingRuleInner parameters, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, serverName, databaseName, dataMaskingRuleName, parameters, context) + .block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a database data masking rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DataMaskingRuleInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String dataMaskingRuleName, + DataMaskingRuleInner parameters) { + return createOrUpdateWithResponse( + resourceGroupName, serverName, databaseName, dataMaskingRuleName, parameters, Context.NONE) + .getValue(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database data masking rules along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String dataMaskingPolicyName = "Default"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + dataMaskingPolicyName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database data masking rules along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String dataMaskingPolicyName = "Default"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + dataMaskingPolicyName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database data masking rules as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName) { + return new PagedFlux<>(() -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database data masking rules as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database data masking rules as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database data masking rules as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName, context)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataMaskingRulesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataMaskingRulesImpl.java new file mode 100644 index 0000000000000..3073431427558 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataMaskingRulesImpl.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.DataMaskingRulesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DataMaskingRuleInner; +import com.azure.resourcemanager.sql.generated.models.DataMaskingRule; +import com.azure.resourcemanager.sql.generated.models.DataMaskingRules; + +public final class DataMaskingRulesImpl implements DataMaskingRules { + private static final ClientLogger LOGGER = new ClientLogger(DataMaskingRulesImpl.class); + + private final DataMaskingRulesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public DataMaskingRulesImpl( + DataMaskingRulesClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName); + return Utils.mapPage(inner, inner1 -> new DataMaskingRuleImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName, context); + return Utils.mapPage(inner, inner1 -> new DataMaskingRuleImpl(inner1, this.manager())); + } + + private DataMaskingRulesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public DataMaskingRuleImpl define(String name) { + return new DataMaskingRuleImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataWarehouseUserActivitiesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataWarehouseUserActivitiesImpl.java new file mode 100644 index 0000000000000..0bac66cffb3e4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataWarehouseUserActivitiesImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.DataWarehouseUserActivitiesInner; +import com.azure.resourcemanager.sql.generated.models.DataWarehouseUserActivities; + +public final class DataWarehouseUserActivitiesImpl implements DataWarehouseUserActivities { + private DataWarehouseUserActivitiesInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + DataWarehouseUserActivitiesImpl( + DataWarehouseUserActivitiesInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public Integer activeQueriesCount() { + return this.innerModel().activeQueriesCount(); + } + + public DataWarehouseUserActivitiesInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataWarehouseUserActivitiesOperationsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataWarehouseUserActivitiesOperationsClientImpl.java new file mode 100644 index 0000000000000..be38a9d9ddb0a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataWarehouseUserActivitiesOperationsClientImpl.java @@ -0,0 +1,599 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.DataWarehouseUserActivitiesOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DataWarehouseUserActivitiesInner; +import com.azure.resourcemanager.sql.generated.models.DataWarehouseUserActivitiesListResult; +import com.azure.resourcemanager.sql.generated.models.DataWarehouseUserActivityName; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * DataWarehouseUserActivitiesOperationsClient. + */ +public final class DataWarehouseUserActivitiesOperationsClientImpl + implements DataWarehouseUserActivitiesOperationsClient { + /** The proxy service used to perform REST calls. */ + private final DataWarehouseUserActivitiesOperationsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of DataWarehouseUserActivitiesOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DataWarehouseUserActivitiesOperationsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + DataWarehouseUserActivitiesOperationsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientDataWarehouseUserActivitiesOperations to be used + * by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientD") + public interface DataWarehouseUserActivitiesOperationsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/dataWarehouseUserActivities/{dataWarehouseUserActivityName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("dataWarehouseUserActivityName") DataWarehouseUserActivityName dataWarehouseUserActivityName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/dataWarehouseUserActivities") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabaseNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 dataWarehouseUserActivityName The activity name of the data warehouse. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the user activities of a data warehouse which includes running and suspended queries along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + DataWarehouseUserActivityName dataWarehouseUserActivityName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (dataWarehouseUserActivityName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter dataWarehouseUserActivityName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + dataWarehouseUserActivityName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 dataWarehouseUserActivityName The activity name of the data warehouse. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the user activities of a data warehouse which includes running and suspended queries along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + DataWarehouseUserActivityName dataWarehouseUserActivityName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (dataWarehouseUserActivityName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter dataWarehouseUserActivityName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + dataWarehouseUserActivityName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 dataWarehouseUserActivityName The activity name of the data warehouse. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the user activities of a data warehouse which includes running and suspended queries on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String serverName, + String databaseName, + DataWarehouseUserActivityName dataWarehouseUserActivityName) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, dataWarehouseUserActivityName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 dataWarehouseUserActivityName The activity name of the data warehouse. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the user activities of a data warehouse which includes running and suspended queries along with {@link + * Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + DataWarehouseUserActivityName dataWarehouseUserActivityName, + Context context) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, dataWarehouseUserActivityName, context) + .block(); + } + + /** + * 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 dataWarehouseUserActivityName The activity name of the data warehouse. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the user activities of a data warehouse which includes running and suspended queries. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DataWarehouseUserActivitiesInner get( + String resourceGroupName, + String serverName, + String databaseName, + DataWarehouseUserActivityName dataWarehouseUserActivityName) { + return getWithResponse(resourceGroupName, serverName, databaseName, dataWarehouseUserActivityName, Context.NONE) + .getValue(); + } + + /** + * List 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return user activities of a data warehouse along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List the 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return user activities of a data warehouse along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return user activities of a data warehouse as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * List 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return user activities of a data warehouse as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, context), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * List 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return user activities of a data warehouse as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName)); + } + + /** + * List 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return user activities of a data warehouse as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return user activities of a data warehouse along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return user activities of a data warehouse along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataWarehouseUserActivitiesOperationsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataWarehouseUserActivitiesOperationsImpl.java new file mode 100644 index 0000000000000..ea0b895cab677 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DataWarehouseUserActivitiesOperationsImpl.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.DataWarehouseUserActivitiesOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DataWarehouseUserActivitiesInner; +import com.azure.resourcemanager.sql.generated.models.DataWarehouseUserActivities; +import com.azure.resourcemanager.sql.generated.models.DataWarehouseUserActivitiesOperations; +import com.azure.resourcemanager.sql.generated.models.DataWarehouseUserActivityName; + +public final class DataWarehouseUserActivitiesOperationsImpl implements DataWarehouseUserActivitiesOperations { + private static final ClientLogger LOGGER = new ClientLogger(DataWarehouseUserActivitiesOperationsImpl.class); + + private final DataWarehouseUserActivitiesOperationsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public DataWarehouseUserActivitiesOperationsImpl( + DataWarehouseUserActivitiesOperationsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + DataWarehouseUserActivityName dataWarehouseUserActivityName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, serverName, databaseName, dataWarehouseUserActivityName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DataWarehouseUserActivitiesImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DataWarehouseUserActivities get( + String resourceGroupName, + String serverName, + String databaseName, + DataWarehouseUserActivityName dataWarehouseUserActivityName) { + DataWarehouseUserActivitiesInner inner = + this.serviceClient().get(resourceGroupName, serverName, databaseName, dataWarehouseUserActivityName); + if (inner != null) { + return new DataWarehouseUserActivitiesImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName); + return Utils.mapPage(inner, inner1 -> new DataWarehouseUserActivitiesImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName, context); + return Utils.mapPage(inner, inner1 -> new DataWarehouseUserActivitiesImpl(inner1, this.manager())); + } + + private DataWarehouseUserActivitiesOperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseAdvancedThreatProtectionImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseAdvancedThreatProtectionImpl.java new file mode 100644 index 0000000000000..ae6bf4b3b858f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseAdvancedThreatProtectionImpl.java @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseAdvancedThreatProtectionInner; +import com.azure.resourcemanager.sql.generated.models.AdvancedThreatProtectionName; +import com.azure.resourcemanager.sql.generated.models.AdvancedThreatProtectionState; +import com.azure.resourcemanager.sql.generated.models.DatabaseAdvancedThreatProtection; +import java.time.OffsetDateTime; + +public final class DatabaseAdvancedThreatProtectionImpl + implements DatabaseAdvancedThreatProtection, + DatabaseAdvancedThreatProtection.Definition, + DatabaseAdvancedThreatProtection.Update { + private DatabaseAdvancedThreatProtectionInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public AdvancedThreatProtectionState state() { + return this.innerModel().state(); + } + + public OffsetDateTime creationTime() { + return this.innerModel().creationTime(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public DatabaseAdvancedThreatProtectionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String databaseName; + + private AdvancedThreatProtectionName advancedThreatProtectionName; + + public DatabaseAdvancedThreatProtectionImpl withExistingDatabase( + String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + + public DatabaseAdvancedThreatProtection create() { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseAdvancedThreatProtectionSettings() + .createOrUpdateWithResponse( + resourceGroupName, + serverName, + databaseName, + advancedThreatProtectionName, + this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public DatabaseAdvancedThreatProtection create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseAdvancedThreatProtectionSettings() + .createOrUpdateWithResponse( + resourceGroupName, + serverName, + databaseName, + advancedThreatProtectionName, + this.innerModel(), + context) + .getValue(); + return this; + } + + DatabaseAdvancedThreatProtectionImpl( + AdvancedThreatProtectionName name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new DatabaseAdvancedThreatProtectionInner(); + this.serviceManager = serviceManager; + this.advancedThreatProtectionName = name; + } + + public DatabaseAdvancedThreatProtectionImpl update() { + return this; + } + + public DatabaseAdvancedThreatProtection apply() { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseAdvancedThreatProtectionSettings() + .createOrUpdateWithResponse( + resourceGroupName, + serverName, + databaseName, + advancedThreatProtectionName, + this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public DatabaseAdvancedThreatProtection apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseAdvancedThreatProtectionSettings() + .createOrUpdateWithResponse( + resourceGroupName, + serverName, + databaseName, + advancedThreatProtectionName, + this.innerModel(), + context) + .getValue(); + return this; + } + + DatabaseAdvancedThreatProtectionImpl( + DatabaseAdvancedThreatProtectionInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "databases"); + this.advancedThreatProtectionName = + AdvancedThreatProtectionName + .fromString(Utils.getValueFromIdByName(innerObject.id(), "advancedThreatProtectionSettings")); + } + + public DatabaseAdvancedThreatProtection refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseAdvancedThreatProtectionSettings() + .getWithResponse( + resourceGroupName, serverName, databaseName, advancedThreatProtectionName, Context.NONE) + .getValue(); + return this; + } + + public DatabaseAdvancedThreatProtection refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseAdvancedThreatProtectionSettings() + .getWithResponse(resourceGroupName, serverName, databaseName, advancedThreatProtectionName, context) + .getValue(); + return this; + } + + public DatabaseAdvancedThreatProtectionImpl withState(AdvancedThreatProtectionState state) { + this.innerModel().withState(state); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseAdvancedThreatProtectionSettingsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseAdvancedThreatProtectionSettingsClientImpl.java new file mode 100644 index 0000000000000..e86d6ca9d8f89 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseAdvancedThreatProtectionSettingsClientImpl.java @@ -0,0 +1,849 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseAdvancedThreatProtectionSettingsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseAdvancedThreatProtectionInner; +import com.azure.resourcemanager.sql.generated.models.AdvancedThreatProtectionName; +import com.azure.resourcemanager.sql.generated.models.DatabaseAdvancedThreatProtectionListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * DatabaseAdvancedThreatProtectionSettingsClient. + */ +public final class DatabaseAdvancedThreatProtectionSettingsClientImpl + implements DatabaseAdvancedThreatProtectionSettingsClient { + /** The proxy service used to perform REST calls. */ + private final DatabaseAdvancedThreatProtectionSettingsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseAdvancedThreatProtectionSettingsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DatabaseAdvancedThreatProtectionSettingsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + DatabaseAdvancedThreatProtectionSettingsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientDatabaseAdvancedThreatProtectionSettings to be + * used by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientD") + public interface DatabaseAdvancedThreatProtectionSettingsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/advancedThreatProtectionSettings") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/advancedThreatProtectionSettings" + + "/{advancedThreatProtectionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("advancedThreatProtectionName") AdvancedThreatProtectionName advancedThreatProtectionName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/advancedThreatProtectionSettings" + + "/{advancedThreatProtectionName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("advancedThreatProtectionName") AdvancedThreatProtectionName advancedThreatProtectionName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DatabaseAdvancedThreatProtectionInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabaseNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a list of database's Advanced Threat Protection states. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's Advanced Threat Protection states along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of database's Advanced Threat Protection states. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's Advanced Threat Protection states along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of database's Advanced Threat Protection states. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's Advanced Threat Protection states as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of database's Advanced Threat Protection states. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's Advanced Threat Protection states as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, context), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of database's Advanced Threat Protection states. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's Advanced Threat Protection states as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName)); + } + + /** + * Gets a list of database's Advanced Threat Protection states. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's Advanced Threat Protection states as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName, context)); + } + + /** + * Gets a database's Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's Advanced Threat Protection state along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + AdvancedThreatProtectionName advancedThreatProtectionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (advancedThreatProtectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter advancedThreatProtectionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + advancedThreatProtectionName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a database's Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's Advanced Threat Protection state along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + AdvancedThreatProtectionName advancedThreatProtectionName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (advancedThreatProtectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter advancedThreatProtectionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + advancedThreatProtectionName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a database's Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's Advanced Threat Protection state on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String serverName, + String databaseName, + AdvancedThreatProtectionName advancedThreatProtectionName) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, advancedThreatProtectionName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a database's Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's Advanced Threat Protection state along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + AdvancedThreatProtectionName advancedThreatProtectionName, + Context context) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, advancedThreatProtectionName, context) + .block(); + } + + /** + * Gets a database's Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's Advanced Threat Protection state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseAdvancedThreatProtectionInner get( + String resourceGroupName, + String serverName, + String databaseName, + AdvancedThreatProtectionName advancedThreatProtectionName) { + return getWithResponse(resourceGroupName, serverName, databaseName, advancedThreatProtectionName, Context.NONE) + .getValue(); + } + + /** + * Creates or updates a database's Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @param parameters The database Advanced Threat Protection state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database Advanced Threat Protection along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + AdvancedThreatProtectionName advancedThreatProtectionName, + DatabaseAdvancedThreatProtectionInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (advancedThreatProtectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter advancedThreatProtectionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + advancedThreatProtectionName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a database's Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @param parameters The database Advanced Threat Protection state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database Advanced Threat Protection along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + AdvancedThreatProtectionName advancedThreatProtectionName, + DatabaseAdvancedThreatProtectionInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (advancedThreatProtectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter advancedThreatProtectionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + advancedThreatProtectionName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates a database's Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @param parameters The database Advanced Threat Protection state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database Advanced Threat Protection on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + AdvancedThreatProtectionName advancedThreatProtectionName, + DatabaseAdvancedThreatProtectionInner parameters) { + return createOrUpdateWithResponseAsync( + resourceGroupName, serverName, databaseName, advancedThreatProtectionName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or updates a database's Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @param parameters The database Advanced Threat Protection state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database Advanced Threat Protection along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + AdvancedThreatProtectionName advancedThreatProtectionName, + DatabaseAdvancedThreatProtectionInner parameters, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, serverName, databaseName, advancedThreatProtectionName, parameters, context) + .block(); + } + + /** + * Creates or updates a database's Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @param parameters The database Advanced Threat Protection state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database Advanced Threat Protection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseAdvancedThreatProtectionInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + AdvancedThreatProtectionName advancedThreatProtectionName, + DatabaseAdvancedThreatProtectionInner parameters) { + return createOrUpdateWithResponse( + resourceGroupName, serverName, databaseName, advancedThreatProtectionName, parameters, Context.NONE) + .getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the database's Advanced Threat Protection configurations along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the database's Advanced Threat Protection configurations along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseAdvancedThreatProtectionSettingsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseAdvancedThreatProtectionSettingsImpl.java new file mode 100644 index 0000000000000..6b94311b0feec --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseAdvancedThreatProtectionSettingsImpl.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseAdvancedThreatProtectionSettingsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseAdvancedThreatProtectionInner; +import com.azure.resourcemanager.sql.generated.models.AdvancedThreatProtectionName; +import com.azure.resourcemanager.sql.generated.models.DatabaseAdvancedThreatProtection; +import com.azure.resourcemanager.sql.generated.models.DatabaseAdvancedThreatProtectionSettings; + +public final class DatabaseAdvancedThreatProtectionSettingsImpl implements DatabaseAdvancedThreatProtectionSettings { + private static final ClientLogger LOGGER = new ClientLogger(DatabaseAdvancedThreatProtectionSettingsImpl.class); + + private final DatabaseAdvancedThreatProtectionSettingsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public DatabaseAdvancedThreatProtectionSettingsImpl( + DatabaseAdvancedThreatProtectionSettingsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName); + return Utils.mapPage(inner, inner1 -> new DatabaseAdvancedThreatProtectionImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName, context); + return Utils.mapPage(inner, inner1 -> new DatabaseAdvancedThreatProtectionImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + AdvancedThreatProtectionName advancedThreatProtectionName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, serverName, databaseName, advancedThreatProtectionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatabaseAdvancedThreatProtectionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DatabaseAdvancedThreatProtection get( + String resourceGroupName, + String serverName, + String databaseName, + AdvancedThreatProtectionName advancedThreatProtectionName) { + DatabaseAdvancedThreatProtectionInner inner = + this.serviceClient().get(resourceGroupName, serverName, databaseName, advancedThreatProtectionName); + if (inner != null) { + return new DatabaseAdvancedThreatProtectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public DatabaseAdvancedThreatProtection getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String advancedThreatProtectionNameLocal = Utils.getValueFromIdByName(id, "advancedThreatProtectionSettings"); + if (advancedThreatProtectionNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment" + + " 'advancedThreatProtectionSettings'.", + id))); + } + AdvancedThreatProtectionName advancedThreatProtectionName = + AdvancedThreatProtectionName.fromString(advancedThreatProtectionNameLocal); + return this + .getWithResponse(resourceGroupName, serverName, databaseName, advancedThreatProtectionName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String advancedThreatProtectionNameLocal = Utils.getValueFromIdByName(id, "advancedThreatProtectionSettings"); + if (advancedThreatProtectionNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment" + + " 'advancedThreatProtectionSettings'.", + id))); + } + AdvancedThreatProtectionName advancedThreatProtectionName = + AdvancedThreatProtectionName.fromString(advancedThreatProtectionNameLocal); + return this.getWithResponse(resourceGroupName, serverName, databaseName, advancedThreatProtectionName, context); + } + + private DatabaseAdvancedThreatProtectionSettingsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public DatabaseAdvancedThreatProtectionImpl define(AdvancedThreatProtectionName name) { + return new DatabaseAdvancedThreatProtectionImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseAdvisorsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseAdvisorsClientImpl.java new file mode 100644 index 0000000000000..76cb3f39a5a79 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseAdvisorsClientImpl.java @@ -0,0 +1,663 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseAdvisorsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.AdvisorInner; +import java.util.List; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DatabaseAdvisorsClient. */ +public final class DatabaseAdvisorsClientImpl implements DatabaseAdvisorsClient { + /** The proxy service used to perform REST calls. */ + private final DatabaseAdvisorsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseAdvisorsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DatabaseAdvisorsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(DatabaseAdvisorsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientDatabaseAdvisors to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientD") + public interface DatabaseAdvisorsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/advisors") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> listByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @QueryParam("$expand") String expand, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/advisors/{advisorName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("advisorName") String advisorName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/advisors/{advisorName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("advisorName") String advisorName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") AdvisorInner parameters, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 expand The child resources to include in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database advisors along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listByDatabaseWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + expand, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database advisors along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listByDatabaseWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + expand, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database advisors on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName) { + final String expand = null; + return listByDatabaseWithResponseAsync(resourceGroupName, serverName, databaseName, expand) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database advisors along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response> listByDatabaseWithResponse( + String resourceGroupName, String serverName, String databaseName, String expand, Context context) { + return listByDatabaseWithResponseAsync(resourceGroupName, serverName, databaseName, expand, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database advisors. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public List listByDatabase(String resourceGroupName, String serverName, String databaseName) { + final String expand = null; + return listByDatabaseWithResponse(resourceGroupName, serverName, databaseName, expand, Context.NONE).getValue(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database advisor along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String advisorName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (advisorName == null) { + return Mono.error(new IllegalArgumentException("Parameter advisorName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + advisorName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database advisor along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String advisorName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (advisorName == null) { + return Mono.error(new IllegalArgumentException("Parameter advisorName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + advisorName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database advisor on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String databaseName, String advisorName) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, advisorName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database advisor along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, String advisorName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, advisorName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database advisor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AdvisorInner get(String resourceGroupName, String serverName, String databaseName, String advisorName) { + return getWithResponse(resourceGroupName, serverName, databaseName, advisorName, Context.NONE).getValue(); + } + + /** + * 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 parameters The requested advisor resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database, Server or Elastic Pool Advisor along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String advisorName, AdvisorInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (advisorName == null) { + return Mono.error(new IllegalArgumentException("Parameter advisorName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + advisorName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 parameters The requested advisor resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database, Server or Elastic Pool Advisor along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String advisorName, + AdvisorInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (advisorName == null) { + return Mono.error(new IllegalArgumentException("Parameter advisorName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + advisorName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 parameters The requested advisor resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database, Server or Elastic Pool Advisor on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String serverName, String databaseName, String advisorName, AdvisorInner parameters) { + return updateWithResponseAsync(resourceGroupName, serverName, databaseName, advisorName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 parameters The requested advisor resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database, Server or Elastic Pool Advisor along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String advisorName, + AdvisorInner parameters, + Context context) { + return updateWithResponseAsync(resourceGroupName, serverName, databaseName, advisorName, parameters, context) + .block(); + } + + /** + * 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 parameters The requested advisor resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database, Server or Elastic Pool Advisor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AdvisorInner update( + String resourceGroupName, String serverName, String databaseName, String advisorName, AdvisorInner parameters) { + return updateWithResponse(resourceGroupName, serverName, databaseName, advisorName, parameters, Context.NONE) + .getValue(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseAdvisorsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseAdvisorsImpl.java new file mode 100644 index 0000000000000..af9d340502ab8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseAdvisorsImpl.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseAdvisorsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.AdvisorInner; +import com.azure.resourcemanager.sql.generated.models.Advisor; +import com.azure.resourcemanager.sql.generated.models.DatabaseAdvisors; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class DatabaseAdvisorsImpl implements DatabaseAdvisors { + private static final ClientLogger LOGGER = new ClientLogger(DatabaseAdvisorsImpl.class); + + private final DatabaseAdvisorsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public DatabaseAdvisorsImpl( + DatabaseAdvisorsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response> listByDatabaseWithResponse( + String resourceGroupName, String serverName, String databaseName, String expand, Context context) { + Response> inner = + this + .serviceClient() + .listByDatabaseWithResponse(resourceGroupName, serverName, databaseName, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + inner + .getValue() + .stream() + .map(inner1 -> new AdvisorImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return null; + } + } + + public List listByDatabase(String resourceGroupName, String serverName, String databaseName) { + List inner = this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName); + if (inner != null) { + return Collections + .unmodifiableList( + inner.stream().map(inner1 -> new AdvisorImpl(inner1, this.manager())).collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, String advisorName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, databaseName, advisorName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AdvisorImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Advisor get(String resourceGroupName, String serverName, String databaseName, String advisorName) { + AdvisorInner inner = this.serviceClient().get(resourceGroupName, serverName, databaseName, advisorName); + if (inner != null) { + return new AdvisorImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response updateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String advisorName, + AdvisorInner parameters, + Context context) { + Response inner = + this + .serviceClient() + .updateWithResponse(resourceGroupName, serverName, databaseName, advisorName, parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AdvisorImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Advisor update( + String resourceGroupName, String serverName, String databaseName, String advisorName, AdvisorInner parameters) { + AdvisorInner inner = + this.serviceClient().update(resourceGroupName, serverName, databaseName, advisorName, parameters); + if (inner != null) { + return new AdvisorImpl(inner, this.manager()); + } else { + return null; + } + } + + private DatabaseAdvisorsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseAutomaticTuningImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseAutomaticTuningImpl.java new file mode 100644 index 0000000000000..04ecacce7065b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseAutomaticTuningImpl.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseAutomaticTuningInner; +import com.azure.resourcemanager.sql.generated.models.AutomaticTuningMode; +import com.azure.resourcemanager.sql.generated.models.AutomaticTuningOptions; +import com.azure.resourcemanager.sql.generated.models.DatabaseAutomaticTuning; +import java.util.Collections; +import java.util.Map; + +public final class DatabaseAutomaticTuningImpl implements DatabaseAutomaticTuning { + private DatabaseAutomaticTuningInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + DatabaseAutomaticTuningImpl( + DatabaseAutomaticTuningInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public AutomaticTuningMode desiredState() { + return this.innerModel().desiredState(); + } + + public AutomaticTuningMode actualState() { + return this.innerModel().actualState(); + } + + public Map options() { + Map inner = this.innerModel().options(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public DatabaseAutomaticTuningInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseAutomaticTuningsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseAutomaticTuningsClientImpl.java new file mode 100644 index 0000000000000..53c914cce5f5b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseAutomaticTuningsClientImpl.java @@ -0,0 +1,442 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseAutomaticTuningsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseAutomaticTuningInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DatabaseAutomaticTuningsClient. */ +public final class DatabaseAutomaticTuningsClientImpl implements DatabaseAutomaticTuningsClient { + /** The proxy service used to perform REST calls. */ + private final DatabaseAutomaticTuningsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseAutomaticTuningsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DatabaseAutomaticTuningsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create(DatabaseAutomaticTuningsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientDatabaseAutomaticTunings to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientD") + public interface DatabaseAutomaticTuningsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/automaticTuning/current") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/automaticTuning/current") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DatabaseAutomaticTuningInner parameters, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's automatic tuning along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's automatic tuning along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's automatic tuning on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String databaseName) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's automatic tuning along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's automatic tuning. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseAutomaticTuningInner get(String resourceGroupName, String serverName, String databaseName) { + return getWithResponse(resourceGroupName, serverName, databaseName, Context.NONE).getValue(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database-level Automatic Tuning along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, DatabaseAutomaticTuningInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database-level Automatic Tuning along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + DatabaseAutomaticTuningInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database-level Automatic Tuning on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String serverName, String databaseName, DatabaseAutomaticTuningInner parameters) { + return updateWithResponseAsync(resourceGroupName, serverName, databaseName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database-level Automatic Tuning along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + DatabaseAutomaticTuningInner parameters, + Context context) { + return updateWithResponseAsync(resourceGroupName, serverName, databaseName, parameters, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database-level Automatic Tuning. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseAutomaticTuningInner update( + String resourceGroupName, String serverName, String databaseName, DatabaseAutomaticTuningInner parameters) { + return updateWithResponse(resourceGroupName, serverName, databaseName, parameters, Context.NONE).getValue(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseAutomaticTuningsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseAutomaticTuningsImpl.java new file mode 100644 index 0000000000000..cf233355c31ea --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseAutomaticTuningsImpl.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseAutomaticTuningsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseAutomaticTuningInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseAutomaticTuning; +import com.azure.resourcemanager.sql.generated.models.DatabaseAutomaticTunings; + +public final class DatabaseAutomaticTuningsImpl implements DatabaseAutomaticTunings { + private static final ClientLogger LOGGER = new ClientLogger(DatabaseAutomaticTuningsImpl.class); + + private final DatabaseAutomaticTuningsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public DatabaseAutomaticTuningsImpl( + DatabaseAutomaticTuningsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, databaseName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatabaseAutomaticTuningImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DatabaseAutomaticTuning get(String resourceGroupName, String serverName, String databaseName) { + DatabaseAutomaticTuningInner inner = this.serviceClient().get(resourceGroupName, serverName, databaseName); + if (inner != null) { + return new DatabaseAutomaticTuningImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response updateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + DatabaseAutomaticTuningInner parameters, + Context context) { + Response inner = + this.serviceClient().updateWithResponse(resourceGroupName, serverName, databaseName, parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatabaseAutomaticTuningImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DatabaseAutomaticTuning update( + String resourceGroupName, String serverName, String databaseName, DatabaseAutomaticTuningInner parameters) { + DatabaseAutomaticTuningInner inner = + this.serviceClient().update(resourceGroupName, serverName, databaseName, parameters); + if (inner != null) { + return new DatabaseAutomaticTuningImpl(inner, this.manager()); + } else { + return null; + } + } + + private DatabaseAutomaticTuningsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseBlobAuditingPoliciesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseBlobAuditingPoliciesClientImpl.java new file mode 100644 index 0000000000000..c1b639ca68e33 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseBlobAuditingPoliciesClientImpl.java @@ -0,0 +1,768 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseBlobAuditingPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseBlobAuditingPolicyInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseBlobAuditingPolicyListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DatabaseBlobAuditingPoliciesClient. */ +public final class DatabaseBlobAuditingPoliciesClientImpl implements DatabaseBlobAuditingPoliciesClient { + /** The proxy service used to perform REST calls. */ + private final DatabaseBlobAuditingPoliciesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseBlobAuditingPoliciesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DatabaseBlobAuditingPoliciesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + DatabaseBlobAuditingPoliciesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientDatabaseBlobAuditingPolicies to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientD") + public interface DatabaseBlobAuditingPoliciesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/auditingSettings") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/auditingSettings/{blobAuditingPolicyName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("blobAuditingPolicyName") String blobAuditingPolicyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/auditingSettings/{blobAuditingPolicyName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("blobAuditingPolicyName") String blobAuditingPolicyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DatabaseBlobAuditingPolicyInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabaseNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists auditing settings 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database auditing settings along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists auditing settings 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database auditing settings along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists auditing settings 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database auditing settings as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Lists auditing settings 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database auditing settings as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, context), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists auditing settings 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database auditing settings as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName)); + } + + /** + * Lists auditing settings 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database auditing settings as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's blob auditing policy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String blobAuditingPolicyName = "default"; + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + blobAuditingPolicyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's blob auditing policy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String blobAuditingPolicyName = "default"; + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + blobAuditingPolicyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's blob auditing policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String databaseName) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's blob auditing policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseBlobAuditingPolicyInner get(String resourceGroupName, String serverName, String databaseName) { + return getWithResponse(resourceGroupName, serverName, databaseName, Context.NONE).getValue(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database blob auditing policy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, DatabaseBlobAuditingPolicyInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String blobAuditingPolicyName = "default"; + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + blobAuditingPolicyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database blob auditing policy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + DatabaseBlobAuditingPolicyInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String blobAuditingPolicyName = "default"; + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + blobAuditingPolicyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database blob auditing policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serverName, String databaseName, DatabaseBlobAuditingPolicyInner parameters) { + return createOrUpdateWithResponseAsync(resourceGroupName, serverName, databaseName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database blob auditing policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + DatabaseBlobAuditingPolicyInner parameters, + Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, serverName, databaseName, parameters, context) + .block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseBlobAuditingPolicyInner createOrUpdate( + String resourceGroupName, String serverName, String databaseName, DatabaseBlobAuditingPolicyInner parameters) { + return createOrUpdateWithResponse(resourceGroupName, serverName, databaseName, parameters, Context.NONE) + .getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database auditing settings along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database auditing settings along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseBlobAuditingPoliciesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseBlobAuditingPoliciesImpl.java new file mode 100644 index 0000000000000..bda00b7774a54 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseBlobAuditingPoliciesImpl.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseBlobAuditingPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseBlobAuditingPolicyInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseBlobAuditingPolicies; +import com.azure.resourcemanager.sql.generated.models.DatabaseBlobAuditingPolicy; + +public final class DatabaseBlobAuditingPoliciesImpl implements DatabaseBlobAuditingPolicies { + private static final ClientLogger LOGGER = new ClientLogger(DatabaseBlobAuditingPoliciesImpl.class); + + private final DatabaseBlobAuditingPoliciesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public DatabaseBlobAuditingPoliciesImpl( + DatabaseBlobAuditingPoliciesClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName); + return Utils.mapPage(inner, inner1 -> new DatabaseBlobAuditingPolicyImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName, context); + return Utils.mapPage(inner, inner1 -> new DatabaseBlobAuditingPolicyImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, databaseName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatabaseBlobAuditingPolicyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DatabaseBlobAuditingPolicy get(String resourceGroupName, String serverName, String databaseName) { + DatabaseBlobAuditingPolicyInner inner = this.serviceClient().get(resourceGroupName, serverName, databaseName); + if (inner != null) { + return new DatabaseBlobAuditingPolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public DatabaseBlobAuditingPolicy getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, databaseName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, databaseName, context); + } + + private DatabaseBlobAuditingPoliciesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public DatabaseBlobAuditingPolicyImpl define() { + return new DatabaseBlobAuditingPolicyImpl(this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseBlobAuditingPolicyImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseBlobAuditingPolicyImpl.java new file mode 100644 index 0000000000000..ccfd5d97a0b35 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseBlobAuditingPolicyImpl.java @@ -0,0 +1,238 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseBlobAuditingPolicyInner; +import com.azure.resourcemanager.sql.generated.models.BlobAuditingPolicyState; +import com.azure.resourcemanager.sql.generated.models.DatabaseBlobAuditingPolicy; +import java.util.Collections; +import java.util.List; +import java.util.UUID; + +public final class DatabaseBlobAuditingPolicyImpl + implements DatabaseBlobAuditingPolicy, DatabaseBlobAuditingPolicy.Definition, DatabaseBlobAuditingPolicy.Update { + private DatabaseBlobAuditingPolicyInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String kind() { + return this.innerModel().kind(); + } + + public Integer retentionDays() { + return this.innerModel().retentionDays(); + } + + public List auditActionsAndGroups() { + List inner = this.innerModel().auditActionsAndGroups(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Boolean isStorageSecondaryKeyInUse() { + return this.innerModel().isStorageSecondaryKeyInUse(); + } + + public Boolean isAzureMonitorTargetEnabled() { + return this.innerModel().isAzureMonitorTargetEnabled(); + } + + public Integer queueDelayMs() { + return this.innerModel().queueDelayMs(); + } + + public Boolean isManagedIdentityInUse() { + return this.innerModel().isManagedIdentityInUse(); + } + + public BlobAuditingPolicyState state() { + return this.innerModel().state(); + } + + public String storageEndpoint() { + return this.innerModel().storageEndpoint(); + } + + public String storageAccountAccessKey() { + return this.innerModel().storageAccountAccessKey(); + } + + public UUID storageAccountSubscriptionId() { + return this.innerModel().storageAccountSubscriptionId(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public DatabaseBlobAuditingPolicyInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String databaseName; + + public DatabaseBlobAuditingPolicyImpl withExistingDatabase( + String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + + public DatabaseBlobAuditingPolicy create() { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseBlobAuditingPolicies() + .createOrUpdateWithResponse( + resourceGroupName, serverName, databaseName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public DatabaseBlobAuditingPolicy create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseBlobAuditingPolicies() + .createOrUpdateWithResponse(resourceGroupName, serverName, databaseName, this.innerModel(), context) + .getValue(); + return this; + } + + DatabaseBlobAuditingPolicyImpl(com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new DatabaseBlobAuditingPolicyInner(); + this.serviceManager = serviceManager; + } + + public DatabaseBlobAuditingPolicyImpl update() { + return this; + } + + public DatabaseBlobAuditingPolicy apply() { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseBlobAuditingPolicies() + .createOrUpdateWithResponse( + resourceGroupName, serverName, databaseName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public DatabaseBlobAuditingPolicy apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseBlobAuditingPolicies() + .createOrUpdateWithResponse(resourceGroupName, serverName, databaseName, this.innerModel(), context) + .getValue(); + return this; + } + + DatabaseBlobAuditingPolicyImpl( + DatabaseBlobAuditingPolicyInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "databases"); + } + + public DatabaseBlobAuditingPolicy refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseBlobAuditingPolicies() + .getWithResponse(resourceGroupName, serverName, databaseName, Context.NONE) + .getValue(); + return this; + } + + public DatabaseBlobAuditingPolicy refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseBlobAuditingPolicies() + .getWithResponse(resourceGroupName, serverName, databaseName, context) + .getValue(); + return this; + } + + public DatabaseBlobAuditingPolicyImpl withRetentionDays(Integer retentionDays) { + this.innerModel().withRetentionDays(retentionDays); + return this; + } + + public DatabaseBlobAuditingPolicyImpl withAuditActionsAndGroups(List auditActionsAndGroups) { + this.innerModel().withAuditActionsAndGroups(auditActionsAndGroups); + return this; + } + + public DatabaseBlobAuditingPolicyImpl withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse) { + this.innerModel().withIsStorageSecondaryKeyInUse(isStorageSecondaryKeyInUse); + return this; + } + + public DatabaseBlobAuditingPolicyImpl withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled) { + this.innerModel().withIsAzureMonitorTargetEnabled(isAzureMonitorTargetEnabled); + return this; + } + + public DatabaseBlobAuditingPolicyImpl withQueueDelayMs(Integer queueDelayMs) { + this.innerModel().withQueueDelayMs(queueDelayMs); + return this; + } + + public DatabaseBlobAuditingPolicyImpl withIsManagedIdentityInUse(Boolean isManagedIdentityInUse) { + this.innerModel().withIsManagedIdentityInUse(isManagedIdentityInUse); + return this; + } + + public DatabaseBlobAuditingPolicyImpl withState(BlobAuditingPolicyState state) { + this.innerModel().withState(state); + return this; + } + + public DatabaseBlobAuditingPolicyImpl withStorageEndpoint(String storageEndpoint) { + this.innerModel().withStorageEndpoint(storageEndpoint); + return this; + } + + public DatabaseBlobAuditingPolicyImpl withStorageAccountAccessKey(String storageAccountAccessKey) { + this.innerModel().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + public DatabaseBlobAuditingPolicyImpl withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId) { + this.innerModel().withStorageAccountSubscriptionId(storageAccountSubscriptionId); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseColumnImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseColumnImpl.java new file mode 100644 index 0000000000000..e42566439a41b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseColumnImpl.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseColumnInner; +import com.azure.resourcemanager.sql.generated.models.ColumnDataType; +import com.azure.resourcemanager.sql.generated.models.DatabaseColumn; +import com.azure.resourcemanager.sql.generated.models.TableTemporalType; + +public final class DatabaseColumnImpl implements DatabaseColumn { + private DatabaseColumnInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + DatabaseColumnImpl( + DatabaseColumnInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public ColumnDataType columnType() { + return this.innerModel().columnType(); + } + + public TableTemporalType temporalType() { + return this.innerModel().temporalType(); + } + + public Boolean memoryOptimized() { + return this.innerModel().memoryOptimized(); + } + + public Boolean isComputed() { + return this.innerModel().isComputed(); + } + + public DatabaseColumnInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseColumnsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseColumnsClientImpl.java new file mode 100644 index 0000000000000..ce98e078af3df --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseColumnsClientImpl.java @@ -0,0 +1,1169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseColumnsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseColumnInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseColumnListResult; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DatabaseColumnsClient. */ +public final class DatabaseColumnsClientImpl implements DatabaseColumnsClient { + /** The proxy service used to perform REST calls. */ + private final DatabaseColumnsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseColumnsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DatabaseColumnsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(DatabaseColumnsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientDatabaseColumns to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientD") + public interface DatabaseColumnsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/columns") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @QueryParam(value = "schema", multipleQueryParams = true) List schema, + @QueryParam(value = "table", multipleQueryParams = true) List table, + @QueryParam(value = "column", multipleQueryParams = true) List column, + @QueryParam(value = "orderBy", multipleQueryParams = true) List orderBy, + @QueryParam("$skiptoken") String skiptoken, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByTable( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("schemaName") String schemaName, + @PathParam("tableName") String tableName, + @QueryParam("$filter") String filter, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("schemaName") String schemaName, + @PathParam("tableName") String tableName, + @PathParam("columnName") String columnName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabaseNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByTableNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List database columns. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schema Array of Get3ItemsItem. + * @param table Array of Get4ItemsItem. + * @param column Array of Get5ItemsItem. + * @param orderBy Array of Get6ItemsItem. + * @param skiptoken An opaque token that identifies a starting point in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database columns along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, + String serverName, + String databaseName, + List schema, + List table, + List column, + List orderBy, + String skiptoken) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + List schemaConverted = + (schema == null) + ? new ArrayList<>() + : schema.stream().map(item -> Objects.toString(item, "")).collect(Collectors.toList()); + List tableConverted = + (table == null) + ? new ArrayList<>() + : table.stream().map(item -> Objects.toString(item, "")).collect(Collectors.toList()); + List columnConverted = + (column == null) + ? new ArrayList<>() + : column.stream().map(item -> Objects.toString(item, "")).collect(Collectors.toList()); + List orderByConverted = + (orderBy == null) + ? new ArrayList<>() + : orderBy.stream().map(item -> Objects.toString(item, "")).collect(Collectors.toList()); + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + schemaConverted, + tableConverted, + columnConverted, + orderByConverted, + skiptoken, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List database columns. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schema Array of Get3ItemsItem. + * @param table Array of Get4ItemsItem. + * @param column Array of Get5ItemsItem. + * @param orderBy Array of Get6ItemsItem. + * @param skiptoken An opaque token that identifies a starting point in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database columns along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, + String serverName, + String databaseName, + List schema, + List table, + List column, + List orderBy, + String skiptoken, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + List schemaConverted = + (schema == null) + ? new ArrayList<>() + : schema.stream().map(item -> Objects.toString(item, "")).collect(Collectors.toList()); + List tableConverted = + (table == null) + ? new ArrayList<>() + : table.stream().map(item -> Objects.toString(item, "")).collect(Collectors.toList()); + List columnConverted = + (column == null) + ? new ArrayList<>() + : column.stream().map(item -> Objects.toString(item, "")).collect(Collectors.toList()); + List orderByConverted = + (orderBy == null) + ? new ArrayList<>() + : orderBy.stream().map(item -> Objects.toString(item, "")).collect(Collectors.toList()); + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + schemaConverted, + tableConverted, + columnConverted, + orderByConverted, + skiptoken, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List database columns. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schema Array of Get3ItemsItem. + * @param table Array of Get4ItemsItem. + * @param column Array of Get5ItemsItem. + * @param orderBy Array of Get6ItemsItem. + * @param skiptoken An opaque token that identifies a starting point in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database columns as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, + String serverName, + String databaseName, + List schema, + List table, + List column, + List orderBy, + String skiptoken) { + return new PagedFlux<>( + () -> + listByDatabaseSinglePageAsync( + resourceGroupName, serverName, databaseName, schema, table, column, orderBy, skiptoken), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * List database columns. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database columns as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName) { + final List schema = null; + final List table = null; + final List column = null; + final List orderBy = null; + final String skiptoken = null; + return new PagedFlux<>( + () -> + listByDatabaseSinglePageAsync( + resourceGroupName, serverName, databaseName, schema, table, column, orderBy, skiptoken), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * List database columns. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schema Array of Get3ItemsItem. + * @param table Array of Get4ItemsItem. + * @param column Array of Get5ItemsItem. + * @param orderBy Array of Get6ItemsItem. + * @param skiptoken An opaque token that identifies a starting point in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database columns as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, + String serverName, + String databaseName, + List schema, + List table, + List column, + List orderBy, + String skiptoken, + Context context) { + return new PagedFlux<>( + () -> + listByDatabaseSinglePageAsync( + resourceGroupName, serverName, databaseName, schema, table, column, orderBy, skiptoken, context), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * List database columns. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database columns as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + final List schema = null; + final List table = null; + final List column = null; + final List orderBy = null; + final String skiptoken = null; + return new PagedIterable<>( + listByDatabaseAsync( + resourceGroupName, serverName, databaseName, schema, table, column, orderBy, skiptoken)); + } + + /** + * List database columns. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schema Array of Get3ItemsItem. + * @param table Array of Get4ItemsItem. + * @param column Array of Get5ItemsItem. + * @param orderBy Array of Get6ItemsItem. + * @param skiptoken An opaque token that identifies a starting point in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database columns as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, + String serverName, + String databaseName, + List schema, + List table, + List column, + List orderBy, + String skiptoken, + Context context) { + return new PagedIterable<>( + listByDatabaseAsync( + resourceGroupName, serverName, databaseName, schema, table, column, orderBy, skiptoken, context)); + } + + /** + * List database columns. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param 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 filter An OData filter expression that filters elements in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database columns along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByTableSinglePageAsync( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByTable( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + schemaName, + tableName, + filter, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List database columns. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param 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 filter An OData filter expression that filters elements in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database columns along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByTableSinglePageAsync( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String filter, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByTable( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + schemaName, + tableName, + filter, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List database columns. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param 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 filter An OData filter expression that filters elements in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database columns as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByTableAsync( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String filter) { + return new PagedFlux<>( + () -> + listByTableSinglePageAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, filter), + nextLink -> listByTableNextSinglePageAsync(nextLink)); + } + + /** + * List database columns. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database columns as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByTableAsync( + String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName) { + final String filter = null; + return new PagedFlux<>( + () -> + listByTableSinglePageAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, filter), + nextLink -> listByTableNextSinglePageAsync(nextLink)); + } + + /** + * List database columns. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param 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 filter An OData filter expression that filters elements in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database columns as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByTableAsync( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String filter, + Context context) { + return new PagedFlux<>( + () -> + listByTableSinglePageAsync( + resourceGroupName, serverName, databaseName, schemaName, tableName, filter, context), + nextLink -> listByTableNextSinglePageAsync(nextLink, context)); + } + + /** + * List database columns. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database columns as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByTable( + String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName) { + final String filter = null; + return new PagedIterable<>( + listByTableAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, filter)); + } + + /** + * List database columns. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param 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 filter An OData filter expression that filters elements in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database columns as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByTable( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String filter, + Context context) { + return new PagedIterable<>( + listByTableAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, filter, context)); + } + + /** + * Get database 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database column along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (columnName == null) { + return Mono.error(new IllegalArgumentException("Parameter columnName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + schemaName, + tableName, + columnName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get database 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database column along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (columnName == null) { + return Mono.error(new IllegalArgumentException("Parameter columnName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + schemaName, + tableName, + columnName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Get database 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database column on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get database 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database column along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context) { + return getWithResponseAsync( + resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, context) + .block(); + } + + /** + * Get database 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database column. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseColumnInner get( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + return getWithResponse( + resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, Context.NONE) + .getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database columns along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database columns along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database columns along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByTableNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByTableNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database columns along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByTableNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByTableNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseColumnsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseColumnsImpl.java new file mode 100644 index 0000000000000..0244d5ffb12d8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseColumnsImpl.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseColumnsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseColumnInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseColumn; +import com.azure.resourcemanager.sql.generated.models.DatabaseColumns; +import java.util.List; + +public final class DatabaseColumnsImpl implements DatabaseColumns { + private static final ClientLogger LOGGER = new ClientLogger(DatabaseColumnsImpl.class); + + private final DatabaseColumnsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public DatabaseColumnsImpl( + DatabaseColumnsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName); + return Utils.mapPage(inner, inner1 -> new DatabaseColumnImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, + String serverName, + String databaseName, + List schema, + List table, + List column, + List orderBy, + String skiptoken, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByDatabase( + resourceGroupName, serverName, databaseName, schema, table, column, orderBy, skiptoken, context); + return Utils.mapPage(inner, inner1 -> new DatabaseColumnImpl(inner1, this.manager())); + } + + public PagedIterable listByTable( + String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName) { + PagedIterable inner = + this.serviceClient().listByTable(resourceGroupName, serverName, databaseName, schemaName, tableName); + return Utils.mapPage(inner, inner1 -> new DatabaseColumnImpl(inner1, this.manager())); + } + + public PagedIterable listByTable( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String filter, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByTable(resourceGroupName, serverName, databaseName, schemaName, tableName, filter, context); + return Utils.mapPage(inner, inner1 -> new DatabaseColumnImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse( + resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatabaseColumnImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DatabaseColumn get( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + DatabaseColumnInner inner = + this.serviceClient().get(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName); + if (inner != null) { + return new DatabaseColumnImpl(inner, this.manager()); + } else { + return null; + } + } + + private DatabaseColumnsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseExtensionsOperationsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseExtensionsOperationsClientImpl.java new file mode 100644 index 0000000000000..17e544eb1dce2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseExtensionsOperationsClientImpl.java @@ -0,0 +1,961 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseExtensionsOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ImportExportExtensionsOperationResultInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseExtensions; +import com.azure.resourcemanager.sql.generated.models.ImportExportExtensionsOperationListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DatabaseExtensionsOperationsClient. */ +public final class DatabaseExtensionsOperationsClientImpl implements DatabaseExtensionsOperationsClient { + /** The proxy service used to perform REST calls. */ + private final DatabaseExtensionsOperationsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseExtensionsOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DatabaseExtensionsOperationsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + DatabaseExtensionsOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientDatabaseExtensionsOperations to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientD") + public interface DatabaseExtensionsOperationsService { + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/extensions/{extensionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("extensionName") String extensionName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/extensions/{extensionName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("extensionName") String extensionName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DatabaseExtensions parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/extensions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabaseNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a database extension. This will return resource not found as it is not supported. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param extensionName The extensionName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database extension along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String extensionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (extensionName == null) { + return Mono.error(new IllegalArgumentException("Parameter extensionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-02-01-preview"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + extensionName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a database extension. This will return resource not found as it is not supported. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param extensionName The extensionName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database extension along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String extensionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (extensionName == null) { + return Mono.error(new IllegalArgumentException("Parameter extensionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-02-01-preview"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + extensionName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Gets a database extension. This will return resource not found as it is not supported. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param extensionName The extensionName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database extension on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String databaseName, String extensionName) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, extensionName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Gets a database extension. This will return resource not found as it is not supported. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param extensionName The extensionName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database extension along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, String extensionName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, extensionName, context).block(); + } + + /** + * Gets a database extension. This will return resource not found as it is not supported. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param extensionName The extensionName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void get(String resourceGroupName, String serverName, String databaseName, String extensionName) { + getWithResponse(resourceGroupName, serverName, databaseName, extensionName, Context.NONE); + } + + /** + * Perform a database extension operation, like polybase import. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param extensionName The extensionName parameter. + * @param parameters The database import request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Extension operation result resource along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String extensionName, + DatabaseExtensions parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (extensionName == null) { + return Mono.error(new IllegalArgumentException("Parameter extensionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + extensionName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Perform a database extension operation, like polybase import. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param extensionName The extensionName parameter. + * @param parameters The database import request parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Extension operation result resource along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String extensionName, + DatabaseExtensions parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (extensionName == null) { + return Mono.error(new IllegalArgumentException("Parameter extensionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + extensionName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Perform a database extension operation, like polybase import. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param extensionName The extensionName parameter. + * @param parameters The database import request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an Extension operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux< + PollResult, ImportExportExtensionsOperationResultInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String extensionName, + DatabaseExtensions parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, databaseName, extensionName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ImportExportExtensionsOperationResultInner.class, + ImportExportExtensionsOperationResultInner.class, + this.client.getContext()); + } + + /** + * Perform a database extension operation, like polybase import. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param extensionName The extensionName parameter. + * @param parameters The database import request parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an Extension operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux< + PollResult, ImportExportExtensionsOperationResultInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String extensionName, + DatabaseExtensions parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, serverName, databaseName, extensionName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ImportExportExtensionsOperationResultInner.class, + ImportExportExtensionsOperationResultInner.class, + context); + } + + /** + * Perform a database extension operation, like polybase import. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param extensionName The extensionName parameter. + * @param parameters The database import request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Extension operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller< + PollResult, ImportExportExtensionsOperationResultInner> + beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String extensionName, + DatabaseExtensions parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, extensionName, parameters) + .getSyncPoller(); + } + + /** + * Perform a database extension operation, like polybase import. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param extensionName The extensionName parameter. + * @param parameters The database import request parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Extension operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller< + PollResult, ImportExportExtensionsOperationResultInner> + beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String extensionName, + DatabaseExtensions parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, extensionName, parameters, context) + .getSyncPoller(); + } + + /** + * Perform a database extension operation, like polybase import. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param extensionName The extensionName parameter. + * @param parameters The database import request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Extension operation result resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String extensionName, + DatabaseExtensions parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, extensionName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Perform a database extension operation, like polybase import. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param extensionName The extensionName parameter. + * @param parameters The database import request parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Extension operation result resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String extensionName, + DatabaseExtensions parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, extensionName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Perform a database extension operation, like polybase import. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param extensionName The extensionName parameter. + * @param parameters The database import request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Extension operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ImportExportExtensionsOperationResultInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String extensionName, + DatabaseExtensions parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, databaseName, extensionName, parameters).block(); + } + + /** + * Perform a database extension operation, like polybase import. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param extensionName The extensionName parameter. + * @param parameters The database import request parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Extension operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ImportExportExtensionsOperationResultInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String extensionName, + DatabaseExtensions parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, databaseName, extensionName, parameters, context) + .block(); + } + + /** + * List database extension. This will return an empty list as it is not supported. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return import export operation extensions list along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List database extension. This will return an empty list as it is not supported. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return import export operation extensions list along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List database extension. This will return an empty list as it is not supported. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return import export operation extensions list as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * List database extension. This will return an empty list as it is not supported. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return import export operation extensions list as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, context), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * List database extension. This will return an empty list as it is not supported. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return import export operation extensions list as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName)); + } + + /** + * List database extension. This will return an empty list as it is not supported. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return import export operation extensions list as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return import export operation extensions list along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return import export operation extensions list along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseExtensionsOperationsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseExtensionsOperationsImpl.java new file mode 100644 index 0000000000000..81fbe45caa969 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseExtensionsOperationsImpl.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseExtensionsOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ImportExportExtensionsOperationResultInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseExtensionsOperations; +import com.azure.resourcemanager.sql.generated.models.ImportExportExtensionsOperationResult; + +public final class DatabaseExtensionsOperationsImpl implements DatabaseExtensionsOperations { + private static final ClientLogger LOGGER = new ClientLogger(DatabaseExtensionsOperationsImpl.class); + + private final DatabaseExtensionsOperationsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public DatabaseExtensionsOperationsImpl( + DatabaseExtensionsOperationsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, String extensionName, Context context) { + return this + .serviceClient() + .getWithResponse(resourceGroupName, serverName, databaseName, extensionName, context); + } + + public void get(String resourceGroupName, String serverName, String databaseName, String extensionName) { + this.serviceClient().get(resourceGroupName, serverName, databaseName, extensionName); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName); + return Utils.mapPage(inner, inner1 -> new ImportExportExtensionsOperationResultImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName, context); + return Utils.mapPage(inner, inner1 -> new ImportExportExtensionsOperationResultImpl(inner1, this.manager())); + } + + private DatabaseExtensionsOperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ImportExportExtensionsOperationResultImpl define(String name) { + return new ImportExportExtensionsOperationResultImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseImpl.java new file mode 100644 index 0000000000000..539a3d79031d3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseImpl.java @@ -0,0 +1,647 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseInner; +import com.azure.resourcemanager.sql.generated.models.AlwaysEncryptedEnclaveType; +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.azure.resourcemanager.sql.generated.models.CatalogCollationType; +import com.azure.resourcemanager.sql.generated.models.CreateMode; +import com.azure.resourcemanager.sql.generated.models.Database; +import com.azure.resourcemanager.sql.generated.models.DatabaseIdentity; +import com.azure.resourcemanager.sql.generated.models.DatabaseLicenseType; +import com.azure.resourcemanager.sql.generated.models.DatabaseReadScale; +import com.azure.resourcemanager.sql.generated.models.DatabaseStatus; +import com.azure.resourcemanager.sql.generated.models.DatabaseUpdate; +import com.azure.resourcemanager.sql.generated.models.ExportDatabaseDefinition; +import com.azure.resourcemanager.sql.generated.models.ImportExistingDatabaseDefinition; +import com.azure.resourcemanager.sql.generated.models.ImportExportOperationResult; +import com.azure.resourcemanager.sql.generated.models.ReplicaType; +import com.azure.resourcemanager.sql.generated.models.ResourceMoveDefinition; +import com.azure.resourcemanager.sql.generated.models.SampleName; +import com.azure.resourcemanager.sql.generated.models.SecondaryType; +import com.azure.resourcemanager.sql.generated.models.Sku; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.Map; +import java.util.UUID; + +public final class DatabaseImpl implements Database, Database.Definition, Database.Update { + private DatabaseInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public Sku sku() { + return this.innerModel().sku(); + } + + public String kind() { + return this.innerModel().kind(); + } + + public String managedBy() { + return this.innerModel().managedBy(); + } + + public DatabaseIdentity identity() { + return this.innerModel().identity(); + } + + public CreateMode createMode() { + return this.innerModel().createMode(); + } + + public String collation() { + return this.innerModel().collation(); + } + + public Long maxSizeBytes() { + return this.innerModel().maxSizeBytes(); + } + + public SampleName sampleName() { + return this.innerModel().sampleName(); + } + + public String elasticPoolId() { + return this.innerModel().elasticPoolId(); + } + + public String sourceDatabaseId() { + return this.innerModel().sourceDatabaseId(); + } + + public DatabaseStatus status() { + return this.innerModel().status(); + } + + public UUID databaseId() { + return this.innerModel().databaseId(); + } + + public OffsetDateTime creationDate() { + return this.innerModel().creationDate(); + } + + public String currentServiceObjectiveName() { + return this.innerModel().currentServiceObjectiveName(); + } + + public String requestedServiceObjectiveName() { + return this.innerModel().requestedServiceObjectiveName(); + } + + public String defaultSecondaryLocation() { + return this.innerModel().defaultSecondaryLocation(); + } + + public String failoverGroupId() { + return this.innerModel().failoverGroupId(); + } + + public OffsetDateTime restorePointInTime() { + return this.innerModel().restorePointInTime(); + } + + public OffsetDateTime sourceDatabaseDeletionDate() { + return this.innerModel().sourceDatabaseDeletionDate(); + } + + public String recoveryServicesRecoveryPointId() { + return this.innerModel().recoveryServicesRecoveryPointId(); + } + + public String longTermRetentionBackupResourceId() { + return this.innerModel().longTermRetentionBackupResourceId(); + } + + public String recoverableDatabaseId() { + return this.innerModel().recoverableDatabaseId(); + } + + public String restorableDroppedDatabaseId() { + return this.innerModel().restorableDroppedDatabaseId(); + } + + public CatalogCollationType catalogCollation() { + return this.innerModel().catalogCollation(); + } + + public Boolean zoneRedundant() { + return this.innerModel().zoneRedundant(); + } + + public DatabaseLicenseType licenseType() { + return this.innerModel().licenseType(); + } + + public Long maxLogSizeBytes() { + return this.innerModel().maxLogSizeBytes(); + } + + public OffsetDateTime earliestRestoreDate() { + return this.innerModel().earliestRestoreDate(); + } + + public DatabaseReadScale readScale() { + return this.innerModel().readScale(); + } + + public Integer highAvailabilityReplicaCount() { + return this.innerModel().highAvailabilityReplicaCount(); + } + + public SecondaryType secondaryType() { + return this.innerModel().secondaryType(); + } + + public Sku currentSku() { + return this.innerModel().currentSku(); + } + + public Integer autoPauseDelay() { + return this.innerModel().autoPauseDelay(); + } + + public BackupStorageRedundancy currentBackupStorageRedundancy() { + return this.innerModel().currentBackupStorageRedundancy(); + } + + public BackupStorageRedundancy requestedBackupStorageRedundancy() { + return this.innerModel().requestedBackupStorageRedundancy(); + } + + public Double minCapacity() { + return this.innerModel().minCapacity(); + } + + public OffsetDateTime pausedDate() { + return this.innerModel().pausedDate(); + } + + public OffsetDateTime resumedDate() { + return this.innerModel().resumedDate(); + } + + public String maintenanceConfigurationId() { + return this.innerModel().maintenanceConfigurationId(); + } + + public Boolean isLedgerOn() { + return this.innerModel().isLedgerOn(); + } + + public Boolean isInfraEncryptionEnabled() { + return this.innerModel().isInfraEncryptionEnabled(); + } + + public UUID federatedClientId() { + return this.innerModel().federatedClientId(); + } + + public AlwaysEncryptedEnclaveType preferredEnclaveType() { + return this.innerModel().preferredEnclaveType(); + } + + public String sourceResourceId() { + return this.innerModel().sourceResourceId(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public DatabaseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String databaseName; + + private DatabaseUpdate updateParameters; + + public DatabaseImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public Database create() { + this.innerObject = + serviceManager + .serviceClient() + .getDatabases() + .createOrUpdate(resourceGroupName, serverName, databaseName, this.innerModel(), Context.NONE); + return this; + } + + public Database create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabases() + .createOrUpdate(resourceGroupName, serverName, databaseName, this.innerModel(), context); + return this; + } + + DatabaseImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new DatabaseInner(); + this.serviceManager = serviceManager; + this.databaseName = name; + } + + public DatabaseImpl update() { + this.updateParameters = new DatabaseUpdate(); + return this; + } + + public Database apply() { + this.innerObject = + serviceManager + .serviceClient() + .getDatabases() + .update(resourceGroupName, serverName, databaseName, updateParameters, Context.NONE); + return this; + } + + public Database apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabases() + .update(resourceGroupName, serverName, databaseName, updateParameters, context); + return this; + } + + DatabaseImpl(DatabaseInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "databases"); + } + + public Database refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getDatabases() + .getWithResponse(resourceGroupName, serverName, databaseName, Context.NONE) + .getValue(); + return this; + } + + public Database refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabases() + .getWithResponse(resourceGroupName, serverName, databaseName, context) + .getValue(); + return this; + } + + public ImportExportOperationResult export(ExportDatabaseDefinition parameters) { + return serviceManager.databases().export(resourceGroupName, serverName, databaseName, parameters); + } + + public ImportExportOperationResult export(ExportDatabaseDefinition parameters, Context context) { + return serviceManager.databases().export(resourceGroupName, serverName, databaseName, parameters, context); + } + + public void failover() { + serviceManager.databases().failover(resourceGroupName, serverName, databaseName); + } + + public void failover(ReplicaType replicaType, Context context) { + serviceManager.databases().failover(resourceGroupName, serverName, databaseName, replicaType, context); + } + + public ImportExportOperationResult importMethod(ImportExistingDatabaseDefinition parameters) { + return serviceManager.databases().importMethod(resourceGroupName, serverName, databaseName, parameters); + } + + public ImportExportOperationResult importMethod(ImportExistingDatabaseDefinition parameters, Context context) { + return serviceManager + .databases() + .importMethod(resourceGroupName, serverName, databaseName, parameters, context); + } + + public Response renameWithResponse(ResourceMoveDefinition parameters, Context context) { + return serviceManager + .databases() + .renameWithResponse(resourceGroupName, serverName, databaseName, parameters, context); + } + + public void rename(ResourceMoveDefinition parameters) { + serviceManager.databases().rename(resourceGroupName, serverName, databaseName, parameters); + } + + public Database pause() { + return serviceManager.databases().pause(resourceGroupName, serverName, databaseName); + } + + public Database pause(Context context) { + return serviceManager.databases().pause(resourceGroupName, serverName, databaseName, context); + } + + public Database resume() { + return serviceManager.databases().resume(resourceGroupName, serverName, databaseName); + } + + public Database resume(Context context) { + return serviceManager.databases().resume(resourceGroupName, serverName, databaseName, context); + } + + public void upgradeDataWarehouse() { + serviceManager.databases().upgradeDataWarehouse(resourceGroupName, serverName, databaseName); + } + + public void upgradeDataWarehouse(Context context) { + serviceManager.databases().upgradeDataWarehouse(resourceGroupName, serverName, databaseName, context); + } + + public DatabaseImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public DatabaseImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public DatabaseImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public DatabaseImpl withSku(Sku sku) { + if (isInCreateMode()) { + this.innerModel().withSku(sku); + return this; + } else { + this.updateParameters.withSku(sku); + return this; + } + } + + public DatabaseImpl withIdentity(DatabaseIdentity identity) { + if (isInCreateMode()) { + this.innerModel().withIdentity(identity); + return this; + } else { + this.updateParameters.withIdentity(identity); + return this; + } + } + + public DatabaseImpl withCreateMode(CreateMode createMode) { + this.innerModel().withCreateMode(createMode); + return this; + } + + public DatabaseImpl withCollation(String collation) { + this.innerModel().withCollation(collation); + return this; + } + + public DatabaseImpl withMaxSizeBytes(Long maxSizeBytes) { + if (isInCreateMode()) { + this.innerModel().withMaxSizeBytes(maxSizeBytes); + return this; + } else { + this.updateParameters.withMaxSizeBytes(maxSizeBytes); + return this; + } + } + + public DatabaseImpl withSampleName(SampleName sampleName) { + this.innerModel().withSampleName(sampleName); + return this; + } + + public DatabaseImpl withElasticPoolId(String elasticPoolId) { + if (isInCreateMode()) { + this.innerModel().withElasticPoolId(elasticPoolId); + return this; + } else { + this.updateParameters.withElasticPoolId(elasticPoolId); + return this; + } + } + + public DatabaseImpl withSourceDatabaseId(String sourceDatabaseId) { + this.innerModel().withSourceDatabaseId(sourceDatabaseId); + return this; + } + + public DatabaseImpl withRestorePointInTime(OffsetDateTime restorePointInTime) { + this.innerModel().withRestorePointInTime(restorePointInTime); + return this; + } + + public DatabaseImpl withSourceDatabaseDeletionDate(OffsetDateTime sourceDatabaseDeletionDate) { + this.innerModel().withSourceDatabaseDeletionDate(sourceDatabaseDeletionDate); + return this; + } + + public DatabaseImpl withRecoveryServicesRecoveryPointId(String recoveryServicesRecoveryPointId) { + this.innerModel().withRecoveryServicesRecoveryPointId(recoveryServicesRecoveryPointId); + return this; + } + + public DatabaseImpl withLongTermRetentionBackupResourceId(String longTermRetentionBackupResourceId) { + this.innerModel().withLongTermRetentionBackupResourceId(longTermRetentionBackupResourceId); + return this; + } + + public DatabaseImpl withRecoverableDatabaseId(String recoverableDatabaseId) { + this.innerModel().withRecoverableDatabaseId(recoverableDatabaseId); + return this; + } + + public DatabaseImpl withRestorableDroppedDatabaseId(String restorableDroppedDatabaseId) { + this.innerModel().withRestorableDroppedDatabaseId(restorableDroppedDatabaseId); + return this; + } + + public DatabaseImpl withCatalogCollation(CatalogCollationType catalogCollation) { + this.innerModel().withCatalogCollation(catalogCollation); + return this; + } + + public DatabaseImpl withZoneRedundant(Boolean zoneRedundant) { + if (isInCreateMode()) { + this.innerModel().withZoneRedundant(zoneRedundant); + return this; + } else { + this.updateParameters.withZoneRedundant(zoneRedundant); + return this; + } + } + + public DatabaseImpl withLicenseType(DatabaseLicenseType licenseType) { + if (isInCreateMode()) { + this.innerModel().withLicenseType(licenseType); + return this; + } else { + this.updateParameters.withLicenseType(licenseType); + return this; + } + } + + public DatabaseImpl withHighAvailabilityReplicaCount(Integer highAvailabilityReplicaCount) { + if (isInCreateMode()) { + this.innerModel().withHighAvailabilityReplicaCount(highAvailabilityReplicaCount); + return this; + } else { + this.updateParameters.withHighAvailabilityReplicaCount(highAvailabilityReplicaCount); + return this; + } + } + + public DatabaseImpl withSecondaryType(SecondaryType secondaryType) { + if (isInCreateMode()) { + this.innerModel().withSecondaryType(secondaryType); + return this; + } else { + this.updateParameters.withSecondaryType(secondaryType); + return this; + } + } + + public DatabaseImpl withAutoPauseDelay(Integer autoPauseDelay) { + if (isInCreateMode()) { + this.innerModel().withAutoPauseDelay(autoPauseDelay); + return this; + } else { + this.updateParameters.withAutoPauseDelay(autoPauseDelay); + return this; + } + } + + public DatabaseImpl withRequestedBackupStorageRedundancy(BackupStorageRedundancy requestedBackupStorageRedundancy) { + if (isInCreateMode()) { + this.innerModel().withRequestedBackupStorageRedundancy(requestedBackupStorageRedundancy); + return this; + } else { + this.updateParameters.withRequestedBackupStorageRedundancy(requestedBackupStorageRedundancy); + return this; + } + } + + public DatabaseImpl withMinCapacity(Double minCapacity) { + if (isInCreateMode()) { + this.innerModel().withMinCapacity(minCapacity); + return this; + } else { + this.updateParameters.withMinCapacity(minCapacity); + return this; + } + } + + public DatabaseImpl withMaintenanceConfigurationId(String maintenanceConfigurationId) { + if (isInCreateMode()) { + this.innerModel().withMaintenanceConfigurationId(maintenanceConfigurationId); + return this; + } else { + this.updateParameters.withMaintenanceConfigurationId(maintenanceConfigurationId); + return this; + } + } + + public DatabaseImpl withIsLedgerOn(Boolean isLedgerOn) { + if (isInCreateMode()) { + this.innerModel().withIsLedgerOn(isLedgerOn); + return this; + } else { + this.updateParameters.withIsLedgerOn(isLedgerOn); + return this; + } + } + + public DatabaseImpl withFederatedClientId(UUID federatedClientId) { + if (isInCreateMode()) { + this.innerModel().withFederatedClientId(federatedClientId); + return this; + } else { + this.updateParameters.withFederatedClientId(federatedClientId); + return this; + } + } + + public DatabaseImpl withPreferredEnclaveType(AlwaysEncryptedEnclaveType preferredEnclaveType) { + if (isInCreateMode()) { + this.innerModel().withPreferredEnclaveType(preferredEnclaveType); + return this; + } else { + this.updateParameters.withPreferredEnclaveType(preferredEnclaveType); + return this; + } + } + + public DatabaseImpl withSourceResourceId(String sourceResourceId) { + this.innerModel().withSourceResourceId(sourceResourceId); + return this; + } + + public DatabaseImpl withReadScale(DatabaseReadScale readScale) { + this.updateParameters.withReadScale(readScale); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseOperationImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseOperationImpl.java new file mode 100644 index 0000000000000..5c88983da58c5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseOperationImpl.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseOperationInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseOperation; +import com.azure.resourcemanager.sql.generated.models.ManagementOperationState; +import java.time.OffsetDateTime; + +public final class DatabaseOperationImpl implements DatabaseOperation { + private DatabaseOperationInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + DatabaseOperationImpl( + DatabaseOperationInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String databaseName() { + return this.innerModel().databaseName(); + } + + public String operation() { + return this.innerModel().operation(); + } + + public String operationFriendlyName() { + return this.innerModel().operationFriendlyName(); + } + + public Integer percentComplete() { + return this.innerModel().percentComplete(); + } + + public String serverName() { + return this.innerModel().serverName(); + } + + public OffsetDateTime startTime() { + return this.innerModel().startTime(); + } + + public ManagementOperationState state() { + return this.innerModel().state(); + } + + public Integer errorCode() { + return this.innerModel().errorCode(); + } + + public String errorDescription() { + return this.innerModel().errorDescription(); + } + + public Integer errorSeverity() { + return this.innerModel().errorSeverity(); + } + + public Boolean isUserError() { + return this.innerModel().isUserError(); + } + + public OffsetDateTime estimatedCompletionTime() { + return this.innerModel().estimatedCompletionTime(); + } + + public String description() { + return this.innerModel().description(); + } + + public Boolean isCancellable() { + return this.innerModel().isCancellable(); + } + + public DatabaseOperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseOperationsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseOperationsClientImpl.java new file mode 100644 index 0000000000000..f9b9197fb2a54 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseOperationsClientImpl.java @@ -0,0 +1,555 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseOperationInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseOperationListResult; +import java.util.UUID; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DatabaseOperationsClient. */ +public final class DatabaseOperationsClientImpl implements DatabaseOperationsClient { + /** The proxy service used to perform REST calls. */ + private final DatabaseOperationsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DatabaseOperationsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(DatabaseOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientDatabaseOperations to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientD") + public interface DatabaseOperationsService { + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/operations/{operationId}/cancel") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> cancel( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("operationId") UUID operationId, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabaseNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> cancelWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, UUID operationId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-02-01-preview"; + return FluxUtil + .withContext( + context -> + service + .cancel( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + operationId, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> cancelWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, UUID operationId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-02-01-preview"; + context = this.client.mergeContext(context); + return service + .cancel( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + operationId, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono cancelAsync(String resourceGroupName, String serverName, String databaseName, UUID operationId) { + return cancelWithResponseAsync(resourceGroupName, serverName, databaseName, operationId) + .flatMap(ignored -> Mono.empty()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response cancelWithResponse( + String resourceGroupName, String serverName, String databaseName, UUID operationId, Context context) { + return cancelWithResponseAsync(resourceGroupName, serverName, databaseName, operationId, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void cancel(String resourceGroupName, String serverName, String databaseName, UUID operationId) { + cancelWithResponse(resourceGroupName, serverName, databaseName, operationId, Context.NONE); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of operations performed on the database along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of operations performed on the database along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of operations performed on the database as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of operations performed on the database as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, context), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of operations performed on the database as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of operations performed on the database as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list database operations request along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list database operations request along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseOperationsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseOperationsImpl.java new file mode 100644 index 0000000000000..2d3ad9713dcdf --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseOperationsImpl.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseOperationInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseOperation; +import com.azure.resourcemanager.sql.generated.models.DatabaseOperations; +import java.util.UUID; + +public final class DatabaseOperationsImpl implements DatabaseOperations { + private static final ClientLogger LOGGER = new ClientLogger(DatabaseOperationsImpl.class); + + private final DatabaseOperationsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public DatabaseOperationsImpl( + DatabaseOperationsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response cancelWithResponse( + String resourceGroupName, String serverName, String databaseName, UUID operationId, Context context) { + return this + .serviceClient() + .cancelWithResponse(resourceGroupName, serverName, databaseName, operationId, context); + } + + public void cancel(String resourceGroupName, String serverName, String databaseName, UUID operationId) { + this.serviceClient().cancel(resourceGroupName, serverName, databaseName, operationId); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName); + return Utils.mapPage(inner, inner1 -> new DatabaseOperationImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName, context); + return Utils.mapPage(inner, inner1 -> new DatabaseOperationImpl(inner1, this.manager())); + } + + private DatabaseOperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseRecommendedActionsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseRecommendedActionsClientImpl.java new file mode 100644 index 0000000000000..8393e559d8d5d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseRecommendedActionsClientImpl.java @@ -0,0 +1,763 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseRecommendedActionsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.RecommendedActionInner; +import java.util.List; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DatabaseRecommendedActionsClient. */ +public final class DatabaseRecommendedActionsClientImpl implements DatabaseRecommendedActionsClient { + /** The proxy service used to perform REST calls. */ + private final DatabaseRecommendedActionsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseRecommendedActionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DatabaseRecommendedActionsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + DatabaseRecommendedActionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientDatabaseRecommendedActions to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientD") + public interface DatabaseRecommendedActionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/advisors/{advisorName}/recommendedActions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> listByDatabaseAdvisor( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("advisorName") String advisorName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/advisors/{advisorName}/recommendedActions" + + "/{recommendedActionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("advisorName") String advisorName, + @PathParam("recommendedActionName") String recommendedActionName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/advisors/{advisorName}/recommendedActions" + + "/{recommendedActionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("advisorName") String advisorName, + @PathParam("recommendedActionName") String recommendedActionName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") RecommendedActionInner parameters, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Database Recommended Actions along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listByDatabaseAdvisorWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String advisorName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (advisorName == null) { + return Mono.error(new IllegalArgumentException("Parameter advisorName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabaseAdvisor( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + advisorName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Database Recommended Actions along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listByDatabaseAdvisorWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String advisorName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (advisorName == null) { + return Mono.error(new IllegalArgumentException("Parameter advisorName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabaseAdvisor( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + advisorName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Database Recommended Actions on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseAdvisorAsync( + String resourceGroupName, String serverName, String databaseName, String advisorName) { + return listByDatabaseAdvisorWithResponseAsync(resourceGroupName, serverName, databaseName, advisorName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Database Recommended Actions along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response> listByDatabaseAdvisorWithResponse( + String resourceGroupName, String serverName, String databaseName, String advisorName, Context context) { + return listByDatabaseAdvisorWithResponseAsync(resourceGroupName, serverName, databaseName, advisorName, context) + .block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Database Recommended Actions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public List listByDatabaseAdvisor( + String resourceGroupName, String serverName, String databaseName, String advisorName) { + return listByDatabaseAdvisorWithResponse(resourceGroupName, serverName, databaseName, advisorName, Context.NONE) + .getValue(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database recommended action along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String advisorName, + String recommendedActionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (advisorName == null) { + return Mono.error(new IllegalArgumentException("Parameter advisorName is required and cannot be null.")); + } + if (recommendedActionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter recommendedActionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + advisorName, + recommendedActionName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database recommended action along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String advisorName, + String recommendedActionName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (advisorName == null) { + return Mono.error(new IllegalArgumentException("Parameter advisorName is required and cannot be null.")); + } + if (recommendedActionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter recommendedActionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + advisorName, + recommendedActionName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database recommended action on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String serverName, + String databaseName, + String advisorName, + String recommendedActionName) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, advisorName, recommendedActionName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database recommended action along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String advisorName, + String recommendedActionName, + Context context) { + return getWithResponseAsync( + resourceGroupName, serverName, databaseName, advisorName, recommendedActionName, context) + .block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database recommended action. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RecommendedActionInner get( + String resourceGroupName, + String serverName, + String databaseName, + String advisorName, + String recommendedActionName) { + return getWithResponse( + resourceGroupName, serverName, databaseName, advisorName, recommendedActionName, Context.NONE) + .getValue(); + } + + /** + * 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 parameters The requested recommended action resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database, Server or Elastic Pool Recommended Action along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String advisorName, + String recommendedActionName, + RecommendedActionInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (advisorName == null) { + return Mono.error(new IllegalArgumentException("Parameter advisorName is required and cannot be null.")); + } + if (recommendedActionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter recommendedActionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + advisorName, + recommendedActionName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 parameters The requested recommended action resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database, Server or Elastic Pool Recommended Action along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String advisorName, + String recommendedActionName, + RecommendedActionInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (advisorName == null) { + return Mono.error(new IllegalArgumentException("Parameter advisorName is required and cannot be null.")); + } + if (recommendedActionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter recommendedActionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + advisorName, + recommendedActionName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 parameters The requested recommended action resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database, Server or Elastic Pool Recommended Action on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String advisorName, + String recommendedActionName, + RecommendedActionInner parameters) { + return updateWithResponseAsync( + resourceGroupName, serverName, databaseName, advisorName, recommendedActionName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 parameters The requested recommended action resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database, Server or Elastic Pool Recommended Action along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String advisorName, + String recommendedActionName, + RecommendedActionInner parameters, + Context context) { + return updateWithResponseAsync( + resourceGroupName, serverName, databaseName, advisorName, recommendedActionName, parameters, context) + .block(); + } + + /** + * 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 parameters The requested recommended action resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database, Server or Elastic Pool Recommended Action. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RecommendedActionInner update( + String resourceGroupName, + String serverName, + String databaseName, + String advisorName, + String recommendedActionName, + RecommendedActionInner parameters) { + return updateWithResponse( + resourceGroupName, + serverName, + databaseName, + advisorName, + recommendedActionName, + parameters, + Context.NONE) + .getValue(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseRecommendedActionsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseRecommendedActionsImpl.java new file mode 100644 index 0000000000000..15cf7c41f389d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseRecommendedActionsImpl.java @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseRecommendedActionsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.RecommendedActionInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseRecommendedActions; +import com.azure.resourcemanager.sql.generated.models.RecommendedAction; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class DatabaseRecommendedActionsImpl implements DatabaseRecommendedActions { + private static final ClientLogger LOGGER = new ClientLogger(DatabaseRecommendedActionsImpl.class); + + private final DatabaseRecommendedActionsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public DatabaseRecommendedActionsImpl( + DatabaseRecommendedActionsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response> listByDatabaseAdvisorWithResponse( + String resourceGroupName, String serverName, String databaseName, String advisorName, Context context) { + Response> inner = + this + .serviceClient() + .listByDatabaseAdvisorWithResponse(resourceGroupName, serverName, databaseName, advisorName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + inner + .getValue() + .stream() + .map(inner1 -> new RecommendedActionImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return null; + } + } + + public List listByDatabaseAdvisor( + String resourceGroupName, String serverName, String databaseName, String advisorName) { + List inner = + this.serviceClient().listByDatabaseAdvisor(resourceGroupName, serverName, databaseName, advisorName); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new RecommendedActionImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String advisorName, + String recommendedActionName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse( + resourceGroupName, serverName, databaseName, advisorName, recommendedActionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RecommendedActionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public RecommendedAction get( + String resourceGroupName, + String serverName, + String databaseName, + String advisorName, + String recommendedActionName) { + RecommendedActionInner inner = + this.serviceClient().get(resourceGroupName, serverName, databaseName, advisorName, recommendedActionName); + if (inner != null) { + return new RecommendedActionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response updateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String advisorName, + String recommendedActionName, + RecommendedActionInner parameters, + Context context) { + Response inner = + this + .serviceClient() + .updateWithResponse( + resourceGroupName, + serverName, + databaseName, + advisorName, + recommendedActionName, + parameters, + context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RecommendedActionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public RecommendedAction update( + String resourceGroupName, + String serverName, + String databaseName, + String advisorName, + String recommendedActionName, + RecommendedActionInner parameters) { + RecommendedActionInner inner = + this + .serviceClient() + .update(resourceGroupName, serverName, databaseName, advisorName, recommendedActionName, parameters); + if (inner != null) { + return new RecommendedActionImpl(inner, this.manager()); + } else { + return null; + } + } + + private DatabaseRecommendedActionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSchemaImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSchemaImpl.java new file mode 100644 index 0000000000000..52d461391443a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSchemaImpl.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseSchemaInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseSchema; + +public final class DatabaseSchemaImpl implements DatabaseSchema { + private DatabaseSchemaInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + DatabaseSchemaImpl( + DatabaseSchemaInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public DatabaseSchemaInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSchemasClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSchemasClientImpl.java new file mode 100644 index 0000000000000..27db29de65c89 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSchemasClientImpl.java @@ -0,0 +1,587 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseSchemasClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseSchemaInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseSchemaListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DatabaseSchemasClient. */ +public final class DatabaseSchemasClientImpl implements DatabaseSchemasClient { + /** The proxy service used to perform REST calls. */ + private final DatabaseSchemasService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseSchemasClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DatabaseSchemasClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(DatabaseSchemasService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientDatabaseSchemas to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientD") + public interface DatabaseSchemasService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/schemas") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @QueryParam("$filter") String filter, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/schemas/{schemaName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("schemaName") String schemaName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabaseNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List 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. + * @param filter An OData filter expression that filters elements in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database schemas along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + filter, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List 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. + * @param filter An OData filter expression that filters elements in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database schemas along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + filter, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List 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. + * @param filter An OData filter expression that filters elements in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database schemas as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName, String filter) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, filter), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * List 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database schemas as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName) { + final String filter = null; + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, filter), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * List 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. + * @param filter An OData filter expression that filters elements in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database schemas as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName, String filter, Context context) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, filter, context), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * List 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database schemas as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + final String filter = null; + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName, filter)); + } + + /** + * List 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. + * @param filter An OData filter expression that filters elements in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database schemas as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, String filter, Context context) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName, filter, context)); + } + + /** + * Get 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. + * @param schemaName The name of the schema. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database schema along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String schemaName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + schemaName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get 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. + * @param schemaName The name of the schema. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database schema along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String schemaName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + schemaName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Get 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. + * @param schemaName The name of the schema. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database schema on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String databaseName, String schemaName) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, schemaName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get 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. + * @param schemaName The name of the schema. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database schema along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, String schemaName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, schemaName, context).block(); + } + + /** + * Get 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. + * @param schemaName The name of the schema. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database schema. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseSchemaInner get( + String resourceGroupName, String serverName, String databaseName, String schemaName) { + return getWithResponse(resourceGroupName, serverName, databaseName, schemaName, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database schemas along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database schemas along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSchemasImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSchemasImpl.java new file mode 100644 index 0000000000000..7710b68d5d3a7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSchemasImpl.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseSchemasClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseSchemaInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseSchema; +import com.azure.resourcemanager.sql.generated.models.DatabaseSchemas; + +public final class DatabaseSchemasImpl implements DatabaseSchemas { + private static final ClientLogger LOGGER = new ClientLogger(DatabaseSchemasImpl.class); + + private final DatabaseSchemasClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public DatabaseSchemasImpl( + DatabaseSchemasClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName); + return Utils.mapPage(inner, inner1 -> new DatabaseSchemaImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName, filter, context); + return Utils.mapPage(inner, inner1 -> new DatabaseSchemaImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, String schemaName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, databaseName, schemaName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatabaseSchemaImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DatabaseSchema get(String resourceGroupName, String serverName, String databaseName, String schemaName) { + DatabaseSchemaInner inner = this.serviceClient().get(resourceGroupName, serverName, databaseName, schemaName); + if (inner != null) { + return new DatabaseSchemaImpl(inner, this.manager()); + } else { + return null; + } + } + + private DatabaseSchemasClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSecurityAlertPoliciesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSecurityAlertPoliciesClientImpl.java new file mode 100644 index 0000000000000..5d4efd114fc8e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSecurityAlertPoliciesClientImpl.java @@ -0,0 +1,834 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseSecurityAlertPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseSecurityAlertPolicyInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseSecurityAlertListResult; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyName; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DatabaseSecurityAlertPoliciesClient. */ +public final class DatabaseSecurityAlertPoliciesClientImpl implements DatabaseSecurityAlertPoliciesClient { + /** The proxy service used to perform REST calls. */ + private final DatabaseSecurityAlertPoliciesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseSecurityAlertPoliciesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DatabaseSecurityAlertPoliciesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + DatabaseSecurityAlertPoliciesService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientDatabaseSecurityAlertPolicies to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientD") + public interface DatabaseSecurityAlertPoliciesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/securityAlertPolicies/{securityAlertPolicyName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("securityAlertPolicyName") SecurityAlertPolicyName securityAlertPolicyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/securityAlertPolicies/{securityAlertPolicyName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("securityAlertPolicyName") SecurityAlertPolicyName securityAlertPolicyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DatabaseSecurityAlertPolicyInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/securityAlertPolicies") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabaseNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a database's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the security alert policy is defined. + * @param securityAlertPolicyName The name of the security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's security alert policy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (securityAlertPolicyName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter securityAlertPolicyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + securityAlertPolicyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a database's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the security alert policy is defined. + * @param securityAlertPolicyName The name of the security alert policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's security alert policy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (securityAlertPolicyName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter securityAlertPolicyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + securityAlertPolicyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a database's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the security alert policy is defined. + * @param securityAlertPolicyName The name of the security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's security alert policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String serverName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, securityAlertPolicyName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a database's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the security alert policy is defined. + * @param securityAlertPolicyName The name of the security alert policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's security alert policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName, + Context context) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, securityAlertPolicyName, context) + .block(); + } + + /** + * Gets a database's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the security alert policy is defined. + * @param securityAlertPolicyName The name of the security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseSecurityAlertPolicyInner get( + String resourceGroupName, + String serverName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName) { + return getWithResponse(resourceGroupName, serverName, databaseName, securityAlertPolicyName, Context.NONE) + .getValue(); + } + + /** + * Creates or updates a database's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the security alert policy is defined. + * @param securityAlertPolicyName The name of the security alert policy. + * @param parameters The database security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database security alert policy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName, + DatabaseSecurityAlertPolicyInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (securityAlertPolicyName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter securityAlertPolicyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + securityAlertPolicyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a database's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the security alert policy is defined. + * @param securityAlertPolicyName The name of the security alert policy. + * @param parameters The database security alert policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database security alert policy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName, + DatabaseSecurityAlertPolicyInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (securityAlertPolicyName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter securityAlertPolicyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + securityAlertPolicyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates a database's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the security alert policy is defined. + * @param securityAlertPolicyName The name of the security alert policy. + * @param parameters The database security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database security alert policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName, + DatabaseSecurityAlertPolicyInner parameters) { + return createOrUpdateWithResponseAsync( + resourceGroupName, serverName, databaseName, securityAlertPolicyName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or updates a database's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the security alert policy is defined. + * @param securityAlertPolicyName The name of the security alert policy. + * @param parameters The database security alert policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database security alert policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName, + DatabaseSecurityAlertPolicyInner parameters, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, serverName, databaseName, securityAlertPolicyName, parameters, context) + .block(); + } + + /** + * Creates or updates a database's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the security alert policy is defined. + * @param securityAlertPolicyName The name of the security alert policy. + * @param parameters The database security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseSecurityAlertPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName, + DatabaseSecurityAlertPolicyInner parameters) { + return createOrUpdateWithResponse( + resourceGroupName, serverName, databaseName, securityAlertPolicyName, parameters, Context.NONE) + .getValue(); + } + + /** + * Gets a list of database's security alert policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the security alert policy is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's security alert policies along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of database's security alert policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the security alert policy is defined. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's security alert policies along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of database's security alert policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the security alert policy is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's security alert policies as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of database's security alert policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the security alert policy is defined. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's security alert policies as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, context), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of database's security alert policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the security alert policy is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's security alert policies as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName)); + } + + /** + * Gets a list of database's security alert policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the security alert policy is defined. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's security alert policies as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the database's security alert policies along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the database's security alert policies along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSecurityAlertPoliciesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSecurityAlertPoliciesImpl.java new file mode 100644 index 0000000000000..b050c4c950c2f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSecurityAlertPoliciesImpl.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseSecurityAlertPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseSecurityAlertPolicyInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseSecurityAlertPolicies; +import com.azure.resourcemanager.sql.generated.models.DatabaseSecurityAlertPolicy; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyName; + +public final class DatabaseSecurityAlertPoliciesImpl implements DatabaseSecurityAlertPolicies { + private static final ClientLogger LOGGER = new ClientLogger(DatabaseSecurityAlertPoliciesImpl.class); + + private final DatabaseSecurityAlertPoliciesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public DatabaseSecurityAlertPoliciesImpl( + DatabaseSecurityAlertPoliciesClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, serverName, databaseName, securityAlertPolicyName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatabaseSecurityAlertPolicyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DatabaseSecurityAlertPolicy get( + String resourceGroupName, + String serverName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName) { + DatabaseSecurityAlertPolicyInner inner = + this.serviceClient().get(resourceGroupName, serverName, databaseName, securityAlertPolicyName); + if (inner != null) { + return new DatabaseSecurityAlertPolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName); + return Utils.mapPage(inner, inner1 -> new DatabaseSecurityAlertPolicyImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName, context); + return Utils.mapPage(inner, inner1 -> new DatabaseSecurityAlertPolicyImpl(inner1, this.manager())); + } + + public DatabaseSecurityAlertPolicy getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String securityAlertPolicyNameLocal = Utils.getValueFromIdByName(id, "securityAlertPolicies"); + if (securityAlertPolicyNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'securityAlertPolicies'.", + id))); + } + SecurityAlertPolicyName securityAlertPolicyName = + SecurityAlertPolicyName.fromString(securityAlertPolicyNameLocal); + return this + .getWithResponse(resourceGroupName, serverName, databaseName, securityAlertPolicyName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String securityAlertPolicyNameLocal = Utils.getValueFromIdByName(id, "securityAlertPolicies"); + if (securityAlertPolicyNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'securityAlertPolicies'.", + id))); + } + SecurityAlertPolicyName securityAlertPolicyName = + SecurityAlertPolicyName.fromString(securityAlertPolicyNameLocal); + return this.getWithResponse(resourceGroupName, serverName, databaseName, securityAlertPolicyName, context); + } + + private DatabaseSecurityAlertPoliciesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public DatabaseSecurityAlertPolicyImpl define(SecurityAlertPolicyName name) { + return new DatabaseSecurityAlertPolicyImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSecurityAlertPolicyImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSecurityAlertPolicyImpl.java new file mode 100644 index 0000000000000..afa3b3a51ea98 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSecurityAlertPolicyImpl.java @@ -0,0 +1,240 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseSecurityAlertPolicyInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseSecurityAlertPolicy; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyName; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertsPolicyState; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class DatabaseSecurityAlertPolicyImpl + implements DatabaseSecurityAlertPolicy, DatabaseSecurityAlertPolicy.Definition, DatabaseSecurityAlertPolicy.Update { + private DatabaseSecurityAlertPolicyInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public SecurityAlertsPolicyState state() { + return this.innerModel().state(); + } + + public List disabledAlerts() { + List inner = this.innerModel().disabledAlerts(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List emailAddresses() { + List inner = this.innerModel().emailAddresses(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Boolean emailAccountAdmins() { + return this.innerModel().emailAccountAdmins(); + } + + public String storageEndpoint() { + return this.innerModel().storageEndpoint(); + } + + public String storageAccountAccessKey() { + return this.innerModel().storageAccountAccessKey(); + } + + public Integer retentionDays() { + return this.innerModel().retentionDays(); + } + + public OffsetDateTime creationTime() { + return this.innerModel().creationTime(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public DatabaseSecurityAlertPolicyInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String databaseName; + + private SecurityAlertPolicyName securityAlertPolicyName; + + public DatabaseSecurityAlertPolicyImpl withExistingDatabase( + String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + + public DatabaseSecurityAlertPolicy create() { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseSecurityAlertPolicies() + .createOrUpdateWithResponse( + resourceGroupName, + serverName, + databaseName, + securityAlertPolicyName, + this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public DatabaseSecurityAlertPolicy create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseSecurityAlertPolicies() + .createOrUpdateWithResponse( + resourceGroupName, serverName, databaseName, securityAlertPolicyName, this.innerModel(), context) + .getValue(); + return this; + } + + DatabaseSecurityAlertPolicyImpl( + SecurityAlertPolicyName name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new DatabaseSecurityAlertPolicyInner(); + this.serviceManager = serviceManager; + this.securityAlertPolicyName = name; + } + + public DatabaseSecurityAlertPolicyImpl update() { + return this; + } + + public DatabaseSecurityAlertPolicy apply() { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseSecurityAlertPolicies() + .createOrUpdateWithResponse( + resourceGroupName, + serverName, + databaseName, + securityAlertPolicyName, + this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public DatabaseSecurityAlertPolicy apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseSecurityAlertPolicies() + .createOrUpdateWithResponse( + resourceGroupName, serverName, databaseName, securityAlertPolicyName, this.innerModel(), context) + .getValue(); + return this; + } + + DatabaseSecurityAlertPolicyImpl( + DatabaseSecurityAlertPolicyInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "databases"); + this.securityAlertPolicyName = + SecurityAlertPolicyName.fromString(Utils.getValueFromIdByName(innerObject.id(), "securityAlertPolicies")); + } + + public DatabaseSecurityAlertPolicy refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseSecurityAlertPolicies() + .getWithResponse(resourceGroupName, serverName, databaseName, securityAlertPolicyName, Context.NONE) + .getValue(); + return this; + } + + public DatabaseSecurityAlertPolicy refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseSecurityAlertPolicies() + .getWithResponse(resourceGroupName, serverName, databaseName, securityAlertPolicyName, context) + .getValue(); + return this; + } + + public DatabaseSecurityAlertPolicyImpl withState(SecurityAlertsPolicyState state) { + this.innerModel().withState(state); + return this; + } + + public DatabaseSecurityAlertPolicyImpl withDisabledAlerts(List disabledAlerts) { + this.innerModel().withDisabledAlerts(disabledAlerts); + return this; + } + + public DatabaseSecurityAlertPolicyImpl withEmailAddresses(List emailAddresses) { + this.innerModel().withEmailAddresses(emailAddresses); + return this; + } + + public DatabaseSecurityAlertPolicyImpl withEmailAccountAdmins(Boolean emailAccountAdmins) { + this.innerModel().withEmailAccountAdmins(emailAccountAdmins); + return this; + } + + public DatabaseSecurityAlertPolicyImpl withStorageEndpoint(String storageEndpoint) { + this.innerModel().withStorageEndpoint(storageEndpoint); + return this; + } + + public DatabaseSecurityAlertPolicyImpl withStorageAccountAccessKey(String storageAccountAccessKey) { + this.innerModel().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + public DatabaseSecurityAlertPolicyImpl withRetentionDays(Integer retentionDays) { + this.innerModel().withRetentionDays(retentionDays); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSqlVulnerabilityAssessmentBaselineSetImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSqlVulnerabilityAssessmentBaselineSetImpl.java new file mode 100644 index 0000000000000..5f61375ea98a0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSqlVulnerabilityAssessmentBaselineSetImpl.java @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseSqlVulnerabilityAssessmentBaselineSetInner; +import com.azure.resourcemanager.sql.generated.models.BaselineName; +import com.azure.resourcemanager.sql.generated.models.DatabaseSqlVulnerabilityAssessmentBaselineSet; +import com.azure.resourcemanager.sql.generated.models.DatabaseSqlVulnerabilityAssessmentRuleBaselineListInput; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class DatabaseSqlVulnerabilityAssessmentBaselineSetImpl + implements DatabaseSqlVulnerabilityAssessmentBaselineSet, + DatabaseSqlVulnerabilityAssessmentBaselineSet.Definition, + DatabaseSqlVulnerabilityAssessmentBaselineSet.Update { + private DatabaseSqlVulnerabilityAssessmentBaselineSetInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Map>> results() { + Map>> inner = this.innerModel().results(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public DatabaseSqlVulnerabilityAssessmentBaselineSetInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String databaseName; + + private VulnerabilityAssessmentName vulnerabilityAssessmentName; + + private BaselineName baselineName; + + private DatabaseSqlVulnerabilityAssessmentRuleBaselineListInput createParameters; + + private DatabaseSqlVulnerabilityAssessmentRuleBaselineListInput updateParameters; + + public DatabaseSqlVulnerabilityAssessmentBaselineSetImpl withExistingSqlVulnerabilityAssessment( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + this.vulnerabilityAssessmentName = vulnerabilityAssessmentName; + return this; + } + + public DatabaseSqlVulnerabilityAssessmentBaselineSet create() { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseSqlVulnerabilityAssessmentBaselines() + .createOrUpdateWithResponse( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + baselineName, + createParameters, + Context.NONE) + .getValue(); + return this; + } + + public DatabaseSqlVulnerabilityAssessmentBaselineSet create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseSqlVulnerabilityAssessmentBaselines() + .createOrUpdateWithResponse( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + baselineName, + createParameters, + context) + .getValue(); + return this; + } + + DatabaseSqlVulnerabilityAssessmentBaselineSetImpl( + BaselineName name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new DatabaseSqlVulnerabilityAssessmentBaselineSetInner(); + this.serviceManager = serviceManager; + this.baselineName = name; + this.createParameters = new DatabaseSqlVulnerabilityAssessmentRuleBaselineListInput(); + } + + public DatabaseSqlVulnerabilityAssessmentBaselineSetImpl update() { + this.updateParameters = new DatabaseSqlVulnerabilityAssessmentRuleBaselineListInput(); + return this; + } + + public DatabaseSqlVulnerabilityAssessmentBaselineSet apply() { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseSqlVulnerabilityAssessmentBaselines() + .createOrUpdateWithResponse( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + baselineName, + updateParameters, + Context.NONE) + .getValue(); + return this; + } + + public DatabaseSqlVulnerabilityAssessmentBaselineSet apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseSqlVulnerabilityAssessmentBaselines() + .createOrUpdateWithResponse( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + baselineName, + updateParameters, + context) + .getValue(); + return this; + } + + DatabaseSqlVulnerabilityAssessmentBaselineSetImpl( + DatabaseSqlVulnerabilityAssessmentBaselineSetInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "databases"); + this.vulnerabilityAssessmentName = + VulnerabilityAssessmentName + .fromString(Utils.getValueFromIdByName(innerObject.id(), "sqlVulnerabilityAssessments")); + this.baselineName = BaselineName.fromString(Utils.getValueFromIdByName(innerObject.id(), "baselines")); + } + + public DatabaseSqlVulnerabilityAssessmentBaselineSet refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseSqlVulnerabilityAssessmentBaselines() + .getWithResponse( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + baselineName, + Context.NONE) + .getValue(); + return this; + } + + public DatabaseSqlVulnerabilityAssessmentBaselineSet refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseSqlVulnerabilityAssessmentBaselines() + .getWithResponse( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, baselineName, context) + .getValue(); + return this; + } + + public DatabaseSqlVulnerabilityAssessmentBaselineSetImpl withLatestScan(boolean latestScan) { + if (isInCreateMode()) { + this.createParameters.withLatestScan(latestScan); + return this; + } else { + this.updateParameters.withLatestScan(latestScan); + return this; + } + } + + public DatabaseSqlVulnerabilityAssessmentBaselineSetImpl withResults(Map>> results) { + if (isInCreateMode()) { + this.createParameters.withResults(results); + return this; + } else { + this.updateParameters.withResults(results); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSqlVulnerabilityAssessmentBaselinesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSqlVulnerabilityAssessmentBaselinesClientImpl.java new file mode 100644 index 0000000000000..50238bc4b8ce9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSqlVulnerabilityAssessmentBaselinesClientImpl.java @@ -0,0 +1,964 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseSqlVulnerabilityAssessmentBaselinesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseSqlVulnerabilityAssessmentBaselineSetInner; +import com.azure.resourcemanager.sql.generated.models.BaselineName; +import com.azure.resourcemanager.sql.generated.models.DatabaseSqlVulnerabilityAssessmentBaselineSetListResult; +import com.azure.resourcemanager.sql.generated.models.DatabaseSqlVulnerabilityAssessmentRuleBaselineListInput; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * DatabaseSqlVulnerabilityAssessmentBaselinesClient. + */ +public final class DatabaseSqlVulnerabilityAssessmentBaselinesClientImpl + implements DatabaseSqlVulnerabilityAssessmentBaselinesClient { + /** The proxy service used to perform REST calls. */ + private final DatabaseSqlVulnerabilityAssessmentBaselinesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseSqlVulnerabilityAssessmentBaselinesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DatabaseSqlVulnerabilityAssessmentBaselinesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + DatabaseSqlVulnerabilityAssessmentBaselinesService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientDatabaseSqlVulnerabilityAssessmentBaselines to be + * used by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientD") + public interface DatabaseSqlVulnerabilityAssessmentBaselinesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}" + + "/baselines") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySqlVulnerabilityAssessment( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}" + + "/baselines/{baselineName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("baselineName") BaselineName baselineName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}" + + "/baselines/{baselineName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("baselineName") BaselineName baselineName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DatabaseSqlVulnerabilityAssessmentRuleBaselineListInput parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySqlVulnerabilityAssessmentNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's sql vulnerability assessment rule baselines along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listBySqlVulnerabilityAssessmentSinglePageAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listBySqlVulnerabilityAssessment( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's sql vulnerability assessment rule baselines along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listBySqlVulnerabilityAssessmentSinglePageAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySqlVulnerabilityAssessment( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's sql vulnerability assessment rule baselines as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySqlVulnerabilityAssessmentAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + return new PagedFlux<>( + () -> + listBySqlVulnerabilityAssessmentSinglePageAsync( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName), + nextLink -> listBySqlVulnerabilityAssessmentNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's sql vulnerability assessment rule baselines as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySqlVulnerabilityAssessmentAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + return new PagedFlux<>( + () -> + listBySqlVulnerabilityAssessmentSinglePageAsync( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, context), + nextLink -> listBySqlVulnerabilityAssessmentNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's sql vulnerability assessment rule baselines as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySqlVulnerabilityAssessment( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + return new PagedIterable<>( + listBySqlVulnerabilityAssessmentAsync( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName)); + } + + /** + * Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's sql vulnerability assessment rule baselines as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySqlVulnerabilityAssessment( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + return new PagedIterable<>( + listBySqlVulnerabilityAssessmentAsync( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, context)); + } + + /** + * Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's sql vulnerability assessment rule baselines along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (baselineName == null) { + return Mono.error(new IllegalArgumentException("Parameter baselineName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + baselineName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's sql vulnerability assessment rule baselines along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (baselineName == null) { + return Mono.error(new IllegalArgumentException("Parameter baselineName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + baselineName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's sql vulnerability assessment rule baselines on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName) { + return getWithResponseAsync( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, baselineName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's sql vulnerability assessment rule baselines along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + Context context) { + return getWithResponseAsync( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, baselineName, context) + .block(); + } + + /** + * Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's sql vulnerability assessment rule baselines. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseSqlVulnerabilityAssessmentBaselineSetInner get( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName) { + return getWithResponse( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, baselineName, Context.NONE) + .getValue(); + } + + /** + * Add a database's vulnerability assessment rule baseline 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param parameters The requested rule baseline resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database sql vulnerability assessment baseline set along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + DatabaseSqlVulnerabilityAssessmentRuleBaselineListInput parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (baselineName == null) { + return Mono.error(new IllegalArgumentException("Parameter baselineName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + baselineName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Add a database's vulnerability assessment rule baseline 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param parameters The requested rule baseline resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database sql vulnerability assessment baseline set along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + DatabaseSqlVulnerabilityAssessmentRuleBaselineListInput parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (baselineName == null) { + return Mono.error(new IllegalArgumentException("Parameter baselineName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + baselineName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Add a database's vulnerability assessment rule baseline 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param parameters The requested rule baseline resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database sql vulnerability assessment baseline set on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + DatabaseSqlVulnerabilityAssessmentRuleBaselineListInput parameters) { + return createOrUpdateWithResponseAsync( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, baselineName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Add a database's vulnerability assessment rule baseline 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param parameters The requested rule baseline resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database sql vulnerability assessment baseline set along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + DatabaseSqlVulnerabilityAssessmentRuleBaselineListInput parameters, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + baselineName, + parameters, + context) + .block(); + } + + /** + * Add a database's vulnerability assessment rule baseline 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param parameters The requested rule baseline resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database sql vulnerability assessment baseline set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseSqlVulnerabilityAssessmentBaselineSetInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + DatabaseSqlVulnerabilityAssessmentRuleBaselineListInput parameters) { + return createOrUpdateWithResponse( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + baselineName, + parameters, + Context.NONE) + .getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Vulnerability Assessments baseline set along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listBySqlVulnerabilityAssessmentNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service.listBySqlVulnerabilityAssessmentNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Vulnerability Assessments baseline set along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listBySqlVulnerabilityAssessmentNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySqlVulnerabilityAssessmentNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSqlVulnerabilityAssessmentBaselinesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSqlVulnerabilityAssessmentBaselinesImpl.java new file mode 100644 index 0000000000000..f3d418da44c98 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSqlVulnerabilityAssessmentBaselinesImpl.java @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseSqlVulnerabilityAssessmentBaselinesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseSqlVulnerabilityAssessmentBaselineSetInner; +import com.azure.resourcemanager.sql.generated.models.BaselineName; +import com.azure.resourcemanager.sql.generated.models.DatabaseSqlVulnerabilityAssessmentBaselineSet; +import com.azure.resourcemanager.sql.generated.models.DatabaseSqlVulnerabilityAssessmentBaselines; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +public final class DatabaseSqlVulnerabilityAssessmentBaselinesImpl + implements DatabaseSqlVulnerabilityAssessmentBaselines { + private static final ClientLogger LOGGER = new ClientLogger(DatabaseSqlVulnerabilityAssessmentBaselinesImpl.class); + + private final DatabaseSqlVulnerabilityAssessmentBaselinesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public DatabaseSqlVulnerabilityAssessmentBaselinesImpl( + DatabaseSqlVulnerabilityAssessmentBaselinesClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listBySqlVulnerabilityAssessment( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + PagedIterable inner = + this + .serviceClient() + .listBySqlVulnerabilityAssessment( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName); + return Utils + .mapPage(inner, inner1 -> new DatabaseSqlVulnerabilityAssessmentBaselineSetImpl(inner1, this.manager())); + } + + public PagedIterable listBySqlVulnerabilityAssessment( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listBySqlVulnerabilityAssessment( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, context); + return Utils + .mapPage(inner, inner1 -> new DatabaseSqlVulnerabilityAssessmentBaselineSetImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, baselineName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatabaseSqlVulnerabilityAssessmentBaselineSetImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DatabaseSqlVulnerabilityAssessmentBaselineSet get( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName) { + DatabaseSqlVulnerabilityAssessmentBaselineSetInner inner = + this + .serviceClient() + .get(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, baselineName); + if (inner != null) { + return new DatabaseSqlVulnerabilityAssessmentBaselineSetImpl(inner, this.manager()); + } else { + return null; + } + } + + public DatabaseSqlVulnerabilityAssessmentBaselineSet getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String vulnerabilityAssessmentNameLocal = Utils.getValueFromIdByName(id, "sqlVulnerabilityAssessments"); + if (vulnerabilityAssessmentNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment" + + " 'sqlVulnerabilityAssessments'.", + id))); + } + VulnerabilityAssessmentName vulnerabilityAssessmentName = + VulnerabilityAssessmentName.fromString(vulnerabilityAssessmentNameLocal); + String baselineNameLocal = Utils.getValueFromIdByName(id, "baselines"); + if (baselineNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'baselines'.", id))); + } + BaselineName baselineName = BaselineName.fromString(baselineNameLocal); + return this + .getWithResponse( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, baselineName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String vulnerabilityAssessmentNameLocal = Utils.getValueFromIdByName(id, "sqlVulnerabilityAssessments"); + if (vulnerabilityAssessmentNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment" + + " 'sqlVulnerabilityAssessments'.", + id))); + } + VulnerabilityAssessmentName vulnerabilityAssessmentName = + VulnerabilityAssessmentName.fromString(vulnerabilityAssessmentNameLocal); + String baselineNameLocal = Utils.getValueFromIdByName(id, "baselines"); + if (baselineNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'baselines'.", id))); + } + BaselineName baselineName = BaselineName.fromString(baselineNameLocal); + return this + .getWithResponse( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, baselineName, context); + } + + private DatabaseSqlVulnerabilityAssessmentBaselinesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public DatabaseSqlVulnerabilityAssessmentBaselineSetImpl define(BaselineName name) { + return new DatabaseSqlVulnerabilityAssessmentBaselineSetImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSqlVulnerabilityAssessmentExecuteScansClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSqlVulnerabilityAssessmentExecuteScansClientImpl.java new file mode 100644 index 0000000000000..bfe8986c4eb4d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSqlVulnerabilityAssessmentExecuteScansClientImpl.java @@ -0,0 +1,408 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseSqlVulnerabilityAssessmentExecuteScansClient; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * DatabaseSqlVulnerabilityAssessmentExecuteScansClient. + */ +public final class DatabaseSqlVulnerabilityAssessmentExecuteScansClientImpl + implements DatabaseSqlVulnerabilityAssessmentExecuteScansClient { + /** The proxy service used to perform REST calls. */ + private final DatabaseSqlVulnerabilityAssessmentExecuteScansService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseSqlVulnerabilityAssessmentExecuteScansClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DatabaseSqlVulnerabilityAssessmentExecuteScansClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + DatabaseSqlVulnerabilityAssessmentExecuteScansService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientDatabaseSqlVulnerabilityAssessmentExecuteScans to + * be used by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientD") + public interface DatabaseSqlVulnerabilityAssessmentExecuteScansService { + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}" + + "/initiateScan") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> execute( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> executeWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + return FluxUtil + .withContext( + context -> + service + .execute( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> executeWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + context = this.client.mergeContext(context); + return service + .execute( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginExecuteAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + Mono>> mono = + executeWithResponseAsync(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginExecuteAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + executeWithResponseAsync(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginExecute( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + return beginExecuteAsync(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName) + .getSyncPoller(); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginExecute( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + return beginExecuteAsync(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, context) + .getSyncPoller(); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono executeAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + return beginExecuteAsync(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono executeAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + return beginExecuteAsync(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void execute( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + executeAsync(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName).block(); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void execute( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + executeAsync(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, context).block(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSqlVulnerabilityAssessmentExecuteScansImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSqlVulnerabilityAssessmentExecuteScansImpl.java new file mode 100644 index 0000000000000..be502a9c905b2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSqlVulnerabilityAssessmentExecuteScansImpl.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseSqlVulnerabilityAssessmentExecuteScansClient; +import com.azure.resourcemanager.sql.generated.models.DatabaseSqlVulnerabilityAssessmentExecuteScans; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +public final class DatabaseSqlVulnerabilityAssessmentExecuteScansImpl + implements DatabaseSqlVulnerabilityAssessmentExecuteScans { + private static final ClientLogger LOGGER = + new ClientLogger(DatabaseSqlVulnerabilityAssessmentExecuteScansImpl.class); + + private final DatabaseSqlVulnerabilityAssessmentExecuteScansClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public DatabaseSqlVulnerabilityAssessmentExecuteScansImpl( + DatabaseSqlVulnerabilityAssessmentExecuteScansClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void execute( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + this.serviceClient().execute(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName); + } + + public void execute( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + this.serviceClient().execute(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, context); + } + + private DatabaseSqlVulnerabilityAssessmentExecuteScansClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSqlVulnerabilityAssessmentRuleBaselineImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSqlVulnerabilityAssessmentRuleBaselineImpl.java new file mode 100644 index 0000000000000..c7f2245ce92a8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSqlVulnerabilityAssessmentRuleBaselineImpl.java @@ -0,0 +1,249 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseSqlVulnerabilityAssessmentRuleBaselineInner; +import com.azure.resourcemanager.sql.generated.models.BaselineName; +import com.azure.resourcemanager.sql.generated.models.DatabaseSqlVulnerabilityAssessmentRuleBaseline; +import com.azure.resourcemanager.sql.generated.models.DatabaseSqlVulnerabilityAssessmentRuleBaselineInput; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import java.util.Collections; +import java.util.List; + +public final class DatabaseSqlVulnerabilityAssessmentRuleBaselineImpl + implements DatabaseSqlVulnerabilityAssessmentRuleBaseline, + DatabaseSqlVulnerabilityAssessmentRuleBaseline.Definition, + DatabaseSqlVulnerabilityAssessmentRuleBaseline.Update { + private DatabaseSqlVulnerabilityAssessmentRuleBaselineInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public List> results() { + List> inner = this.innerModel().results(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public DatabaseSqlVulnerabilityAssessmentRuleBaselineInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String databaseName; + + private VulnerabilityAssessmentName vulnerabilityAssessmentName; + + private BaselineName baselineName; + + private String ruleId; + + private DatabaseSqlVulnerabilityAssessmentRuleBaselineInput createParameters; + + private DatabaseSqlVulnerabilityAssessmentRuleBaselineInput updateParameters; + + public DatabaseSqlVulnerabilityAssessmentRuleBaselineImpl withExistingBaseline( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + this.vulnerabilityAssessmentName = vulnerabilityAssessmentName; + this.baselineName = baselineName; + return this; + } + + public DatabaseSqlVulnerabilityAssessmentRuleBaseline create() { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseSqlVulnerabilityAssessmentRuleBaselines() + .createOrUpdateWithResponse( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + baselineName, + ruleId, + createParameters, + Context.NONE) + .getValue(); + return this; + } + + public DatabaseSqlVulnerabilityAssessmentRuleBaseline create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseSqlVulnerabilityAssessmentRuleBaselines() + .createOrUpdateWithResponse( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + baselineName, + ruleId, + createParameters, + context) + .getValue(); + return this; + } + + DatabaseSqlVulnerabilityAssessmentRuleBaselineImpl( + String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new DatabaseSqlVulnerabilityAssessmentRuleBaselineInner(); + this.serviceManager = serviceManager; + this.ruleId = name; + this.createParameters = new DatabaseSqlVulnerabilityAssessmentRuleBaselineInput(); + } + + public DatabaseSqlVulnerabilityAssessmentRuleBaselineImpl update() { + this.updateParameters = new DatabaseSqlVulnerabilityAssessmentRuleBaselineInput(); + return this; + } + + public DatabaseSqlVulnerabilityAssessmentRuleBaseline apply() { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseSqlVulnerabilityAssessmentRuleBaselines() + .createOrUpdateWithResponse( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + baselineName, + ruleId, + updateParameters, + Context.NONE) + .getValue(); + return this; + } + + public DatabaseSqlVulnerabilityAssessmentRuleBaseline apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseSqlVulnerabilityAssessmentRuleBaselines() + .createOrUpdateWithResponse( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + baselineName, + ruleId, + updateParameters, + context) + .getValue(); + return this; + } + + DatabaseSqlVulnerabilityAssessmentRuleBaselineImpl( + DatabaseSqlVulnerabilityAssessmentRuleBaselineInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "databases"); + this.vulnerabilityAssessmentName = + VulnerabilityAssessmentName + .fromString(Utils.getValueFromIdByName(innerObject.id(), "sqlVulnerabilityAssessments")); + this.baselineName = BaselineName.fromString(Utils.getValueFromIdByName(innerObject.id(), "baselines")); + this.ruleId = Utils.getValueFromIdByName(innerObject.id(), "rules"); + } + + public DatabaseSqlVulnerabilityAssessmentRuleBaseline refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseSqlVulnerabilityAssessmentRuleBaselines() + .getWithResponse( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + baselineName, + ruleId, + Context.NONE) + .getValue(); + return this; + } + + public DatabaseSqlVulnerabilityAssessmentRuleBaseline refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseSqlVulnerabilityAssessmentRuleBaselines() + .getWithResponse( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + baselineName, + ruleId, + context) + .getValue(); + return this; + } + + public DatabaseSqlVulnerabilityAssessmentRuleBaselineImpl withLatestScan(boolean latestScan) { + if (isInCreateMode()) { + this.createParameters.withLatestScan(latestScan); + return this; + } else { + this.updateParameters.withLatestScan(latestScan); + return this; + } + } + + public DatabaseSqlVulnerabilityAssessmentRuleBaselineImpl withResults(List> results) { + if (isInCreateMode()) { + this.createParameters.withResults(results); + return this; + } else { + this.updateParameters.withResults(results); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSqlVulnerabilityAssessmentRuleBaselinesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSqlVulnerabilityAssessmentRuleBaselinesClientImpl.java new file mode 100644 index 0000000000000..e5f94c592ea95 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSqlVulnerabilityAssessmentRuleBaselinesClientImpl.java @@ -0,0 +1,1293 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseSqlVulnerabilityAssessmentRuleBaselinesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseSqlVulnerabilityAssessmentRuleBaselineInner; +import com.azure.resourcemanager.sql.generated.models.BaselineName; +import com.azure.resourcemanager.sql.generated.models.DatabaseSqlVulnerabilityAssessmentRuleBaselineInput; +import com.azure.resourcemanager.sql.generated.models.DatabaseSqlVulnerabilityAssessmentRuleBaselineListResult; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * DatabaseSqlVulnerabilityAssessmentRuleBaselinesClient. + */ +public final class DatabaseSqlVulnerabilityAssessmentRuleBaselinesClientImpl + implements DatabaseSqlVulnerabilityAssessmentRuleBaselinesClient { + /** The proxy service used to perform REST calls. */ + private final DatabaseSqlVulnerabilityAssessmentRuleBaselinesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseSqlVulnerabilityAssessmentRuleBaselinesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DatabaseSqlVulnerabilityAssessmentRuleBaselinesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + DatabaseSqlVulnerabilityAssessmentRuleBaselinesService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientDatabaseSqlVulnerabilityAssessmentRuleBaselines to + * be used by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientD") + public interface DatabaseSqlVulnerabilityAssessmentRuleBaselinesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}" + + "/baselines/{baselineName}/rules") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByBaseline( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("baselineName") BaselineName baselineName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}" + + "/baselines/{baselineName}/rules/{ruleId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("baselineName") BaselineName baselineName, + @PathParam("ruleId") String ruleId, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}" + + "/baselines/{baselineName}/rules/{ruleId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("baselineName") BaselineName baselineName, + @PathParam("ruleId") String ruleId, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DatabaseSqlVulnerabilityAssessmentRuleBaselineInput parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}" + + "/baselines/{baselineName}/rules/{ruleId}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("baselineName") BaselineName baselineName, + @PathParam("ruleId") String ruleId, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByBaselineNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's sql vulnerability assessment rule baselines along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBaselineSinglePageAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (baselineName == null) { + return Mono.error(new IllegalArgumentException("Parameter baselineName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByBaseline( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + baselineName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's sql vulnerability assessment rule baselines along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBaselineSinglePageAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (baselineName == null) { + return Mono.error(new IllegalArgumentException("Parameter baselineName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByBaseline( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + baselineName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's sql vulnerability assessment rule baselines as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBaselineAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName) { + return new PagedFlux<>( + () -> + listByBaselineSinglePageAsync( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, baselineName), + nextLink -> listByBaselineNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's sql vulnerability assessment rule baselines as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBaselineAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + Context context) { + return new PagedFlux<>( + () -> + listByBaselineSinglePageAsync( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, baselineName, context), + nextLink -> listByBaselineNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's sql vulnerability assessment rule baselines as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBaseline( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName) { + return new PagedIterable<>( + listByBaselineAsync( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, baselineName)); + } + + /** + * Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's sql vulnerability assessment rule baselines as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBaseline( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + Context context) { + return new PagedIterable<>( + listByBaselineAsync( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, baselineName, context)); + } + + /** + * Gets a database's sql 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. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param ruleId The vulnerability assessment rule ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's sql vulnerability assessment rule baseline along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (baselineName == null) { + return Mono.error(new IllegalArgumentException("Parameter baselineName is required and cannot be null.")); + } + if (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + baselineName, + ruleId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a database's sql 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. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param ruleId The vulnerability assessment rule ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's sql vulnerability assessment rule baseline along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (baselineName == null) { + return Mono.error(new IllegalArgumentException("Parameter baselineName is required and cannot be null.")); + } + if (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + baselineName, + ruleId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a database's sql 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. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param ruleId The vulnerability assessment rule ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's sql vulnerability assessment rule baseline on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId) { + return getWithResponseAsync( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, baselineName, ruleId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a database's sql 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. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param ruleId The vulnerability assessment rule ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's sql vulnerability assessment rule baseline along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId, + Context context) { + return getWithResponseAsync( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, baselineName, ruleId, context) + .block(); + } + + /** + * Gets a database's sql 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. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param ruleId The vulnerability assessment rule ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's sql vulnerability assessment rule baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseSqlVulnerabilityAssessmentRuleBaselineInner get( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId) { + return getWithResponse( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + baselineName, + ruleId, + Context.NONE) + .getValue(); + } + + /** + * 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. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param ruleId The vulnerability assessment rule ID. + * @param parameters The requested rule baseline resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database sql vulnerability assessment rule baseline along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId, + DatabaseSqlVulnerabilityAssessmentRuleBaselineInput parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (baselineName == null) { + return Mono.error(new IllegalArgumentException("Parameter baselineName is required and cannot be null.")); + } + if (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + baselineName, + ruleId, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param ruleId The vulnerability assessment rule ID. + * @param parameters The requested rule baseline resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database sql vulnerability assessment rule baseline along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId, + DatabaseSqlVulnerabilityAssessmentRuleBaselineInput parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (baselineName == null) { + return Mono.error(new IllegalArgumentException("Parameter baselineName is required and cannot be null.")); + } + if (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + baselineName, + ruleId, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param ruleId The vulnerability assessment rule ID. + * @param parameters The requested rule baseline resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database sql vulnerability assessment rule baseline on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId, + DatabaseSqlVulnerabilityAssessmentRuleBaselineInput parameters) { + return createOrUpdateWithResponseAsync( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + baselineName, + ruleId, + parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param ruleId The vulnerability assessment rule ID. + * @param parameters The requested rule baseline resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database sql vulnerability assessment rule baseline along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId, + DatabaseSqlVulnerabilityAssessmentRuleBaselineInput parameters, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + baselineName, + ruleId, + parameters, + context) + .block(); + } + + /** + * 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. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param ruleId The vulnerability assessment rule ID. + * @param parameters The requested rule baseline resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database sql vulnerability assessment rule baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseSqlVulnerabilityAssessmentRuleBaselineInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId, + DatabaseSqlVulnerabilityAssessmentRuleBaselineInput parameters) { + return createOrUpdateWithResponse( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + baselineName, + ruleId, + parameters, + Context.NONE) + .getValue(); + } + + /** + * 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. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param ruleId The vulnerability assessment rule ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (baselineName == null) { + return Mono.error(new IllegalArgumentException("Parameter baselineName is required and cannot be null.")); + } + if (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + baselineName, + ruleId, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param ruleId The vulnerability assessment rule ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (baselineName == null) { + return Mono.error(new IllegalArgumentException("Parameter baselineName is required and cannot be null.")); + } + if (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + baselineName, + ruleId, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * 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. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param ruleId The vulnerability assessment rule ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId) { + return deleteWithResponseAsync( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, baselineName, ruleId) + .flatMap(ignored -> Mono.empty()); + } + + /** + * 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. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param ruleId The vulnerability assessment rule ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId, + Context context) { + return deleteWithResponseAsync( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, baselineName, ruleId, context) + .block(); + } + + /** + * 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. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param ruleId The vulnerability assessment rule ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId) { + deleteWithResponse( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + baselineName, + ruleId, + Context.NONE); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Vulnerability Assessments rule baseline along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBaselineNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByBaselineNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Vulnerability Assessments rule baseline along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBaselineNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByBaselineNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSqlVulnerabilityAssessmentRuleBaselinesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSqlVulnerabilityAssessmentRuleBaselinesImpl.java new file mode 100644 index 0000000000000..726919d908baf --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSqlVulnerabilityAssessmentRuleBaselinesImpl.java @@ -0,0 +1,405 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseSqlVulnerabilityAssessmentRuleBaselinesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseSqlVulnerabilityAssessmentRuleBaselineInner; +import com.azure.resourcemanager.sql.generated.models.BaselineName; +import com.azure.resourcemanager.sql.generated.models.DatabaseSqlVulnerabilityAssessmentRuleBaseline; +import com.azure.resourcemanager.sql.generated.models.DatabaseSqlVulnerabilityAssessmentRuleBaselines; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +public final class DatabaseSqlVulnerabilityAssessmentRuleBaselinesImpl + implements DatabaseSqlVulnerabilityAssessmentRuleBaselines { + private static final ClientLogger LOGGER = + new ClientLogger(DatabaseSqlVulnerabilityAssessmentRuleBaselinesImpl.class); + + private final DatabaseSqlVulnerabilityAssessmentRuleBaselinesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public DatabaseSqlVulnerabilityAssessmentRuleBaselinesImpl( + DatabaseSqlVulnerabilityAssessmentRuleBaselinesClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByBaseline( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName) { + PagedIterable inner = + this + .serviceClient() + .listByBaseline(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, baselineName); + return Utils + .mapPage(inner, inner1 -> new DatabaseSqlVulnerabilityAssessmentRuleBaselineImpl(inner1, this.manager())); + } + + public PagedIterable listByBaseline( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByBaseline( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, baselineName, context); + return Utils + .mapPage(inner, inner1 -> new DatabaseSqlVulnerabilityAssessmentRuleBaselineImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + baselineName, + ruleId, + context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatabaseSqlVulnerabilityAssessmentRuleBaselineImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DatabaseSqlVulnerabilityAssessmentRuleBaseline get( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId) { + DatabaseSqlVulnerabilityAssessmentRuleBaselineInner inner = + this + .serviceClient() + .get(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, baselineName, ruleId); + if (inner != null) { + return new DatabaseSqlVulnerabilityAssessmentRuleBaselineImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId, + Context context) { + return this + .serviceClient() + .deleteWithResponse( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + baselineName, + ruleId, + context); + } + + public void delete( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId) { + this + .serviceClient() + .delete(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, baselineName, ruleId); + } + + public DatabaseSqlVulnerabilityAssessmentRuleBaseline getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String vulnerabilityAssessmentNameLocal = Utils.getValueFromIdByName(id, "sqlVulnerabilityAssessments"); + if (vulnerabilityAssessmentNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment" + + " 'sqlVulnerabilityAssessments'.", + id))); + } + VulnerabilityAssessmentName vulnerabilityAssessmentName = + VulnerabilityAssessmentName.fromString(vulnerabilityAssessmentNameLocal); + String baselineNameLocal = Utils.getValueFromIdByName(id, "baselines"); + if (baselineNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'baselines'.", id))); + } + BaselineName baselineName = BaselineName.fromString(baselineNameLocal); + String ruleId = Utils.getValueFromIdByName(id, "rules"); + if (ruleId == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'rules'.", id))); + } + return this + .getWithResponse( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + baselineName, + ruleId, + Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String vulnerabilityAssessmentNameLocal = Utils.getValueFromIdByName(id, "sqlVulnerabilityAssessments"); + if (vulnerabilityAssessmentNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment" + + " 'sqlVulnerabilityAssessments'.", + id))); + } + VulnerabilityAssessmentName vulnerabilityAssessmentName = + VulnerabilityAssessmentName.fromString(vulnerabilityAssessmentNameLocal); + String baselineNameLocal = Utils.getValueFromIdByName(id, "baselines"); + if (baselineNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'baselines'.", id))); + } + BaselineName baselineName = BaselineName.fromString(baselineNameLocal); + String ruleId = Utils.getValueFromIdByName(id, "rules"); + if (ruleId == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'rules'.", id))); + } + return this + .getWithResponse( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + baselineName, + ruleId, + context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String vulnerabilityAssessmentNameLocal = Utils.getValueFromIdByName(id, "sqlVulnerabilityAssessments"); + if (vulnerabilityAssessmentNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment" + + " 'sqlVulnerabilityAssessments'.", + id))); + } + VulnerabilityAssessmentName vulnerabilityAssessmentName = + VulnerabilityAssessmentName.fromString(vulnerabilityAssessmentNameLocal); + String baselineNameLocal = Utils.getValueFromIdByName(id, "baselines"); + if (baselineNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'baselines'.", id))); + } + BaselineName baselineName = BaselineName.fromString(baselineNameLocal); + String ruleId = Utils.getValueFromIdByName(id, "rules"); + if (ruleId == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'rules'.", id))); + } + this + .deleteWithResponse( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + baselineName, + ruleId, + Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String vulnerabilityAssessmentNameLocal = Utils.getValueFromIdByName(id, "sqlVulnerabilityAssessments"); + if (vulnerabilityAssessmentNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment" + + " 'sqlVulnerabilityAssessments'.", + id))); + } + VulnerabilityAssessmentName vulnerabilityAssessmentName = + VulnerabilityAssessmentName.fromString(vulnerabilityAssessmentNameLocal); + String baselineNameLocal = Utils.getValueFromIdByName(id, "baselines"); + if (baselineNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'baselines'.", id))); + } + BaselineName baselineName = BaselineName.fromString(baselineNameLocal); + String ruleId = Utils.getValueFromIdByName(id, "rules"); + if (ruleId == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'rules'.", id))); + } + return this + .deleteWithResponse( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + baselineName, + ruleId, + context); + } + + private DatabaseSqlVulnerabilityAssessmentRuleBaselinesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public DatabaseSqlVulnerabilityAssessmentRuleBaselineImpl define(String name) { + return new DatabaseSqlVulnerabilityAssessmentRuleBaselineImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSqlVulnerabilityAssessmentScanResultsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSqlVulnerabilityAssessmentScanResultsClientImpl.java new file mode 100644 index 0000000000000..0c5db4a984c20 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSqlVulnerabilityAssessmentScanResultsClientImpl.java @@ -0,0 +1,716 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseSqlVulnerabilityAssessmentScanResultsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.SqlVulnerabilityAssessmentScanResultsInner; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentScanListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * DatabaseSqlVulnerabilityAssessmentScanResultsClient. + */ +public final class DatabaseSqlVulnerabilityAssessmentScanResultsClientImpl + implements DatabaseSqlVulnerabilityAssessmentScanResultsClient { + /** The proxy service used to perform REST calls. */ + private final DatabaseSqlVulnerabilityAssessmentScanResultsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseSqlVulnerabilityAssessmentScanResultsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DatabaseSqlVulnerabilityAssessmentScanResultsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + DatabaseSqlVulnerabilityAssessmentScanResultsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientDatabaseSqlVulnerabilityAssessmentScanResults to + * be used by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientD") + public interface DatabaseSqlVulnerabilityAssessmentScanResultsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}" + + "/scans/{scanId}/scanResults") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByScan( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("vulnerabilityAssessmentName") SqlVulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("scanId") String scanId, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}" + + "/scans/{scanId}/scanResults/{scanResultId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("vulnerabilityAssessmentName") SqlVulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("scanId") String scanId, + @PathParam("scanResultId") String scanResultId, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByScanNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @param scanId The scan id of the SQL Vulnerability Assessment scan to retrieve result from. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a vulnerability assessment scan record of a database along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByScanSinglePageAsync( + String resourceGroupName, + String serverName, + String databaseName, + SqlVulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (scanId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByScan( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + scanId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @param scanId The scan id of the SQL Vulnerability Assessment scan to retrieve result from. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a vulnerability assessment scan record of a database along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByScanSinglePageAsync( + String resourceGroupName, + String serverName, + String databaseName, + SqlVulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (scanId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByScan( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + scanId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @param scanId The scan id of the SQL Vulnerability Assessment scan to retrieve result from. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a vulnerability assessment scan record of a database as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByScanAsync( + String resourceGroupName, + String serverName, + String databaseName, + SqlVulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + return new PagedFlux<>( + () -> + listByScanSinglePageAsync( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId), + nextLink -> listByScanNextSinglePageAsync(nextLink)); + } + + /** + * 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 vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @param scanId The scan id of the SQL Vulnerability Assessment scan to retrieve result from. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a vulnerability assessment scan record of a database as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByScanAsync( + String resourceGroupName, + String serverName, + String databaseName, + SqlVulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context) { + return new PagedFlux<>( + () -> + listByScanSinglePageAsync( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId, context), + nextLink -> listByScanNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @param scanId The scan id of the SQL Vulnerability Assessment scan to retrieve result from. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a vulnerability assessment scan record of a database as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByScan( + String resourceGroupName, + String serverName, + String databaseName, + SqlVulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + return new PagedIterable<>( + listByScanAsync(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @param scanId The scan id of the SQL Vulnerability Assessment scan to retrieve result from. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a vulnerability assessment scan record of a database as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByScan( + String resourceGroupName, + String serverName, + String databaseName, + SqlVulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context) { + return new PagedIterable<>( + listByScanAsync(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId, context)); + } + + /** + * 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 vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @param scanId The scan id of the SQL Vulnerability Assessment scan to retrieve result from. + * @param scanResultId The scan result id of the specific result to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a vulnerability assessment scan record of a database along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + SqlVulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + String scanResultId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (scanId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + if (scanResultId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanResultId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + scanId, + scanResultId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @param scanId The scan id of the SQL Vulnerability Assessment scan to retrieve result from. + * @param scanResultId The scan result id of the specific result to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a vulnerability assessment scan record of a database along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + SqlVulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + String scanResultId, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (scanId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + if (scanResultId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanResultId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + scanId, + scanResultId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @param scanId The scan id of the SQL Vulnerability Assessment scan to retrieve result from. + * @param scanResultId The scan result id of the specific result to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a vulnerability assessment scan record of a database on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String serverName, + String databaseName, + SqlVulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + String scanResultId) { + return getWithResponseAsync( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId, scanResultId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @param scanId The scan id of the SQL Vulnerability Assessment scan to retrieve result from. + * @param scanResultId The scan result id of the specific result to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a vulnerability assessment scan record of a database along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + SqlVulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + String scanResultId, + Context context) { + return getWithResponseAsync( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId, scanResultId, context) + .block(); + } + + /** + * 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 vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @param scanId The scan id of the SQL Vulnerability Assessment scan to retrieve result from. + * @param scanResultId The scan result id of the specific result to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a vulnerability assessment scan record of a database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlVulnerabilityAssessmentScanResultsInner get( + String resourceGroupName, + String serverName, + String databaseName, + SqlVulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + String scanResultId) { + return getWithResponse( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + scanId, + scanResultId, + Context.NONE) + .getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan results along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByScanNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByScanNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan results along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByScanNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByScanNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSqlVulnerabilityAssessmentScanResultsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSqlVulnerabilityAssessmentScanResultsImpl.java new file mode 100644 index 0000000000000..1c7fc0beea0fa --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSqlVulnerabilityAssessmentScanResultsImpl.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseSqlVulnerabilityAssessmentScanResultsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.SqlVulnerabilityAssessmentScanResultsInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseSqlVulnerabilityAssessmentScanResults; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentScanResults; + +public final class DatabaseSqlVulnerabilityAssessmentScanResultsImpl + implements DatabaseSqlVulnerabilityAssessmentScanResults { + private static final ClientLogger LOGGER = + new ClientLogger(DatabaseSqlVulnerabilityAssessmentScanResultsImpl.class); + + private final DatabaseSqlVulnerabilityAssessmentScanResultsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public DatabaseSqlVulnerabilityAssessmentScanResultsImpl( + DatabaseSqlVulnerabilityAssessmentScanResultsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByScan( + String resourceGroupName, + String serverName, + String databaseName, + SqlVulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + PagedIterable inner = + this + .serviceClient() + .listByScan(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId); + return Utils.mapPage(inner, inner1 -> new SqlVulnerabilityAssessmentScanResultsImpl(inner1, this.manager())); + } + + public PagedIterable listByScan( + String resourceGroupName, + String serverName, + String databaseName, + SqlVulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByScan(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId, context); + return Utils.mapPage(inner, inner1 -> new SqlVulnerabilityAssessmentScanResultsImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + SqlVulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + String scanResultId, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + scanId, + scanResultId, + context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SqlVulnerabilityAssessmentScanResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SqlVulnerabilityAssessmentScanResults get( + String resourceGroupName, + String serverName, + String databaseName, + SqlVulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + String scanResultId) { + SqlVulnerabilityAssessmentScanResultsInner inner = + this + .serviceClient() + .get(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId, scanResultId); + if (inner != null) { + return new SqlVulnerabilityAssessmentScanResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + private DatabaseSqlVulnerabilityAssessmentScanResultsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSqlVulnerabilityAssessmentScansClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSqlVulnerabilityAssessmentScansClientImpl.java new file mode 100644 index 0000000000000..42c91a82f086b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSqlVulnerabilityAssessmentScansClientImpl.java @@ -0,0 +1,675 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseSqlVulnerabilityAssessmentScansClient; +import com.azure.resourcemanager.sql.generated.fluent.models.SqlVulnerabilityAssessmentScanRecordInner; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentScanRecordListResult; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * DatabaseSqlVulnerabilityAssessmentScansClient. + */ +public final class DatabaseSqlVulnerabilityAssessmentScansClientImpl + implements DatabaseSqlVulnerabilityAssessmentScansClient { + /** The proxy service used to perform REST calls. */ + private final DatabaseSqlVulnerabilityAssessmentScansService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseSqlVulnerabilityAssessmentScansClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DatabaseSqlVulnerabilityAssessmentScansClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + DatabaseSqlVulnerabilityAssessmentScansService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientDatabaseSqlVulnerabilityAssessmentScans to be used + * by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientD") + public interface DatabaseSqlVulnerabilityAssessmentScansService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}" + + "/scans") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySqlVulnerabilityAssessments( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}" + + "/scans/{scanId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("scanId") String scanId, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySqlVulnerabilityAssessmentsNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan records along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listBySqlVulnerabilityAssessmentsSinglePageAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listBySqlVulnerabilityAssessments( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan records along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listBySqlVulnerabilityAssessmentsSinglePageAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySqlVulnerabilityAssessments( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan records as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySqlVulnerabilityAssessmentsAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + return new PagedFlux<>( + () -> + listBySqlVulnerabilityAssessmentsSinglePageAsync( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName), + nextLink -> listBySqlVulnerabilityAssessmentsNextSinglePageAsync(nextLink)); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan records as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySqlVulnerabilityAssessmentsAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + return new PagedFlux<>( + () -> + listBySqlVulnerabilityAssessmentsSinglePageAsync( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, context), + nextLink -> listBySqlVulnerabilityAssessmentsNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan records as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySqlVulnerabilityAssessments( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + return new PagedIterable<>( + listBySqlVulnerabilityAssessmentsAsync( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName)); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan records as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySqlVulnerabilityAssessments( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + return new PagedIterable<>( + listBySqlVulnerabilityAssessmentsAsync( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, context)); + } + + /** + * Get a database vulnerability assessment scan 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. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database vulnerability assessment scan result along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (scanId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + scanId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a database vulnerability assessment scan 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. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database vulnerability assessment scan result along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (scanId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + scanId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Get a database vulnerability assessment scan 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. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database vulnerability assessment scan result on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a database vulnerability assessment scan 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. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database vulnerability assessment scan result along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context) { + return getWithResponseAsync( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId, context) + .block(); + } + + /** + * Get a database vulnerability assessment scan 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. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database vulnerability assessment scan result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlVulnerabilityAssessmentScanRecordInner get( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + return getWithResponse( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId, Context.NONE) + .getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan records along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listBySqlVulnerabilityAssessmentsNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service.listBySqlVulnerabilityAssessmentsNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan records along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listBySqlVulnerabilityAssessmentsNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySqlVulnerabilityAssessmentsNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSqlVulnerabilityAssessmentScansImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSqlVulnerabilityAssessmentScansImpl.java new file mode 100644 index 0000000000000..9ab406f81a72a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSqlVulnerabilityAssessmentScansImpl.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseSqlVulnerabilityAssessmentScansClient; +import com.azure.resourcemanager.sql.generated.fluent.models.SqlVulnerabilityAssessmentScanRecordInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseSqlVulnerabilityAssessmentScans; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentScanRecord; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +public final class DatabaseSqlVulnerabilityAssessmentScansImpl implements DatabaseSqlVulnerabilityAssessmentScans { + private static final ClientLogger LOGGER = new ClientLogger(DatabaseSqlVulnerabilityAssessmentScansImpl.class); + + private final DatabaseSqlVulnerabilityAssessmentScansClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public DatabaseSqlVulnerabilityAssessmentScansImpl( + DatabaseSqlVulnerabilityAssessmentScansClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listBySqlVulnerabilityAssessments( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + PagedIterable inner = + this + .serviceClient() + .listBySqlVulnerabilityAssessments( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName); + return Utils.mapPage(inner, inner1 -> new SqlVulnerabilityAssessmentScanRecordImpl(inner1, this.manager())); + } + + public PagedIterable listBySqlVulnerabilityAssessments( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listBySqlVulnerabilityAssessments( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, context); + return Utils.mapPage(inner, inner1 -> new SqlVulnerabilityAssessmentScanRecordImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SqlVulnerabilityAssessmentScanRecordImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SqlVulnerabilityAssessmentScanRecord get( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + SqlVulnerabilityAssessmentScanRecordInner inner = + this.serviceClient().get(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId); + if (inner != null) { + return new SqlVulnerabilityAssessmentScanRecordImpl(inner, this.manager()); + } else { + return null; + } + } + + private DatabaseSqlVulnerabilityAssessmentScansClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSqlVulnerabilityAssessmentsSettingsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSqlVulnerabilityAssessmentsSettingsClientImpl.java new file mode 100644 index 0000000000000..548fcb23495f0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSqlVulnerabilityAssessmentsSettingsClientImpl.java @@ -0,0 +1,598 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseSqlVulnerabilityAssessmentsSettingsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.SqlVulnerabilityAssessmentInner; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentListResult; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentNameAutoGenerated; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * DatabaseSqlVulnerabilityAssessmentsSettingsClient. + */ +public final class DatabaseSqlVulnerabilityAssessmentsSettingsClientImpl + implements DatabaseSqlVulnerabilityAssessmentsSettingsClient { + /** The proxy service used to perform REST calls. */ + private final DatabaseSqlVulnerabilityAssessmentsSettingsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseSqlVulnerabilityAssessmentsSettingsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DatabaseSqlVulnerabilityAssessmentsSettingsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + DatabaseSqlVulnerabilityAssessmentsSettingsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientDatabaseSqlVulnerabilityAssessmentsSettings to be + * used by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientD") + public interface DatabaseSqlVulnerabilityAssessmentsSettingsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/sqlVulnerabilityAssessments") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("vulnerabilityAssessmentName") + SqlVulnerabilityAssessmentNameAutoGenerated vulnerabilityAssessmentName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabaseNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists SQL 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Vulnerability Assessments along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists SQL 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Vulnerability Assessments along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists SQL 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Vulnerability Assessments as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Lists SQL 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Vulnerability Assessments as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, context), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists SQL 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Vulnerability Assessments as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName)); + } + + /** + * Lists SQL 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Vulnerability Assessments as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName, context)); + } + + /** + * Gets SQL Vulnerability Assessment policy for database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return sQL Vulnerability Assessment policy for database along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + SqlVulnerabilityAssessmentNameAutoGenerated vulnerabilityAssessmentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets SQL Vulnerability Assessment policy for database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return sQL Vulnerability Assessment policy for database along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + SqlVulnerabilityAssessmentNameAutoGenerated vulnerabilityAssessmentName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets SQL Vulnerability Assessment policy for database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return sQL Vulnerability Assessment policy for database on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String serverName, + String databaseName, + SqlVulnerabilityAssessmentNameAutoGenerated vulnerabilityAssessmentName) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets SQL Vulnerability Assessment policy for database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return sQL Vulnerability Assessment policy for database along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + SqlVulnerabilityAssessmentNameAutoGenerated vulnerabilityAssessmentName, + Context context) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, context) + .block(); + } + + /** + * Gets SQL Vulnerability Assessment policy for database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return sQL Vulnerability Assessment policy for database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlVulnerabilityAssessmentInner get( + String resourceGroupName, + String serverName, + String databaseName, + SqlVulnerabilityAssessmentNameAutoGenerated vulnerabilityAssessmentName) { + return getWithResponse(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, Context.NONE) + .getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Vulnerability Assessments along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Vulnerability Assessments along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSqlVulnerabilityAssessmentsSettingsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSqlVulnerabilityAssessmentsSettingsImpl.java new file mode 100644 index 0000000000000..c8e7f543f02ce --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseSqlVulnerabilityAssessmentsSettingsImpl.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseSqlVulnerabilityAssessmentsSettingsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.SqlVulnerabilityAssessmentInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseSqlVulnerabilityAssessmentsSettings; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessment; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentNameAutoGenerated; + +public final class DatabaseSqlVulnerabilityAssessmentsSettingsImpl + implements DatabaseSqlVulnerabilityAssessmentsSettings { + private static final ClientLogger LOGGER = new ClientLogger(DatabaseSqlVulnerabilityAssessmentsSettingsImpl.class); + + private final DatabaseSqlVulnerabilityAssessmentsSettingsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public DatabaseSqlVulnerabilityAssessmentsSettingsImpl( + DatabaseSqlVulnerabilityAssessmentsSettingsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName); + return Utils.mapPage(inner, inner1 -> new SqlVulnerabilityAssessmentImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName, context); + return Utils.mapPage(inner, inner1 -> new SqlVulnerabilityAssessmentImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + SqlVulnerabilityAssessmentNameAutoGenerated vulnerabilityAssessmentName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SqlVulnerabilityAssessmentImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SqlVulnerabilityAssessment get( + String resourceGroupName, + String serverName, + String databaseName, + SqlVulnerabilityAssessmentNameAutoGenerated vulnerabilityAssessmentName) { + SqlVulnerabilityAssessmentInner inner = + this.serviceClient().get(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName); + if (inner != null) { + return new SqlVulnerabilityAssessmentImpl(inner, this.manager()); + } else { + return null; + } + } + + private DatabaseSqlVulnerabilityAssessmentsSettingsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseTableImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseTableImpl.java new file mode 100644 index 0000000000000..d2d15edb904b7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseTableImpl.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseTableInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseTable; +import com.azure.resourcemanager.sql.generated.models.TableTemporalType; + +public final class DatabaseTableImpl implements DatabaseTable { + private DatabaseTableInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + DatabaseTableImpl( + DatabaseTableInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public TableTemporalType temporalType() { + return this.innerModel().temporalType(); + } + + public Boolean memoryOptimized() { + return this.innerModel().memoryOptimized(); + } + + public DatabaseTableInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseTablesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseTablesClientImpl.java new file mode 100644 index 0000000000000..7d5e11e5373dc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseTablesClientImpl.java @@ -0,0 +1,644 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseTablesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseTableInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseTableListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DatabaseTablesClient. */ +public final class DatabaseTablesClientImpl implements DatabaseTablesClient { + /** The proxy service used to perform REST calls. */ + private final DatabaseTablesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseTablesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DatabaseTablesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(DatabaseTablesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientDatabaseTables to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientD") + public interface DatabaseTablesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySchema( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("schemaName") String schemaName, + @QueryParam("$filter") String filter, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("schemaName") String schemaName, + @PathParam("tableName") String tableName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySchemaNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List database tables. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 filter An OData filter expression that filters elements in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database tables along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySchemaSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, String schemaName, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listBySchema( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + schemaName, + filter, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List database tables. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 filter An OData filter expression that filters elements in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database tables along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySchemaSinglePageAsync( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String filter, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySchema( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + schemaName, + filter, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List database tables. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 filter An OData filter expression that filters elements in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database tables as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySchemaAsync( + String resourceGroupName, String serverName, String databaseName, String schemaName, String filter) { + return new PagedFlux<>( + () -> listBySchemaSinglePageAsync(resourceGroupName, serverName, databaseName, schemaName, filter), + nextLink -> listBySchemaNextSinglePageAsync(nextLink)); + } + + /** + * List database tables. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database tables as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySchemaAsync( + String resourceGroupName, String serverName, String databaseName, String schemaName) { + final String filter = null; + return new PagedFlux<>( + () -> listBySchemaSinglePageAsync(resourceGroupName, serverName, databaseName, schemaName, filter), + nextLink -> listBySchemaNextSinglePageAsync(nextLink)); + } + + /** + * List database tables. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 filter An OData filter expression that filters elements in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database tables as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySchemaAsync( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String filter, + Context context) { + return new PagedFlux<>( + () -> listBySchemaSinglePageAsync(resourceGroupName, serverName, databaseName, schemaName, filter, context), + nextLink -> listBySchemaNextSinglePageAsync(nextLink, context)); + } + + /** + * List database tables. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database tables as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySchema( + String resourceGroupName, String serverName, String databaseName, String schemaName) { + final String filter = null; + return new PagedIterable<>(listBySchemaAsync(resourceGroupName, serverName, databaseName, schemaName, filter)); + } + + /** + * List database tables. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 filter An OData filter expression that filters elements in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database tables as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySchema( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String filter, + Context context) { + return new PagedIterable<>( + listBySchemaAsync(resourceGroupName, serverName, databaseName, schemaName, filter, context)); + } + + /** + * Get database table. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database table along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + schemaName, + tableName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get database table. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database table along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + schemaName, + tableName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Get database table. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database table on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, schemaName, tableName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get database table. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database table along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + Context context) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, context) + .block(); + } + + /** + * Get database table. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseTableInner get( + String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName) { + return getWithResponse(resourceGroupName, serverName, databaseName, schemaName, tableName, Context.NONE) + .getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database tables along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySchemaNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listBySchemaNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database tables along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySchemaNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySchemaNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseTablesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseTablesImpl.java new file mode 100644 index 0000000000000..f79376217baf2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseTablesImpl.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseTablesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseTableInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseTable; +import com.azure.resourcemanager.sql.generated.models.DatabaseTables; + +public final class DatabaseTablesImpl implements DatabaseTables { + private static final ClientLogger LOGGER = new ClientLogger(DatabaseTablesImpl.class); + + private final DatabaseTablesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public DatabaseTablesImpl( + DatabaseTablesClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listBySchema( + String resourceGroupName, String serverName, String databaseName, String schemaName) { + PagedIterable inner = + this.serviceClient().listBySchema(resourceGroupName, serverName, databaseName, schemaName); + return Utils.mapPage(inner, inner1 -> new DatabaseTableImpl(inner1, this.manager())); + } + + public PagedIterable listBySchema( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String filter, + Context context) { + PagedIterable inner = + this.serviceClient().listBySchema(resourceGroupName, serverName, databaseName, schemaName, filter, context); + return Utils.mapPage(inner, inner1 -> new DatabaseTableImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, serverName, databaseName, schemaName, tableName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatabaseTableImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DatabaseTable get( + String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName) { + DatabaseTableInner inner = + this.serviceClient().get(resourceGroupName, serverName, databaseName, schemaName, tableName); + if (inner != null) { + return new DatabaseTableImpl(inner, this.manager()); + } else { + return null; + } + } + + private DatabaseTablesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseUsageImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseUsageImpl.java new file mode 100644 index 0000000000000..6ad5f555d48a7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseUsageImpl.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseUsageInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseUsage; + +public final class DatabaseUsageImpl implements DatabaseUsage { + private DatabaseUsageInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + DatabaseUsageImpl( + DatabaseUsageInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public Double currentValue() { + return this.innerModel().currentValue(); + } + + public Double limit() { + return this.innerModel().limit(); + } + + public String unit() { + return this.innerModel().unit(); + } + + public DatabaseUsageInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseUsagesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseUsagesClientImpl.java new file mode 100644 index 0000000000000..a8f62e540b710 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseUsagesClientImpl.java @@ -0,0 +1,365 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseUsagesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseUsageInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseUsageListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DatabaseUsagesClient. */ +public final class DatabaseUsagesClientImpl implements DatabaseUsagesClient { + /** The proxy service used to perform REST calls. */ + private final DatabaseUsagesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseUsagesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DatabaseUsagesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(DatabaseUsagesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientDatabaseUsages to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientD") + public interface DatabaseUsagesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/usages") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabaseNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database usages along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database usages along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database usages as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Gets 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database usages as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, context), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database usages as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName)); + } + + /** + * Gets 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database usages as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database usage metrics along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database usage metrics along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseUsagesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseUsagesImpl.java new file mode 100644 index 0000000000000..acf64c3b3d7f5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseUsagesImpl.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseUsagesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseUsageInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseUsage; +import com.azure.resourcemanager.sql.generated.models.DatabaseUsages; + +public final class DatabaseUsagesImpl implements DatabaseUsages { + private static final ClientLogger LOGGER = new ClientLogger(DatabaseUsagesImpl.class); + + private final DatabaseUsagesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public DatabaseUsagesImpl( + DatabaseUsagesClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName); + return Utils.mapPage(inner, inner1 -> new DatabaseUsageImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName, context); + return Utils.mapPage(inner, inner1 -> new DatabaseUsageImpl(inner1, this.manager())); + } + + private DatabaseUsagesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentImpl.java new file mode 100644 index 0000000000000..8b7430183ae9b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentImpl.java @@ -0,0 +1,205 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseVulnerabilityAssessment; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentRecurringScansProperties; + +public final class DatabaseVulnerabilityAssessmentImpl + implements DatabaseVulnerabilityAssessment, + DatabaseVulnerabilityAssessment.Definition, + DatabaseVulnerabilityAssessment.Update { + private DatabaseVulnerabilityAssessmentInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String storageContainerPath() { + return this.innerModel().storageContainerPath(); + } + + public String storageContainerSasKey() { + return this.innerModel().storageContainerSasKey(); + } + + public String storageAccountAccessKey() { + return this.innerModel().storageAccountAccessKey(); + } + + public VulnerabilityAssessmentRecurringScansProperties recurringScans() { + return this.innerModel().recurringScans(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public DatabaseVulnerabilityAssessmentInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String databaseName; + + private VulnerabilityAssessmentName vulnerabilityAssessmentName; + + public DatabaseVulnerabilityAssessmentImpl withExistingDatabase( + String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + + public DatabaseVulnerabilityAssessment create() { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseVulnerabilityAssessments() + .createOrUpdateWithResponse( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public DatabaseVulnerabilityAssessment create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseVulnerabilityAssessments() + .createOrUpdateWithResponse( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + this.innerModel(), + context) + .getValue(); + return this; + } + + DatabaseVulnerabilityAssessmentImpl( + VulnerabilityAssessmentName name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new DatabaseVulnerabilityAssessmentInner(); + this.serviceManager = serviceManager; + this.vulnerabilityAssessmentName = name; + } + + public DatabaseVulnerabilityAssessmentImpl update() { + return this; + } + + public DatabaseVulnerabilityAssessment apply() { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseVulnerabilityAssessments() + .createOrUpdateWithResponse( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public DatabaseVulnerabilityAssessment apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseVulnerabilityAssessments() + .createOrUpdateWithResponse( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + this.innerModel(), + context) + .getValue(); + return this; + } + + DatabaseVulnerabilityAssessmentImpl( + DatabaseVulnerabilityAssessmentInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "databases"); + this.vulnerabilityAssessmentName = + VulnerabilityAssessmentName + .fromString(Utils.getValueFromIdByName(innerObject.id(), "vulnerabilityAssessments")); + } + + public DatabaseVulnerabilityAssessment refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseVulnerabilityAssessments() + .getWithResponse(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, Context.NONE) + .getValue(); + return this; + } + + public DatabaseVulnerabilityAssessment refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseVulnerabilityAssessments() + .getWithResponse(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, context) + .getValue(); + return this; + } + + public DatabaseVulnerabilityAssessmentImpl withStorageContainerPath(String storageContainerPath) { + this.innerModel().withStorageContainerPath(storageContainerPath); + return this; + } + + public DatabaseVulnerabilityAssessmentImpl withStorageContainerSasKey(String storageContainerSasKey) { + this.innerModel().withStorageContainerSasKey(storageContainerSasKey); + return this; + } + + public DatabaseVulnerabilityAssessmentImpl withStorageAccountAccessKey(String storageAccountAccessKey) { + this.innerModel().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + public DatabaseVulnerabilityAssessmentImpl withRecurringScans( + VulnerabilityAssessmentRecurringScansProperties recurringScans) { + this.innerModel().withRecurringScans(recurringScans); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentRuleBaselineImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentRuleBaselineImpl.java new file mode 100644 index 0000000000000..f7d125578cce6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentRuleBaselineImpl.java @@ -0,0 +1,223 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentRuleBaselineInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseVulnerabilityAssessmentRuleBaseline; +import com.azure.resourcemanager.sql.generated.models.DatabaseVulnerabilityAssessmentRuleBaselineItem; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentPolicyBaselineName; +import java.util.Collections; +import java.util.List; + +public final class DatabaseVulnerabilityAssessmentRuleBaselineImpl + implements DatabaseVulnerabilityAssessmentRuleBaseline, + DatabaseVulnerabilityAssessmentRuleBaseline.Definition, + DatabaseVulnerabilityAssessmentRuleBaseline.Update { + private DatabaseVulnerabilityAssessmentRuleBaselineInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public List baselineResults() { + List inner = this.innerModel().baselineResults(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public DatabaseVulnerabilityAssessmentRuleBaselineInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String databaseName; + + private VulnerabilityAssessmentName vulnerabilityAssessmentName; + + private String ruleId; + + private VulnerabilityAssessmentPolicyBaselineName baselineName; + + public DatabaseVulnerabilityAssessmentRuleBaselineImpl withExistingRule( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + this.vulnerabilityAssessmentName = vulnerabilityAssessmentName; + this.ruleId = ruleId; + return this; + } + + public DatabaseVulnerabilityAssessmentRuleBaseline create() { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseVulnerabilityAssessmentRuleBaselines() + .createOrUpdateWithResponse( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public DatabaseVulnerabilityAssessmentRuleBaseline create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseVulnerabilityAssessmentRuleBaselines() + .createOrUpdateWithResponse( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + this.innerModel(), + context) + .getValue(); + return this; + } + + DatabaseVulnerabilityAssessmentRuleBaselineImpl( + VulnerabilityAssessmentPolicyBaselineName name, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new DatabaseVulnerabilityAssessmentRuleBaselineInner(); + this.serviceManager = serviceManager; + this.baselineName = name; + } + + public DatabaseVulnerabilityAssessmentRuleBaselineImpl update() { + return this; + } + + public DatabaseVulnerabilityAssessmentRuleBaseline apply() { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseVulnerabilityAssessmentRuleBaselines() + .createOrUpdateWithResponse( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public DatabaseVulnerabilityAssessmentRuleBaseline apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseVulnerabilityAssessmentRuleBaselines() + .createOrUpdateWithResponse( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + this.innerModel(), + context) + .getValue(); + return this; + } + + DatabaseVulnerabilityAssessmentRuleBaselineImpl( + DatabaseVulnerabilityAssessmentRuleBaselineInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "databases"); + this.vulnerabilityAssessmentName = + VulnerabilityAssessmentName + .fromString(Utils.getValueFromIdByName(innerObject.id(), "vulnerabilityAssessments")); + this.ruleId = Utils.getValueFromIdByName(innerObject.id(), "rules"); + this.baselineName = + VulnerabilityAssessmentPolicyBaselineName + .fromString(Utils.getValueFromIdByName(innerObject.id(), "baselines")); + } + + public DatabaseVulnerabilityAssessmentRuleBaseline refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseVulnerabilityAssessmentRuleBaselines() + .getWithResponse( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + Context.NONE) + .getValue(); + return this; + } + + public DatabaseVulnerabilityAssessmentRuleBaseline refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseVulnerabilityAssessmentRuleBaselines() + .getWithResponse( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + context) + .getValue(); + return this; + } + + public DatabaseVulnerabilityAssessmentRuleBaselineImpl withBaselineResults( + List baselineResults) { + this.innerModel().withBaselineResults(baselineResults); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentRuleBaselinesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentRuleBaselinesClientImpl.java new file mode 100644 index 0000000000000..2034e561d3d25 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentRuleBaselinesClientImpl.java @@ -0,0 +1,917 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseVulnerabilityAssessmentRuleBaselinesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentRuleBaselineInner; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentPolicyBaselineName; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * DatabaseVulnerabilityAssessmentRuleBaselinesClient. + */ +public final class DatabaseVulnerabilityAssessmentRuleBaselinesClientImpl + implements DatabaseVulnerabilityAssessmentRuleBaselinesClient { + /** The proxy service used to perform REST calls. */ + private final DatabaseVulnerabilityAssessmentRuleBaselinesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseVulnerabilityAssessmentRuleBaselinesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DatabaseVulnerabilityAssessmentRuleBaselinesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + DatabaseVulnerabilityAssessmentRuleBaselinesService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientDatabaseVulnerabilityAssessmentRuleBaselines to be + * used by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientD") + public interface DatabaseVulnerabilityAssessmentRuleBaselinesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules" + + "/{ruleId}/baselines/{baselineName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("ruleId") String ruleId, + @PathParam("baselineName") VulnerabilityAssessmentPolicyBaselineName baselineName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules" + + "/{ruleId}/baselines/{baselineName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("ruleId") String ruleId, + @PathParam("baselineName") VulnerabilityAssessmentPolicyBaselineName baselineName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DatabaseVulnerabilityAssessmentRuleBaselineInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules" + + "/{ruleId}/baselines/{baselineName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("ruleId") String ruleId, + @PathParam("baselineName") VulnerabilityAssessmentPolicyBaselineName baselineName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's vulnerability assessment rule baseline along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (baselineName == null) { + return Mono.error(new IllegalArgumentException("Parameter baselineName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's vulnerability assessment rule baseline along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (baselineName == null) { + return Mono.error(new IllegalArgumentException("Parameter baselineName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's vulnerability assessment rule baseline on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName) { + return getWithResponseAsync( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, ruleId, baselineName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's vulnerability assessment rule baseline along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + Context context) { + return getWithResponseAsync( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, ruleId, baselineName, context) + .block(); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's vulnerability assessment rule baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseVulnerabilityAssessmentRuleBaselineInner get( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName) { + return getWithResponse( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + Context.NONE) + .getValue(); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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). + * @param parameters The requested rule baseline resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database vulnerability assessment rule baseline along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + DatabaseVulnerabilityAssessmentRuleBaselineInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (baselineName == null) { + return Mono.error(new IllegalArgumentException("Parameter baselineName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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). + * @param parameters The requested rule baseline resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database vulnerability assessment rule baseline along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + DatabaseVulnerabilityAssessmentRuleBaselineInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (baselineName == null) { + return Mono.error(new IllegalArgumentException("Parameter baselineName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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). + * @param parameters The requested rule baseline resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database vulnerability assessment rule baseline on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + DatabaseVulnerabilityAssessmentRuleBaselineInner parameters) { + return createOrUpdateWithResponseAsync( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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). + * @param parameters The requested rule baseline resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database vulnerability assessment rule baseline along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + DatabaseVulnerabilityAssessmentRuleBaselineInner parameters, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + parameters, + context) + .block(); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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). + * @param parameters The requested rule baseline resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database vulnerability assessment rule baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseVulnerabilityAssessmentRuleBaselineInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + DatabaseVulnerabilityAssessmentRuleBaselineInner parameters) { + return createOrUpdateWithResponse( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + parameters, + Context.NONE) + .getValue(); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (baselineName == null) { + return Mono.error(new IllegalArgumentException("Parameter baselineName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (baselineName == null) { + return Mono.error(new IllegalArgumentException("Parameter baselineName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName) { + return deleteWithResponseAsync( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, ruleId, baselineName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + Context context) { + return deleteWithResponseAsync( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, ruleId, baselineName, context) + .block(); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName) { + deleteWithResponse( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentRuleBaselinesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentRuleBaselinesImpl.java new file mode 100644 index 0000000000000..969cf5968caa6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentRuleBaselinesImpl.java @@ -0,0 +1,373 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseVulnerabilityAssessmentRuleBaselinesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentRuleBaselineInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseVulnerabilityAssessmentRuleBaseline; +import com.azure.resourcemanager.sql.generated.models.DatabaseVulnerabilityAssessmentRuleBaselines; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentPolicyBaselineName; + +public final class DatabaseVulnerabilityAssessmentRuleBaselinesImpl + implements DatabaseVulnerabilityAssessmentRuleBaselines { + private static final ClientLogger LOGGER = new ClientLogger(DatabaseVulnerabilityAssessmentRuleBaselinesImpl.class); + + private final DatabaseVulnerabilityAssessmentRuleBaselinesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public DatabaseVulnerabilityAssessmentRuleBaselinesImpl( + DatabaseVulnerabilityAssessmentRuleBaselinesClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatabaseVulnerabilityAssessmentRuleBaselineImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DatabaseVulnerabilityAssessmentRuleBaseline get( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName) { + DatabaseVulnerabilityAssessmentRuleBaselineInner inner = + this + .serviceClient() + .get(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, ruleId, baselineName); + if (inner != null) { + return new DatabaseVulnerabilityAssessmentRuleBaselineImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + Context context) { + return this + .serviceClient() + .deleteWithResponse( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + context); + } + + public void delete( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName) { + this + .serviceClient() + .delete(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, ruleId, baselineName); + } + + public DatabaseVulnerabilityAssessmentRuleBaseline getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String vulnerabilityAssessmentNameLocal = Utils.getValueFromIdByName(id, "vulnerabilityAssessments"); + if (vulnerabilityAssessmentNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'vulnerabilityAssessments'.", + id))); + } + VulnerabilityAssessmentName vulnerabilityAssessmentName = + VulnerabilityAssessmentName.fromString(vulnerabilityAssessmentNameLocal); + String ruleId = Utils.getValueFromIdByName(id, "rules"); + if (ruleId == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'rules'.", id))); + } + String baselineNameLocal = Utils.getValueFromIdByName(id, "baselines"); + if (baselineNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'baselines'.", id))); + } + VulnerabilityAssessmentPolicyBaselineName baselineName = + VulnerabilityAssessmentPolicyBaselineName.fromString(baselineNameLocal); + return this + .getWithResponse( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String vulnerabilityAssessmentNameLocal = Utils.getValueFromIdByName(id, "vulnerabilityAssessments"); + if (vulnerabilityAssessmentNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'vulnerabilityAssessments'.", + id))); + } + VulnerabilityAssessmentName vulnerabilityAssessmentName = + VulnerabilityAssessmentName.fromString(vulnerabilityAssessmentNameLocal); + String ruleId = Utils.getValueFromIdByName(id, "rules"); + if (ruleId == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'rules'.", id))); + } + String baselineNameLocal = Utils.getValueFromIdByName(id, "baselines"); + if (baselineNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'baselines'.", id))); + } + VulnerabilityAssessmentPolicyBaselineName baselineName = + VulnerabilityAssessmentPolicyBaselineName.fromString(baselineNameLocal); + return this + .getWithResponse( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String vulnerabilityAssessmentNameLocal = Utils.getValueFromIdByName(id, "vulnerabilityAssessments"); + if (vulnerabilityAssessmentNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'vulnerabilityAssessments'.", + id))); + } + VulnerabilityAssessmentName vulnerabilityAssessmentName = + VulnerabilityAssessmentName.fromString(vulnerabilityAssessmentNameLocal); + String ruleId = Utils.getValueFromIdByName(id, "rules"); + if (ruleId == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'rules'.", id))); + } + String baselineNameLocal = Utils.getValueFromIdByName(id, "baselines"); + if (baselineNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'baselines'.", id))); + } + VulnerabilityAssessmentPolicyBaselineName baselineName = + VulnerabilityAssessmentPolicyBaselineName.fromString(baselineNameLocal); + this + .deleteWithResponse( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String vulnerabilityAssessmentNameLocal = Utils.getValueFromIdByName(id, "vulnerabilityAssessments"); + if (vulnerabilityAssessmentNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'vulnerabilityAssessments'.", + id))); + } + VulnerabilityAssessmentName vulnerabilityAssessmentName = + VulnerabilityAssessmentName.fromString(vulnerabilityAssessmentNameLocal); + String ruleId = Utils.getValueFromIdByName(id, "rules"); + if (ruleId == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'rules'.", id))); + } + String baselineNameLocal = Utils.getValueFromIdByName(id, "baselines"); + if (baselineNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'baselines'.", id))); + } + VulnerabilityAssessmentPolicyBaselineName baselineName = + VulnerabilityAssessmentPolicyBaselineName.fromString(baselineNameLocal); + return this + .deleteWithResponse( + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + context); + } + + private DatabaseVulnerabilityAssessmentRuleBaselinesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public DatabaseVulnerabilityAssessmentRuleBaselineImpl define(VulnerabilityAssessmentPolicyBaselineName name) { + return new DatabaseVulnerabilityAssessmentRuleBaselineImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentScansClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentScansClientImpl.java new file mode 100644 index 0000000000000..c4e78f2955ebf --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentScansClientImpl.java @@ -0,0 +1,1293 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseVulnerabilityAssessmentScansClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentScansExportInner; +import com.azure.resourcemanager.sql.generated.fluent.models.VulnerabilityAssessmentScanRecordInner; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentScanRecordListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * DatabaseVulnerabilityAssessmentScansClient. + */ +public final class DatabaseVulnerabilityAssessmentScansClientImpl + implements DatabaseVulnerabilityAssessmentScansClient { + /** The proxy service used to perform REST calls. */ + private final DatabaseVulnerabilityAssessmentScansService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseVulnerabilityAssessmentScansClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DatabaseVulnerabilityAssessmentScansClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + DatabaseVulnerabilityAssessmentScansService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientDatabaseVulnerabilityAssessmentScans to be used by + * the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientD") + public interface DatabaseVulnerabilityAssessmentScansService { + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans" + + "/{scanId}/initiateScan") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> initiateScan( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("scanId") String scanId, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans" + + "/{scanId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("scanId") String scanId, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans" + + "/{scanId}/export") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> export( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("scanId") String scanId, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabaseNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> initiateScanWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (scanId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .initiateScan( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + scanId, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> initiateScanWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (scanId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .initiateScan( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + scanId, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginInitiateScanAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + Mono>> mono = + initiateScanWithResponseAsync( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginInitiateScanAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + initiateScanWithResponseAsync( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginInitiateScan( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + return beginInitiateScanAsync(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId) + .getSyncPoller(); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginInitiateScan( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context) { + return beginInitiateScanAsync( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId, context) + .getSyncPoller(); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono initiateScanAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + return beginInitiateScanAsync(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono initiateScanAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context) { + return beginInitiateScanAsync( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void initiateScan( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + initiateScanAsync(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId).block(); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void initiateScan( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context) { + initiateScanAsync(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId, context) + .block(); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan records along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan records along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan records as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + return new PagedFlux<>( + () -> + listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan records as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + return new PagedFlux<>( + () -> + listByDatabaseSinglePageAsync( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, context), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan records as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + return new PagedIterable<>( + listByDatabaseAsync(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName)); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan records as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + return new PagedIterable<>( + listByDatabaseAsync(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, context)); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a vulnerability assessment scan record of a database along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (scanId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + scanId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a vulnerability assessment scan record of a database along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (scanId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + scanId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a vulnerability assessment scan record of a database on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a vulnerability assessment scan record of a database along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context) { + return getWithResponseAsync( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId, context) + .block(); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a vulnerability assessment scan record of a database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VulnerabilityAssessmentScanRecordInner get( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + return getWithResponse( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId, Context.NONE) + .getValue(); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database Vulnerability Assessment scan export resource along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> exportWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (scanId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .export( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + scanId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database Vulnerability Assessment scan export resource along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> exportWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (scanId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .export( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + scanId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database Vulnerability Assessment scan export resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono exportAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + return exportWithResponseAsync(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database Vulnerability Assessment scan export resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response exportWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context) { + return exportWithResponseAsync( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId, context) + .block(); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database Vulnerability Assessment scan export resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseVulnerabilityAssessmentScansExportInner export( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + return exportWithResponse( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId, Context.NONE) + .getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan records along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan records along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentScansExportImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentScansExportImpl.java new file mode 100644 index 0000000000000..2f51060457cb9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentScansExportImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentScansExportInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseVulnerabilityAssessmentScansExport; + +public final class DatabaseVulnerabilityAssessmentScansExportImpl + implements DatabaseVulnerabilityAssessmentScansExport { + private DatabaseVulnerabilityAssessmentScansExportInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + DatabaseVulnerabilityAssessmentScansExportImpl( + DatabaseVulnerabilityAssessmentScansExportInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String exportedReportLocation() { + return this.innerModel().exportedReportLocation(); + } + + public DatabaseVulnerabilityAssessmentScansExportInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentScansImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentScansImpl.java new file mode 100644 index 0000000000000..054952ae7f445 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentScansImpl.java @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseVulnerabilityAssessmentScansClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentScansExportInner; +import com.azure.resourcemanager.sql.generated.fluent.models.VulnerabilityAssessmentScanRecordInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseVulnerabilityAssessmentScans; +import com.azure.resourcemanager.sql.generated.models.DatabaseVulnerabilityAssessmentScansExport; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentScanRecord; + +public final class DatabaseVulnerabilityAssessmentScansImpl implements DatabaseVulnerabilityAssessmentScans { + private static final ClientLogger LOGGER = new ClientLogger(DatabaseVulnerabilityAssessmentScansImpl.class); + + private final DatabaseVulnerabilityAssessmentScansClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public DatabaseVulnerabilityAssessmentScansImpl( + DatabaseVulnerabilityAssessmentScansClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void initiateScan( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + this + .serviceClient() + .initiateScan(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId); + } + + public void initiateScan( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context) { + this + .serviceClient() + .initiateScan(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId, context); + } + + public PagedIterable listByDatabase( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + PagedIterable inner = + this + .serviceClient() + .listByDatabase(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName); + return Utils.mapPage(inner, inner1 -> new VulnerabilityAssessmentScanRecordImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByDatabase(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, context); + return Utils.mapPage(inner, inner1 -> new VulnerabilityAssessmentScanRecordImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new VulnerabilityAssessmentScanRecordImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public VulnerabilityAssessmentScanRecord get( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + VulnerabilityAssessmentScanRecordInner inner = + this.serviceClient().get(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId); + if (inner != null) { + return new VulnerabilityAssessmentScanRecordImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response exportWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context) { + Response inner = + this + .serviceClient() + .exportWithResponse( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatabaseVulnerabilityAssessmentScansExportImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DatabaseVulnerabilityAssessmentScansExport export( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + DatabaseVulnerabilityAssessmentScansExportInner inner = + this + .serviceClient() + .export(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId); + if (inner != null) { + return new DatabaseVulnerabilityAssessmentScansExportImpl(inner, this.manager()); + } else { + return null; + } + } + + private DatabaseVulnerabilityAssessmentScansClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentsClientImpl.java new file mode 100644 index 0000000000000..e911b30caec53 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentsClientImpl.java @@ -0,0 +1,1057 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseVulnerabilityAssessmentsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseVulnerabilityAssessmentListResult; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in DatabaseVulnerabilityAssessmentsClient. + */ +public final class DatabaseVulnerabilityAssessmentsClientImpl implements DatabaseVulnerabilityAssessmentsClient { + /** The proxy service used to perform REST calls. */ + private final DatabaseVulnerabilityAssessmentsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabaseVulnerabilityAssessmentsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DatabaseVulnerabilityAssessmentsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + DatabaseVulnerabilityAssessmentsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientDatabaseVulnerabilityAssessments to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientD") + public interface DatabaseVulnerabilityAssessmentsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DatabaseVulnerabilityAssessmentInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/vulnerabilityAssessments") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabaseNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the database's vulnerability assessment along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the database's vulnerability assessment along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the database's vulnerability assessment on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the database's vulnerability assessment along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, context) + .block(); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the database's vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseVulnerabilityAssessmentInner get( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + return getWithResponse(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, Context.NONE) + .getValue(); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database vulnerability assessment along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + DatabaseVulnerabilityAssessmentInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database vulnerability assessment along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + DatabaseVulnerabilityAssessmentInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database vulnerability assessment on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + DatabaseVulnerabilityAssessmentInner parameters) { + return createOrUpdateWithResponseAsync( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database vulnerability assessment along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + DatabaseVulnerabilityAssessmentInner parameters, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, parameters, context) + .block(); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseVulnerabilityAssessmentInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + DatabaseVulnerabilityAssessmentInner parameters) { + return createOrUpdateWithResponse( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, parameters, Context.NONE) + .getValue(); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + return deleteWithResponseAsync(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + return deleteWithResponseAsync( + resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, context) + .block(); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + deleteWithResponse(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, Context.NONE); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the database's vulnerability assessments along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the database's vulnerability assessments along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the database's vulnerability assessments as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the database's vulnerability assessments as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, context), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the database's vulnerability assessments as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the database's vulnerability assessments as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the database's vulnerability assessments along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the database's vulnerability assessments along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentsImpl.java new file mode 100644 index 0000000000000..70437029b830d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabaseVulnerabilityAssessmentsImpl.java @@ -0,0 +1,266 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseVulnerabilityAssessmentsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseVulnerabilityAssessment; +import com.azure.resourcemanager.sql.generated.models.DatabaseVulnerabilityAssessments; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +public final class DatabaseVulnerabilityAssessmentsImpl implements DatabaseVulnerabilityAssessments { + private static final ClientLogger LOGGER = new ClientLogger(DatabaseVulnerabilityAssessmentsImpl.class); + + private final DatabaseVulnerabilityAssessmentsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public DatabaseVulnerabilityAssessmentsImpl( + DatabaseVulnerabilityAssessmentsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatabaseVulnerabilityAssessmentImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DatabaseVulnerabilityAssessment get( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + DatabaseVulnerabilityAssessmentInner inner = + this.serviceClient().get(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName); + if (inner != null) { + return new DatabaseVulnerabilityAssessmentImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + return this + .serviceClient() + .deleteWithResponse(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, context); + } + + public void delete( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + this.serviceClient().delete(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName); + return Utils.mapPage(inner, inner1 -> new DatabaseVulnerabilityAssessmentImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName, context); + return Utils.mapPage(inner, inner1 -> new DatabaseVulnerabilityAssessmentImpl(inner1, this.manager())); + } + + public DatabaseVulnerabilityAssessment getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String vulnerabilityAssessmentNameLocal = Utils.getValueFromIdByName(id, "vulnerabilityAssessments"); + if (vulnerabilityAssessmentNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'vulnerabilityAssessments'.", + id))); + } + VulnerabilityAssessmentName vulnerabilityAssessmentName = + VulnerabilityAssessmentName.fromString(vulnerabilityAssessmentNameLocal); + return this + .getWithResponse(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String vulnerabilityAssessmentNameLocal = Utils.getValueFromIdByName(id, "vulnerabilityAssessments"); + if (vulnerabilityAssessmentNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'vulnerabilityAssessments'.", + id))); + } + VulnerabilityAssessmentName vulnerabilityAssessmentName = + VulnerabilityAssessmentName.fromString(vulnerabilityAssessmentNameLocal); + return this.getWithResponse(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String vulnerabilityAssessmentNameLocal = Utils.getValueFromIdByName(id, "vulnerabilityAssessments"); + if (vulnerabilityAssessmentNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'vulnerabilityAssessments'.", + id))); + } + VulnerabilityAssessmentName vulnerabilityAssessmentName = + VulnerabilityAssessmentName.fromString(vulnerabilityAssessmentNameLocal); + this.deleteWithResponse(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String vulnerabilityAssessmentNameLocal = Utils.getValueFromIdByName(id, "vulnerabilityAssessments"); + if (vulnerabilityAssessmentNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'vulnerabilityAssessments'.", + id))); + } + VulnerabilityAssessmentName vulnerabilityAssessmentName = + VulnerabilityAssessmentName.fromString(vulnerabilityAssessmentNameLocal); + return this + .deleteWithResponse(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, context); + } + + private DatabaseVulnerabilityAssessmentsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public DatabaseVulnerabilityAssessmentImpl define(VulnerabilityAssessmentName name) { + return new DatabaseVulnerabilityAssessmentImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabasesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabasesClientImpl.java new file mode 100644 index 0000000000000..c2882713fbeff --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabasesClientImpl.java @@ -0,0 +1,4577 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.DatabasesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseInner; +import com.azure.resourcemanager.sql.generated.fluent.models.ImportExportOperationResultInner; +import com.azure.resourcemanager.sql.generated.fluent.models.MetricDefinitionInner; +import com.azure.resourcemanager.sql.generated.fluent.models.MetricInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseListResult; +import com.azure.resourcemanager.sql.generated.models.DatabaseUpdate; +import com.azure.resourcemanager.sql.generated.models.ExportDatabaseDefinition; +import com.azure.resourcemanager.sql.generated.models.ImportExistingDatabaseDefinition; +import com.azure.resourcemanager.sql.generated.models.MetricDefinitionListResult; +import com.azure.resourcemanager.sql.generated.models.MetricListResult; +import com.azure.resourcemanager.sql.generated.models.ReplicaType; +import com.azure.resourcemanager.sql.generated.models.ResourceMoveDefinition; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DatabasesClient. */ +public final class DatabasesClientImpl implements DatabasesClient { + /** The proxy service used to perform REST calls. */ + private final DatabasesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of DatabasesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DatabasesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(DatabasesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientDatabases to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientD") + public interface DatabasesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/metrics") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listMetrics( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/metricDefinitions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listMetricDefinitions( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @QueryParam("$skipToken") String skipToken, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DatabaseInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DatabaseUpdate parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/export") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> export( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ExportDatabaseDefinition parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/failover") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> failover( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @QueryParam("replicaType") ReplicaType replicaType, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/import") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> importMethod( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ImportExistingDatabaseDefinition parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/move") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> rename( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ResourceMoveDefinition parameters, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/pause") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> pause( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/resume") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> resume( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/upgradeDataWarehouse") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> upgradeDataWarehouse( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/elasticPools/{elasticPoolName}/databases") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByElasticPool( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("elasticPoolName") String elasticPoolName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/inaccessibleDatabases") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listInaccessibleByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByElasticPoolNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listInaccessibleByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list database metrics request along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricsSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMetrics( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list database metrics request along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricsSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMetrics( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list database metrics request as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricsAsync( + String resourceGroupName, String serverName, String databaseName, String filter) { + return new PagedFlux<>(() -> listMetricsSinglePageAsync(resourceGroupName, serverName, databaseName, filter)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list database metrics request as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricsAsync( + String resourceGroupName, String serverName, String databaseName, String filter, Context context) { + return new PagedFlux<>( + () -> listMetricsSinglePageAsync(resourceGroupName, serverName, databaseName, filter, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list database metrics request as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics( + String resourceGroupName, String serverName, String databaseName, String filter) { + return new PagedIterable<>(listMetricsAsync(resourceGroupName, serverName, databaseName, filter)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list database metrics request as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics( + String resourceGroupName, String serverName, String databaseName, String filter, Context context) { + return new PagedIterable<>(listMetricsAsync(resourceGroupName, serverName, databaseName, filter, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list database metric definitions request along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricDefinitionsSinglePageAsync( + String resourceGroupName, String serverName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMetricDefinitions( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list database metric definitions request along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricDefinitionsSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMetricDefinitions( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list database metric definitions request as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricDefinitionsAsync( + String resourceGroupName, String serverName, String databaseName) { + return new PagedFlux<>(() -> listMetricDefinitionsSinglePageAsync(resourceGroupName, serverName, databaseName)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list database metric definitions request as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricDefinitionsAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedFlux<>( + () -> listMetricDefinitionsSinglePageAsync(resourceGroupName, serverName, databaseName, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list database metric definitions request as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetricDefinitions( + String resourceGroupName, String serverName, String databaseName) { + return new PagedIterable<>(listMetricDefinitionsAsync(resourceGroupName, serverName, databaseName)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list database metric definitions request as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetricDefinitions( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedIterable<>(listMetricDefinitionsAsync(resourceGroupName, serverName, databaseName, context)); + } + + /** + * 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 skipToken The skipToken parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of databases along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, String skipToken) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + skipToken, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 skipToken The skipToken parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of databases along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, String skipToken, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + skipToken, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 skipToken The skipToken parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of databases as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName, String skipToken) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, skipToken), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of databases as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + final String skipToken = null; + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, skipToken), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * 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 skipToken The skipToken parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of databases as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, String skipToken, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, skipToken, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of databases as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + final String skipToken = null; + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, skipToken)); + } + + /** + * 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 skipToken The skipToken parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of databases as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, String skipToken, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, skipToken, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serverName, String databaseName) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseInner get(String resourceGroupName, String serverName, String databaseName) { + return getWithResponse(resourceGroupName, serverName, databaseName, Context.NONE).getValue(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2022-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2022-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DatabaseInner> beginCreateOrUpdateAsync( + String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, databaseName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DatabaseInner.class, + DatabaseInner.class, + this.client.getContext()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DatabaseInner> beginCreateOrUpdateAsync( + String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, databaseName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), DatabaseInner.class, DatabaseInner.class, context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DatabaseInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters).getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DatabaseInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters, context) + .getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseInner createOrUpdate( + String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseInner createOrUpdate( + String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters, Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-05-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-05-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String databaseName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, serverName, databaseName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, databaseName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String databaseName) { + return beginDeleteAsync(resourceGroupName, serverName, databaseName).getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String databaseName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, databaseName, context).getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String serverName, String databaseName) { + return beginDeleteAsync(resourceGroupName, serverName, databaseName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String serverName, String databaseName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, databaseName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, String databaseName) { + deleteAsync(resourceGroupName, serverName, databaseName).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, String databaseName, Context context) { + deleteAsync(resourceGroupName, serverName, databaseName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2022-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2022-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DatabaseInner> beginUpdateAsync( + String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, serverName, databaseName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DatabaseInner.class, + DatabaseInner.class, + this.client.getContext()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DatabaseInner> beginUpdateAsync( + String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, serverName, databaseName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), DatabaseInner.class, DatabaseInner.class, context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DatabaseInner> beginUpdate( + String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters) { + return beginUpdateAsync(resourceGroupName, serverName, databaseName, parameters).getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DatabaseInner> beginUpdate( + String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters, Context context) { + return beginUpdateAsync(resourceGroupName, serverName, databaseName, parameters, context).getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters) { + return beginUpdateAsync(resourceGroupName, serverName, databaseName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters, Context context) { + return beginUpdateAsync(resourceGroupName, serverName, databaseName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseInner update( + String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters) { + return updateAsync(resourceGroupName, serverName, databaseName, parameters).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseInner update( + String resourceGroupName, String serverName, String databaseName, DatabaseUpdate parameters, Context context) { + return updateAsync(resourceGroupName, serverName, databaseName, parameters, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> exportWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, ExportDatabaseDefinition parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2022-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .export( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> exportWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + ExportDatabaseDefinition parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2022-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .export( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ImportExportOperationResultInner> beginExportAsync( + String resourceGroupName, String serverName, String databaseName, ExportDatabaseDefinition parameters) { + Mono>> mono = + exportWithResponseAsync(resourceGroupName, serverName, databaseName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ImportExportOperationResultInner.class, + ImportExportOperationResultInner.class, + this.client.getContext()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ImportExportOperationResultInner> beginExportAsync( + String resourceGroupName, + String serverName, + String databaseName, + ExportDatabaseDefinition parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + exportWithResponseAsync(resourceGroupName, serverName, databaseName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ImportExportOperationResultInner.class, + ImportExportOperationResultInner.class, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ImportExportOperationResultInner> beginExport( + String resourceGroupName, String serverName, String databaseName, ExportDatabaseDefinition parameters) { + return beginExportAsync(resourceGroupName, serverName, databaseName, parameters).getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ImportExportOperationResultInner> beginExport( + String resourceGroupName, + String serverName, + String databaseName, + ExportDatabaseDefinition parameters, + Context context) { + return beginExportAsync(resourceGroupName, serverName, databaseName, parameters, context).getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono exportAsync( + String resourceGroupName, String serverName, String databaseName, ExportDatabaseDefinition parameters) { + return beginExportAsync(resourceGroupName, serverName, databaseName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono exportAsync( + String resourceGroupName, + String serverName, + String databaseName, + ExportDatabaseDefinition parameters, + Context context) { + return beginExportAsync(resourceGroupName, serverName, databaseName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ImportExportOperationResultInner export( + String resourceGroupName, String serverName, String databaseName, ExportDatabaseDefinition parameters) { + return exportAsync(resourceGroupName, serverName, databaseName, parameters).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ImportExportOperationResultInner export( + String resourceGroupName, + String serverName, + String databaseName, + ExportDatabaseDefinition parameters, + Context context) { + return exportAsync(resourceGroupName, serverName, databaseName, parameters, context).block(); + } + + /** + * Failovers a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to failover. + * @param replicaType The type of replica to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> failoverWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, ReplicaType replicaType) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-05-01-preview"; + return FluxUtil + .withContext( + context -> + service + .failover( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + replicaType, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Failovers a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to failover. + * @param replicaType The type of replica to be failed over. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> failoverWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, ReplicaType replicaType, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-05-01-preview"; + context = this.client.mergeContext(context); + return service + .failover( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + replicaType, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Failovers a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to failover. + * @param replicaType The type of replica to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginFailoverAsync( + String resourceGroupName, String serverName, String databaseName, ReplicaType replicaType) { + Mono>> mono = + failoverWithResponseAsync(resourceGroupName, serverName, databaseName, replicaType); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Failovers a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to failover. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginFailoverAsync( + String resourceGroupName, String serverName, String databaseName) { + final ReplicaType replicaType = null; + Mono>> mono = + failoverWithResponseAsync(resourceGroupName, serverName, databaseName, replicaType); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Failovers a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to failover. + * @param replicaType The type of replica to be failed over. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginFailoverAsync( + String resourceGroupName, String serverName, String databaseName, ReplicaType replicaType, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + failoverWithResponseAsync(resourceGroupName, serverName, databaseName, replicaType, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Failovers a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to failover. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginFailover( + String resourceGroupName, String serverName, String databaseName) { + final ReplicaType replicaType = null; + return beginFailoverAsync(resourceGroupName, serverName, databaseName, replicaType).getSyncPoller(); + } + + /** + * Failovers a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to failover. + * @param replicaType The type of replica to be failed over. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginFailover( + String resourceGroupName, String serverName, String databaseName, ReplicaType replicaType, Context context) { + return beginFailoverAsync(resourceGroupName, serverName, databaseName, replicaType, context).getSyncPoller(); + } + + /** + * Failovers a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to failover. + * @param replicaType The type of replica to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono failoverAsync( + String resourceGroupName, String serverName, String databaseName, ReplicaType replicaType) { + return beginFailoverAsync(resourceGroupName, serverName, databaseName, replicaType) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Failovers a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to failover. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono failoverAsync(String resourceGroupName, String serverName, String databaseName) { + final ReplicaType replicaType = null; + return beginFailoverAsync(resourceGroupName, serverName, databaseName, replicaType) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Failovers a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to failover. + * @param replicaType The type of replica to be failed over. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono failoverAsync( + String resourceGroupName, String serverName, String databaseName, ReplicaType replicaType, Context context) { + return beginFailoverAsync(resourceGroupName, serverName, databaseName, replicaType, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Failovers a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to failover. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void failover(String resourceGroupName, String serverName, String databaseName) { + final ReplicaType replicaType = null; + failoverAsync(resourceGroupName, serverName, databaseName, replicaType).block(); + } + + /** + * Failovers a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to failover. + * @param replicaType The type of replica to be failed over. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void failover( + String resourceGroupName, String serverName, String databaseName, ReplicaType replicaType, Context context) { + failoverAsync(resourceGroupName, serverName, databaseName, replicaType, context).block(); + } + + /** + * 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 databaseName The name of the database. + * @param parameters The database import request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> importMethodWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, ImportExistingDatabaseDefinition parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2022-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .importMethod( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 databaseName The name of the database. + * @param parameters The database import request parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> importMethodWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + ImportExistingDatabaseDefinition parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2022-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .importMethod( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 databaseName The name of the database. + * @param parameters The database import request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ImportExportOperationResultInner> + beginImportMethodAsync( + String resourceGroupName, + String serverName, + String databaseName, + ImportExistingDatabaseDefinition parameters) { + Mono>> mono = + importMethodWithResponseAsync(resourceGroupName, serverName, databaseName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ImportExportOperationResultInner.class, + ImportExportOperationResultInner.class, + this.client.getContext()); + } + + /** + * 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 databaseName The name of the database. + * @param parameters The database import request parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ImportExportOperationResultInner> + beginImportMethodAsync( + String resourceGroupName, + String serverName, + String databaseName, + ImportExistingDatabaseDefinition parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + importMethodWithResponseAsync(resourceGroupName, serverName, databaseName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ImportExportOperationResultInner.class, + ImportExportOperationResultInner.class, + context); + } + + /** + * 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 databaseName The name of the database. + * @param parameters The database import request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ImportExportOperationResultInner> beginImportMethod( + String resourceGroupName, String serverName, String databaseName, ImportExistingDatabaseDefinition parameters) { + return beginImportMethodAsync(resourceGroupName, serverName, databaseName, parameters).getSyncPoller(); + } + + /** + * 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 databaseName The name of the database. + * @param parameters The database import request parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ImportExportOperationResultInner> beginImportMethod( + String resourceGroupName, + String serverName, + String databaseName, + ImportExistingDatabaseDefinition parameters, + Context context) { + return beginImportMethodAsync(resourceGroupName, serverName, databaseName, parameters, context).getSyncPoller(); + } + + /** + * 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 databaseName The name of the database. + * @param parameters The database import request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono importMethodAsync( + String resourceGroupName, String serverName, String databaseName, ImportExistingDatabaseDefinition parameters) { + return beginImportMethodAsync(resourceGroupName, serverName, databaseName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 databaseName The name of the database. + * @param parameters The database import request parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono importMethodAsync( + String resourceGroupName, + String serverName, + String databaseName, + ImportExistingDatabaseDefinition parameters, + Context context) { + return beginImportMethodAsync(resourceGroupName, serverName, databaseName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 databaseName The name of the database. + * @param parameters The database import request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ImportExportOperationResultInner importMethod( + String resourceGroupName, String serverName, String databaseName, ImportExistingDatabaseDefinition parameters) { + return importMethodAsync(resourceGroupName, serverName, databaseName, parameters).block(); + } + + /** + * 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 databaseName The name of the database. + * @param parameters The database import request parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ImportExportOperationResultInner importMethod( + String resourceGroupName, + String serverName, + String databaseName, + ImportExistingDatabaseDefinition parameters, + Context context) { + return importMethodAsync(resourceGroupName, serverName, databaseName, parameters, context).block(); + } + + /** + * 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 parameters The resource move definition for renaming this database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> renameWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, ResourceMoveDefinition parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2022-05-01-preview"; + return FluxUtil + .withContext( + context -> + service + .rename( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 parameters The resource move definition for renaming this database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> renameWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + ResourceMoveDefinition parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2022-05-01-preview"; + context = this.client.mergeContext(context); + return service + .rename( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + context); + } + + /** + * 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 parameters The resource move definition for renaming this database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono renameAsync( + String resourceGroupName, String serverName, String databaseName, ResourceMoveDefinition parameters) { + return renameWithResponseAsync(resourceGroupName, serverName, databaseName, parameters) + .flatMap(ignored -> Mono.empty()); + } + + /** + * 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 parameters The resource move definition for renaming this database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response renameWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + ResourceMoveDefinition parameters, + Context context) { + return renameWithResponseAsync(resourceGroupName, serverName, databaseName, parameters, context).block(); + } + + /** + * 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 parameters The resource move definition for renaming this database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void rename( + String resourceGroupName, String serverName, String databaseName, ResourceMoveDefinition parameters) { + renameWithResponse(resourceGroupName, serverName, databaseName, parameters, Context.NONE); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> pauseWithResponseAsync( + String resourceGroupName, String serverName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .pause( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> pauseWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .pause( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DatabaseInner> beginPauseAsync( + String resourceGroupName, String serverName, String databaseName) { + Mono>> mono = pauseWithResponseAsync(resourceGroupName, serverName, databaseName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DatabaseInner.class, + DatabaseInner.class, + this.client.getContext()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DatabaseInner> beginPauseAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + pauseWithResponseAsync(resourceGroupName, serverName, databaseName, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), DatabaseInner.class, DatabaseInner.class, context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DatabaseInner> beginPause( + String resourceGroupName, String serverName, String databaseName) { + return beginPauseAsync(resourceGroupName, serverName, databaseName).getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DatabaseInner> beginPause( + String resourceGroupName, String serverName, String databaseName, Context context) { + return beginPauseAsync(resourceGroupName, serverName, databaseName, context).getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono pauseAsync(String resourceGroupName, String serverName, String databaseName) { + return beginPauseAsync(resourceGroupName, serverName, databaseName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono pauseAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + return beginPauseAsync(resourceGroupName, serverName, databaseName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseInner pause(String resourceGroupName, String serverName, String databaseName) { + return pauseAsync(resourceGroupName, serverName, databaseName).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseInner pause(String resourceGroupName, String serverName, String databaseName, Context context) { + return pauseAsync(resourceGroupName, serverName, databaseName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> resumeWithResponseAsync( + String resourceGroupName, String serverName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .resume( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> resumeWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .resume( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DatabaseInner> beginResumeAsync( + String resourceGroupName, String serverName, String databaseName) { + Mono>> mono = resumeWithResponseAsync(resourceGroupName, serverName, databaseName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DatabaseInner.class, + DatabaseInner.class, + this.client.getContext()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DatabaseInner> beginResumeAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + resumeWithResponseAsync(resourceGroupName, serverName, databaseName, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), DatabaseInner.class, DatabaseInner.class, context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DatabaseInner> beginResume( + String resourceGroupName, String serverName, String databaseName) { + return beginResumeAsync(resourceGroupName, serverName, databaseName).getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DatabaseInner> beginResume( + String resourceGroupName, String serverName, String databaseName, Context context) { + return beginResumeAsync(resourceGroupName, serverName, databaseName, context).getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono resumeAsync(String resourceGroupName, String serverName, String databaseName) { + return beginResumeAsync(resourceGroupName, serverName, databaseName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono resumeAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + return beginResumeAsync(resourceGroupName, serverName, databaseName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseInner resume(String resourceGroupName, String serverName, String databaseName) { + return resumeAsync(resourceGroupName, serverName, databaseName).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseInner resume(String resourceGroupName, String serverName, String databaseName, Context context) { + return resumeAsync(resourceGroupName, serverName, databaseName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> upgradeDataWarehouseWithResponseAsync( + String resourceGroupName, String serverName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-05-01-preview"; + return FluxUtil + .withContext( + context -> + service + .upgradeDataWarehouse( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> upgradeDataWarehouseWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-05-01-preview"; + context = this.client.mergeContext(context); + return service + .upgradeDataWarehouse( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginUpgradeDataWarehouseAsync( + String resourceGroupName, String serverName, String databaseName) { + Mono>> mono = + upgradeDataWarehouseWithResponseAsync(resourceGroupName, serverName, databaseName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginUpgradeDataWarehouseAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + upgradeDataWarehouseWithResponseAsync(resourceGroupName, serverName, databaseName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginUpgradeDataWarehouse( + String resourceGroupName, String serverName, String databaseName) { + return beginUpgradeDataWarehouseAsync(resourceGroupName, serverName, databaseName).getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginUpgradeDataWarehouse( + String resourceGroupName, String serverName, String databaseName, Context context) { + return beginUpgradeDataWarehouseAsync(resourceGroupName, serverName, databaseName, context).getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono upgradeDataWarehouseAsync(String resourceGroupName, String serverName, String databaseName) { + return beginUpgradeDataWarehouseAsync(resourceGroupName, serverName, databaseName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono upgradeDataWarehouseAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + return beginUpgradeDataWarehouseAsync(resourceGroupName, serverName, databaseName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void upgradeDataWarehouse(String resourceGroupName, String serverName, String databaseName) { + upgradeDataWarehouseAsync(resourceGroupName, serverName, databaseName).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void upgradeDataWarehouse( + String resourceGroupName, String serverName, String databaseName, Context context) { + upgradeDataWarehouseAsync(resourceGroupName, serverName, databaseName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of databases in an elastic pool along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByElasticPoolSinglePageAsync( + String resourceGroupName, String serverName, String elasticPoolName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (elasticPoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByElasticPool( + this.client.getEndpoint(), + resourceGroupName, + serverName, + elasticPoolName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of databases in an elastic pool along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByElasticPoolSinglePageAsync( + String resourceGroupName, String serverName, String elasticPoolName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (elasticPoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByElasticPool( + this.client.getEndpoint(), + resourceGroupName, + serverName, + elasticPoolName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of databases in an elastic pool as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByElasticPoolAsync( + String resourceGroupName, String serverName, String elasticPoolName) { + return new PagedFlux<>( + () -> listByElasticPoolSinglePageAsync(resourceGroupName, serverName, elasticPoolName), + nextLink -> listByElasticPoolNextSinglePageAsync(nextLink)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of databases in an elastic pool as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByElasticPoolAsync( + String resourceGroupName, String serverName, String elasticPoolName, Context context) { + return new PagedFlux<>( + () -> listByElasticPoolSinglePageAsync(resourceGroupName, serverName, elasticPoolName, context), + nextLink -> listByElasticPoolNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of databases in an elastic pool as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName) { + return new PagedIterable<>(listByElasticPoolAsync(resourceGroupName, serverName, elasticPoolName)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of databases in an elastic pool as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName, Context context) { + return new PagedIterable<>(listByElasticPoolAsync(resourceGroupName, serverName, elasticPoolName, context)); + } + + /** + * Gets a list of inaccessible databases in a logical server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of inaccessible databases in a logical server along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listInaccessibleByServerSinglePageAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listInaccessibleByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of inaccessible databases in a logical server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of inaccessible databases in a logical server along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listInaccessibleByServerSinglePageAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listInaccessibleByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of inaccessible databases in a logical server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of inaccessible databases in a logical server as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listInaccessibleByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listInaccessibleByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listInaccessibleByServerNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of inaccessible databases in a logical server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of inaccessible databases in a logical server as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listInaccessibleByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listInaccessibleByServerSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listInaccessibleByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of inaccessible databases in a logical server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of inaccessible databases in a logical server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listInaccessibleByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listInaccessibleByServerAsync(resourceGroupName, serverName)); + } + + /** + * Gets a list of inaccessible databases in a logical server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of inaccessible databases in a logical server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listInaccessibleByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listInaccessibleByServerAsync(resourceGroupName, serverName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of databases along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByServerNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of databases along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServerNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of databases along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByElasticPoolNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByElasticPoolNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of databases along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByElasticPoolNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByElasticPoolNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of databases along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listInaccessibleByServerNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listInaccessibleByServerNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of databases along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listInaccessibleByServerNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listInaccessibleByServerNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabasesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabasesImpl.java new file mode 100644 index 0000000000000..b90b0e5003ff5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DatabasesImpl.java @@ -0,0 +1,376 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.DatabasesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseInner; +import com.azure.resourcemanager.sql.generated.fluent.models.ImportExportOperationResultInner; +import com.azure.resourcemanager.sql.generated.fluent.models.MetricDefinitionInner; +import com.azure.resourcemanager.sql.generated.fluent.models.MetricInner; +import com.azure.resourcemanager.sql.generated.models.Database; +import com.azure.resourcemanager.sql.generated.models.Databases; +import com.azure.resourcemanager.sql.generated.models.ExportDatabaseDefinition; +import com.azure.resourcemanager.sql.generated.models.ImportExistingDatabaseDefinition; +import com.azure.resourcemanager.sql.generated.models.ImportExportOperationResult; +import com.azure.resourcemanager.sql.generated.models.Metric; +import com.azure.resourcemanager.sql.generated.models.MetricDefinition; +import com.azure.resourcemanager.sql.generated.models.ReplicaType; +import com.azure.resourcemanager.sql.generated.models.ResourceMoveDefinition; + +public final class DatabasesImpl implements Databases { + private static final ClientLogger LOGGER = new ClientLogger(DatabasesImpl.class); + + private final DatabasesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public DatabasesImpl( + DatabasesClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listMetrics( + String resourceGroupName, String serverName, String databaseName, String filter) { + PagedIterable inner = + this.serviceClient().listMetrics(resourceGroupName, serverName, databaseName, filter); + return Utils.mapPage(inner, inner1 -> new MetricImpl(inner1, this.manager())); + } + + public PagedIterable listMetrics( + String resourceGroupName, String serverName, String databaseName, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listMetrics(resourceGroupName, serverName, databaseName, filter, context); + return Utils.mapPage(inner, inner1 -> new MetricImpl(inner1, this.manager())); + } + + public PagedIterable listMetricDefinitions( + String resourceGroupName, String serverName, String databaseName) { + PagedIterable inner = + this.serviceClient().listMetricDefinitions(resourceGroupName, serverName, databaseName); + return Utils.mapPage(inner, inner1 -> new MetricDefinitionImpl(inner1, this.manager())); + } + + public PagedIterable listMetricDefinitions( + String resourceGroupName, String serverName, String databaseName, Context context) { + PagedIterable inner = + this.serviceClient().listMetricDefinitions(resourceGroupName, serverName, databaseName, context); + return Utils.mapPage(inner, inner1 -> new MetricDefinitionImpl(inner1, this.manager())); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new DatabaseImpl(inner1, this.manager())); + } + + public PagedIterable listByServer( + String resourceGroupName, String serverName, String skipToken, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, skipToken, context); + return Utils.mapPage(inner, inner1 -> new DatabaseImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, databaseName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatabaseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Database get(String resourceGroupName, String serverName, String databaseName) { + DatabaseInner inner = this.serviceClient().get(resourceGroupName, serverName, databaseName); + if (inner != null) { + return new DatabaseImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String serverName, String databaseName) { + this.serviceClient().delete(resourceGroupName, serverName, databaseName); + } + + public void delete(String resourceGroupName, String serverName, String databaseName, Context context) { + this.serviceClient().delete(resourceGroupName, serverName, databaseName, context); + } + + public ImportExportOperationResult export( + String resourceGroupName, String serverName, String databaseName, ExportDatabaseDefinition parameters) { + ImportExportOperationResultInner inner = + this.serviceClient().export(resourceGroupName, serverName, databaseName, parameters); + if (inner != null) { + return new ImportExportOperationResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public ImportExportOperationResult export( + String resourceGroupName, + String serverName, + String databaseName, + ExportDatabaseDefinition parameters, + Context context) { + ImportExportOperationResultInner inner = + this.serviceClient().export(resourceGroupName, serverName, databaseName, parameters, context); + if (inner != null) { + return new ImportExportOperationResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public void failover(String resourceGroupName, String serverName, String databaseName) { + this.serviceClient().failover(resourceGroupName, serverName, databaseName); + } + + public void failover( + String resourceGroupName, String serverName, String databaseName, ReplicaType replicaType, Context context) { + this.serviceClient().failover(resourceGroupName, serverName, databaseName, replicaType, context); + } + + public ImportExportOperationResult importMethod( + String resourceGroupName, String serverName, String databaseName, ImportExistingDatabaseDefinition parameters) { + ImportExportOperationResultInner inner = + this.serviceClient().importMethod(resourceGroupName, serverName, databaseName, parameters); + if (inner != null) { + return new ImportExportOperationResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public ImportExportOperationResult importMethod( + String resourceGroupName, + String serverName, + String databaseName, + ImportExistingDatabaseDefinition parameters, + Context context) { + ImportExportOperationResultInner inner = + this.serviceClient().importMethod(resourceGroupName, serverName, databaseName, parameters, context); + if (inner != null) { + return new ImportExportOperationResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response renameWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + ResourceMoveDefinition parameters, + Context context) { + return this + .serviceClient() + .renameWithResponse(resourceGroupName, serverName, databaseName, parameters, context); + } + + public void rename( + String resourceGroupName, String serverName, String databaseName, ResourceMoveDefinition parameters) { + this.serviceClient().rename(resourceGroupName, serverName, databaseName, parameters); + } + + public Database pause(String resourceGroupName, String serverName, String databaseName) { + DatabaseInner inner = this.serviceClient().pause(resourceGroupName, serverName, databaseName); + if (inner != null) { + return new DatabaseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Database pause(String resourceGroupName, String serverName, String databaseName, Context context) { + DatabaseInner inner = this.serviceClient().pause(resourceGroupName, serverName, databaseName, context); + if (inner != null) { + return new DatabaseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Database resume(String resourceGroupName, String serverName, String databaseName) { + DatabaseInner inner = this.serviceClient().resume(resourceGroupName, serverName, databaseName); + if (inner != null) { + return new DatabaseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Database resume(String resourceGroupName, String serverName, String databaseName, Context context) { + DatabaseInner inner = this.serviceClient().resume(resourceGroupName, serverName, databaseName, context); + if (inner != null) { + return new DatabaseImpl(inner, this.manager()); + } else { + return null; + } + } + + public void upgradeDataWarehouse(String resourceGroupName, String serverName, String databaseName) { + this.serviceClient().upgradeDataWarehouse(resourceGroupName, serverName, databaseName); + } + + public void upgradeDataWarehouse( + String resourceGroupName, String serverName, String databaseName, Context context) { + this.serviceClient().upgradeDataWarehouse(resourceGroupName, serverName, databaseName, context); + } + + public PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName) { + PagedIterable inner = + this.serviceClient().listByElasticPool(resourceGroupName, serverName, elasticPoolName); + return Utils.mapPage(inner, inner1 -> new DatabaseImpl(inner1, this.manager())); + } + + public PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName, Context context) { + PagedIterable inner = + this.serviceClient().listByElasticPool(resourceGroupName, serverName, elasticPoolName, context); + return Utils.mapPage(inner, inner1 -> new DatabaseImpl(inner1, this.manager())); + } + + public PagedIterable listInaccessibleByServer(String resourceGroupName, String serverName) { + PagedIterable inner = + this.serviceClient().listInaccessibleByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new DatabaseImpl(inner1, this.manager())); + } + + public PagedIterable listInaccessibleByServer( + String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listInaccessibleByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new DatabaseImpl(inner1, this.manager())); + } + + public Database getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, databaseName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, databaseName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + this.delete(resourceGroupName, serverName, databaseName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + this.delete(resourceGroupName, serverName, databaseName, context); + } + + private DatabasesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public DatabaseImpl define(String name) { + return new DatabaseImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DeletedServerImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DeletedServerImpl.java new file mode 100644 index 0000000000000..56765466fad1d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DeletedServerImpl.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.DeletedServerInner; +import com.azure.resourcemanager.sql.generated.models.DeletedServer; +import java.time.OffsetDateTime; + +public final class DeletedServerImpl implements DeletedServer { + private DeletedServerInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + DeletedServerImpl( + DeletedServerInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String version() { + return this.innerModel().version(); + } + + public OffsetDateTime deletionTime() { + return this.innerModel().deletionTime(); + } + + public String originalId() { + return this.innerModel().originalId(); + } + + public String fullyQualifiedDomainName() { + return this.innerModel().fullyQualifiedDomainName(); + } + + public DeletedServerInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DeletedServersClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DeletedServersClientImpl.java new file mode 100644 index 0000000000000..d8ae98d8cca6b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DeletedServersClientImpl.java @@ -0,0 +1,958 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.DeletedServersClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DeletedServerInner; +import com.azure.resourcemanager.sql.generated.models.DeletedServerListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DeletedServersClient. */ +public final class DeletedServersClientImpl implements DeletedServersClient { + /** The proxy service used to perform REST calls. */ + private final DeletedServersService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of DeletedServersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DeletedServersClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(DeletedServersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientDeletedServers to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientD") + public interface DeletedServersService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/deletedServers") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/deletedServers" + + "/{deletedServerName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("locationName") String locationName, + @PathParam("deletedServerName") String deletedServerName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/deletedServers") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByLocation( + @HostParam("$host") String endpoint, + @PathParam("locationName") String locationName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/deletedServers" + + "/{deletedServerName}/recover") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> recover( + @HostParam("$host") String endpoint, + @PathParam("locationName") String locationName, + @PathParam("deletedServerName") String deletedServerName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByLocationNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a list of all deleted servers in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all deleted servers in a subscription along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of all deleted servers in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all deleted servers in a subscription along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of all deleted servers in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all deleted servers in a subscription as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of all deleted servers in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all deleted servers in a subscription as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of all deleted servers in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all deleted servers in a subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Gets a list of all deleted servers in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all deleted servers in a subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Gets a deleted server. + * + * @param locationName The name of the region where the resource is located. + * @param deletedServerName The name of the deleted server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deleted server along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String locationName, String deletedServerName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (deletedServerName == null) { + return Mono + .error(new IllegalArgumentException("Parameter deletedServerName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + locationName, + deletedServerName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a deleted server. + * + * @param locationName The name of the region where the resource is located. + * @param deletedServerName The name of the deleted server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deleted server along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String locationName, String deletedServerName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (deletedServerName == null) { + return Mono + .error(new IllegalArgumentException("Parameter deletedServerName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + locationName, + deletedServerName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a deleted server. + * + * @param locationName The name of the region where the resource is located. + * @param deletedServerName The name of the deleted server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deleted server on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String locationName, String deletedServerName) { + return getWithResponseAsync(locationName, deletedServerName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a deleted server. + * + * @param locationName The name of the region where the resource is located. + * @param deletedServerName The name of the deleted server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deleted server along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String locationName, String deletedServerName, Context context) { + return getWithResponseAsync(locationName, deletedServerName, context).block(); + } + + /** + * Gets a deleted server. + * + * @param locationName The name of the region where the resource is located. + * @param deletedServerName The name of the deleted server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deleted server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeletedServerInner get(String locationName, String deletedServerName) { + return getWithResponse(locationName, deletedServerName, Context.NONE).getValue(); + } + + /** + * Gets a list of deleted servers for a location. + * + * @param locationName The name of the region where the resource is located. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of deleted servers for a location along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationSinglePageAsync(String locationName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByLocation( + this.client.getEndpoint(), + locationName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of deleted servers for a location. + * + * @param locationName The name of the region where the resource is located. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of deleted servers for a location along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationSinglePageAsync( + String locationName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByLocation( + this.client.getEndpoint(), locationName, this.client.getSubscriptionId(), apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of deleted servers for a location. + * + * @param locationName The name of the region where the resource is located. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of deleted servers for a location as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByLocationAsync(String locationName) { + return new PagedFlux<>( + () -> listByLocationSinglePageAsync(locationName), nextLink -> listByLocationNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of deleted servers for a location. + * + * @param locationName The name of the region where the resource is located. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of deleted servers for a location as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByLocationAsync(String locationName, Context context) { + return new PagedFlux<>( + () -> listByLocationSinglePageAsync(locationName, context), + nextLink -> listByLocationNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of deleted servers for a location. + * + * @param locationName The name of the region where the resource is located. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of deleted servers for a location as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByLocation(String locationName) { + return new PagedIterable<>(listByLocationAsync(locationName)); + } + + /** + * Gets a list of deleted servers for a location. + * + * @param locationName The name of the region where the resource is located. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of deleted servers for a location as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByLocation(String locationName, Context context) { + return new PagedIterable<>(listByLocationAsync(locationName, context)); + } + + /** + * Recovers a deleted server. + * + * @param locationName The name of the region where the resource is located. + * @param deletedServerName The name of the deleted server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deleted server along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> recoverWithResponseAsync(String locationName, String deletedServerName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (deletedServerName == null) { + return Mono + .error(new IllegalArgumentException("Parameter deletedServerName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .recover( + this.client.getEndpoint(), + locationName, + deletedServerName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Recovers a deleted server. + * + * @param locationName The name of the region where the resource is located. + * @param deletedServerName The name of the deleted server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deleted server along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> recoverWithResponseAsync( + String locationName, String deletedServerName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (deletedServerName == null) { + return Mono + .error(new IllegalArgumentException("Parameter deletedServerName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .recover( + this.client.getEndpoint(), + locationName, + deletedServerName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Recovers a deleted server. + * + * @param locationName The name of the region where the resource is located. + * @param deletedServerName The name of the deleted server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a deleted server. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DeletedServerInner> beginRecoverAsync( + String locationName, String deletedServerName) { + Mono>> mono = recoverWithResponseAsync(locationName, deletedServerName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DeletedServerInner.class, + DeletedServerInner.class, + this.client.getContext()); + } + + /** + * Recovers a deleted server. + * + * @param locationName The name of the region where the resource is located. + * @param deletedServerName The name of the deleted server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a deleted server. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DeletedServerInner> beginRecoverAsync( + String locationName, String deletedServerName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = recoverWithResponseAsync(locationName, deletedServerName, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), DeletedServerInner.class, DeletedServerInner.class, context); + } + + /** + * Recovers a deleted server. + * + * @param locationName The name of the region where the resource is located. + * @param deletedServerName The name of the deleted server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a deleted server. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DeletedServerInner> beginRecover( + String locationName, String deletedServerName) { + return beginRecoverAsync(locationName, deletedServerName).getSyncPoller(); + } + + /** + * Recovers a deleted server. + * + * @param locationName The name of the region where the resource is located. + * @param deletedServerName The name of the deleted server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a deleted server. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DeletedServerInner> beginRecover( + String locationName, String deletedServerName, Context context) { + return beginRecoverAsync(locationName, deletedServerName, context).getSyncPoller(); + } + + /** + * Recovers a deleted server. + * + * @param locationName The name of the region where the resource is located. + * @param deletedServerName The name of the deleted server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deleted server on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono recoverAsync(String locationName, String deletedServerName) { + return beginRecoverAsync(locationName, deletedServerName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Recovers a deleted server. + * + * @param locationName The name of the region where the resource is located. + * @param deletedServerName The name of the deleted server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deleted server on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono recoverAsync(String locationName, String deletedServerName, Context context) { + return beginRecoverAsync(locationName, deletedServerName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Recovers a deleted server. + * + * @param locationName The name of the region where the resource is located. + * @param deletedServerName The name of the deleted server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deleted server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeletedServerInner recover(String locationName, String deletedServerName) { + return recoverAsync(locationName, deletedServerName).block(); + } + + /** + * Recovers a deleted server. + * + * @param locationName The name of the region where the resource is located. + * @param deletedServerName The name of the deleted server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deleted server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeletedServerInner recover(String locationName, String deletedServerName, Context context) { + return recoverAsync(locationName, deletedServerName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of deleted servers along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of deleted servers along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of deleted servers along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByLocationNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of deleted servers along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByLocationNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DeletedServersImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DeletedServersImpl.java new file mode 100644 index 0000000000000..799fe735d85f4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DeletedServersImpl.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.DeletedServersClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DeletedServerInner; +import com.azure.resourcemanager.sql.generated.models.DeletedServer; +import com.azure.resourcemanager.sql.generated.models.DeletedServers; + +public final class DeletedServersImpl implements DeletedServers { + private static final ClientLogger LOGGER = new ClientLogger(DeletedServersImpl.class); + + private final DeletedServersClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public DeletedServersImpl( + DeletedServersClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new DeletedServerImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new DeletedServerImpl(inner1, this.manager())); + } + + public Response getWithResponse(String locationName, String deletedServerName, Context context) { + Response inner = + this.serviceClient().getWithResponse(locationName, deletedServerName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DeletedServerImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DeletedServer get(String locationName, String deletedServerName) { + DeletedServerInner inner = this.serviceClient().get(locationName, deletedServerName); + if (inner != null) { + return new DeletedServerImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listByLocation(String locationName) { + PagedIterable inner = this.serviceClient().listByLocation(locationName); + return Utils.mapPage(inner, inner1 -> new DeletedServerImpl(inner1, this.manager())); + } + + public PagedIterable listByLocation(String locationName, Context context) { + PagedIterable inner = this.serviceClient().listByLocation(locationName, context); + return Utils.mapPage(inner, inner1 -> new DeletedServerImpl(inner1, this.manager())); + } + + public DeletedServer recover(String locationName, String deletedServerName) { + DeletedServerInner inner = this.serviceClient().recover(locationName, deletedServerName); + if (inner != null) { + return new DeletedServerImpl(inner, this.manager()); + } else { + return null; + } + } + + public DeletedServer recover(String locationName, String deletedServerName, Context context) { + DeletedServerInner inner = this.serviceClient().recover(locationName, deletedServerName, context); + if (inner != null) { + return new DeletedServerImpl(inner, this.manager()); + } else { + return null; + } + } + + private DeletedServersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DistributedAvailabilityGroupImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DistributedAvailabilityGroupImpl.java new file mode 100644 index 0000000000000..b0bafd0072ebc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DistributedAvailabilityGroupImpl.java @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DistributedAvailabilityGroupInner; +import com.azure.resourcemanager.sql.generated.models.DistributedAvailabilityGroup; +import com.azure.resourcemanager.sql.generated.models.ReplicationMode; +import java.util.UUID; + +public final class DistributedAvailabilityGroupImpl + implements DistributedAvailabilityGroup, + DistributedAvailabilityGroup.Definition, + DistributedAvailabilityGroup.Update { + private DistributedAvailabilityGroupInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String targetDatabase() { + return this.innerModel().targetDatabase(); + } + + public String sourceEndpoint() { + return this.innerModel().sourceEndpoint(); + } + + public String primaryAvailabilityGroupName() { + return this.innerModel().primaryAvailabilityGroupName(); + } + + public String secondaryAvailabilityGroupName() { + return this.innerModel().secondaryAvailabilityGroupName(); + } + + public ReplicationMode replicationMode() { + return this.innerModel().replicationMode(); + } + + public UUID distributedAvailabilityGroupId() { + return this.innerModel().distributedAvailabilityGroupId(); + } + + public UUID sourceReplicaId() { + return this.innerModel().sourceReplicaId(); + } + + public UUID targetReplicaId() { + return this.innerModel().targetReplicaId(); + } + + public String linkState() { + return this.innerModel().linkState(); + } + + public String lastHardenedLsn() { + return this.innerModel().lastHardenedLsn(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public DistributedAvailabilityGroupInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String managedInstanceName; + + private String distributedAvailabilityGroupName; + + public DistributedAvailabilityGroupImpl withExistingManagedInstance( + String resourceGroupName, String managedInstanceName) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + return this; + } + + public DistributedAvailabilityGroup create() { + this.innerObject = + serviceManager + .serviceClient() + .getDistributedAvailabilityGroups() + .createOrUpdate( + resourceGroupName, + managedInstanceName, + distributedAvailabilityGroupName, + this.innerModel(), + Context.NONE); + return this; + } + + public DistributedAvailabilityGroup create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDistributedAvailabilityGroups() + .createOrUpdate( + resourceGroupName, + managedInstanceName, + distributedAvailabilityGroupName, + this.innerModel(), + context); + return this; + } + + DistributedAvailabilityGroupImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new DistributedAvailabilityGroupInner(); + this.serviceManager = serviceManager; + this.distributedAvailabilityGroupName = name; + } + + public DistributedAvailabilityGroupImpl update() { + return this; + } + + public DistributedAvailabilityGroup apply() { + this.innerObject = + serviceManager + .serviceClient() + .getDistributedAvailabilityGroups() + .update( + resourceGroupName, + managedInstanceName, + distributedAvailabilityGroupName, + this.innerModel(), + Context.NONE); + return this; + } + + public DistributedAvailabilityGroup apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDistributedAvailabilityGroups() + .update( + resourceGroupName, + managedInstanceName, + distributedAvailabilityGroupName, + this.innerModel(), + context); + return this; + } + + DistributedAvailabilityGroupImpl( + DistributedAvailabilityGroupInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.managedInstanceName = Utils.getValueFromIdByName(innerObject.id(), "managedInstances"); + this.distributedAvailabilityGroupName = + Utils.getValueFromIdByName(innerObject.id(), "distributedAvailabilityGroups"); + } + + public DistributedAvailabilityGroup refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getDistributedAvailabilityGroups() + .getWithResponse(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, Context.NONE) + .getValue(); + return this; + } + + public DistributedAvailabilityGroup refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDistributedAvailabilityGroups() + .getWithResponse(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, context) + .getValue(); + return this; + } + + public DistributedAvailabilityGroupImpl withTargetDatabase(String targetDatabase) { + this.innerModel().withTargetDatabase(targetDatabase); + return this; + } + + public DistributedAvailabilityGroupImpl withSourceEndpoint(String sourceEndpoint) { + this.innerModel().withSourceEndpoint(sourceEndpoint); + return this; + } + + public DistributedAvailabilityGroupImpl withPrimaryAvailabilityGroupName(String primaryAvailabilityGroupName) { + this.innerModel().withPrimaryAvailabilityGroupName(primaryAvailabilityGroupName); + return this; + } + + public DistributedAvailabilityGroupImpl withSecondaryAvailabilityGroupName(String secondaryAvailabilityGroupName) { + this.innerModel().withSecondaryAvailabilityGroupName(secondaryAvailabilityGroupName); + return this; + } + + public DistributedAvailabilityGroupImpl withReplicationMode(ReplicationMode replicationMode) { + this.innerModel().withReplicationMode(replicationMode); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DistributedAvailabilityGroupsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DistributedAvailabilityGroupsClientImpl.java new file mode 100644 index 0000000000000..7b31991d4b18d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DistributedAvailabilityGroupsClientImpl.java @@ -0,0 +1,1636 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.DistributedAvailabilityGroupsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DistributedAvailabilityGroupInner; +import com.azure.resourcemanager.sql.generated.models.DistributedAvailabilityGroupsListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DistributedAvailabilityGroupsClient. */ +public final class DistributedAvailabilityGroupsClientImpl implements DistributedAvailabilityGroupsClient { + /** The proxy service used to perform REST calls. */ + private final DistributedAvailabilityGroupsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of DistributedAvailabilityGroupsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DistributedAvailabilityGroupsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + DistributedAvailabilityGroupsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientDistributedAvailabilityGroups to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientD") + public interface DistributedAvailabilityGroupsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/distributedAvailabilityGroups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInstance( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/distributedAvailabilityGroups" + + "/{distributedAvailabilityGroupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("distributedAvailabilityGroupName") String distributedAvailabilityGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/distributedAvailabilityGroups" + + "/{distributedAvailabilityGroupName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("distributedAvailabilityGroupName") String distributedAvailabilityGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DistributedAvailabilityGroupInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/distributedAvailabilityGroups" + + "/{distributedAvailabilityGroupName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("distributedAvailabilityGroupName") String distributedAvailabilityGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/distributedAvailabilityGroups" + + "/{distributedAvailabilityGroupName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("distributedAvailabilityGroupName") String distributedAvailabilityGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DistributedAvailabilityGroupInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInstanceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a list of a distributed availability groups in 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of a distributed availability groups in instance along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of a distributed availability groups in 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of a distributed availability groups in instance along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of a distributed availability groups in 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of a distributed availability groups in instance as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync( + String resourceGroupName, String managedInstanceName) { + return new PagedFlux<>( + () -> listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName), + nextLink -> listByInstanceNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of a distributed availability groups in 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of a distributed availability groups in instance as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedFlux<>( + () -> listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName, context), + nextLink -> listByInstanceNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of a distributed availability groups in 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of a distributed availability groups in instance as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName) { + return new PagedIterable<>(listByInstanceAsync(resourceGroupName, managedInstanceName)); + } + + /** + * Gets a list of a distributed availability groups in 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of a distributed availability groups in instance as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedIterable<>(listByInstanceAsync(resourceGroupName, managedInstanceName, context)); + } + + /** + * Gets a distributed availability group info. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param distributedAvailabilityGroupName The distributed availability group name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a distributed availability group info along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, String distributedAvailabilityGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (distributedAvailabilityGroupName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter distributedAvailabilityGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + distributedAvailabilityGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a distributed availability group info. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param distributedAvailabilityGroupName The distributed availability group name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a distributed availability group info along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (distributedAvailabilityGroupName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter distributedAvailabilityGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + distributedAvailabilityGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a distributed availability group info. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param distributedAvailabilityGroupName The distributed availability group name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a distributed availability group info on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String managedInstanceName, String distributedAvailabilityGroupName) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a distributed availability group info. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param distributedAvailabilityGroupName The distributed availability group name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a distributed availability group info along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + Context context) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, context) + .block(); + } + + /** + * Gets a distributed availability group info. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param distributedAvailabilityGroupName The distributed availability group name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a distributed availability group info. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DistributedAvailabilityGroupInner get( + String resourceGroupName, String managedInstanceName, String distributedAvailabilityGroupName) { + return getWithResponse(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, Context.NONE) + .getValue(); + } + + /** + * Creates a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group name. + * @param parameters The distributed availability group info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return distributed availability group between box and Sql Managed Instance along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + DistributedAvailabilityGroupInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (distributedAvailabilityGroupName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter distributedAvailabilityGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + distributedAvailabilityGroupName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group name. + * @param parameters The distributed availability group info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return distributed availability group between box and Sql Managed Instance along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + DistributedAvailabilityGroupInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (distributedAvailabilityGroupName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter distributedAvailabilityGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + distributedAvailabilityGroupName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group name. + * @param parameters The distributed availability group info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of distributed availability group between box and Sql Managed + * Instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DistributedAvailabilityGroupInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + DistributedAvailabilityGroupInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DistributedAvailabilityGroupInner.class, + DistributedAvailabilityGroupInner.class, + this.client.getContext()); + } + + /** + * Creates a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group name. + * @param parameters The distributed availability group info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of distributed availability group between box and Sql Managed + * Instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DistributedAvailabilityGroupInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + DistributedAvailabilityGroupInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DistributedAvailabilityGroupInner.class, + DistributedAvailabilityGroupInner.class, + context); + } + + /** + * Creates a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group name. + * @param parameters The distributed availability group info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of distributed availability group between box and Sql Managed + * Instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DistributedAvailabilityGroupInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + DistributedAvailabilityGroupInner parameters) { + return beginCreateOrUpdateAsync( + resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, parameters) + .getSyncPoller(); + } + + /** + * Creates a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group name. + * @param parameters The distributed availability group info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of distributed availability group between box and Sql Managed + * Instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DistributedAvailabilityGroupInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + DistributedAvailabilityGroupInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, parameters, context) + .getSyncPoller(); + } + + /** + * Creates a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group name. + * @param parameters The distributed availability group info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return distributed availability group between box and Sql Managed Instance on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + DistributedAvailabilityGroupInner parameters) { + return beginCreateOrUpdateAsync( + resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group name. + * @param parameters The distributed availability group info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return distributed availability group between box and Sql Managed Instance on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + DistributedAvailabilityGroupInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group name. + * @param parameters The distributed availability group info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return distributed availability group between box and Sql Managed Instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DistributedAvailabilityGroupInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + DistributedAvailabilityGroupInner parameters) { + return createOrUpdateAsync(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, parameters) + .block(); + } + + /** + * Creates a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group name. + * @param parameters The distributed availability group info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return distributed availability group between box and Sql Managed Instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DistributedAvailabilityGroupInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + DistributedAvailabilityGroupInner parameters, + Context context) { + return createOrUpdateAsync( + resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, parameters, context) + .block(); + } + + /** + * Drops a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String managedInstanceName, String distributedAvailabilityGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (distributedAvailabilityGroupName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter distributedAvailabilityGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + distributedAvailabilityGroupName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Drops a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (distributedAvailabilityGroupName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter distributedAvailabilityGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + distributedAvailabilityGroupName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Drops a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String managedInstanceName, String distributedAvailabilityGroupName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Drops a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Drops a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, String distributedAvailabilityGroupName) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName) + .getSyncPoller(); + } + + /** + * Drops a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + Context context) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, context) + .getSyncPoller(); + } + + /** + * Drops a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String managedInstanceName, String distributedAvailabilityGroupName) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Drops a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + Context context) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Drops a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String managedInstanceName, String distributedAvailabilityGroupName) { + deleteAsync(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName).block(); + } + + /** + * Drops a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + Context context) { + deleteAsync(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, context).block(); + } + + /** + * Updates a distributed availability group replication mode. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param distributedAvailabilityGroupName The distributed availability group name. + * @param parameters The distributed availability group info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return distributed availability group between box and Sql Managed Instance along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + DistributedAvailabilityGroupInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (distributedAvailabilityGroupName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter distributedAvailabilityGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + distributedAvailabilityGroupName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates a distributed availability group replication mode. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param distributedAvailabilityGroupName The distributed availability group name. + * @param parameters The distributed availability group info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return distributed availability group between box and Sql Managed Instance along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + DistributedAvailabilityGroupInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (distributedAvailabilityGroupName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter distributedAvailabilityGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + distributedAvailabilityGroupName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Updates a distributed availability group replication mode. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param distributedAvailabilityGroupName The distributed availability group name. + * @param parameters The distributed availability group info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of distributed availability group between box and Sql Managed + * Instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DistributedAvailabilityGroupInner> + beginUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + DistributedAvailabilityGroupInner parameters) { + Mono>> mono = + updateWithResponseAsync( + resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DistributedAvailabilityGroupInner.class, + DistributedAvailabilityGroupInner.class, + this.client.getContext()); + } + + /** + * Updates a distributed availability group replication mode. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param distributedAvailabilityGroupName The distributed availability group name. + * @param parameters The distributed availability group info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of distributed availability group between box and Sql Managed + * Instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DistributedAvailabilityGroupInner> + beginUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + DistributedAvailabilityGroupInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync( + resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DistributedAvailabilityGroupInner.class, + DistributedAvailabilityGroupInner.class, + context); + } + + /** + * Updates a distributed availability group replication mode. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param distributedAvailabilityGroupName The distributed availability group name. + * @param parameters The distributed availability group info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of distributed availability group between box and Sql Managed + * Instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DistributedAvailabilityGroupInner> beginUpdate( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + DistributedAvailabilityGroupInner parameters) { + return beginUpdateAsync(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, parameters) + .getSyncPoller(); + } + + /** + * Updates a distributed availability group replication mode. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param distributedAvailabilityGroupName The distributed availability group name. + * @param parameters The distributed availability group info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of distributed availability group between box and Sql Managed + * Instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DistributedAvailabilityGroupInner> beginUpdate( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + DistributedAvailabilityGroupInner parameters, + Context context) { + return beginUpdateAsync( + resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, parameters, context) + .getSyncPoller(); + } + + /** + * Updates a distributed availability group replication mode. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param distributedAvailabilityGroupName The distributed availability group name. + * @param parameters The distributed availability group info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return distributed availability group between box and Sql Managed Instance on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + DistributedAvailabilityGroupInner parameters) { + return beginUpdateAsync(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a distributed availability group replication mode. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param distributedAvailabilityGroupName The distributed availability group name. + * @param parameters The distributed availability group info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return distributed availability group between box and Sql Managed Instance on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + DistributedAvailabilityGroupInner parameters, + Context context) { + return beginUpdateAsync( + resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a distributed availability group replication mode. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param distributedAvailabilityGroupName The distributed availability group name. + * @param parameters The distributed availability group info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return distributed availability group between box and Sql Managed Instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DistributedAvailabilityGroupInner update( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + DistributedAvailabilityGroupInner parameters) { + return updateAsync(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, parameters) + .block(); + } + + /** + * Updates a distributed availability group replication mode. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param distributedAvailabilityGroupName The distributed availability group name. + * @param parameters The distributed availability group info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return distributed availability group between box and Sql Managed Instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DistributedAvailabilityGroupInner update( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + DistributedAvailabilityGroupInner parameters, + Context context) { + return updateAsync( + resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, parameters, context) + .block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of distributed availability groups in instance along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByInstanceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of distributed availability groups in instance along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInstanceNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DistributedAvailabilityGroupsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DistributedAvailabilityGroupsImpl.java new file mode 100644 index 0000000000000..9a5df012e5f35 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/DistributedAvailabilityGroupsImpl.java @@ -0,0 +1,229 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.DistributedAvailabilityGroupsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DistributedAvailabilityGroupInner; +import com.azure.resourcemanager.sql.generated.models.DistributedAvailabilityGroup; +import com.azure.resourcemanager.sql.generated.models.DistributedAvailabilityGroups; + +public final class DistributedAvailabilityGroupsImpl implements DistributedAvailabilityGroups { + private static final ClientLogger LOGGER = new ClientLogger(DistributedAvailabilityGroupsImpl.class); + + private final DistributedAvailabilityGroupsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public DistributedAvailabilityGroupsImpl( + DistributedAvailabilityGroupsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName) { + PagedIterable inner = + this.serviceClient().listByInstance(resourceGroupName, managedInstanceName); + return Utils.mapPage(inner, inner1 -> new DistributedAvailabilityGroupImpl(inner1, this.manager())); + } + + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context) { + PagedIterable inner = + this.serviceClient().listByInstance(resourceGroupName, managedInstanceName, context); + return Utils.mapPage(inner, inner1 -> new DistributedAvailabilityGroupImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DistributedAvailabilityGroupImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DistributedAvailabilityGroup get( + String resourceGroupName, String managedInstanceName, String distributedAvailabilityGroupName) { + DistributedAvailabilityGroupInner inner = + this.serviceClient().get(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName); + if (inner != null) { + return new DistributedAvailabilityGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String managedInstanceName, String distributedAvailabilityGroupName) { + this.serviceClient().delete(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName); + } + + public void delete( + String resourceGroupName, + String managedInstanceName, + String distributedAvailabilityGroupName, + Context context) { + this.serviceClient().delete(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, context); + } + + public DistributedAvailabilityGroup getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String distributedAvailabilityGroupName = Utils.getValueFromIdByName(id, "distributedAvailabilityGroups"); + if (distributedAvailabilityGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment" + + " 'distributedAvailabilityGroups'.", + id))); + } + return this + .getWithResponse(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String distributedAvailabilityGroupName = Utils.getValueFromIdByName(id, "distributedAvailabilityGroups"); + if (distributedAvailabilityGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment" + + " 'distributedAvailabilityGroups'.", + id))); + } + return this.getWithResponse(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String distributedAvailabilityGroupName = Utils.getValueFromIdByName(id, "distributedAvailabilityGroups"); + if (distributedAvailabilityGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment" + + " 'distributedAvailabilityGroups'.", + id))); + } + this.delete(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String distributedAvailabilityGroupName = Utils.getValueFromIdByName(id, "distributedAvailabilityGroups"); + if (distributedAvailabilityGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment" + + " 'distributedAvailabilityGroups'.", + id))); + } + this.delete(resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, context); + } + + private DistributedAvailabilityGroupsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public DistributedAvailabilityGroupImpl define(String name) { + return new DistributedAvailabilityGroupImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolActivitiesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolActivitiesClientImpl.java new file mode 100644 index 0000000000000..b514d23bf6b18 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolActivitiesClientImpl.java @@ -0,0 +1,275 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.ElasticPoolActivitiesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ElasticPoolActivityInner; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolActivityListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ElasticPoolActivitiesClient. */ +public final class ElasticPoolActivitiesClientImpl implements ElasticPoolActivitiesClient { + /** The proxy service used to perform REST calls. */ + private final ElasticPoolActivitiesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ElasticPoolActivitiesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ElasticPoolActivitiesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create(ElasticPoolActivitiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientElasticPoolActivities to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientE") + public interface ElasticPoolActivitiesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/elasticPools/{elasticPoolName}/elasticPoolActivity") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByElasticPool( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("elasticPoolName") String elasticPoolName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a list elastic pool activity request along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByElasticPoolSinglePageAsync( + String resourceGroupName, String serverName, String elasticPoolName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (elasticPoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByElasticPool( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + elasticPoolName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a list elastic pool activity request along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByElasticPoolSinglePageAsync( + String resourceGroupName, String serverName, String elasticPoolName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (elasticPoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByElasticPool( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + elasticPoolName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a list elastic pool activity request as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByElasticPoolAsync( + String resourceGroupName, String serverName, String elasticPoolName) { + return new PagedFlux<>(() -> listByElasticPoolSinglePageAsync(resourceGroupName, serverName, elasticPoolName)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a list elastic pool activity request as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByElasticPoolAsync( + String resourceGroupName, String serverName, String elasticPoolName, Context context) { + return new PagedFlux<>( + () -> listByElasticPoolSinglePageAsync(resourceGroupName, serverName, elasticPoolName, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a list elastic pool activity request as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName) { + return new PagedIterable<>(listByElasticPoolAsync(resourceGroupName, serverName, elasticPoolName)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a list elastic pool activity request as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName, Context context) { + return new PagedIterable<>(listByElasticPoolAsync(resourceGroupName, serverName, elasticPoolName, context)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolActivitiesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolActivitiesImpl.java new file mode 100644 index 0000000000000..9b571cd263eb7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolActivitiesImpl.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ElasticPoolActivitiesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ElasticPoolActivityInner; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolActivities; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolActivity; + +public final class ElasticPoolActivitiesImpl implements ElasticPoolActivities { + private static final ClientLogger LOGGER = new ClientLogger(ElasticPoolActivitiesImpl.class); + + private final ElasticPoolActivitiesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ElasticPoolActivitiesImpl( + ElasticPoolActivitiesClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName) { + PagedIterable inner = + this.serviceClient().listByElasticPool(resourceGroupName, serverName, elasticPoolName); + return Utils.mapPage(inner, inner1 -> new ElasticPoolActivityImpl(inner1, this.manager())); + } + + public PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName, Context context) { + PagedIterable inner = + this.serviceClient().listByElasticPool(resourceGroupName, serverName, elasticPoolName, context); + return Utils.mapPage(inner, inner1 -> new ElasticPoolActivityImpl(inner1, this.manager())); + } + + private ElasticPoolActivitiesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolActivityImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolActivityImpl.java new file mode 100644 index 0000000000000..97f430e16764a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolActivityImpl.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.ElasticPoolActivityInner; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolActivity; +import java.time.OffsetDateTime; +import java.util.UUID; + +public final class ElasticPoolActivityImpl implements ElasticPoolActivity { + private ElasticPoolActivityInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + ElasticPoolActivityImpl( + ElasticPoolActivityInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public OffsetDateTime endTime() { + return this.innerModel().endTime(); + } + + public Integer errorCode() { + return this.innerModel().errorCode(); + } + + public String errorMessage() { + return this.innerModel().errorMessage(); + } + + public Integer errorSeverity() { + return this.innerModel().errorSeverity(); + } + + public String operation() { + return this.innerModel().operation(); + } + + public UUID operationId() { + return this.innerModel().operationId(); + } + + public Integer percentComplete() { + return this.innerModel().percentComplete(); + } + + public Integer requestedDatabaseDtuMax() { + return this.innerModel().requestedDatabaseDtuMax(); + } + + public Integer requestedDatabaseDtuMin() { + return this.innerModel().requestedDatabaseDtuMin(); + } + + public Integer requestedDtu() { + return this.innerModel().requestedDtu(); + } + + public String requestedElasticPoolName() { + return this.innerModel().requestedElasticPoolName(); + } + + public Long requestedStorageLimitInGB() { + return this.innerModel().requestedStorageLimitInGB(); + } + + public String elasticPoolName() { + return this.innerModel().elasticPoolName(); + } + + public String serverName() { + return this.innerModel().serverName(); + } + + public OffsetDateTime startTime() { + return this.innerModel().startTime(); + } + + public String state() { + return this.innerModel().state(); + } + + public Integer requestedStorageLimitInMB() { + return this.innerModel().requestedStorageLimitInMB(); + } + + public Integer requestedDatabaseDtuGuarantee() { + return this.innerModel().requestedDatabaseDtuGuarantee(); + } + + public Integer requestedDatabaseDtuCap() { + return this.innerModel().requestedDatabaseDtuCap(); + } + + public Integer requestedDtuGuarantee() { + return this.innerModel().requestedDtuGuarantee(); + } + + public ElasticPoolActivityInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolDatabaseActivitiesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolDatabaseActivitiesClientImpl.java new file mode 100644 index 0000000000000..89fb778e345e3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolDatabaseActivitiesClientImpl.java @@ -0,0 +1,278 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.ElasticPoolDatabaseActivitiesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ElasticPoolDatabaseActivityInner; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolDatabaseActivityListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ElasticPoolDatabaseActivitiesClient. */ +public final class ElasticPoolDatabaseActivitiesClientImpl implements ElasticPoolDatabaseActivitiesClient { + /** The proxy service used to perform REST calls. */ + private final ElasticPoolDatabaseActivitiesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ElasticPoolDatabaseActivitiesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ElasticPoolDatabaseActivitiesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ElasticPoolDatabaseActivitiesService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientElasticPoolDatabaseActivities to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientE") + public interface ElasticPoolDatabaseActivitiesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/elasticPools/{elasticPoolName}/elasticPoolDatabaseActivity") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByElasticPool( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("elasticPoolName") String elasticPoolName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a list elastic pool database activity request along with {@link PagedResponse} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByElasticPoolSinglePageAsync( + String resourceGroupName, String serverName, String elasticPoolName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (elasticPoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByElasticPool( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + elasticPoolName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a list elastic pool database activity request along with {@link PagedResponse} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByElasticPoolSinglePageAsync( + String resourceGroupName, String serverName, String elasticPoolName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (elasticPoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByElasticPool( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + elasticPoolName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a list elastic pool database activity request as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByElasticPoolAsync( + String resourceGroupName, String serverName, String elasticPoolName) { + return new PagedFlux<>(() -> listByElasticPoolSinglePageAsync(resourceGroupName, serverName, elasticPoolName)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a list elastic pool database activity request as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByElasticPoolAsync( + String resourceGroupName, String serverName, String elasticPoolName, Context context) { + return new PagedFlux<>( + () -> listByElasticPoolSinglePageAsync(resourceGroupName, serverName, elasticPoolName, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a list elastic pool database activity request as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName) { + return new PagedIterable<>(listByElasticPoolAsync(resourceGroupName, serverName, elasticPoolName)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a list elastic pool database activity request as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName, Context context) { + return new PagedIterable<>(listByElasticPoolAsync(resourceGroupName, serverName, elasticPoolName, context)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolDatabaseActivitiesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolDatabaseActivitiesImpl.java new file mode 100644 index 0000000000000..e8ae12817bc1d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolDatabaseActivitiesImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ElasticPoolDatabaseActivitiesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ElasticPoolDatabaseActivityInner; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolDatabaseActivities; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolDatabaseActivity; + +public final class ElasticPoolDatabaseActivitiesImpl implements ElasticPoolDatabaseActivities { + private static final ClientLogger LOGGER = new ClientLogger(ElasticPoolDatabaseActivitiesImpl.class); + + private final ElasticPoolDatabaseActivitiesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ElasticPoolDatabaseActivitiesImpl( + ElasticPoolDatabaseActivitiesClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName) { + PagedIterable inner = + this.serviceClient().listByElasticPool(resourceGroupName, serverName, elasticPoolName); + return Utils.mapPage(inner, inner1 -> new ElasticPoolDatabaseActivityImpl(inner1, this.manager())); + } + + public PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName, Context context) { + PagedIterable inner = + this.serviceClient().listByElasticPool(resourceGroupName, serverName, elasticPoolName, context); + return Utils.mapPage(inner, inner1 -> new ElasticPoolDatabaseActivityImpl(inner1, this.manager())); + } + + private ElasticPoolDatabaseActivitiesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolDatabaseActivityImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolDatabaseActivityImpl.java new file mode 100644 index 0000000000000..2a9044e2ea808 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolDatabaseActivityImpl.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.ElasticPoolDatabaseActivityInner; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolDatabaseActivity; +import java.time.OffsetDateTime; +import java.util.UUID; + +public final class ElasticPoolDatabaseActivityImpl implements ElasticPoolDatabaseActivity { + private ElasticPoolDatabaseActivityInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + ElasticPoolDatabaseActivityImpl( + ElasticPoolDatabaseActivityInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public String databaseName() { + return this.innerModel().databaseName(); + } + + public OffsetDateTime endTime() { + return this.innerModel().endTime(); + } + + public Integer errorCode() { + return this.innerModel().errorCode(); + } + + public String errorMessage() { + return this.innerModel().errorMessage(); + } + + public Integer errorSeverity() { + return this.innerModel().errorSeverity(); + } + + public String operation() { + return this.innerModel().operation(); + } + + public UUID operationId() { + return this.innerModel().operationId(); + } + + public Integer percentComplete() { + return this.innerModel().percentComplete(); + } + + public String requestedElasticPoolName() { + return this.innerModel().requestedElasticPoolName(); + } + + public String currentElasticPoolName() { + return this.innerModel().currentElasticPoolName(); + } + + public String currentServiceObjective() { + return this.innerModel().currentServiceObjective(); + } + + public String requestedServiceObjective() { + return this.innerModel().requestedServiceObjective(); + } + + public String serverName() { + return this.innerModel().serverName(); + } + + public OffsetDateTime startTime() { + return this.innerModel().startTime(); + } + + public String state() { + return this.innerModel().state(); + } + + public ElasticPoolDatabaseActivityInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolImpl.java new file mode 100644 index 0000000000000..976a090aa78b4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolImpl.java @@ -0,0 +1,300 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ElasticPoolInner; +import com.azure.resourcemanager.sql.generated.models.ElasticPool; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolLicenseType; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolPerDatabaseSettings; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolState; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolUpdate; +import com.azure.resourcemanager.sql.generated.models.Sku; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.Map; + +public final class ElasticPoolImpl implements ElasticPool, ElasticPool.Definition, ElasticPool.Update { + private ElasticPoolInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public Sku sku() { + return this.innerModel().sku(); + } + + public String kind() { + return this.innerModel().kind(); + } + + public ElasticPoolState state() { + return this.innerModel().state(); + } + + public OffsetDateTime creationDate() { + return this.innerModel().creationDate(); + } + + public Long maxSizeBytes() { + return this.innerModel().maxSizeBytes(); + } + + public ElasticPoolPerDatabaseSettings perDatabaseSettings() { + return this.innerModel().perDatabaseSettings(); + } + + public Boolean zoneRedundant() { + return this.innerModel().zoneRedundant(); + } + + public ElasticPoolLicenseType licenseType() { + return this.innerModel().licenseType(); + } + + public String maintenanceConfigurationId() { + return this.innerModel().maintenanceConfigurationId(); + } + + public Integer highAvailabilityReplicaCount() { + return this.innerModel().highAvailabilityReplicaCount(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ElasticPoolInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String elasticPoolName; + + private ElasticPoolUpdate updateParameters; + + public ElasticPoolImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public ElasticPool create() { + this.innerObject = + serviceManager + .serviceClient() + .getElasticPools() + .createOrUpdate(resourceGroupName, serverName, elasticPoolName, this.innerModel(), Context.NONE); + return this; + } + + public ElasticPool create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getElasticPools() + .createOrUpdate(resourceGroupName, serverName, elasticPoolName, this.innerModel(), context); + return this; + } + + ElasticPoolImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ElasticPoolInner(); + this.serviceManager = serviceManager; + this.elasticPoolName = name; + } + + public ElasticPoolImpl update() { + this.updateParameters = new ElasticPoolUpdate(); + return this; + } + + public ElasticPool apply() { + this.innerObject = + serviceManager + .serviceClient() + .getElasticPools() + .update(resourceGroupName, serverName, elasticPoolName, updateParameters, Context.NONE); + return this; + } + + public ElasticPool apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getElasticPools() + .update(resourceGroupName, serverName, elasticPoolName, updateParameters, context); + return this; + } + + ElasticPoolImpl(ElasticPoolInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.elasticPoolName = Utils.getValueFromIdByName(innerObject.id(), "elasticPools"); + } + + public ElasticPool refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getElasticPools() + .getWithResponse(resourceGroupName, serverName, elasticPoolName, Context.NONE) + .getValue(); + return this; + } + + public ElasticPool refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getElasticPools() + .getWithResponse(resourceGroupName, serverName, elasticPoolName, context) + .getValue(); + return this; + } + + public void failover() { + serviceManager.elasticPools().failover(resourceGroupName, serverName, elasticPoolName); + } + + public void failover(Context context) { + serviceManager.elasticPools().failover(resourceGroupName, serverName, elasticPoolName, context); + } + + public ElasticPoolImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public ElasticPoolImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public ElasticPoolImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public ElasticPoolImpl withSku(Sku sku) { + if (isInCreateMode()) { + this.innerModel().withSku(sku); + return this; + } else { + this.updateParameters.withSku(sku); + return this; + } + } + + public ElasticPoolImpl withMaxSizeBytes(Long maxSizeBytes) { + if (isInCreateMode()) { + this.innerModel().withMaxSizeBytes(maxSizeBytes); + return this; + } else { + this.updateParameters.withMaxSizeBytes(maxSizeBytes); + return this; + } + } + + public ElasticPoolImpl withPerDatabaseSettings(ElasticPoolPerDatabaseSettings perDatabaseSettings) { + if (isInCreateMode()) { + this.innerModel().withPerDatabaseSettings(perDatabaseSettings); + return this; + } else { + this.updateParameters.withPerDatabaseSettings(perDatabaseSettings); + return this; + } + } + + public ElasticPoolImpl withZoneRedundant(Boolean zoneRedundant) { + if (isInCreateMode()) { + this.innerModel().withZoneRedundant(zoneRedundant); + return this; + } else { + this.updateParameters.withZoneRedundant(zoneRedundant); + return this; + } + } + + public ElasticPoolImpl withLicenseType(ElasticPoolLicenseType licenseType) { + if (isInCreateMode()) { + this.innerModel().withLicenseType(licenseType); + return this; + } else { + this.updateParameters.withLicenseType(licenseType); + return this; + } + } + + public ElasticPoolImpl withMaintenanceConfigurationId(String maintenanceConfigurationId) { + if (isInCreateMode()) { + this.innerModel().withMaintenanceConfigurationId(maintenanceConfigurationId); + return this; + } else { + this.updateParameters.withMaintenanceConfigurationId(maintenanceConfigurationId); + return this; + } + } + + public ElasticPoolImpl withHighAvailabilityReplicaCount(Integer highAvailabilityReplicaCount) { + if (isInCreateMode()) { + this.innerModel().withHighAvailabilityReplicaCount(highAvailabilityReplicaCount); + return this; + } else { + this.updateParameters.withHighAvailabilityReplicaCount(highAvailabilityReplicaCount); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolOperationImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolOperationImpl.java new file mode 100644 index 0000000000000..f0cdd15fcfefa --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolOperationImpl.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.ElasticPoolOperationInner; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolOperation; +import java.time.OffsetDateTime; + +public final class ElasticPoolOperationImpl implements ElasticPoolOperation { + private ElasticPoolOperationInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + ElasticPoolOperationImpl( + ElasticPoolOperationInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String elasticPoolName() { + return this.innerModel().elasticPoolName(); + } + + public String operation() { + return this.innerModel().operation(); + } + + public String operationFriendlyName() { + return this.innerModel().operationFriendlyName(); + } + + public Integer percentComplete() { + return this.innerModel().percentComplete(); + } + + public String serverName() { + return this.innerModel().serverName(); + } + + public OffsetDateTime startTime() { + return this.innerModel().startTime(); + } + + public String state() { + return this.innerModel().state(); + } + + public Integer errorCode() { + return this.innerModel().errorCode(); + } + + public String errorDescription() { + return this.innerModel().errorDescription(); + } + + public Integer errorSeverity() { + return this.innerModel().errorSeverity(); + } + + public Boolean isUserError() { + return this.innerModel().isUserError(); + } + + public OffsetDateTime estimatedCompletionTime() { + return this.innerModel().estimatedCompletionTime(); + } + + public String description() { + return this.innerModel().description(); + } + + public Boolean isCancellable() { + return this.innerModel().isCancellable(); + } + + public ElasticPoolOperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolOperationsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolOperationsClientImpl.java new file mode 100644 index 0000000000000..e8f1b9e01bab5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolOperationsClientImpl.java @@ -0,0 +1,561 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.ElasticPoolOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ElasticPoolOperationInner; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolOperationListResult; +import java.util.UUID; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ElasticPoolOperationsClient. */ +public final class ElasticPoolOperationsClientImpl implements ElasticPoolOperationsClient { + /** The proxy service used to perform REST calls. */ + private final ElasticPoolOperationsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ElasticPoolOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ElasticPoolOperationsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create(ElasticPoolOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientElasticPoolOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientE") + public interface ElasticPoolOperationsService { + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/elasticPools/{elasticPoolName}/operations/{operationId}/cancel") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> cancel( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("elasticPoolName") String elasticPoolName, + @PathParam("operationId") UUID operationId, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/elasticPools/{elasticPoolName}/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByElasticPool( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("elasticPoolName") String elasticPoolName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByElasticPoolNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 elasticPoolName parameter. + * @param operationId The operation identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> cancelWithResponseAsync( + String resourceGroupName, String serverName, String elasticPoolName, UUID operationId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (elasticPoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null.")); + } + if (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .cancel( + this.client.getEndpoint(), + resourceGroupName, + serverName, + elasticPoolName, + operationId, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 elasticPoolName parameter. + * @param operationId The operation identifier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> cancelWithResponseAsync( + String resourceGroupName, String serverName, String elasticPoolName, UUID operationId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (elasticPoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null.")); + } + if (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .cancel( + this.client.getEndpoint(), + resourceGroupName, + serverName, + elasticPoolName, + operationId, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * 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 elasticPoolName parameter. + * @param operationId The operation identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono cancelAsync( + String resourceGroupName, String serverName, String elasticPoolName, UUID operationId) { + return cancelWithResponseAsync(resourceGroupName, serverName, elasticPoolName, operationId) + .flatMap(ignored -> Mono.empty()); + } + + /** + * 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 elasticPoolName parameter. + * @param operationId The operation identifier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response cancelWithResponse( + String resourceGroupName, String serverName, String elasticPoolName, UUID operationId, Context context) { + return cancelWithResponseAsync(resourceGroupName, serverName, elasticPoolName, operationId, context).block(); + } + + /** + * 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 elasticPoolName parameter. + * @param operationId The operation identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void cancel(String resourceGroupName, String serverName, String elasticPoolName, UUID operationId) { + cancelWithResponse(resourceGroupName, serverName, elasticPoolName, operationId, Context.NONE); + } + + /** + * 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 elasticPoolName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of operations performed on the elastic pool along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByElasticPoolSinglePageAsync( + String resourceGroupName, String serverName, String elasticPoolName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (elasticPoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByElasticPool( + this.client.getEndpoint(), + resourceGroupName, + serverName, + elasticPoolName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 elasticPoolName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of operations performed on the elastic pool along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByElasticPoolSinglePageAsync( + String resourceGroupName, String serverName, String elasticPoolName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (elasticPoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByElasticPool( + this.client.getEndpoint(), + resourceGroupName, + serverName, + elasticPoolName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 elasticPoolName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of operations performed on the elastic pool as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByElasticPoolAsync( + String resourceGroupName, String serverName, String elasticPoolName) { + return new PagedFlux<>( + () -> listByElasticPoolSinglePageAsync(resourceGroupName, serverName, elasticPoolName), + nextLink -> listByElasticPoolNextSinglePageAsync(nextLink)); + } + + /** + * 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 elasticPoolName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of operations performed on the elastic pool as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByElasticPoolAsync( + String resourceGroupName, String serverName, String elasticPoolName, Context context) { + return new PagedFlux<>( + () -> listByElasticPoolSinglePageAsync(resourceGroupName, serverName, elasticPoolName, context), + nextLink -> listByElasticPoolNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 elasticPoolName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of operations performed on the elastic pool as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName) { + return new PagedIterable<>(listByElasticPoolAsync(resourceGroupName, serverName, elasticPoolName)); + } + + /** + * 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 elasticPoolName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of operations performed on the elastic pool as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName, Context context) { + return new PagedIterable<>(listByElasticPoolAsync(resourceGroupName, serverName, elasticPoolName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list elastic pool operations request along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByElasticPoolNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByElasticPoolNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list elastic pool operations request along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByElasticPoolNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByElasticPoolNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolOperationsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolOperationsImpl.java new file mode 100644 index 0000000000000..10bc089fbff07 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolOperationsImpl.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ElasticPoolOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ElasticPoolOperationInner; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolOperation; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolOperations; +import java.util.UUID; + +public final class ElasticPoolOperationsImpl implements ElasticPoolOperations { + private static final ClientLogger LOGGER = new ClientLogger(ElasticPoolOperationsImpl.class); + + private final ElasticPoolOperationsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ElasticPoolOperationsImpl( + ElasticPoolOperationsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response cancelWithResponse( + String resourceGroupName, String serverName, String elasticPoolName, UUID operationId, Context context) { + return this + .serviceClient() + .cancelWithResponse(resourceGroupName, serverName, elasticPoolName, operationId, context); + } + + public void cancel(String resourceGroupName, String serverName, String elasticPoolName, UUID operationId) { + this.serviceClient().cancel(resourceGroupName, serverName, elasticPoolName, operationId); + } + + public PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName) { + PagedIterable inner = + this.serviceClient().listByElasticPool(resourceGroupName, serverName, elasticPoolName); + return Utils.mapPage(inner, inner1 -> new ElasticPoolOperationImpl(inner1, this.manager())); + } + + public PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName, Context context) { + PagedIterable inner = + this.serviceClient().listByElasticPool(resourceGroupName, serverName, elasticPoolName, context); + return Utils.mapPage(inner, inner1 -> new ElasticPoolOperationImpl(inner1, this.manager())); + } + + private ElasticPoolOperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolsClientImpl.java new file mode 100644 index 0000000000000..6596e1b729adf --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolsClientImpl.java @@ -0,0 +1,2239 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ElasticPoolsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ElasticPoolInner; +import com.azure.resourcemanager.sql.generated.fluent.models.MetricDefinitionInner; +import com.azure.resourcemanager.sql.generated.fluent.models.MetricInner; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolListResult; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolUpdate; +import com.azure.resourcemanager.sql.generated.models.MetricDefinitionListResult; +import com.azure.resourcemanager.sql.generated.models.MetricListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ElasticPoolsClient. */ +public final class ElasticPoolsClientImpl implements ElasticPoolsClient { + /** The proxy service used to perform REST calls. */ + private final ElasticPoolsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ElasticPoolsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ElasticPoolsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(ElasticPoolsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientElasticPools to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientE") + public interface ElasticPoolsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/elasticPools/{elasticPoolName}/metrics") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listMetrics( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("elasticPoolName") String elasticPoolName, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/elasticPools/{elasticPoolName}/metricDefinitions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listMetricDefinitions( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("elasticPoolName") String elasticPoolName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/elasticPools") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @QueryParam("$skip") Long skip, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/elasticPools/{elasticPoolName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("elasticPoolName") String elasticPoolName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/elasticPools/{elasticPoolName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("elasticPoolName") String elasticPoolName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ElasticPoolInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/elasticPools/{elasticPoolName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("elasticPoolName") String elasticPoolName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/elasticPools/{elasticPoolName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("elasticPoolName") String elasticPoolName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ElasticPoolUpdate parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/elasticPools/{elasticPoolName}/failover") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> failover( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("elasticPoolName") String elasticPoolName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list database metrics request along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricsSinglePageAsync( + String resourceGroupName, String serverName, String elasticPoolName, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (elasticPoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMetrics( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + elasticPoolName, + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list database metrics request along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricsSinglePageAsync( + String resourceGroupName, String serverName, String elasticPoolName, String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (elasticPoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMetrics( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + elasticPoolName, + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list database metrics request as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricsAsync( + String resourceGroupName, String serverName, String elasticPoolName, String filter) { + return new PagedFlux<>( + () -> listMetricsSinglePageAsync(resourceGroupName, serverName, elasticPoolName, filter)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list database metrics request as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricsAsync( + String resourceGroupName, String serverName, String elasticPoolName, String filter, Context context) { + return new PagedFlux<>( + () -> listMetricsSinglePageAsync(resourceGroupName, serverName, elasticPoolName, filter, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list database metrics request as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics( + String resourceGroupName, String serverName, String elasticPoolName, String filter) { + return new PagedIterable<>(listMetricsAsync(resourceGroupName, serverName, elasticPoolName, filter)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list database metrics request as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetrics( + String resourceGroupName, String serverName, String elasticPoolName, String filter, Context context) { + return new PagedIterable<>(listMetricsAsync(resourceGroupName, serverName, elasticPoolName, filter, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list database metric definitions request along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricDefinitionsSinglePageAsync( + String resourceGroupName, String serverName, String elasticPoolName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (elasticPoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMetricDefinitions( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + elasticPoolName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list database metric definitions request along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMetricDefinitionsSinglePageAsync( + String resourceGroupName, String serverName, String elasticPoolName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (elasticPoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMetricDefinitions( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + elasticPoolName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list database metric definitions request as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricDefinitionsAsync( + String resourceGroupName, String serverName, String elasticPoolName) { + return new PagedFlux<>( + () -> listMetricDefinitionsSinglePageAsync(resourceGroupName, serverName, elasticPoolName)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list database metric definitions request as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMetricDefinitionsAsync( + String resourceGroupName, String serverName, String elasticPoolName, Context context) { + return new PagedFlux<>( + () -> listMetricDefinitionsSinglePageAsync(resourceGroupName, serverName, elasticPoolName, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list database metric definitions request as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetricDefinitions( + String resourceGroupName, String serverName, String elasticPoolName) { + return new PagedIterable<>(listMetricDefinitionsAsync(resourceGroupName, serverName, elasticPoolName)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list database metric definitions request as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMetricDefinitions( + String resourceGroupName, String serverName, String elasticPoolName, Context context) { + return new PagedIterable<>(listMetricDefinitionsAsync(resourceGroupName, serverName, elasticPoolName, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all elastic pools in a server along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, Long skip) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-08-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + skip, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all elastic pools in a server along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, Long skip, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-08-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + skip, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all elastic pools in a server as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName, Long skip) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, skip), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all elastic pools in a server as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + final Long skip = null; + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, skip), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all elastic pools in a server as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Long skip, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, skip, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all elastic pools in a server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + final Long skip = null; + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, skip)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all elastic pools in a server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Long skip, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, skip, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String elasticPoolName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (elasticPoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-08-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + elasticPoolName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String elasticPoolName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (elasticPoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-08-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + elasticPoolName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serverName, String elasticPoolName) { + return getWithResponseAsync(resourceGroupName, serverName, elasticPoolName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String elasticPoolName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, elasticPoolName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ElasticPoolInner get(String resourceGroupName, String serverName, String elasticPoolName) { + return getWithResponse(resourceGroupName, serverName, elasticPoolName, Context.NONE).getValue(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (elasticPoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-08-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + elasticPoolName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String elasticPoolName, + ElasticPoolInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (elasticPoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-08-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + elasticPoolName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an elastic pool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ElasticPoolInner> beginCreateOrUpdateAsync( + String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ElasticPoolInner.class, + ElasticPoolInner.class, + this.client.getContext()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an elastic pool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ElasticPoolInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String elasticPoolName, + ElasticPoolInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ElasticPoolInner.class, ElasticPoolInner.class, context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an elastic pool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ElasticPoolInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, elasticPoolName, parameters).getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an elastic pool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ElasticPoolInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String elasticPoolName, + ElasticPoolInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, elasticPoolName, parameters, context) + .getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, elasticPoolName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String elasticPoolName, + ElasticPoolInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, elasticPoolName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ElasticPoolInner createOrUpdate( + String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, elasticPoolName, parameters).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ElasticPoolInner createOrUpdate( + String resourceGroupName, + String serverName, + String elasticPoolName, + ElasticPoolInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, elasticPoolName, parameters, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, String elasticPoolName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (elasticPoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-08-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + elasticPoolName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, String elasticPoolName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (elasticPoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-08-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + elasticPoolName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String elasticPoolName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, serverName, elasticPoolName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String elasticPoolName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, elasticPoolName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String elasticPoolName) { + return beginDeleteAsync(resourceGroupName, serverName, elasticPoolName).getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String elasticPoolName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, elasticPoolName, context).getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String serverName, String elasticPoolName) { + return beginDeleteAsync(resourceGroupName, serverName, elasticPoolName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String serverName, String elasticPoolName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, elasticPoolName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, String elasticPoolName) { + deleteAsync(resourceGroupName, serverName, elasticPoolName).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, String elasticPoolName, Context context) { + deleteAsync(resourceGroupName, serverName, elasticPoolName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdate parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (elasticPoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-08-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + serverName, + elasticPoolName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String serverName, + String elasticPoolName, + ElasticPoolUpdate parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (elasticPoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-08-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + serverName, + elasticPoolName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an elastic pool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ElasticPoolInner> beginUpdateAsync( + String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdate parameters) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ElasticPoolInner.class, + ElasticPoolInner.class, + this.client.getContext()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an elastic pool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ElasticPoolInner> beginUpdateAsync( + String resourceGroupName, + String serverName, + String elasticPoolName, + ElasticPoolUpdate parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ElasticPoolInner.class, ElasticPoolInner.class, context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an elastic pool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ElasticPoolInner> beginUpdate( + String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdate parameters) { + return beginUpdateAsync(resourceGroupName, serverName, elasticPoolName, parameters).getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an elastic pool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ElasticPoolInner> beginUpdate( + String resourceGroupName, + String serverName, + String elasticPoolName, + ElasticPoolUpdate parameters, + Context context) { + return beginUpdateAsync(resourceGroupName, serverName, elasticPoolName, parameters, context).getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdate parameters) { + return beginUpdateAsync(resourceGroupName, serverName, elasticPoolName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String serverName, + String elasticPoolName, + ElasticPoolUpdate parameters, + Context context) { + return beginUpdateAsync(resourceGroupName, serverName, elasticPoolName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ElasticPoolInner update( + String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolUpdate parameters) { + return updateAsync(resourceGroupName, serverName, elasticPoolName, parameters).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ElasticPoolInner update( + String resourceGroupName, + String serverName, + String elasticPoolName, + ElasticPoolUpdate parameters, + Context context) { + return updateAsync(resourceGroupName, serverName, elasticPoolName, parameters, context).block(); + } + + /** + * Failovers an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool to failover. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> failoverWithResponseAsync( + String resourceGroupName, String serverName, String elasticPoolName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (elasticPoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-08-01-preview"; + return FluxUtil + .withContext( + context -> + service + .failover( + this.client.getEndpoint(), + resourceGroupName, + serverName, + elasticPoolName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Failovers an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool to failover. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> failoverWithResponseAsync( + String resourceGroupName, String serverName, String elasticPoolName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (elasticPoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter elasticPoolName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-08-01-preview"; + context = this.client.mergeContext(context); + return service + .failover( + this.client.getEndpoint(), + resourceGroupName, + serverName, + elasticPoolName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Failovers an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool to failover. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginFailoverAsync( + String resourceGroupName, String serverName, String elasticPoolName) { + Mono>> mono = + failoverWithResponseAsync(resourceGroupName, serverName, elasticPoolName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Failovers an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool to failover. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginFailoverAsync( + String resourceGroupName, String serverName, String elasticPoolName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + failoverWithResponseAsync(resourceGroupName, serverName, elasticPoolName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Failovers an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool to failover. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginFailover( + String resourceGroupName, String serverName, String elasticPoolName) { + return beginFailoverAsync(resourceGroupName, serverName, elasticPoolName).getSyncPoller(); + } + + /** + * Failovers an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool to failover. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginFailover( + String resourceGroupName, String serverName, String elasticPoolName, Context context) { + return beginFailoverAsync(resourceGroupName, serverName, elasticPoolName, context).getSyncPoller(); + } + + /** + * Failovers an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool to failover. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono failoverAsync(String resourceGroupName, String serverName, String elasticPoolName) { + return beginFailoverAsync(resourceGroupName, serverName, elasticPoolName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Failovers an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool to failover. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono failoverAsync( + String resourceGroupName, String serverName, String elasticPoolName, Context context) { + return beginFailoverAsync(resourceGroupName, serverName, elasticPoolName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Failovers an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool to failover. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void failover(String resourceGroupName, String serverName, String elasticPoolName) { + failoverAsync(resourceGroupName, serverName, elasticPoolName).block(); + } + + /** + * Failovers an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool to failover. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void failover(String resourceGroupName, String serverName, String elasticPoolName, Context context) { + failoverAsync(resourceGroupName, serverName, elasticPoolName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of an elastic pool list request along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByServerNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of an elastic pool list request along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServerNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolsImpl.java new file mode 100644 index 0000000000000..e0d52ed4c0dd1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ElasticPoolsImpl.java @@ -0,0 +1,229 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ElasticPoolsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ElasticPoolInner; +import com.azure.resourcemanager.sql.generated.fluent.models.MetricDefinitionInner; +import com.azure.resourcemanager.sql.generated.fluent.models.MetricInner; +import com.azure.resourcemanager.sql.generated.models.ElasticPool; +import com.azure.resourcemanager.sql.generated.models.ElasticPools; +import com.azure.resourcemanager.sql.generated.models.Metric; +import com.azure.resourcemanager.sql.generated.models.MetricDefinition; + +public final class ElasticPoolsImpl implements ElasticPools { + private static final ClientLogger LOGGER = new ClientLogger(ElasticPoolsImpl.class); + + private final ElasticPoolsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ElasticPoolsImpl( + ElasticPoolsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listMetrics( + String resourceGroupName, String serverName, String elasticPoolName, String filter) { + PagedIterable inner = + this.serviceClient().listMetrics(resourceGroupName, serverName, elasticPoolName, filter); + return Utils.mapPage(inner, inner1 -> new MetricImpl(inner1, this.manager())); + } + + public PagedIterable listMetrics( + String resourceGroupName, String serverName, String elasticPoolName, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listMetrics(resourceGroupName, serverName, elasticPoolName, filter, context); + return Utils.mapPage(inner, inner1 -> new MetricImpl(inner1, this.manager())); + } + + public PagedIterable listMetricDefinitions( + String resourceGroupName, String serverName, String elasticPoolName) { + PagedIterable inner = + this.serviceClient().listMetricDefinitions(resourceGroupName, serverName, elasticPoolName); + return Utils.mapPage(inner, inner1 -> new MetricDefinitionImpl(inner1, this.manager())); + } + + public PagedIterable listMetricDefinitions( + String resourceGroupName, String serverName, String elasticPoolName, Context context) { + PagedIterable inner = + this.serviceClient().listMetricDefinitions(resourceGroupName, serverName, elasticPoolName, context); + return Utils.mapPage(inner, inner1 -> new MetricDefinitionImpl(inner1, this.manager())); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new ElasticPoolImpl(inner1, this.manager())); + } + + public PagedIterable listByServer( + String resourceGroupName, String serverName, Long skip, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, skip, context); + return Utils.mapPage(inner, inner1 -> new ElasticPoolImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String elasticPoolName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, elasticPoolName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ElasticPoolImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ElasticPool get(String resourceGroupName, String serverName, String elasticPoolName) { + ElasticPoolInner inner = this.serviceClient().get(resourceGroupName, serverName, elasticPoolName); + if (inner != null) { + return new ElasticPoolImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String serverName, String elasticPoolName) { + this.serviceClient().delete(resourceGroupName, serverName, elasticPoolName); + } + + public void delete(String resourceGroupName, String serverName, String elasticPoolName, Context context) { + this.serviceClient().delete(resourceGroupName, serverName, elasticPoolName, context); + } + + public void failover(String resourceGroupName, String serverName, String elasticPoolName) { + this.serviceClient().failover(resourceGroupName, serverName, elasticPoolName); + } + + public void failover(String resourceGroupName, String serverName, String elasticPoolName, Context context) { + this.serviceClient().failover(resourceGroupName, serverName, elasticPoolName, context); + } + + public ElasticPool getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String elasticPoolName = Utils.getValueFromIdByName(id, "elasticPools"); + if (elasticPoolName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'elasticPools'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, elasticPoolName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String elasticPoolName = Utils.getValueFromIdByName(id, "elasticPools"); + if (elasticPoolName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'elasticPools'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, elasticPoolName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String elasticPoolName = Utils.getValueFromIdByName(id, "elasticPools"); + if (elasticPoolName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'elasticPools'.", id))); + } + this.delete(resourceGroupName, serverName, elasticPoolName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String elasticPoolName = Utils.getValueFromIdByName(id, "elasticPools"); + if (elasticPoolName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'elasticPools'.", id))); + } + this.delete(resourceGroupName, serverName, elasticPoolName, context); + } + + private ElasticPoolsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ElasticPoolImpl define(String name) { + return new ElasticPoolImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/EncryptionProtectorImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/EncryptionProtectorImpl.java new file mode 100644 index 0000000000000..2782f964e3be2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/EncryptionProtectorImpl.java @@ -0,0 +1,199 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.EncryptionProtectorInner; +import com.azure.resourcemanager.sql.generated.models.EncryptionProtector; +import com.azure.resourcemanager.sql.generated.models.EncryptionProtectorName; +import com.azure.resourcemanager.sql.generated.models.ServerKeyType; + +public final class EncryptionProtectorImpl + implements EncryptionProtector, EncryptionProtector.Definition, EncryptionProtector.Update { + private EncryptionProtectorInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String kind() { + return this.innerModel().kind(); + } + + public String location() { + return this.innerModel().location(); + } + + public String subregion() { + return this.innerModel().subregion(); + } + + public String serverKeyName() { + return this.innerModel().serverKeyName(); + } + + public ServerKeyType serverKeyType() { + return this.innerModel().serverKeyType(); + } + + public String uri() { + return this.innerModel().uri(); + } + + public String thumbprint() { + return this.innerModel().thumbprint(); + } + + public Boolean autoRotationEnabled() { + return this.innerModel().autoRotationEnabled(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public EncryptionProtectorInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private EncryptionProtectorName encryptionProtectorName; + + public EncryptionProtectorImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public EncryptionProtector create() { + this.innerObject = + serviceManager + .serviceClient() + .getEncryptionProtectors() + .createOrUpdate( + resourceGroupName, serverName, encryptionProtectorName, this.innerModel(), Context.NONE); + return this; + } + + public EncryptionProtector create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getEncryptionProtectors() + .createOrUpdate(resourceGroupName, serverName, encryptionProtectorName, this.innerModel(), context); + return this; + } + + EncryptionProtectorImpl( + EncryptionProtectorName name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new EncryptionProtectorInner(); + this.serviceManager = serviceManager; + this.encryptionProtectorName = name; + } + + public EncryptionProtectorImpl update() { + return this; + } + + public EncryptionProtector apply() { + this.innerObject = + serviceManager + .serviceClient() + .getEncryptionProtectors() + .createOrUpdate( + resourceGroupName, serverName, encryptionProtectorName, this.innerModel(), Context.NONE); + return this; + } + + public EncryptionProtector apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getEncryptionProtectors() + .createOrUpdate(resourceGroupName, serverName, encryptionProtectorName, this.innerModel(), context); + return this; + } + + EncryptionProtectorImpl( + EncryptionProtectorInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.encryptionProtectorName = + EncryptionProtectorName.fromString(Utils.getValueFromIdByName(innerObject.id(), "encryptionProtector")); + } + + public EncryptionProtector refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getEncryptionProtectors() + .getWithResponse(resourceGroupName, serverName, encryptionProtectorName, Context.NONE) + .getValue(); + return this; + } + + public EncryptionProtector refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getEncryptionProtectors() + .getWithResponse(resourceGroupName, serverName, encryptionProtectorName, context) + .getValue(); + return this; + } + + public void revalidate() { + serviceManager.encryptionProtectors().revalidate(resourceGroupName, serverName, encryptionProtectorName); + } + + public void revalidate(Context context) { + serviceManager + .encryptionProtectors() + .revalidate(resourceGroupName, serverName, encryptionProtectorName, context); + } + + public EncryptionProtectorImpl withServerKeyName(String serverKeyName) { + this.innerModel().withServerKeyName(serverKeyName); + return this; + } + + public EncryptionProtectorImpl withServerKeyType(ServerKeyType serverKeyType) { + this.innerModel().withServerKeyType(serverKeyType); + return this; + } + + public EncryptionProtectorImpl withAutoRotationEnabled(Boolean autoRotationEnabled) { + this.innerModel().withAutoRotationEnabled(autoRotationEnabled); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/EncryptionProtectorsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/EncryptionProtectorsClientImpl.java new file mode 100644 index 0000000000000..b4f3f12e7f01a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/EncryptionProtectorsClientImpl.java @@ -0,0 +1,1187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.EncryptionProtectorsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.EncryptionProtectorInner; +import com.azure.resourcemanager.sql.generated.models.EncryptionProtectorListResult; +import com.azure.resourcemanager.sql.generated.models.EncryptionProtectorName; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in EncryptionProtectorsClient. */ +public final class EncryptionProtectorsClientImpl implements EncryptionProtectorsClient { + /** The proxy service used to perform REST calls. */ + private final EncryptionProtectorsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of EncryptionProtectorsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + EncryptionProtectorsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create(EncryptionProtectorsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientEncryptionProtectors to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientE") + public interface EncryptionProtectorsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/encryptionProtector") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/encryptionProtector/{encryptionProtectorName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("encryptionProtectorName") EncryptionProtectorName encryptionProtectorName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/encryptionProtector/{encryptionProtectorName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("encryptionProtectorName") EncryptionProtectorName encryptionProtectorName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") EncryptionProtectorInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/encryptionProtector/{encryptionProtectorName}/revalidate") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> revalidate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("encryptionProtectorName") EncryptionProtectorName encryptionProtectorName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server encryption protectors along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server encryption protectors along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server encryption protectors as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server encryption protectors as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server encryption protectors as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server encryption protectors as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } + + /** + * 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 encryptionProtectorName The name of the encryption protector to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server encryption protector along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, EncryptionProtectorName encryptionProtectorName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (encryptionProtectorName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter encryptionProtectorName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + encryptionProtectorName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 encryptionProtectorName The name of the encryption protector to be retrieved. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server encryption protector along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, EncryptionProtectorName encryptionProtectorName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (encryptionProtectorName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter encryptionProtectorName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + encryptionProtectorName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 encryptionProtectorName The name of the encryption protector to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server encryption protector on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, EncryptionProtectorName encryptionProtectorName) { + return getWithResponseAsync(resourceGroupName, serverName, encryptionProtectorName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 encryptionProtectorName The name of the encryption protector to be retrieved. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server encryption protector along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, EncryptionProtectorName encryptionProtectorName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, encryptionProtectorName, context).block(); + } + + /** + * 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 encryptionProtectorName The name of the encryption protector to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server encryption protector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EncryptionProtectorInner get( + String resourceGroupName, String serverName, EncryptionProtectorName encryptionProtectorName) { + return getWithResponse(resourceGroupName, serverName, encryptionProtectorName, Context.NONE).getValue(); + } + + /** + * 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 encryptionProtectorName The name of the encryption protector to be updated. + * @param parameters The requested encryption protector resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the server encryption protector along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + EncryptionProtectorName encryptionProtectorName, + EncryptionProtectorInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (encryptionProtectorName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter encryptionProtectorName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + encryptionProtectorName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 encryptionProtectorName The name of the encryption protector to be updated. + * @param parameters The requested encryption protector resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the server encryption protector along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + EncryptionProtectorName encryptionProtectorName, + EncryptionProtectorInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (encryptionProtectorName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter encryptionProtectorName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + encryptionProtectorName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 encryptionProtectorName The name of the encryption protector to be updated. + * @param parameters The requested encryption protector resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the server encryption protector. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, EncryptionProtectorInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + EncryptionProtectorName encryptionProtectorName, + EncryptionProtectorInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, encryptionProtectorName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + EncryptionProtectorInner.class, + EncryptionProtectorInner.class, + this.client.getContext()); + } + + /** + * 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 encryptionProtectorName The name of the encryption protector to be updated. + * @param parameters The requested encryption protector resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the server encryption protector. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, EncryptionProtectorInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + EncryptionProtectorName encryptionProtectorName, + EncryptionProtectorInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, serverName, encryptionProtectorName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + EncryptionProtectorInner.class, + EncryptionProtectorInner.class, + context); + } + + /** + * 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 encryptionProtectorName The name of the encryption protector to be updated. + * @param parameters The requested encryption protector resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the server encryption protector. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, EncryptionProtectorInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + EncryptionProtectorName encryptionProtectorName, + EncryptionProtectorInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, encryptionProtectorName, parameters) + .getSyncPoller(); + } + + /** + * 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 encryptionProtectorName The name of the encryption protector to be updated. + * @param parameters The requested encryption protector resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the server encryption protector. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, EncryptionProtectorInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + EncryptionProtectorName encryptionProtectorName, + EncryptionProtectorInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, encryptionProtectorName, parameters, context) + .getSyncPoller(); + } + + /** + * 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 encryptionProtectorName The name of the encryption protector to be updated. + * @param parameters The requested encryption protector resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the server encryption protector on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + EncryptionProtectorName encryptionProtectorName, + EncryptionProtectorInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, encryptionProtectorName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 encryptionProtectorName The name of the encryption protector to be updated. + * @param parameters The requested encryption protector resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the server encryption protector on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + EncryptionProtectorName encryptionProtectorName, + EncryptionProtectorInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, encryptionProtectorName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 encryptionProtectorName The name of the encryption protector to be updated. + * @param parameters The requested encryption protector resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the server encryption protector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EncryptionProtectorInner createOrUpdate( + String resourceGroupName, + String serverName, + EncryptionProtectorName encryptionProtectorName, + EncryptionProtectorInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, encryptionProtectorName, parameters).block(); + } + + /** + * 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 encryptionProtectorName The name of the encryption protector to be updated. + * @param parameters The requested encryption protector resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the server encryption protector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EncryptionProtectorInner createOrUpdate( + String resourceGroupName, + String serverName, + EncryptionProtectorName encryptionProtectorName, + EncryptionProtectorInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, encryptionProtectorName, parameters, context).block(); + } + + /** + * Revalidates 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 encryptionProtectorName The name of the encryption protector to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> revalidateWithResponseAsync( + String resourceGroupName, String serverName, EncryptionProtectorName encryptionProtectorName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (encryptionProtectorName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter encryptionProtectorName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .revalidate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + encryptionProtectorName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Revalidates 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 encryptionProtectorName The name of the encryption protector to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> revalidateWithResponseAsync( + String resourceGroupName, String serverName, EncryptionProtectorName encryptionProtectorName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (encryptionProtectorName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter encryptionProtectorName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .revalidate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + encryptionProtectorName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Revalidates 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 encryptionProtectorName The name of the encryption protector to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRevalidateAsync( + String resourceGroupName, String serverName, EncryptionProtectorName encryptionProtectorName) { + Mono>> mono = + revalidateWithResponseAsync(resourceGroupName, serverName, encryptionProtectorName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Revalidates 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 encryptionProtectorName The name of the encryption protector to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRevalidateAsync( + String resourceGroupName, String serverName, EncryptionProtectorName encryptionProtectorName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + revalidateWithResponseAsync(resourceGroupName, serverName, encryptionProtectorName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Revalidates 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 encryptionProtectorName The name of the encryption protector to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRevalidate( + String resourceGroupName, String serverName, EncryptionProtectorName encryptionProtectorName) { + return beginRevalidateAsync(resourceGroupName, serverName, encryptionProtectorName).getSyncPoller(); + } + + /** + * Revalidates 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 encryptionProtectorName The name of the encryption protector to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRevalidate( + String resourceGroupName, String serverName, EncryptionProtectorName encryptionProtectorName, Context context) { + return beginRevalidateAsync(resourceGroupName, serverName, encryptionProtectorName, context).getSyncPoller(); + } + + /** + * Revalidates 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 encryptionProtectorName The name of the encryption protector to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono revalidateAsync( + String resourceGroupName, String serverName, EncryptionProtectorName encryptionProtectorName) { + return beginRevalidateAsync(resourceGroupName, serverName, encryptionProtectorName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Revalidates 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 encryptionProtectorName The name of the encryption protector to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono revalidateAsync( + String resourceGroupName, String serverName, EncryptionProtectorName encryptionProtectorName, Context context) { + return beginRevalidateAsync(resourceGroupName, serverName, encryptionProtectorName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Revalidates 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 encryptionProtectorName The name of the encryption protector to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void revalidate( + String resourceGroupName, String serverName, EncryptionProtectorName encryptionProtectorName) { + revalidateAsync(resourceGroupName, serverName, encryptionProtectorName).block(); + } + + /** + * Revalidates 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 encryptionProtectorName The name of the encryption protector to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void revalidate( + String resourceGroupName, String serverName, EncryptionProtectorName encryptionProtectorName, Context context) { + revalidateAsync(resourceGroupName, serverName, encryptionProtectorName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server encryption protectors along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByServerNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server encryption protectors along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServerNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/EncryptionProtectorsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/EncryptionProtectorsImpl.java new file mode 100644 index 0000000000000..b215c7719cad4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/EncryptionProtectorsImpl.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.EncryptionProtectorsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.EncryptionProtectorInner; +import com.azure.resourcemanager.sql.generated.models.EncryptionProtector; +import com.azure.resourcemanager.sql.generated.models.EncryptionProtectorName; +import com.azure.resourcemanager.sql.generated.models.EncryptionProtectors; + +public final class EncryptionProtectorsImpl implements EncryptionProtectors { + private static final ClientLogger LOGGER = new ClientLogger(EncryptionProtectorsImpl.class); + + private final EncryptionProtectorsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public EncryptionProtectorsImpl( + EncryptionProtectorsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new EncryptionProtectorImpl(inner1, this.manager())); + } + + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new EncryptionProtectorImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, String serverName, EncryptionProtectorName encryptionProtectorName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, encryptionProtectorName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new EncryptionProtectorImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public EncryptionProtector get( + String resourceGroupName, String serverName, EncryptionProtectorName encryptionProtectorName) { + EncryptionProtectorInner inner = + this.serviceClient().get(resourceGroupName, serverName, encryptionProtectorName); + if (inner != null) { + return new EncryptionProtectorImpl(inner, this.manager()); + } else { + return null; + } + } + + public void revalidate( + String resourceGroupName, String serverName, EncryptionProtectorName encryptionProtectorName) { + this.serviceClient().revalidate(resourceGroupName, serverName, encryptionProtectorName); + } + + public void revalidate( + String resourceGroupName, String serverName, EncryptionProtectorName encryptionProtectorName, Context context) { + this.serviceClient().revalidate(resourceGroupName, serverName, encryptionProtectorName, context); + } + + public EncryptionProtector getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String encryptionProtectorNameLocal = Utils.getValueFromIdByName(id, "encryptionProtector"); + if (encryptionProtectorNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'encryptionProtector'.", id))); + } + EncryptionProtectorName encryptionProtectorName = + EncryptionProtectorName.fromString(encryptionProtectorNameLocal); + return this.getWithResponse(resourceGroupName, serverName, encryptionProtectorName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String encryptionProtectorNameLocal = Utils.getValueFromIdByName(id, "encryptionProtector"); + if (encryptionProtectorNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'encryptionProtector'.", id))); + } + EncryptionProtectorName encryptionProtectorName = + EncryptionProtectorName.fromString(encryptionProtectorNameLocal); + return this.getWithResponse(resourceGroupName, serverName, encryptionProtectorName, context); + } + + private EncryptionProtectorsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public EncryptionProtectorImpl define(EncryptionProtectorName name) { + return new EncryptionProtectorImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/EndpointCertificateImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/EndpointCertificateImpl.java new file mode 100644 index 0000000000000..7fff0e680d644 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/EndpointCertificateImpl.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.EndpointCertificateInner; +import com.azure.resourcemanager.sql.generated.models.EndpointCertificate; + +public final class EndpointCertificateImpl implements EndpointCertificate { + private EndpointCertificateInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + EndpointCertificateImpl( + EndpointCertificateInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String publicBlob() { + return this.innerModel().publicBlob(); + } + + public EndpointCertificateInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/EndpointCertificatesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/EndpointCertificatesClientImpl.java new file mode 100644 index 0000000000000..5435f2fff5de1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/EndpointCertificatesClientImpl.java @@ -0,0 +1,538 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.EndpointCertificatesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.EndpointCertificateInner; +import com.azure.resourcemanager.sql.generated.models.EndpointCertificateListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in EndpointCertificatesClient. */ +public final class EndpointCertificatesClientImpl implements EndpointCertificatesClient { + /** The proxy service used to perform REST calls. */ + private final EndpointCertificatesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of EndpointCertificatesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + EndpointCertificatesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create(EndpointCertificatesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientEndpointCertificates to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientE") + public interface EndpointCertificatesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/endpointCertificates") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInstance( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/endpointCertificates/{endpointType}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("endpointType") String endpointType, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInstanceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List certificates used on endpoints on the target 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of endpoint certificates on the target instance along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List certificates used on endpoints on the target 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of endpoint certificates on the target instance along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List certificates used on endpoints on the target 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of endpoint certificates on the target instance as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync( + String resourceGroupName, String managedInstanceName) { + return new PagedFlux<>( + () -> listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName), + nextLink -> listByInstanceNextSinglePageAsync(nextLink)); + } + + /** + * List certificates used on endpoints on the target 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of endpoint certificates on the target instance as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedFlux<>( + () -> listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName, context), + nextLink -> listByInstanceNextSinglePageAsync(nextLink, context)); + } + + /** + * List certificates used on endpoints on the target 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of endpoint certificates on the target instance as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName) { + return new PagedIterable<>(listByInstanceAsync(resourceGroupName, managedInstanceName)); + } + + /** + * List certificates used on endpoints on the target 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of endpoint certificates on the target instance as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedIterable<>(listByInstanceAsync(resourceGroupName, managedInstanceName, context)); + } + + /** + * Gets a certificate used on the endpoint with the given id. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param endpointType Type of the endpoint whose certificate the customer is looking for. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a certificate used on the endpoint with the given id along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, String endpointType) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (endpointType == null) { + return Mono.error(new IllegalArgumentException("Parameter endpointType is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + endpointType, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a certificate used on the endpoint with the given id. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param endpointType Type of the endpoint whose certificate the customer is looking for. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a certificate used on the endpoint with the given id along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, String endpointType, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (endpointType == null) { + return Mono.error(new IllegalArgumentException("Parameter endpointType is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + endpointType, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a certificate used on the endpoint with the given id. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param endpointType Type of the endpoint whose certificate the customer is looking for. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a certificate used on the endpoint with the given id on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String managedInstanceName, String endpointType) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, endpointType) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a certificate used on the endpoint with the given id. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param endpointType Type of the endpoint whose certificate the customer is looking for. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a certificate used on the endpoint with the given id along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, String endpointType, Context context) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, endpointType, context).block(); + } + + /** + * Gets a certificate used on the endpoint with the given id. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param endpointType Type of the endpoint whose certificate the customer is looking for. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a certificate used on the endpoint with the given id. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EndpointCertificateInner get(String resourceGroupName, String managedInstanceName, String endpointType) { + return getWithResponse(resourceGroupName, managedInstanceName, endpointType, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of endpoint certificates on the target instance along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByInstanceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of endpoint certificates on the target instance along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInstanceNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/EndpointCertificatesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/EndpointCertificatesImpl.java new file mode 100644 index 0000000000000..28d6f8b5fd7c2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/EndpointCertificatesImpl.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.EndpointCertificatesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.EndpointCertificateInner; +import com.azure.resourcemanager.sql.generated.models.EndpointCertificate; +import com.azure.resourcemanager.sql.generated.models.EndpointCertificates; + +public final class EndpointCertificatesImpl implements EndpointCertificates { + private static final ClientLogger LOGGER = new ClientLogger(EndpointCertificatesImpl.class); + + private final EndpointCertificatesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public EndpointCertificatesImpl( + EndpointCertificatesClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByInstance(String resourceGroupName, String managedInstanceName) { + PagedIterable inner = + this.serviceClient().listByInstance(resourceGroupName, managedInstanceName); + return Utils.mapPage(inner, inner1 -> new EndpointCertificateImpl(inner1, this.manager())); + } + + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context) { + PagedIterable inner = + this.serviceClient().listByInstance(resourceGroupName, managedInstanceName, context); + return Utils.mapPage(inner, inner1 -> new EndpointCertificateImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, String endpointType, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, managedInstanceName, endpointType, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new EndpointCertificateImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public EndpointCertificate get(String resourceGroupName, String managedInstanceName, String endpointType) { + EndpointCertificateInner inner = this.serviceClient().get(resourceGroupName, managedInstanceName, endpointType); + if (inner != null) { + return new EndpointCertificateImpl(inner, this.manager()); + } else { + return null; + } + } + + private EndpointCertificatesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ExtendedDatabaseBlobAuditingPoliciesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ExtendedDatabaseBlobAuditingPoliciesClientImpl.java new file mode 100644 index 0000000000000..b1fbbfd050dc2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ExtendedDatabaseBlobAuditingPoliciesClientImpl.java @@ -0,0 +1,789 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.ExtendedDatabaseBlobAuditingPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ExtendedDatabaseBlobAuditingPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ExtendedDatabaseBlobAuditingPolicyListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * ExtendedDatabaseBlobAuditingPoliciesClient. + */ +public final class ExtendedDatabaseBlobAuditingPoliciesClientImpl + implements ExtendedDatabaseBlobAuditingPoliciesClient { + /** The proxy service used to perform REST calls. */ + private final ExtendedDatabaseBlobAuditingPoliciesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ExtendedDatabaseBlobAuditingPoliciesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ExtendedDatabaseBlobAuditingPoliciesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ExtendedDatabaseBlobAuditingPoliciesService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientExtendedDatabaseBlobAuditingPolicies to be used by + * the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientE") + public interface ExtendedDatabaseBlobAuditingPoliciesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/extendedAuditingSettings") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/extendedAuditingSettings/{blobAuditingPolicyName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("blobAuditingPolicyName") String blobAuditingPolicyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/extendedAuditingSettings/{blobAuditingPolicyName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("blobAuditingPolicyName") String blobAuditingPolicyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ExtendedDatabaseBlobAuditingPolicyInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabaseNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists extended auditing settings 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database extended auditing settings along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists extended auditing settings 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database extended auditing settings along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists extended auditing settings 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database extended auditing settings as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Lists extended auditing settings 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database extended auditing settings as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, context), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists extended auditing settings 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database extended auditing settings as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName)); + } + + /** + * Lists extended auditing settings 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database extended auditing settings as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an extended database's blob auditing policy along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String blobAuditingPolicyName = "default"; + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + blobAuditingPolicyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an extended database's blob auditing policy along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String blobAuditingPolicyName = "default"; + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + blobAuditingPolicyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an extended database's blob auditing policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String databaseName) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an extended database's blob auditing policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an extended database's blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ExtendedDatabaseBlobAuditingPolicyInner get( + String resourceGroupName, String serverName, String databaseName) { + return getWithResponse(resourceGroupName, serverName, databaseName, Context.NONE).getValue(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an extended database blob auditing policy along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + ExtendedDatabaseBlobAuditingPolicyInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String blobAuditingPolicyName = "default"; + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + blobAuditingPolicyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an extended database blob auditing policy along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + ExtendedDatabaseBlobAuditingPolicyInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String blobAuditingPolicyName = "default"; + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + blobAuditingPolicyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an extended database blob auditing policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + ExtendedDatabaseBlobAuditingPolicyInner parameters) { + return createOrUpdateWithResponseAsync(resourceGroupName, serverName, databaseName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an extended database blob auditing policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + ExtendedDatabaseBlobAuditingPolicyInner parameters, + Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, serverName, databaseName, parameters, context) + .block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an extended database blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ExtendedDatabaseBlobAuditingPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + ExtendedDatabaseBlobAuditingPolicyInner parameters) { + return createOrUpdateWithResponse(resourceGroupName, serverName, databaseName, parameters, Context.NONE) + .getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database extended auditing settings along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database extended auditing settings along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ExtendedDatabaseBlobAuditingPoliciesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ExtendedDatabaseBlobAuditingPoliciesImpl.java new file mode 100644 index 0000000000000..c03c4970c5867 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ExtendedDatabaseBlobAuditingPoliciesImpl.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ExtendedDatabaseBlobAuditingPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ExtendedDatabaseBlobAuditingPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ExtendedDatabaseBlobAuditingPolicies; +import com.azure.resourcemanager.sql.generated.models.ExtendedDatabaseBlobAuditingPolicy; + +public final class ExtendedDatabaseBlobAuditingPoliciesImpl implements ExtendedDatabaseBlobAuditingPolicies { + private static final ClientLogger LOGGER = new ClientLogger(ExtendedDatabaseBlobAuditingPoliciesImpl.class); + + private final ExtendedDatabaseBlobAuditingPoliciesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ExtendedDatabaseBlobAuditingPoliciesImpl( + ExtendedDatabaseBlobAuditingPoliciesClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName); + return Utils.mapPage(inner, inner1 -> new ExtendedDatabaseBlobAuditingPolicyImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName, context); + return Utils.mapPage(inner, inner1 -> new ExtendedDatabaseBlobAuditingPolicyImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, databaseName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ExtendedDatabaseBlobAuditingPolicyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ExtendedDatabaseBlobAuditingPolicy get(String resourceGroupName, String serverName, String databaseName) { + ExtendedDatabaseBlobAuditingPolicyInner inner = + this.serviceClient().get(resourceGroupName, serverName, databaseName); + if (inner != null) { + return new ExtendedDatabaseBlobAuditingPolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public ExtendedDatabaseBlobAuditingPolicy getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, databaseName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, databaseName, context); + } + + private ExtendedDatabaseBlobAuditingPoliciesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ExtendedDatabaseBlobAuditingPolicyImpl define() { + return new ExtendedDatabaseBlobAuditingPolicyImpl(this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ExtendedDatabaseBlobAuditingPolicyImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ExtendedDatabaseBlobAuditingPolicyImpl.java new file mode 100644 index 0000000000000..68ee758cc7b69 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ExtendedDatabaseBlobAuditingPolicyImpl.java @@ -0,0 +1,245 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ExtendedDatabaseBlobAuditingPolicyInner; +import com.azure.resourcemanager.sql.generated.models.BlobAuditingPolicyState; +import com.azure.resourcemanager.sql.generated.models.ExtendedDatabaseBlobAuditingPolicy; +import java.util.Collections; +import java.util.List; +import java.util.UUID; + +public final class ExtendedDatabaseBlobAuditingPolicyImpl + implements ExtendedDatabaseBlobAuditingPolicy, + ExtendedDatabaseBlobAuditingPolicy.Definition, + ExtendedDatabaseBlobAuditingPolicy.Update { + private ExtendedDatabaseBlobAuditingPolicyInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String predicateExpression() { + return this.innerModel().predicateExpression(); + } + + public Integer retentionDays() { + return this.innerModel().retentionDays(); + } + + public List auditActionsAndGroups() { + List inner = this.innerModel().auditActionsAndGroups(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Boolean isStorageSecondaryKeyInUse() { + return this.innerModel().isStorageSecondaryKeyInUse(); + } + + public Boolean isAzureMonitorTargetEnabled() { + return this.innerModel().isAzureMonitorTargetEnabled(); + } + + public Integer queueDelayMs() { + return this.innerModel().queueDelayMs(); + } + + public Boolean isManagedIdentityInUse() { + return this.innerModel().isManagedIdentityInUse(); + } + + public BlobAuditingPolicyState state() { + return this.innerModel().state(); + } + + public String storageEndpoint() { + return this.innerModel().storageEndpoint(); + } + + public String storageAccountAccessKey() { + return this.innerModel().storageAccountAccessKey(); + } + + public UUID storageAccountSubscriptionId() { + return this.innerModel().storageAccountSubscriptionId(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ExtendedDatabaseBlobAuditingPolicyInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String databaseName; + + public ExtendedDatabaseBlobAuditingPolicyImpl withExistingDatabase( + String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + + public ExtendedDatabaseBlobAuditingPolicy create() { + this.innerObject = + serviceManager + .serviceClient() + .getExtendedDatabaseBlobAuditingPolicies() + .createOrUpdateWithResponse( + resourceGroupName, serverName, databaseName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public ExtendedDatabaseBlobAuditingPolicy create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getExtendedDatabaseBlobAuditingPolicies() + .createOrUpdateWithResponse(resourceGroupName, serverName, databaseName, this.innerModel(), context) + .getValue(); + return this; + } + + ExtendedDatabaseBlobAuditingPolicyImpl(com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ExtendedDatabaseBlobAuditingPolicyInner(); + this.serviceManager = serviceManager; + } + + public ExtendedDatabaseBlobAuditingPolicyImpl update() { + return this; + } + + public ExtendedDatabaseBlobAuditingPolicy apply() { + this.innerObject = + serviceManager + .serviceClient() + .getExtendedDatabaseBlobAuditingPolicies() + .createOrUpdateWithResponse( + resourceGroupName, serverName, databaseName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public ExtendedDatabaseBlobAuditingPolicy apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getExtendedDatabaseBlobAuditingPolicies() + .createOrUpdateWithResponse(resourceGroupName, serverName, databaseName, this.innerModel(), context) + .getValue(); + return this; + } + + ExtendedDatabaseBlobAuditingPolicyImpl( + ExtendedDatabaseBlobAuditingPolicyInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "databases"); + } + + public ExtendedDatabaseBlobAuditingPolicy refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getExtendedDatabaseBlobAuditingPolicies() + .getWithResponse(resourceGroupName, serverName, databaseName, Context.NONE) + .getValue(); + return this; + } + + public ExtendedDatabaseBlobAuditingPolicy refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getExtendedDatabaseBlobAuditingPolicies() + .getWithResponse(resourceGroupName, serverName, databaseName, context) + .getValue(); + return this; + } + + public ExtendedDatabaseBlobAuditingPolicyImpl withPredicateExpression(String predicateExpression) { + this.innerModel().withPredicateExpression(predicateExpression); + return this; + } + + public ExtendedDatabaseBlobAuditingPolicyImpl withRetentionDays(Integer retentionDays) { + this.innerModel().withRetentionDays(retentionDays); + return this; + } + + public ExtendedDatabaseBlobAuditingPolicyImpl withAuditActionsAndGroups(List auditActionsAndGroups) { + this.innerModel().withAuditActionsAndGroups(auditActionsAndGroups); + return this; + } + + public ExtendedDatabaseBlobAuditingPolicyImpl withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse) { + this.innerModel().withIsStorageSecondaryKeyInUse(isStorageSecondaryKeyInUse); + return this; + } + + public ExtendedDatabaseBlobAuditingPolicyImpl withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled) { + this.innerModel().withIsAzureMonitorTargetEnabled(isAzureMonitorTargetEnabled); + return this; + } + + public ExtendedDatabaseBlobAuditingPolicyImpl withQueueDelayMs(Integer queueDelayMs) { + this.innerModel().withQueueDelayMs(queueDelayMs); + return this; + } + + public ExtendedDatabaseBlobAuditingPolicyImpl withIsManagedIdentityInUse(Boolean isManagedIdentityInUse) { + this.innerModel().withIsManagedIdentityInUse(isManagedIdentityInUse); + return this; + } + + public ExtendedDatabaseBlobAuditingPolicyImpl withState(BlobAuditingPolicyState state) { + this.innerModel().withState(state); + return this; + } + + public ExtendedDatabaseBlobAuditingPolicyImpl withStorageEndpoint(String storageEndpoint) { + this.innerModel().withStorageEndpoint(storageEndpoint); + return this; + } + + public ExtendedDatabaseBlobAuditingPolicyImpl withStorageAccountAccessKey(String storageAccountAccessKey) { + this.innerModel().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + public ExtendedDatabaseBlobAuditingPolicyImpl withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId) { + this.innerModel().withStorageAccountSubscriptionId(storageAccountSubscriptionId); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ExtendedServerBlobAuditingPoliciesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ExtendedServerBlobAuditingPoliciesClientImpl.java new file mode 100644 index 0000000000000..96635818c938d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ExtendedServerBlobAuditingPoliciesClientImpl.java @@ -0,0 +1,861 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ExtendedServerBlobAuditingPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ExtendedServerBlobAuditingPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ExtendedServerBlobAuditingPolicyListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ExtendedServerBlobAuditingPoliciesClient. + */ +public final class ExtendedServerBlobAuditingPoliciesClientImpl implements ExtendedServerBlobAuditingPoliciesClient { + /** The proxy service used to perform REST calls. */ + private final ExtendedServerBlobAuditingPoliciesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ExtendedServerBlobAuditingPoliciesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ExtendedServerBlobAuditingPoliciesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ExtendedServerBlobAuditingPoliciesService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientExtendedServerBlobAuditingPolicies to be used by + * the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientE") + public interface ExtendedServerBlobAuditingPoliciesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/extendedAuditingSettings") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/extendedAuditingSettings/{blobAuditingPolicyName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("blobAuditingPolicyName") String blobAuditingPolicyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/extendedAuditingSettings/{blobAuditingPolicyName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("blobAuditingPolicyName") String blobAuditingPolicyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ExtendedServerBlobAuditingPolicyInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists extended auditing settings of 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server extended auditing settings along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists extended auditing settings of 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server extended auditing settings along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists extended auditing settings of 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server extended auditing settings as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Lists extended auditing settings of 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server extended auditing settings as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists extended auditing settings of 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server extended auditing settings as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * Lists extended auditing settings of 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server extended auditing settings as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an extended server's blob auditing policy along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String blobAuditingPolicyName = "default"; + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + blobAuditingPolicyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an extended server's blob auditing policy along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String blobAuditingPolicyName = "default"; + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + blobAuditingPolicyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an extended server's blob auditing policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serverName) { + return getWithResponseAsync(resourceGroupName, serverName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an extended server's blob auditing policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an extended server's blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ExtendedServerBlobAuditingPolicyInner get(String resourceGroupName, String serverName) { + return getWithResponse(resourceGroupName, serverName, Context.NONE).getValue(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an extended server blob auditing policy along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverName, ExtendedServerBlobAuditingPolicyInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String blobAuditingPolicyName = "default"; + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + blobAuditingPolicyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an extended server blob auditing policy along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + ExtendedServerBlobAuditingPolicyInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String blobAuditingPolicyName = "default"; + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + blobAuditingPolicyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an extended server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ExtendedServerBlobAuditingPolicyInner> + beginCreateOrUpdateAsync( + String resourceGroupName, String serverName, ExtendedServerBlobAuditingPolicyInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ExtendedServerBlobAuditingPolicyInner.class, + ExtendedServerBlobAuditingPolicyInner.class, + this.client.getContext()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an extended server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ExtendedServerBlobAuditingPolicyInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + ExtendedServerBlobAuditingPolicyInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ExtendedServerBlobAuditingPolicyInner.class, + ExtendedServerBlobAuditingPolicyInner.class, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an extended server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ExtendedServerBlobAuditingPolicyInner> + beginCreateOrUpdate( + String resourceGroupName, String serverName, ExtendedServerBlobAuditingPolicyInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, parameters).getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an extended server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ExtendedServerBlobAuditingPolicyInner> + beginCreateOrUpdate( + String resourceGroupName, + String serverName, + ExtendedServerBlobAuditingPolicyInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, parameters, context).getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an extended server blob auditing policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serverName, ExtendedServerBlobAuditingPolicyInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an extended server blob auditing policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + ExtendedServerBlobAuditingPolicyInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an extended server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ExtendedServerBlobAuditingPolicyInner createOrUpdate( + String resourceGroupName, String serverName, ExtendedServerBlobAuditingPolicyInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, parameters).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an extended server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ExtendedServerBlobAuditingPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + ExtendedServerBlobAuditingPolicyInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, parameters, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server extended auditing settings along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByServerNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server extended auditing settings along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServerNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ExtendedServerBlobAuditingPoliciesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ExtendedServerBlobAuditingPoliciesImpl.java new file mode 100644 index 0000000000000..5ee223c036abc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ExtendedServerBlobAuditingPoliciesImpl.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ExtendedServerBlobAuditingPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ExtendedServerBlobAuditingPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ExtendedServerBlobAuditingPolicies; +import com.azure.resourcemanager.sql.generated.models.ExtendedServerBlobAuditingPolicy; + +public final class ExtendedServerBlobAuditingPoliciesImpl implements ExtendedServerBlobAuditingPolicies { + private static final ClientLogger LOGGER = new ClientLogger(ExtendedServerBlobAuditingPoliciesImpl.class); + + private final ExtendedServerBlobAuditingPoliciesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ExtendedServerBlobAuditingPoliciesImpl( + ExtendedServerBlobAuditingPoliciesClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new ExtendedServerBlobAuditingPolicyImpl(inner1, this.manager())); + } + + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new ExtendedServerBlobAuditingPolicyImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, String serverName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ExtendedServerBlobAuditingPolicyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ExtendedServerBlobAuditingPolicy get(String resourceGroupName, String serverName) { + ExtendedServerBlobAuditingPolicyInner inner = this.serviceClient().get(resourceGroupName, serverName); + if (inner != null) { + return new ExtendedServerBlobAuditingPolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public ExtendedServerBlobAuditingPolicy getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, context); + } + + private ExtendedServerBlobAuditingPoliciesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ExtendedServerBlobAuditingPolicyImpl define() { + return new ExtendedServerBlobAuditingPolicyImpl(this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ExtendedServerBlobAuditingPolicyImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ExtendedServerBlobAuditingPolicyImpl.java new file mode 100644 index 0000000000000..2b982e6ee3bbe --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ExtendedServerBlobAuditingPolicyImpl.java @@ -0,0 +1,243 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ExtendedServerBlobAuditingPolicyInner; +import com.azure.resourcemanager.sql.generated.models.BlobAuditingPolicyState; +import com.azure.resourcemanager.sql.generated.models.ExtendedServerBlobAuditingPolicy; +import java.util.Collections; +import java.util.List; +import java.util.UUID; + +public final class ExtendedServerBlobAuditingPolicyImpl + implements ExtendedServerBlobAuditingPolicy, + ExtendedServerBlobAuditingPolicy.Definition, + ExtendedServerBlobAuditingPolicy.Update { + private ExtendedServerBlobAuditingPolicyInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public Boolean isDevopsAuditEnabled() { + return this.innerModel().isDevopsAuditEnabled(); + } + + public String predicateExpression() { + return this.innerModel().predicateExpression(); + } + + public Integer retentionDays() { + return this.innerModel().retentionDays(); + } + + public List auditActionsAndGroups() { + List inner = this.innerModel().auditActionsAndGroups(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Boolean isStorageSecondaryKeyInUse() { + return this.innerModel().isStorageSecondaryKeyInUse(); + } + + public Boolean isAzureMonitorTargetEnabled() { + return this.innerModel().isAzureMonitorTargetEnabled(); + } + + public Integer queueDelayMs() { + return this.innerModel().queueDelayMs(); + } + + public Boolean isManagedIdentityInUse() { + return this.innerModel().isManagedIdentityInUse(); + } + + public BlobAuditingPolicyState state() { + return this.innerModel().state(); + } + + public String storageEndpoint() { + return this.innerModel().storageEndpoint(); + } + + public String storageAccountAccessKey() { + return this.innerModel().storageAccountAccessKey(); + } + + public UUID storageAccountSubscriptionId() { + return this.innerModel().storageAccountSubscriptionId(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ExtendedServerBlobAuditingPolicyInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + public ExtendedServerBlobAuditingPolicyImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public ExtendedServerBlobAuditingPolicy create() { + this.innerObject = + serviceManager + .serviceClient() + .getExtendedServerBlobAuditingPolicies() + .createOrUpdate(resourceGroupName, serverName, this.innerModel(), Context.NONE); + return this; + } + + public ExtendedServerBlobAuditingPolicy create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getExtendedServerBlobAuditingPolicies() + .createOrUpdate(resourceGroupName, serverName, this.innerModel(), context); + return this; + } + + ExtendedServerBlobAuditingPolicyImpl(com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ExtendedServerBlobAuditingPolicyInner(); + this.serviceManager = serviceManager; + } + + public ExtendedServerBlobAuditingPolicyImpl update() { + return this; + } + + public ExtendedServerBlobAuditingPolicy apply() { + this.innerObject = + serviceManager + .serviceClient() + .getExtendedServerBlobAuditingPolicies() + .createOrUpdate(resourceGroupName, serverName, this.innerModel(), Context.NONE); + return this; + } + + public ExtendedServerBlobAuditingPolicy apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getExtendedServerBlobAuditingPolicies() + .createOrUpdate(resourceGroupName, serverName, this.innerModel(), context); + return this; + } + + ExtendedServerBlobAuditingPolicyImpl( + ExtendedServerBlobAuditingPolicyInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + } + + public ExtendedServerBlobAuditingPolicy refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getExtendedServerBlobAuditingPolicies() + .getWithResponse(resourceGroupName, serverName, Context.NONE) + .getValue(); + return this; + } + + public ExtendedServerBlobAuditingPolicy refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getExtendedServerBlobAuditingPolicies() + .getWithResponse(resourceGroupName, serverName, context) + .getValue(); + return this; + } + + public ExtendedServerBlobAuditingPolicyImpl withIsDevopsAuditEnabled(Boolean isDevopsAuditEnabled) { + this.innerModel().withIsDevopsAuditEnabled(isDevopsAuditEnabled); + return this; + } + + public ExtendedServerBlobAuditingPolicyImpl withPredicateExpression(String predicateExpression) { + this.innerModel().withPredicateExpression(predicateExpression); + return this; + } + + public ExtendedServerBlobAuditingPolicyImpl withRetentionDays(Integer retentionDays) { + this.innerModel().withRetentionDays(retentionDays); + return this; + } + + public ExtendedServerBlobAuditingPolicyImpl withAuditActionsAndGroups(List auditActionsAndGroups) { + this.innerModel().withAuditActionsAndGroups(auditActionsAndGroups); + return this; + } + + public ExtendedServerBlobAuditingPolicyImpl withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse) { + this.innerModel().withIsStorageSecondaryKeyInUse(isStorageSecondaryKeyInUse); + return this; + } + + public ExtendedServerBlobAuditingPolicyImpl withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled) { + this.innerModel().withIsAzureMonitorTargetEnabled(isAzureMonitorTargetEnabled); + return this; + } + + public ExtendedServerBlobAuditingPolicyImpl withQueueDelayMs(Integer queueDelayMs) { + this.innerModel().withQueueDelayMs(queueDelayMs); + return this; + } + + public ExtendedServerBlobAuditingPolicyImpl withIsManagedIdentityInUse(Boolean isManagedIdentityInUse) { + this.innerModel().withIsManagedIdentityInUse(isManagedIdentityInUse); + return this; + } + + public ExtendedServerBlobAuditingPolicyImpl withState(BlobAuditingPolicyState state) { + this.innerModel().withState(state); + return this; + } + + public ExtendedServerBlobAuditingPolicyImpl withStorageEndpoint(String storageEndpoint) { + this.innerModel().withStorageEndpoint(storageEndpoint); + return this; + } + + public ExtendedServerBlobAuditingPolicyImpl withStorageAccountAccessKey(String storageAccountAccessKey) { + this.innerModel().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + public ExtendedServerBlobAuditingPolicyImpl withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId) { + this.innerModel().withStorageAccountSubscriptionId(storageAccountSubscriptionId); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/FailoverGroupImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/FailoverGroupImpl.java new file mode 100644 index 0000000000000..6c8228f4af3bb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/FailoverGroupImpl.java @@ -0,0 +1,262 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.FailoverGroupInner; +import com.azure.resourcemanager.sql.generated.models.FailoverGroup; +import com.azure.resourcemanager.sql.generated.models.FailoverGroupReadOnlyEndpoint; +import com.azure.resourcemanager.sql.generated.models.FailoverGroupReadWriteEndpoint; +import com.azure.resourcemanager.sql.generated.models.FailoverGroupReplicationRole; +import com.azure.resourcemanager.sql.generated.models.FailoverGroupUpdate; +import com.azure.resourcemanager.sql.generated.models.PartnerInfo; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class FailoverGroupImpl implements FailoverGroup, FailoverGroup.Definition, FailoverGroup.Update { + private FailoverGroupInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public FailoverGroupReadWriteEndpoint readWriteEndpoint() { + return this.innerModel().readWriteEndpoint(); + } + + public FailoverGroupReadOnlyEndpoint readOnlyEndpoint() { + return this.innerModel().readOnlyEndpoint(); + } + + public FailoverGroupReplicationRole replicationRole() { + return this.innerModel().replicationRole(); + } + + public String replicationState() { + return this.innerModel().replicationState(); + } + + public List partnerServers() { + List inner = this.innerModel().partnerServers(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List databases() { + List inner = this.innerModel().databases(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public FailoverGroupInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String failoverGroupName; + + private FailoverGroupUpdate updateParameters; + + public FailoverGroupImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public FailoverGroup create() { + this.innerObject = + serviceManager + .serviceClient() + .getFailoverGroups() + .createOrUpdate(resourceGroupName, serverName, failoverGroupName, this.innerModel(), Context.NONE); + return this; + } + + public FailoverGroup create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getFailoverGroups() + .createOrUpdate(resourceGroupName, serverName, failoverGroupName, this.innerModel(), context); + return this; + } + + FailoverGroupImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new FailoverGroupInner(); + this.serviceManager = serviceManager; + this.failoverGroupName = name; + } + + public FailoverGroupImpl update() { + this.updateParameters = new FailoverGroupUpdate(); + return this; + } + + public FailoverGroup apply() { + this.innerObject = + serviceManager + .serviceClient() + .getFailoverGroups() + .update(resourceGroupName, serverName, failoverGroupName, updateParameters, Context.NONE); + return this; + } + + public FailoverGroup apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getFailoverGroups() + .update(resourceGroupName, serverName, failoverGroupName, updateParameters, context); + return this; + } + + FailoverGroupImpl( + FailoverGroupInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.failoverGroupName = Utils.getValueFromIdByName(innerObject.id(), "failoverGroups"); + } + + public FailoverGroup refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getFailoverGroups() + .getWithResponse(resourceGroupName, serverName, failoverGroupName, Context.NONE) + .getValue(); + return this; + } + + public FailoverGroup refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getFailoverGroups() + .getWithResponse(resourceGroupName, serverName, failoverGroupName, context) + .getValue(); + return this; + } + + public FailoverGroup failover() { + return serviceManager.failoverGroups().failover(resourceGroupName, serverName, failoverGroupName); + } + + public FailoverGroup failover(Context context) { + return serviceManager.failoverGroups().failover(resourceGroupName, serverName, failoverGroupName, context); + } + + public FailoverGroup forceFailoverAllowDataLoss() { + return serviceManager + .failoverGroups() + .forceFailoverAllowDataLoss(resourceGroupName, serverName, failoverGroupName); + } + + public FailoverGroup forceFailoverAllowDataLoss(Context context) { + return serviceManager + .failoverGroups() + .forceFailoverAllowDataLoss(resourceGroupName, serverName, failoverGroupName, context); + } + + public FailoverGroupImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public FailoverGroupImpl withReadWriteEndpoint(FailoverGroupReadWriteEndpoint readWriteEndpoint) { + if (isInCreateMode()) { + this.innerModel().withReadWriteEndpoint(readWriteEndpoint); + return this; + } else { + this.updateParameters.withReadWriteEndpoint(readWriteEndpoint); + return this; + } + } + + public FailoverGroupImpl withReadOnlyEndpoint(FailoverGroupReadOnlyEndpoint readOnlyEndpoint) { + if (isInCreateMode()) { + this.innerModel().withReadOnlyEndpoint(readOnlyEndpoint); + return this; + } else { + this.updateParameters.withReadOnlyEndpoint(readOnlyEndpoint); + return this; + } + } + + public FailoverGroupImpl withPartnerServers(List partnerServers) { + this.innerModel().withPartnerServers(partnerServers); + return this; + } + + public FailoverGroupImpl withDatabases(List databases) { + if (isInCreateMode()) { + this.innerModel().withDatabases(databases); + return this; + } else { + this.updateParameters.withDatabases(databases); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/FailoverGroupsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/FailoverGroupsClientImpl.java new file mode 100644 index 0000000000000..8b7ff8bbb1cb0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/FailoverGroupsClientImpl.java @@ -0,0 +1,2073 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.FailoverGroupsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.FailoverGroupInner; +import com.azure.resourcemanager.sql.generated.models.FailoverGroupListResult; +import com.azure.resourcemanager.sql.generated.models.FailoverGroupUpdate; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in FailoverGroupsClient. */ +public final class FailoverGroupsClientImpl implements FailoverGroupsClient { + /** The proxy service used to perform REST calls. */ + private final FailoverGroupsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of FailoverGroupsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + FailoverGroupsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(FailoverGroupsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientFailoverGroups to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientF") + public interface FailoverGroupsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/failoverGroups/{failoverGroupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("failoverGroupName") String failoverGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/failoverGroups/{failoverGroupName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("failoverGroupName") String failoverGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") FailoverGroupInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/failoverGroups/{failoverGroupName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("failoverGroupName") String failoverGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/failoverGroups/{failoverGroupName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("failoverGroupName") String failoverGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") FailoverGroupUpdate parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/failoverGroups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/failoverGroups/{failoverGroupName}/failover") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> failover( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("failoverGroupName") String failoverGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/failoverGroups/{failoverGroupName}/forceFailoverAllowDataLoss") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> forceFailoverAllowDataLoss( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("failoverGroupName") String failoverGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String failoverGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (failoverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + failoverGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String failoverGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (failoverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + failoverGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serverName, String failoverGroupName) { + return getWithResponseAsync(resourceGroupName, serverName, failoverGroupName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String failoverGroupName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, failoverGroupName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FailoverGroupInner get(String resourceGroupName, String serverName, String failoverGroupName) { + return getWithResponse(resourceGroupName, serverName, failoverGroupName, Context.NONE).getValue(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (failoverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + failoverGroupName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String failoverGroupName, + FailoverGroupInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (failoverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + failoverGroupName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, FailoverGroupInner> beginCreateOrUpdateAsync( + String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, failoverGroupName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + FailoverGroupInner.class, + FailoverGroupInner.class, + this.client.getContext()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, FailoverGroupInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String failoverGroupName, + FailoverGroupInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, failoverGroupName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), FailoverGroupInner.class, FailoverGroupInner.class, context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, FailoverGroupInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, failoverGroupName, parameters).getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, FailoverGroupInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String failoverGroupName, + FailoverGroupInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, failoverGroupName, parameters, context) + .getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, failoverGroupName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String failoverGroupName, + FailoverGroupInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, failoverGroupName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FailoverGroupInner createOrUpdate( + String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, failoverGroupName, parameters).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FailoverGroupInner createOrUpdate( + String resourceGroupName, + String serverName, + String failoverGroupName, + FailoverGroupInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, failoverGroupName, parameters, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, String failoverGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (failoverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + failoverGroupName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, String failoverGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (failoverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + failoverGroupName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String failoverGroupName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, failoverGroupName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String failoverGroupName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, failoverGroupName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String failoverGroupName) { + return beginDeleteAsync(resourceGroupName, serverName, failoverGroupName).getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String failoverGroupName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, failoverGroupName, context).getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String serverName, String failoverGroupName) { + return beginDeleteAsync(resourceGroupName, serverName, failoverGroupName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String serverName, String failoverGroupName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, failoverGroupName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, String failoverGroupName) { + deleteAsync(resourceGroupName, serverName, failoverGroupName).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, String failoverGroupName, Context context) { + deleteAsync(resourceGroupName, serverName, failoverGroupName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupUpdate parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (failoverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + serverName, + failoverGroupName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String serverName, + String failoverGroupName, + FailoverGroupUpdate parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (failoverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + serverName, + failoverGroupName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, FailoverGroupInner> beginUpdateAsync( + String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupUpdate parameters) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, serverName, failoverGroupName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + FailoverGroupInner.class, + FailoverGroupInner.class, + this.client.getContext()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, FailoverGroupInner> beginUpdateAsync( + String resourceGroupName, + String serverName, + String failoverGroupName, + FailoverGroupUpdate parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, serverName, failoverGroupName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), FailoverGroupInner.class, FailoverGroupInner.class, context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, FailoverGroupInner> beginUpdate( + String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupUpdate parameters) { + return beginUpdateAsync(resourceGroupName, serverName, failoverGroupName, parameters).getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, FailoverGroupInner> beginUpdate( + String resourceGroupName, + String serverName, + String failoverGroupName, + FailoverGroupUpdate parameters, + Context context) { + return beginUpdateAsync(resourceGroupName, serverName, failoverGroupName, parameters, context).getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupUpdate parameters) { + return beginUpdateAsync(resourceGroupName, serverName, failoverGroupName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String serverName, + String failoverGroupName, + FailoverGroupUpdate parameters, + Context context) { + return beginUpdateAsync(resourceGroupName, serverName, failoverGroupName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FailoverGroupInner update( + String resourceGroupName, String serverName, String failoverGroupName, FailoverGroupUpdate parameters) { + return updateAsync(resourceGroupName, serverName, failoverGroupName, parameters).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FailoverGroupInner update( + String resourceGroupName, + String serverName, + String failoverGroupName, + FailoverGroupUpdate parameters, + Context context) { + return updateAsync(resourceGroupName, serverName, failoverGroupName, parameters, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of failover groups along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of failover groups along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of failover groups as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of failover groups as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of failover groups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of failover groups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> failoverWithResponseAsync( + String resourceGroupName, String serverName, String failoverGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (failoverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .failover( + this.client.getEndpoint(), + resourceGroupName, + serverName, + failoverGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> failoverWithResponseAsync( + String resourceGroupName, String serverName, String failoverGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (failoverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .failover( + this.client.getEndpoint(), + resourceGroupName, + serverName, + failoverGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, FailoverGroupInner> beginFailoverAsync( + String resourceGroupName, String serverName, String failoverGroupName) { + Mono>> mono = + failoverWithResponseAsync(resourceGroupName, serverName, failoverGroupName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + FailoverGroupInner.class, + FailoverGroupInner.class, + this.client.getContext()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, FailoverGroupInner> beginFailoverAsync( + String resourceGroupName, String serverName, String failoverGroupName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + failoverWithResponseAsync(resourceGroupName, serverName, failoverGroupName, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), FailoverGroupInner.class, FailoverGroupInner.class, context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, FailoverGroupInner> beginFailover( + String resourceGroupName, String serverName, String failoverGroupName) { + return beginFailoverAsync(resourceGroupName, serverName, failoverGroupName).getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, FailoverGroupInner> beginFailover( + String resourceGroupName, String serverName, String failoverGroupName, Context context) { + return beginFailoverAsync(resourceGroupName, serverName, failoverGroupName, context).getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono failoverAsync( + String resourceGroupName, String serverName, String failoverGroupName) { + return beginFailoverAsync(resourceGroupName, serverName, failoverGroupName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono failoverAsync( + String resourceGroupName, String serverName, String failoverGroupName, Context context) { + return beginFailoverAsync(resourceGroupName, serverName, failoverGroupName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FailoverGroupInner failover(String resourceGroupName, String serverName, String failoverGroupName) { + return failoverAsync(resourceGroupName, serverName, failoverGroupName).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FailoverGroupInner failover( + String resourceGroupName, String serverName, String failoverGroupName, Context context) { + return failoverAsync(resourceGroupName, serverName, failoverGroupName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> forceFailoverAllowDataLossWithResponseAsync( + String resourceGroupName, String serverName, String failoverGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (failoverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .forceFailoverAllowDataLoss( + this.client.getEndpoint(), + resourceGroupName, + serverName, + failoverGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> forceFailoverAllowDataLossWithResponseAsync( + String resourceGroupName, String serverName, String failoverGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (failoverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .forceFailoverAllowDataLoss( + this.client.getEndpoint(), + resourceGroupName, + serverName, + failoverGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, FailoverGroupInner> beginForceFailoverAllowDataLossAsync( + String resourceGroupName, String serverName, String failoverGroupName) { + Mono>> mono = + forceFailoverAllowDataLossWithResponseAsync(resourceGroupName, serverName, failoverGroupName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + FailoverGroupInner.class, + FailoverGroupInner.class, + this.client.getContext()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, FailoverGroupInner> beginForceFailoverAllowDataLossAsync( + String resourceGroupName, String serverName, String failoverGroupName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + forceFailoverAllowDataLossWithResponseAsync(resourceGroupName, serverName, failoverGroupName, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), FailoverGroupInner.class, FailoverGroupInner.class, context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, FailoverGroupInner> beginForceFailoverAllowDataLoss( + String resourceGroupName, String serverName, String failoverGroupName) { + return beginForceFailoverAllowDataLossAsync(resourceGroupName, serverName, failoverGroupName).getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, FailoverGroupInner> beginForceFailoverAllowDataLoss( + String resourceGroupName, String serverName, String failoverGroupName, Context context) { + return beginForceFailoverAllowDataLossAsync(resourceGroupName, serverName, failoverGroupName, context) + .getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono forceFailoverAllowDataLossAsync( + String resourceGroupName, String serverName, String failoverGroupName) { + return beginForceFailoverAllowDataLossAsync(resourceGroupName, serverName, failoverGroupName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono forceFailoverAllowDataLossAsync( + String resourceGroupName, String serverName, String failoverGroupName, Context context) { + return beginForceFailoverAllowDataLossAsync(resourceGroupName, serverName, failoverGroupName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FailoverGroupInner forceFailoverAllowDataLoss( + String resourceGroupName, String serverName, String failoverGroupName) { + return forceFailoverAllowDataLossAsync(resourceGroupName, serverName, failoverGroupName).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FailoverGroupInner forceFailoverAllowDataLoss( + String resourceGroupName, String serverName, String failoverGroupName, Context context) { + return forceFailoverAllowDataLossAsync(resourceGroupName, serverName, failoverGroupName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of failover groups along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByServerNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of failover groups along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServerNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/FailoverGroupsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/FailoverGroupsImpl.java new file mode 100644 index 0000000000000..10c1fdce00c51 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/FailoverGroupsImpl.java @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.FailoverGroupsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.FailoverGroupInner; +import com.azure.resourcemanager.sql.generated.models.FailoverGroup; +import com.azure.resourcemanager.sql.generated.models.FailoverGroups; + +public final class FailoverGroupsImpl implements FailoverGroups { + private static final ClientLogger LOGGER = new ClientLogger(FailoverGroupsImpl.class); + + private final FailoverGroupsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public FailoverGroupsImpl( + FailoverGroupsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String failoverGroupName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, failoverGroupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new FailoverGroupImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public FailoverGroup get(String resourceGroupName, String serverName, String failoverGroupName) { + FailoverGroupInner inner = this.serviceClient().get(resourceGroupName, serverName, failoverGroupName); + if (inner != null) { + return new FailoverGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String serverName, String failoverGroupName) { + this.serviceClient().delete(resourceGroupName, serverName, failoverGroupName); + } + + public void delete(String resourceGroupName, String serverName, String failoverGroupName, Context context) { + this.serviceClient().delete(resourceGroupName, serverName, failoverGroupName, context); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new FailoverGroupImpl(inner1, this.manager())); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new FailoverGroupImpl(inner1, this.manager())); + } + + public FailoverGroup failover(String resourceGroupName, String serverName, String failoverGroupName) { + FailoverGroupInner inner = this.serviceClient().failover(resourceGroupName, serverName, failoverGroupName); + if (inner != null) { + return new FailoverGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public FailoverGroup failover( + String resourceGroupName, String serverName, String failoverGroupName, Context context) { + FailoverGroupInner inner = + this.serviceClient().failover(resourceGroupName, serverName, failoverGroupName, context); + if (inner != null) { + return new FailoverGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public FailoverGroup forceFailoverAllowDataLoss( + String resourceGroupName, String serverName, String failoverGroupName) { + FailoverGroupInner inner = + this.serviceClient().forceFailoverAllowDataLoss(resourceGroupName, serverName, failoverGroupName); + if (inner != null) { + return new FailoverGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public FailoverGroup forceFailoverAllowDataLoss( + String resourceGroupName, String serverName, String failoverGroupName, Context context) { + FailoverGroupInner inner = + this.serviceClient().forceFailoverAllowDataLoss(resourceGroupName, serverName, failoverGroupName, context); + if (inner != null) { + return new FailoverGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public FailoverGroup getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String failoverGroupName = Utils.getValueFromIdByName(id, "failoverGroups"); + if (failoverGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'failoverGroups'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, failoverGroupName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String failoverGroupName = Utils.getValueFromIdByName(id, "failoverGroups"); + if (failoverGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'failoverGroups'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, failoverGroupName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String failoverGroupName = Utils.getValueFromIdByName(id, "failoverGroups"); + if (failoverGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'failoverGroups'.", id))); + } + this.delete(resourceGroupName, serverName, failoverGroupName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String failoverGroupName = Utils.getValueFromIdByName(id, "failoverGroups"); + if (failoverGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'failoverGroups'.", id))); + } + this.delete(resourceGroupName, serverName, failoverGroupName, context); + } + + private FailoverGroupsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public FailoverGroupImpl define(String name) { + return new FailoverGroupImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/FirewallRuleImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/FirewallRuleImpl.java new file mode 100644 index 0000000000000..bf42cbefbff71 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/FirewallRuleImpl.java @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.FirewallRuleInner; +import com.azure.resourcemanager.sql.generated.models.FirewallRule; + +public final class FirewallRuleImpl implements FirewallRule, FirewallRule.Definition, FirewallRule.Update { + private FirewallRuleInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String type() { + return this.innerModel().type(); + } + + public String name() { + return this.innerModel().name(); + } + + public String startIpAddress() { + return this.innerModel().startIpAddress(); + } + + public String endIpAddress() { + return this.innerModel().endIpAddress(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public FirewallRuleInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String firewallRuleName; + + public FirewallRuleImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public FirewallRule create() { + this.innerObject = + serviceManager + .serviceClient() + .getFirewallRules() + .createOrUpdateWithResponse( + resourceGroupName, serverName, firewallRuleName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public FirewallRule create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getFirewallRules() + .createOrUpdateWithResponse(resourceGroupName, serverName, firewallRuleName, this.innerModel(), context) + .getValue(); + return this; + } + + FirewallRuleImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new FirewallRuleInner(); + this.serviceManager = serviceManager; + this.firewallRuleName = name; + } + + public FirewallRuleImpl update() { + return this; + } + + public FirewallRule apply() { + this.innerObject = + serviceManager + .serviceClient() + .getFirewallRules() + .createOrUpdateWithResponse( + resourceGroupName, serverName, firewallRuleName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public FirewallRule apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getFirewallRules() + .createOrUpdateWithResponse(resourceGroupName, serverName, firewallRuleName, this.innerModel(), context) + .getValue(); + return this; + } + + FirewallRuleImpl(FirewallRuleInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.firewallRuleName = Utils.getValueFromIdByName(innerObject.id(), "firewallRules"); + } + + public FirewallRule refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getFirewallRules() + .getWithResponse(resourceGroupName, serverName, firewallRuleName, Context.NONE) + .getValue(); + return this; + } + + public FirewallRule refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getFirewallRules() + .getWithResponse(resourceGroupName, serverName, firewallRuleName, context) + .getValue(); + return this; + } + + public FirewallRuleImpl withName(String name) { + this.innerModel().withName(name); + return this; + } + + public FirewallRuleImpl withStartIpAddress(String startIpAddress) { + this.innerModel().withStartIpAddress(startIpAddress); + return this; + } + + public FirewallRuleImpl withEndIpAddress(String endIpAddress) { + this.innerModel().withEndIpAddress(endIpAddress); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/FirewallRulesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/FirewallRulesClientImpl.java new file mode 100644 index 0000000000000..dd708e4f6d5f3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/FirewallRulesClientImpl.java @@ -0,0 +1,1097 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.FirewallRulesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.FirewallRuleInner; +import com.azure.resourcemanager.sql.generated.models.FirewallRuleList; +import com.azure.resourcemanager.sql.generated.models.FirewallRuleListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in FirewallRulesClient. */ +public final class FirewallRulesClientImpl implements FirewallRulesClient { + /** The proxy service used to perform REST calls. */ + private final FirewallRulesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of FirewallRulesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + FirewallRulesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(FirewallRulesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientFirewallRules to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientF") + public interface FirewallRulesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/firewallRules/{firewallRuleName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("firewallRuleName") String firewallRuleName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/firewallRules/{firewallRuleName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("firewallRuleName") String firewallRuleName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") FirewallRuleInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/firewallRules/{firewallRuleName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("firewallRuleName") String firewallRuleName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/firewallRules") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/firewallRules") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> replace( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") FirewallRuleList parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a firewall rule along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String firewallRuleName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (firewallRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter firewallRuleName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + firewallRuleName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a firewall rule along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String firewallRuleName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (firewallRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter firewallRuleName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + firewallRuleName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a firewall rule on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serverName, String firewallRuleName) { + return getWithResponseAsync(resourceGroupName, serverName, firewallRuleName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a firewall rule along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String firewallRuleName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, firewallRuleName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FirewallRuleInner get(String resourceGroupName, String serverName, String firewallRuleName) { + return getWithResponse(resourceGroupName, serverName, firewallRuleName, Context.NONE).getValue(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server firewall rule along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverName, String firewallRuleName, FirewallRuleInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (firewallRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter firewallRuleName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + firewallRuleName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server firewall rule along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String firewallRuleName, + FirewallRuleInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (firewallRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter firewallRuleName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + firewallRuleName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server firewall rule on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serverName, String firewallRuleName, FirewallRuleInner parameters) { + return createOrUpdateWithResponseAsync(resourceGroupName, serverName, firewallRuleName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server firewall rule along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String firewallRuleName, + FirewallRuleInner parameters, + Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, serverName, firewallRuleName, parameters, context) + .block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FirewallRuleInner createOrUpdate( + String resourceGroupName, String serverName, String firewallRuleName, FirewallRuleInner parameters) { + return createOrUpdateWithResponse(resourceGroupName, serverName, firewallRuleName, parameters, Context.NONE) + .getValue(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String serverName, String firewallRuleName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (firewallRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter firewallRuleName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + firewallRuleName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String serverName, String firewallRuleName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (firewallRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter firewallRuleName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + firewallRuleName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String serverName, String firewallRuleName) { + return deleteWithResponseAsync(resourceGroupName, serverName, firewallRuleName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, String serverName, String firewallRuleName, Context context) { + return deleteWithResponseAsync(resourceGroupName, serverName, firewallRuleName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, String firewallRuleName) { + deleteWithResponse(resourceGroupName, serverName, firewallRuleName, Context.NONE); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of firewall rules along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of firewall rules along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of firewall rules as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of firewall rules as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of firewall rules as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of firewall rules as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } + + /** + * 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 parameters A list of server firewall rules. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server firewall rule along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> replaceWithResponseAsync( + String resourceGroupName, String serverName, FirewallRuleList parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .replace( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 parameters A list of server firewall rules. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server firewall rule along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> replaceWithResponseAsync( + String resourceGroupName, String serverName, FirewallRuleList parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .replace( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 parameters A list of server firewall rules. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server firewall rule on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono replaceAsync( + String resourceGroupName, String serverName, FirewallRuleList parameters) { + return replaceWithResponseAsync(resourceGroupName, serverName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 parameters A list of server firewall rules. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server firewall rule along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response replaceWithResponse( + String resourceGroupName, String serverName, FirewallRuleList parameters, Context context) { + return replaceWithResponseAsync(resourceGroupName, serverName, parameters, context).block(); + } + + /** + * 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 parameters A list of server firewall rules. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FirewallRuleInner replace(String resourceGroupName, String serverName, FirewallRuleList parameters) { + return replaceWithResponse(resourceGroupName, serverName, parameters, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list firewall rules request along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByServerNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list firewall rules request along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServerNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/FirewallRulesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/FirewallRulesImpl.java new file mode 100644 index 0000000000000..f40597760bd47 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/FirewallRulesImpl.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.FirewallRulesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.FirewallRuleInner; +import com.azure.resourcemanager.sql.generated.models.FirewallRule; +import com.azure.resourcemanager.sql.generated.models.FirewallRuleList; +import com.azure.resourcemanager.sql.generated.models.FirewallRules; + +public final class FirewallRulesImpl implements FirewallRules { + private static final ClientLogger LOGGER = new ClientLogger(FirewallRulesImpl.class); + + private final FirewallRulesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public FirewallRulesImpl( + FirewallRulesClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String firewallRuleName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, firewallRuleName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new FirewallRuleImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public FirewallRule get(String resourceGroupName, String serverName, String firewallRuleName) { + FirewallRuleInner inner = this.serviceClient().get(resourceGroupName, serverName, firewallRuleName); + if (inner != null) { + return new FirewallRuleImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse( + String resourceGroupName, String serverName, String firewallRuleName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, serverName, firewallRuleName, context); + } + + public void delete(String resourceGroupName, String serverName, String firewallRuleName) { + this.serviceClient().delete(resourceGroupName, serverName, firewallRuleName); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new FirewallRuleImpl(inner1, this.manager())); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new FirewallRuleImpl(inner1, this.manager())); + } + + public Response replaceWithResponse( + String resourceGroupName, String serverName, FirewallRuleList parameters, Context context) { + Response inner = + this.serviceClient().replaceWithResponse(resourceGroupName, serverName, parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new FirewallRuleImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public FirewallRule replace(String resourceGroupName, String serverName, FirewallRuleList parameters) { + FirewallRuleInner inner = this.serviceClient().replace(resourceGroupName, serverName, parameters); + if (inner != null) { + return new FirewallRuleImpl(inner, this.manager()); + } else { + return null; + } + } + + public FirewallRule getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String firewallRuleName = Utils.getValueFromIdByName(id, "firewallRules"); + if (firewallRuleName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'firewallRules'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, firewallRuleName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String firewallRuleName = Utils.getValueFromIdByName(id, "firewallRules"); + if (firewallRuleName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'firewallRules'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, firewallRuleName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String firewallRuleName = Utils.getValueFromIdByName(id, "firewallRules"); + if (firewallRuleName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'firewallRules'.", id))); + } + this.deleteWithResponse(resourceGroupName, serverName, firewallRuleName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String firewallRuleName = Utils.getValueFromIdByName(id, "firewallRules"); + if (firewallRuleName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'firewallRules'.", id))); + } + return this.deleteWithResponse(resourceGroupName, serverName, firewallRuleName, context); + } + + private FirewallRulesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public FirewallRuleImpl define(String name) { + return new FirewallRuleImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/GeoBackupPoliciesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/GeoBackupPoliciesClientImpl.java new file mode 100644 index 0000000000000..845833959bad5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/GeoBackupPoliciesClientImpl.java @@ -0,0 +1,717 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.GeoBackupPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.GeoBackupPolicyInner; +import com.azure.resourcemanager.sql.generated.models.GeoBackupPolicyListResult; +import com.azure.resourcemanager.sql.generated.models.GeoBackupPolicyName; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in GeoBackupPoliciesClient. */ +public final class GeoBackupPoliciesClientImpl implements GeoBackupPoliciesClient { + /** The proxy service used to perform REST calls. */ + private final GeoBackupPoliciesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of GeoBackupPoliciesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + GeoBackupPoliciesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(GeoBackupPoliciesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientGeoBackupPolicies to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientG") + public interface GeoBackupPoliciesService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/geoBackupPolicies/{geoBackupPolicyName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("geoBackupPolicyName") GeoBackupPolicyName geoBackupPolicyName, + @BodyParam("application/json") GeoBackupPolicyInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/geoBackupPolicies/{geoBackupPolicyName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("geoBackupPolicyName") GeoBackupPolicyName geoBackupPolicyName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/geoBackupPolicies") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 geoBackupPolicyName The name of the geo backup policy. + * @param parameters The required parameters for creating or updating the geo backup policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database geo backup policy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + GeoBackupPolicyName geoBackupPolicyName, + GeoBackupPolicyInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (geoBackupPolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter geoBackupPolicyName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + geoBackupPolicyName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 geoBackupPolicyName The name of the geo backup policy. + * @param parameters The required parameters for creating or updating the geo backup policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database geo backup policy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + GeoBackupPolicyName geoBackupPolicyName, + GeoBackupPolicyInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (geoBackupPolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter geoBackupPolicyName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + geoBackupPolicyName, + parameters, + accept, + context); + } + + /** + * 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 geoBackupPolicyName The name of the geo backup policy. + * @param parameters The required parameters for creating or updating the geo backup policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database geo backup policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + GeoBackupPolicyName geoBackupPolicyName, + GeoBackupPolicyInner parameters) { + return createOrUpdateWithResponseAsync( + resourceGroupName, serverName, databaseName, geoBackupPolicyName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 geoBackupPolicyName The name of the geo backup policy. + * @param parameters The required parameters for creating or updating the geo backup policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database geo backup policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + GeoBackupPolicyName geoBackupPolicyName, + GeoBackupPolicyInner parameters, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, serverName, databaseName, geoBackupPolicyName, parameters, context) + .block(); + } + + /** + * 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 geoBackupPolicyName The name of the geo backup policy. + * @param parameters The required parameters for creating or updating the geo backup policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database geo backup policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GeoBackupPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + GeoBackupPolicyName geoBackupPolicyName, + GeoBackupPolicyInner parameters) { + return createOrUpdateWithResponse( + resourceGroupName, serverName, databaseName, geoBackupPolicyName, parameters, Context.NONE) + .getValue(); + } + + /** + * 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 geoBackupPolicyName The name of the geo backup policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a geo backup policy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, GeoBackupPolicyName geoBackupPolicyName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (geoBackupPolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter geoBackupPolicyName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + geoBackupPolicyName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 geoBackupPolicyName The name of the geo backup policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a geo backup policy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + GeoBackupPolicyName geoBackupPolicyName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (geoBackupPolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter geoBackupPolicyName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + geoBackupPolicyName, + accept, + context); + } + + /** + * 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 geoBackupPolicyName The name of the geo backup policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a geo backup policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String databaseName, GeoBackupPolicyName geoBackupPolicyName) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, geoBackupPolicyName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 geoBackupPolicyName The name of the geo backup policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a geo backup policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + GeoBackupPolicyName geoBackupPolicyName, + Context context) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, geoBackupPolicyName, context).block(); + } + + /** + * 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 geoBackupPolicyName The name of the geo backup policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a geo backup policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GeoBackupPolicyInner get( + String resourceGroupName, String serverName, String databaseName, GeoBackupPolicyName geoBackupPolicyName) { + return getWithResponse(resourceGroupName, serverName, databaseName, geoBackupPolicyName, Context.NONE) + .getValue(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list geo backup policies request along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list geo backup policies request along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list geo backup policies request as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName) { + return new PagedFlux<>(() -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list geo backup policies request as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list geo backup policies request as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list geo backup policies request as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName, context)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/GeoBackupPoliciesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/GeoBackupPoliciesImpl.java new file mode 100644 index 0000000000000..bc26ac0742ddb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/GeoBackupPoliciesImpl.java @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.GeoBackupPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.GeoBackupPolicyInner; +import com.azure.resourcemanager.sql.generated.models.GeoBackupPolicies; +import com.azure.resourcemanager.sql.generated.models.GeoBackupPolicy; +import com.azure.resourcemanager.sql.generated.models.GeoBackupPolicyName; + +public final class GeoBackupPoliciesImpl implements GeoBackupPolicies { + private static final ClientLogger LOGGER = new ClientLogger(GeoBackupPoliciesImpl.class); + + private final GeoBackupPoliciesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public GeoBackupPoliciesImpl( + GeoBackupPoliciesClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + GeoBackupPolicyName geoBackupPolicyName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, serverName, databaseName, geoBackupPolicyName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new GeoBackupPolicyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public GeoBackupPolicy get( + String resourceGroupName, String serverName, String databaseName, GeoBackupPolicyName geoBackupPolicyName) { + GeoBackupPolicyInner inner = + this.serviceClient().get(resourceGroupName, serverName, databaseName, geoBackupPolicyName); + if (inner != null) { + return new GeoBackupPolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName); + return Utils.mapPage(inner, inner1 -> new GeoBackupPolicyImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName, context); + return Utils.mapPage(inner, inner1 -> new GeoBackupPolicyImpl(inner1, this.manager())); + } + + public GeoBackupPolicy getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String geoBackupPolicyNameLocal = Utils.getValueFromIdByName(id, "geoBackupPolicies"); + if (geoBackupPolicyNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'geoBackupPolicies'.", id))); + } + GeoBackupPolicyName geoBackupPolicyName = GeoBackupPolicyName.fromString(geoBackupPolicyNameLocal); + return this + .getWithResponse(resourceGroupName, serverName, databaseName, geoBackupPolicyName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String geoBackupPolicyNameLocal = Utils.getValueFromIdByName(id, "geoBackupPolicies"); + if (geoBackupPolicyNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'geoBackupPolicies'.", id))); + } + GeoBackupPolicyName geoBackupPolicyName = GeoBackupPolicyName.fromString(geoBackupPolicyNameLocal); + return this.getWithResponse(resourceGroupName, serverName, databaseName, geoBackupPolicyName, context); + } + + private GeoBackupPoliciesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public GeoBackupPolicyImpl define(GeoBackupPolicyName name) { + return new GeoBackupPolicyImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/GeoBackupPolicyImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/GeoBackupPolicyImpl.java new file mode 100644 index 0000000000000..ebba59e2c3b89 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/GeoBackupPolicyImpl.java @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.GeoBackupPolicyInner; +import com.azure.resourcemanager.sql.generated.models.GeoBackupPolicy; +import com.azure.resourcemanager.sql.generated.models.GeoBackupPolicyName; +import com.azure.resourcemanager.sql.generated.models.GeoBackupPolicyState; + +public final class GeoBackupPolicyImpl implements GeoBackupPolicy, GeoBackupPolicy.Definition, GeoBackupPolicy.Update { + private GeoBackupPolicyInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String kind() { + return this.innerModel().kind(); + } + + public String location() { + return this.innerModel().location(); + } + + public GeoBackupPolicyState state() { + return this.innerModel().state(); + } + + public String storageType() { + return this.innerModel().storageType(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public GeoBackupPolicyInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String databaseName; + + private GeoBackupPolicyName geoBackupPolicyName; + + public GeoBackupPolicyImpl withExistingDatabase(String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + + public GeoBackupPolicy create() { + this.innerObject = + serviceManager + .serviceClient() + .getGeoBackupPolicies() + .createOrUpdateWithResponse( + resourceGroupName, serverName, databaseName, geoBackupPolicyName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public GeoBackupPolicy create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getGeoBackupPolicies() + .createOrUpdateWithResponse( + resourceGroupName, serverName, databaseName, geoBackupPolicyName, this.innerModel(), context) + .getValue(); + return this; + } + + GeoBackupPolicyImpl(GeoBackupPolicyName name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new GeoBackupPolicyInner(); + this.serviceManager = serviceManager; + this.geoBackupPolicyName = name; + } + + public GeoBackupPolicyImpl update() { + return this; + } + + public GeoBackupPolicy apply() { + this.innerObject = + serviceManager + .serviceClient() + .getGeoBackupPolicies() + .createOrUpdateWithResponse( + resourceGroupName, serverName, databaseName, geoBackupPolicyName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public GeoBackupPolicy apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getGeoBackupPolicies() + .createOrUpdateWithResponse( + resourceGroupName, serverName, databaseName, geoBackupPolicyName, this.innerModel(), context) + .getValue(); + return this; + } + + GeoBackupPolicyImpl( + GeoBackupPolicyInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "databases"); + this.geoBackupPolicyName = + GeoBackupPolicyName.fromString(Utils.getValueFromIdByName(innerObject.id(), "geoBackupPolicies")); + } + + public GeoBackupPolicy refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getGeoBackupPolicies() + .getWithResponse(resourceGroupName, serverName, databaseName, geoBackupPolicyName, Context.NONE) + .getValue(); + return this; + } + + public GeoBackupPolicy refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getGeoBackupPolicies() + .getWithResponse(resourceGroupName, serverName, databaseName, geoBackupPolicyName, context) + .getValue(); + return this; + } + + public GeoBackupPolicyImpl withState(GeoBackupPolicyState state) { + this.innerModel().withState(state); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/IPv6FirewallRuleImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/IPv6FirewallRuleImpl.java new file mode 100644 index 0000000000000..2cdad35a05775 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/IPv6FirewallRuleImpl.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.IPv6FirewallRuleInner; +import com.azure.resourcemanager.sql.generated.models.IPv6FirewallRule; + +public final class IPv6FirewallRuleImpl + implements IPv6FirewallRule, IPv6FirewallRule.Definition, IPv6FirewallRule.Update { + private IPv6FirewallRuleInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String type() { + return this.innerModel().type(); + } + + public String name() { + return this.innerModel().name(); + } + + public String startIPv6Address() { + return this.innerModel().startIPv6Address(); + } + + public String endIPv6Address() { + return this.innerModel().endIPv6Address(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public IPv6FirewallRuleInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String firewallRuleName; + + public IPv6FirewallRuleImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public IPv6FirewallRule create() { + this.innerObject = + serviceManager + .serviceClient() + .getIPv6FirewallRules() + .createOrUpdateWithResponse( + resourceGroupName, serverName, firewallRuleName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public IPv6FirewallRule create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getIPv6FirewallRules() + .createOrUpdateWithResponse(resourceGroupName, serverName, firewallRuleName, this.innerModel(), context) + .getValue(); + return this; + } + + IPv6FirewallRuleImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new IPv6FirewallRuleInner(); + this.serviceManager = serviceManager; + this.firewallRuleName = name; + } + + public IPv6FirewallRuleImpl update() { + return this; + } + + public IPv6FirewallRule apply() { + this.innerObject = + serviceManager + .serviceClient() + .getIPv6FirewallRules() + .createOrUpdateWithResponse( + resourceGroupName, serverName, firewallRuleName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public IPv6FirewallRule apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getIPv6FirewallRules() + .createOrUpdateWithResponse(resourceGroupName, serverName, firewallRuleName, this.innerModel(), context) + .getValue(); + return this; + } + + IPv6FirewallRuleImpl( + IPv6FirewallRuleInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.firewallRuleName = Utils.getValueFromIdByName(innerObject.id(), "ipv6FirewallRules"); + } + + public IPv6FirewallRule refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getIPv6FirewallRules() + .getWithResponse(resourceGroupName, serverName, firewallRuleName, Context.NONE) + .getValue(); + return this; + } + + public IPv6FirewallRule refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getIPv6FirewallRules() + .getWithResponse(resourceGroupName, serverName, firewallRuleName, context) + .getValue(); + return this; + } + + public IPv6FirewallRuleImpl withName(String name) { + this.innerModel().withName(name); + return this; + } + + public IPv6FirewallRuleImpl withStartIPv6Address(String startIPv6Address) { + this.innerModel().withStartIPv6Address(startIPv6Address); + return this; + } + + public IPv6FirewallRuleImpl withEndIPv6Address(String endIPv6Address) { + this.innerModel().withEndIPv6Address(endIPv6Address); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/IPv6FirewallRulesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/IPv6FirewallRulesClientImpl.java new file mode 100644 index 0000000000000..524f6c752619b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/IPv6FirewallRulesClientImpl.java @@ -0,0 +1,915 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.IPv6FirewallRulesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.IPv6FirewallRuleInner; +import com.azure.resourcemanager.sql.generated.models.IPv6FirewallRuleListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in IPv6FirewallRulesClient. */ +public final class IPv6FirewallRulesClientImpl implements IPv6FirewallRulesClient { + /** The proxy service used to perform REST calls. */ + private final IPv6FirewallRulesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of IPv6FirewallRulesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + IPv6FirewallRulesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(IPv6FirewallRulesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientIPv6FirewallRules to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientI") + public interface IPv6FirewallRulesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/ipv6FirewallRules") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/ipv6FirewallRules/{firewallRuleName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("firewallRuleName") String firewallRuleName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/ipv6FirewallRules/{firewallRuleName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("firewallRuleName") String firewallRuleName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") IPv6FirewallRuleInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/ipv6FirewallRules/{firewallRuleName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("firewallRuleName") String firewallRuleName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a list of IPv6 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of IPv6 firewall rules along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of IPv6 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of IPv6 firewall rules along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of IPv6 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of IPv6 firewall rules as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of IPv6 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of IPv6 firewall rules as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of IPv6 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of IPv6 firewall rules as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * Gets a list of IPv6 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of IPv6 firewall rules as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } + + /** + * Gets an IPv6 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an IPv6 firewall rule along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String firewallRuleName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (firewallRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter firewallRuleName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + firewallRuleName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets an IPv6 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an IPv6 firewall rule along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String firewallRuleName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (firewallRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter firewallRuleName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + firewallRuleName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets an IPv6 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an IPv6 firewall rule on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serverName, String firewallRuleName) { + return getWithResponseAsync(resourceGroupName, serverName, firewallRuleName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets an IPv6 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an IPv6 firewall rule along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String firewallRuleName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, firewallRuleName, context).block(); + } + + /** + * Gets an IPv6 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an IPv6 firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public IPv6FirewallRuleInner get(String resourceGroupName, String serverName, String firewallRuleName) { + return getWithResponse(resourceGroupName, serverName, firewallRuleName, Context.NONE).getValue(); + } + + /** + * Creates or updates an IPv6 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 an IPv6 firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an IPv6 server firewall rule along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverName, String firewallRuleName, IPv6FirewallRuleInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (firewallRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter firewallRuleName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + firewallRuleName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates an IPv6 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 an IPv6 firewall rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an IPv6 server firewall rule along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String firewallRuleName, + IPv6FirewallRuleInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (firewallRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter firewallRuleName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + firewallRuleName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates an IPv6 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 an IPv6 firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an IPv6 server firewall rule on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serverName, String firewallRuleName, IPv6FirewallRuleInner parameters) { + return createOrUpdateWithResponseAsync(resourceGroupName, serverName, firewallRuleName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or updates an IPv6 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 an IPv6 firewall rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an IPv6 server firewall rule along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String firewallRuleName, + IPv6FirewallRuleInner parameters, + Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, serverName, firewallRuleName, parameters, context) + .block(); + } + + /** + * Creates or updates an IPv6 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 an IPv6 firewall rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an IPv6 server firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public IPv6FirewallRuleInner createOrUpdate( + String resourceGroupName, String serverName, String firewallRuleName, IPv6FirewallRuleInner parameters) { + return createOrUpdateWithResponse(resourceGroupName, serverName, firewallRuleName, parameters, Context.NONE) + .getValue(); + } + + /** + * Deletes an IPv6 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String serverName, String firewallRuleName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (firewallRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter firewallRuleName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + firewallRuleName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an IPv6 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String serverName, String firewallRuleName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (firewallRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter firewallRuleName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + firewallRuleName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes an IPv6 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String serverName, String firewallRuleName) { + return deleteWithResponseAsync(resourceGroupName, serverName, firewallRuleName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes an IPv6 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, String serverName, String firewallRuleName, Context context) { + return deleteWithResponseAsync(resourceGroupName, serverName, firewallRuleName, context).block(); + } + + /** + * Deletes an IPv6 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, String firewallRuleName) { + deleteWithResponse(resourceGroupName, serverName, firewallRuleName, Context.NONE); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list IPv6 firewall rules request along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByServerNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list IPv6 firewall rules request along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServerNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/IPv6FirewallRulesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/IPv6FirewallRulesImpl.java new file mode 100644 index 0000000000000..43143a2e32723 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/IPv6FirewallRulesImpl.java @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.IPv6FirewallRulesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.IPv6FirewallRuleInner; +import com.azure.resourcemanager.sql.generated.models.IPv6FirewallRule; +import com.azure.resourcemanager.sql.generated.models.IPv6FirewallRules; + +public final class IPv6FirewallRulesImpl implements IPv6FirewallRules { + private static final ClientLogger LOGGER = new ClientLogger(IPv6FirewallRulesImpl.class); + + private final IPv6FirewallRulesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public IPv6FirewallRulesImpl( + IPv6FirewallRulesClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new IPv6FirewallRuleImpl(inner1, this.manager())); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new IPv6FirewallRuleImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String firewallRuleName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, firewallRuleName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new IPv6FirewallRuleImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public IPv6FirewallRule get(String resourceGroupName, String serverName, String firewallRuleName) { + IPv6FirewallRuleInner inner = this.serviceClient().get(resourceGroupName, serverName, firewallRuleName); + if (inner != null) { + return new IPv6FirewallRuleImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse( + String resourceGroupName, String serverName, String firewallRuleName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, serverName, firewallRuleName, context); + } + + public void delete(String resourceGroupName, String serverName, String firewallRuleName) { + this.serviceClient().delete(resourceGroupName, serverName, firewallRuleName); + } + + public IPv6FirewallRule getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String firewallRuleName = Utils.getValueFromIdByName(id, "ipv6FirewallRules"); + if (firewallRuleName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'ipv6FirewallRules'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, firewallRuleName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String firewallRuleName = Utils.getValueFromIdByName(id, "ipv6FirewallRules"); + if (firewallRuleName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'ipv6FirewallRules'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, firewallRuleName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String firewallRuleName = Utils.getValueFromIdByName(id, "ipv6FirewallRules"); + if (firewallRuleName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'ipv6FirewallRules'.", id))); + } + this.deleteWithResponse(resourceGroupName, serverName, firewallRuleName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String firewallRuleName = Utils.getValueFromIdByName(id, "ipv6FirewallRules"); + if (firewallRuleName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'ipv6FirewallRules'.", id))); + } + return this.deleteWithResponse(resourceGroupName, serverName, firewallRuleName, context); + } + + private IPv6FirewallRulesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public IPv6FirewallRuleImpl define(String name) { + return new IPv6FirewallRuleImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ImportExportExtensionsOperationResultImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ImportExportExtensionsOperationResultImpl.java new file mode 100644 index 0000000000000..0f75184996524 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ImportExportExtensionsOperationResultImpl.java @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ImportExportExtensionsOperationResultInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseExtensions; +import com.azure.resourcemanager.sql.generated.models.ImportExportExtensionsOperationResult; +import com.azure.resourcemanager.sql.generated.models.OperationMode; +import com.azure.resourcemanager.sql.generated.models.StorageKeyType; +import java.util.UUID; + +public final class ImportExportExtensionsOperationResultImpl + implements ImportExportExtensionsOperationResult, + ImportExportExtensionsOperationResult.Definition, + ImportExportExtensionsOperationResult.Update { + private ImportExportExtensionsOperationResultInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public UUID requestId() { + return this.innerModel().requestId(); + } + + public String requestType() { + return this.innerModel().requestType(); + } + + public String lastModifiedTime() { + return this.innerModel().lastModifiedTime(); + } + + public String serverName() { + return this.innerModel().serverName(); + } + + public String databaseName() { + return this.innerModel().databaseName(); + } + + public String status() { + return this.innerModel().status(); + } + + public String errorMessage() { + return this.innerModel().errorMessage(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ImportExportExtensionsOperationResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String databaseName; + + private String extensionName; + + private DatabaseExtensions createParameters; + + private DatabaseExtensions updateParameters; + + public ImportExportExtensionsOperationResultImpl withExistingDatabase( + String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + + public ImportExportExtensionsOperationResult create() { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseExtensionsOperations() + .createOrUpdate( + resourceGroupName, serverName, databaseName, extensionName, createParameters, Context.NONE); + return this; + } + + public ImportExportExtensionsOperationResult create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseExtensionsOperations() + .createOrUpdate(resourceGroupName, serverName, databaseName, extensionName, createParameters, context); + return this; + } + + ImportExportExtensionsOperationResultImpl( + String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ImportExportExtensionsOperationResultInner(); + this.serviceManager = serviceManager; + this.extensionName = name; + this.createParameters = new DatabaseExtensions(); + } + + public ImportExportExtensionsOperationResultImpl update() { + this.updateParameters = new DatabaseExtensions(); + return this; + } + + public ImportExportExtensionsOperationResult apply() { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseExtensionsOperations() + .createOrUpdate( + resourceGroupName, serverName, databaseName, extensionName, updateParameters, Context.NONE); + return this; + } + + public ImportExportExtensionsOperationResult apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabaseExtensionsOperations() + .createOrUpdate(resourceGroupName, serverName, databaseName, extensionName, updateParameters, context); + return this; + } + + ImportExportExtensionsOperationResultImpl( + ImportExportExtensionsOperationResultInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "databases"); + this.extensionName = Utils.getValueFromIdByName(innerObject.id(), "extensions"); + } + + public ImportExportExtensionsOperationResultImpl withOperationMode(OperationMode operationMode) { + this.createParameters.withOperationMode(operationMode); + return this; + } + + public ImportExportExtensionsOperationResultImpl withStorageKeyType(StorageKeyType storageKeyType) { + this.createParameters.withStorageKeyType(storageKeyType); + return this; + } + + public ImportExportExtensionsOperationResultImpl withStorageKey(String storageKey) { + this.createParameters.withStorageKey(storageKey); + return this; + } + + public ImportExportExtensionsOperationResultImpl withStorageUri(String storageUri) { + this.createParameters.withStorageUri(storageUri); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ImportExportOperationResultImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ImportExportOperationResultImpl.java new file mode 100644 index 0000000000000..5e0a99c810d7d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ImportExportOperationResultImpl.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.ImportExportOperationResultInner; +import com.azure.resourcemanager.sql.generated.models.ImportExportOperationResult; +import com.azure.resourcemanager.sql.generated.models.PrivateEndpointConnectionRequestStatus; +import java.util.Collections; +import java.util.List; +import java.util.UUID; + +public final class ImportExportOperationResultImpl implements ImportExportOperationResult { + private ImportExportOperationResultInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + ImportExportOperationResultImpl( + ImportExportOperationResultInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public UUID requestId() { + return this.innerModel().requestId(); + } + + public String requestType() { + return this.innerModel().requestType(); + } + + public String queuedTime() { + return this.innerModel().queuedTime(); + } + + public String lastModifiedTime() { + return this.innerModel().lastModifiedTime(); + } + + public String blobUri() { + return this.innerModel().blobUri(); + } + + public String serverName() { + return this.innerModel().serverName(); + } + + public String databaseName() { + return this.innerModel().databaseName(); + } + + public String status() { + return this.innerModel().status(); + } + + public String errorMessage() { + return this.innerModel().errorMessage(); + } + + public List privateEndpointConnections() { + List inner = this.innerModel().privateEndpointConnections(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ImportExportOperationResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/InstanceFailoverGroupImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/InstanceFailoverGroupImpl.java new file mode 100644 index 0000000000000..7e1594b7348d8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/InstanceFailoverGroupImpl.java @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.InstanceFailoverGroupInner; +import com.azure.resourcemanager.sql.generated.models.InstanceFailoverGroup; +import com.azure.resourcemanager.sql.generated.models.InstanceFailoverGroupReadOnlyEndpoint; +import com.azure.resourcemanager.sql.generated.models.InstanceFailoverGroupReadWriteEndpoint; +import com.azure.resourcemanager.sql.generated.models.InstanceFailoverGroupReplicationRole; +import com.azure.resourcemanager.sql.generated.models.ManagedInstancePairInfo; +import com.azure.resourcemanager.sql.generated.models.PartnerRegionInfo; +import java.util.Collections; +import java.util.List; + +public final class InstanceFailoverGroupImpl + implements InstanceFailoverGroup, InstanceFailoverGroup.Definition, InstanceFailoverGroup.Update { + private InstanceFailoverGroupInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public InstanceFailoverGroupReadWriteEndpoint readWriteEndpoint() { + return this.innerModel().readWriteEndpoint(); + } + + public InstanceFailoverGroupReadOnlyEndpoint readOnlyEndpoint() { + return this.innerModel().readOnlyEndpoint(); + } + + public InstanceFailoverGroupReplicationRole replicationRole() { + return this.innerModel().replicationRole(); + } + + public String replicationState() { + return this.innerModel().replicationState(); + } + + public List partnerRegions() { + List inner = this.innerModel().partnerRegions(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List managedInstancePairs() { + List inner = this.innerModel().managedInstancePairs(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public InstanceFailoverGroupInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String locationName; + + private String failoverGroupName; + + public InstanceFailoverGroupImpl withExistingLocation(String resourceGroupName, String locationName) { + this.resourceGroupName = resourceGroupName; + this.locationName = locationName; + return this; + } + + public InstanceFailoverGroup create() { + this.innerObject = + serviceManager + .serviceClient() + .getInstanceFailoverGroups() + .createOrUpdate(resourceGroupName, locationName, failoverGroupName, this.innerModel(), Context.NONE); + return this; + } + + public InstanceFailoverGroup create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getInstanceFailoverGroups() + .createOrUpdate(resourceGroupName, locationName, failoverGroupName, this.innerModel(), context); + return this; + } + + InstanceFailoverGroupImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new InstanceFailoverGroupInner(); + this.serviceManager = serviceManager; + this.failoverGroupName = name; + } + + public InstanceFailoverGroupImpl update() { + return this; + } + + public InstanceFailoverGroup apply() { + this.innerObject = + serviceManager + .serviceClient() + .getInstanceFailoverGroups() + .createOrUpdate(resourceGroupName, locationName, failoverGroupName, this.innerModel(), Context.NONE); + return this; + } + + public InstanceFailoverGroup apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getInstanceFailoverGroups() + .createOrUpdate(resourceGroupName, locationName, failoverGroupName, this.innerModel(), context); + return this; + } + + InstanceFailoverGroupImpl( + InstanceFailoverGroupInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.locationName = Utils.getValueFromIdByName(innerObject.id(), "locations"); + this.failoverGroupName = Utils.getValueFromIdByName(innerObject.id(), "instanceFailoverGroups"); + } + + public InstanceFailoverGroup refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getInstanceFailoverGroups() + .getWithResponse(resourceGroupName, locationName, failoverGroupName, Context.NONE) + .getValue(); + return this; + } + + public InstanceFailoverGroup refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getInstanceFailoverGroups() + .getWithResponse(resourceGroupName, locationName, failoverGroupName, context) + .getValue(); + return this; + } + + public InstanceFailoverGroup failover() { + return serviceManager.instanceFailoverGroups().failover(resourceGroupName, locationName, failoverGroupName); + } + + public InstanceFailoverGroup failover(Context context) { + return serviceManager + .instanceFailoverGroups() + .failover(resourceGroupName, locationName, failoverGroupName, context); + } + + public InstanceFailoverGroup forceFailoverAllowDataLoss() { + return serviceManager + .instanceFailoverGroups() + .forceFailoverAllowDataLoss(resourceGroupName, locationName, failoverGroupName); + } + + public InstanceFailoverGroup forceFailoverAllowDataLoss(Context context) { + return serviceManager + .instanceFailoverGroups() + .forceFailoverAllowDataLoss(resourceGroupName, locationName, failoverGroupName, context); + } + + public InstanceFailoverGroupImpl withReadWriteEndpoint(InstanceFailoverGroupReadWriteEndpoint readWriteEndpoint) { + this.innerModel().withReadWriteEndpoint(readWriteEndpoint); + return this; + } + + public InstanceFailoverGroupImpl withReadOnlyEndpoint(InstanceFailoverGroupReadOnlyEndpoint readOnlyEndpoint) { + this.innerModel().withReadOnlyEndpoint(readOnlyEndpoint); + return this; + } + + public InstanceFailoverGroupImpl withPartnerRegions(List partnerRegions) { + this.innerModel().withPartnerRegions(partnerRegions); + return this; + } + + public InstanceFailoverGroupImpl withManagedInstancePairs(List managedInstancePairs) { + this.innerModel().withManagedInstancePairs(managedInstancePairs); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/InstanceFailoverGroupsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/InstanceFailoverGroupsClientImpl.java new file mode 100644 index 0000000000000..35d8c5ef39d83 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/InstanceFailoverGroupsClientImpl.java @@ -0,0 +1,1782 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.InstanceFailoverGroupsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.InstanceFailoverGroupInner; +import com.azure.resourcemanager.sql.generated.models.InstanceFailoverGroupListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in InstanceFailoverGroupsClient. */ +public final class InstanceFailoverGroupsClientImpl implements InstanceFailoverGroupsClient { + /** The proxy service used to perform REST calls. */ + private final InstanceFailoverGroupsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of InstanceFailoverGroupsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + InstanceFailoverGroupsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create(InstanceFailoverGroupsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientInstanceFailoverGroups to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientI") + public interface InstanceFailoverGroupsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations" + + "/{locationName}/instanceFailoverGroups/{failoverGroupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("locationName") String locationName, + @PathParam("failoverGroupName") String failoverGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations" + + "/{locationName}/instanceFailoverGroups/{failoverGroupName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("locationName") String locationName, + @PathParam("failoverGroupName") String failoverGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") InstanceFailoverGroupInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations" + + "/{locationName}/instanceFailoverGroups/{failoverGroupName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("locationName") String locationName, + @PathParam("failoverGroupName") String failoverGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations" + + "/{locationName}/instanceFailoverGroups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByLocation( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("locationName") String locationName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations" + + "/{locationName}/instanceFailoverGroups/{failoverGroupName}/failover") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> failover( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("locationName") String locationName, + @PathParam("failoverGroupName") String failoverGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations" + + "/{locationName}/instanceFailoverGroups/{failoverGroupName}/forceFailoverAllowDataLoss") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> forceFailoverAllowDataLoss( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("locationName") String locationName, + @PathParam("failoverGroupName") String failoverGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByLocationNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String locationName, String failoverGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (failoverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + locationName, + failoverGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String locationName, String failoverGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (failoverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + locationName, + failoverGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String locationName, String failoverGroupName) { + return getWithResponseAsync(resourceGroupName, locationName, failoverGroupName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String locationName, String failoverGroupName, Context context) { + return getWithResponseAsync(resourceGroupName, locationName, failoverGroupName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public InstanceFailoverGroupInner get(String resourceGroupName, String locationName, String failoverGroupName) { + return getWithResponse(resourceGroupName, locationName, failoverGroupName, Context.NONE).getValue(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String locationName, + String failoverGroupName, + InstanceFailoverGroupInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (failoverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + locationName, + failoverGroupName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String locationName, + String failoverGroupName, + InstanceFailoverGroupInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (failoverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + locationName, + failoverGroupName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an instance failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, InstanceFailoverGroupInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String locationName, + String failoverGroupName, + InstanceFailoverGroupInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, locationName, failoverGroupName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + InstanceFailoverGroupInner.class, + InstanceFailoverGroupInner.class, + this.client.getContext()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an instance failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, InstanceFailoverGroupInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String locationName, + String failoverGroupName, + InstanceFailoverGroupInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, locationName, failoverGroupName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + InstanceFailoverGroupInner.class, + InstanceFailoverGroupInner.class, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an instance failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, InstanceFailoverGroupInner> beginCreateOrUpdate( + String resourceGroupName, + String locationName, + String failoverGroupName, + InstanceFailoverGroupInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, locationName, failoverGroupName, parameters).getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an instance failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, InstanceFailoverGroupInner> beginCreateOrUpdate( + String resourceGroupName, + String locationName, + String failoverGroupName, + InstanceFailoverGroupInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, locationName, failoverGroupName, parameters, context) + .getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String locationName, + String failoverGroupName, + InstanceFailoverGroupInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, locationName, failoverGroupName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String locationName, + String failoverGroupName, + InstanceFailoverGroupInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, locationName, failoverGroupName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public InstanceFailoverGroupInner createOrUpdate( + String resourceGroupName, + String locationName, + String failoverGroupName, + InstanceFailoverGroupInner parameters) { + return createOrUpdateAsync(resourceGroupName, locationName, failoverGroupName, parameters).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public InstanceFailoverGroupInner createOrUpdate( + String resourceGroupName, + String locationName, + String failoverGroupName, + InstanceFailoverGroupInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, locationName, failoverGroupName, parameters, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String locationName, String failoverGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (failoverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + locationName, + failoverGroupName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String locationName, String failoverGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (failoverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + locationName, + failoverGroupName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String locationName, String failoverGroupName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, locationName, failoverGroupName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String locationName, String failoverGroupName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, locationName, failoverGroupName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String locationName, String failoverGroupName) { + return beginDeleteAsync(resourceGroupName, locationName, failoverGroupName).getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String locationName, String failoverGroupName, Context context) { + return beginDeleteAsync(resourceGroupName, locationName, failoverGroupName, context).getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String locationName, String failoverGroupName) { + return beginDeleteAsync(resourceGroupName, locationName, failoverGroupName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String locationName, String failoverGroupName, Context context) { + return beginDeleteAsync(resourceGroupName, locationName, failoverGroupName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String locationName, String failoverGroupName) { + deleteAsync(resourceGroupName, locationName, failoverGroupName).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String locationName, String failoverGroupName, Context context) { + deleteAsync(resourceGroupName, locationName, failoverGroupName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of instance failover groups along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationSinglePageAsync( + String resourceGroupName, String locationName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByLocation( + this.client.getEndpoint(), + resourceGroupName, + locationName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of instance failover groups along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationSinglePageAsync( + String resourceGroupName, String locationName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByLocation( + this.client.getEndpoint(), + resourceGroupName, + locationName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of instance failover groups as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByLocationAsync(String resourceGroupName, String locationName) { + return new PagedFlux<>( + () -> listByLocationSinglePageAsync(resourceGroupName, locationName), + nextLink -> listByLocationNextSinglePageAsync(nextLink)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of instance failover groups as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByLocationAsync( + String resourceGroupName, String locationName, Context context) { + return new PagedFlux<>( + () -> listByLocationSinglePageAsync(resourceGroupName, locationName, context), + nextLink -> listByLocationNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of instance failover groups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByLocation(String resourceGroupName, String locationName) { + return new PagedIterable<>(listByLocationAsync(resourceGroupName, locationName)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of instance failover groups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByLocation( + String resourceGroupName, String locationName, Context context) { + return new PagedIterable<>(listByLocationAsync(resourceGroupName, locationName, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> failoverWithResponseAsync( + String resourceGroupName, String locationName, String failoverGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (failoverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .failover( + this.client.getEndpoint(), + resourceGroupName, + locationName, + failoverGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> failoverWithResponseAsync( + String resourceGroupName, String locationName, String failoverGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (failoverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .failover( + this.client.getEndpoint(), + resourceGroupName, + locationName, + failoverGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an instance failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, InstanceFailoverGroupInner> beginFailoverAsync( + String resourceGroupName, String locationName, String failoverGroupName) { + Mono>> mono = + failoverWithResponseAsync(resourceGroupName, locationName, failoverGroupName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + InstanceFailoverGroupInner.class, + InstanceFailoverGroupInner.class, + this.client.getContext()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an instance failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, InstanceFailoverGroupInner> beginFailoverAsync( + String resourceGroupName, String locationName, String failoverGroupName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + failoverWithResponseAsync(resourceGroupName, locationName, failoverGroupName, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + InstanceFailoverGroupInner.class, + InstanceFailoverGroupInner.class, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an instance failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, InstanceFailoverGroupInner> beginFailover( + String resourceGroupName, String locationName, String failoverGroupName) { + return beginFailoverAsync(resourceGroupName, locationName, failoverGroupName).getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an instance failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, InstanceFailoverGroupInner> beginFailover( + String resourceGroupName, String locationName, String failoverGroupName, Context context) { + return beginFailoverAsync(resourceGroupName, locationName, failoverGroupName, context).getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono failoverAsync( + String resourceGroupName, String locationName, String failoverGroupName) { + return beginFailoverAsync(resourceGroupName, locationName, failoverGroupName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono failoverAsync( + String resourceGroupName, String locationName, String failoverGroupName, Context context) { + return beginFailoverAsync(resourceGroupName, locationName, failoverGroupName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public InstanceFailoverGroupInner failover( + String resourceGroupName, String locationName, String failoverGroupName) { + return failoverAsync(resourceGroupName, locationName, failoverGroupName).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public InstanceFailoverGroupInner failover( + String resourceGroupName, String locationName, String failoverGroupName, Context context) { + return failoverAsync(resourceGroupName, locationName, failoverGroupName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> forceFailoverAllowDataLossWithResponseAsync( + String resourceGroupName, String locationName, String failoverGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (failoverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .forceFailoverAllowDataLoss( + this.client.getEndpoint(), + resourceGroupName, + locationName, + failoverGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> forceFailoverAllowDataLossWithResponseAsync( + String resourceGroupName, String locationName, String failoverGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (failoverGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter failoverGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .forceFailoverAllowDataLoss( + this.client.getEndpoint(), + resourceGroupName, + locationName, + failoverGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an instance failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, InstanceFailoverGroupInner> + beginForceFailoverAllowDataLossAsync(String resourceGroupName, String locationName, String failoverGroupName) { + Mono>> mono = + forceFailoverAllowDataLossWithResponseAsync(resourceGroupName, locationName, failoverGroupName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + InstanceFailoverGroupInner.class, + InstanceFailoverGroupInner.class, + this.client.getContext()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an instance failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, InstanceFailoverGroupInner> + beginForceFailoverAllowDataLossAsync( + String resourceGroupName, String locationName, String failoverGroupName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + forceFailoverAllowDataLossWithResponseAsync(resourceGroupName, locationName, failoverGroupName, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + InstanceFailoverGroupInner.class, + InstanceFailoverGroupInner.class, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an instance failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, InstanceFailoverGroupInner> + beginForceFailoverAllowDataLoss(String resourceGroupName, String locationName, String failoverGroupName) { + return beginForceFailoverAllowDataLossAsync(resourceGroupName, locationName, failoverGroupName).getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an instance failover group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, InstanceFailoverGroupInner> + beginForceFailoverAllowDataLoss( + String resourceGroupName, String locationName, String failoverGroupName, Context context) { + return beginForceFailoverAllowDataLossAsync(resourceGroupName, locationName, failoverGroupName, context) + .getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono forceFailoverAllowDataLossAsync( + String resourceGroupName, String locationName, String failoverGroupName) { + return beginForceFailoverAllowDataLossAsync(resourceGroupName, locationName, failoverGroupName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono forceFailoverAllowDataLossAsync( + String resourceGroupName, String locationName, String failoverGroupName, Context context) { + return beginForceFailoverAllowDataLossAsync(resourceGroupName, locationName, failoverGroupName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public InstanceFailoverGroupInner forceFailoverAllowDataLoss( + String resourceGroupName, String locationName, String failoverGroupName) { + return forceFailoverAllowDataLossAsync(resourceGroupName, locationName, failoverGroupName).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public InstanceFailoverGroupInner forceFailoverAllowDataLoss( + String resourceGroupName, String locationName, String failoverGroupName, Context context) { + return forceFailoverAllowDataLossAsync(resourceGroupName, locationName, failoverGroupName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of instance failover groups along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByLocationNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of instance failover groups along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByLocationNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/InstanceFailoverGroupsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/InstanceFailoverGroupsImpl.java new file mode 100644 index 0000000000000..b459387cf1a9b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/InstanceFailoverGroupsImpl.java @@ -0,0 +1,247 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.InstanceFailoverGroupsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.InstanceFailoverGroupInner; +import com.azure.resourcemanager.sql.generated.models.InstanceFailoverGroup; +import com.azure.resourcemanager.sql.generated.models.InstanceFailoverGroups; + +public final class InstanceFailoverGroupsImpl implements InstanceFailoverGroups { + private static final ClientLogger LOGGER = new ClientLogger(InstanceFailoverGroupsImpl.class); + + private final InstanceFailoverGroupsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public InstanceFailoverGroupsImpl( + InstanceFailoverGroupsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String resourceGroupName, String locationName, String failoverGroupName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, locationName, failoverGroupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new InstanceFailoverGroupImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public InstanceFailoverGroup get(String resourceGroupName, String locationName, String failoverGroupName) { + InstanceFailoverGroupInner inner = this.serviceClient().get(resourceGroupName, locationName, failoverGroupName); + if (inner != null) { + return new InstanceFailoverGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String locationName, String failoverGroupName) { + this.serviceClient().delete(resourceGroupName, locationName, failoverGroupName); + } + + public void delete(String resourceGroupName, String locationName, String failoverGroupName, Context context) { + this.serviceClient().delete(resourceGroupName, locationName, failoverGroupName, context); + } + + public PagedIterable listByLocation(String resourceGroupName, String locationName) { + PagedIterable inner = + this.serviceClient().listByLocation(resourceGroupName, locationName); + return Utils.mapPage(inner, inner1 -> new InstanceFailoverGroupImpl(inner1, this.manager())); + } + + public PagedIterable listByLocation( + String resourceGroupName, String locationName, Context context) { + PagedIterable inner = + this.serviceClient().listByLocation(resourceGroupName, locationName, context); + return Utils.mapPage(inner, inner1 -> new InstanceFailoverGroupImpl(inner1, this.manager())); + } + + public InstanceFailoverGroup failover(String resourceGroupName, String locationName, String failoverGroupName) { + InstanceFailoverGroupInner inner = + this.serviceClient().failover(resourceGroupName, locationName, failoverGroupName); + if (inner != null) { + return new InstanceFailoverGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public InstanceFailoverGroup failover( + String resourceGroupName, String locationName, String failoverGroupName, Context context) { + InstanceFailoverGroupInner inner = + this.serviceClient().failover(resourceGroupName, locationName, failoverGroupName, context); + if (inner != null) { + return new InstanceFailoverGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public InstanceFailoverGroup forceFailoverAllowDataLoss( + String resourceGroupName, String locationName, String failoverGroupName) { + InstanceFailoverGroupInner inner = + this.serviceClient().forceFailoverAllowDataLoss(resourceGroupName, locationName, failoverGroupName); + if (inner != null) { + return new InstanceFailoverGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public InstanceFailoverGroup forceFailoverAllowDataLoss( + String resourceGroupName, String locationName, String failoverGroupName, Context context) { + InstanceFailoverGroupInner inner = + this + .serviceClient() + .forceFailoverAllowDataLoss(resourceGroupName, locationName, failoverGroupName, context); + if (inner != null) { + return new InstanceFailoverGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public InstanceFailoverGroup getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String locationName = Utils.getValueFromIdByName(id, "locations"); + if (locationName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'locations'.", id))); + } + String failoverGroupName = Utils.getValueFromIdByName(id, "instanceFailoverGroups"); + if (failoverGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'instanceFailoverGroups'.", + id))); + } + return this.getWithResponse(resourceGroupName, locationName, failoverGroupName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String locationName = Utils.getValueFromIdByName(id, "locations"); + if (locationName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'locations'.", id))); + } + String failoverGroupName = Utils.getValueFromIdByName(id, "instanceFailoverGroups"); + if (failoverGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'instanceFailoverGroups'.", + id))); + } + return this.getWithResponse(resourceGroupName, locationName, failoverGroupName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String locationName = Utils.getValueFromIdByName(id, "locations"); + if (locationName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'locations'.", id))); + } + String failoverGroupName = Utils.getValueFromIdByName(id, "instanceFailoverGroups"); + if (failoverGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'instanceFailoverGroups'.", + id))); + } + this.delete(resourceGroupName, locationName, failoverGroupName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String locationName = Utils.getValueFromIdByName(id, "locations"); + if (locationName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'locations'.", id))); + } + String failoverGroupName = Utils.getValueFromIdByName(id, "instanceFailoverGroups"); + if (failoverGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'instanceFailoverGroups'.", + id))); + } + this.delete(resourceGroupName, locationName, failoverGroupName, context); + } + + private InstanceFailoverGroupsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public InstanceFailoverGroupImpl define(String name) { + return new InstanceFailoverGroupImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/InstancePoolImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/InstancePoolImpl.java new file mode 100644 index 0000000000000..6d093b2a34d6a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/InstancePoolImpl.java @@ -0,0 +1,211 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.InstancePoolInner; +import com.azure.resourcemanager.sql.generated.models.InstancePool; +import com.azure.resourcemanager.sql.generated.models.InstancePoolLicenseType; +import com.azure.resourcemanager.sql.generated.models.InstancePoolUpdate; +import com.azure.resourcemanager.sql.generated.models.Sku; +import java.util.Collections; +import java.util.Map; + +public final class InstancePoolImpl implements InstancePool, InstancePool.Definition, InstancePool.Update { + private InstancePoolInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public Sku sku() { + return this.innerModel().sku(); + } + + public String subnetId() { + return this.innerModel().subnetId(); + } + + public int vCores() { + return this.innerModel().vCores(); + } + + public InstancePoolLicenseType licenseType() { + return this.innerModel().licenseType(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public InstancePoolInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String instancePoolName; + + private InstancePoolUpdate updateParameters; + + public InstancePoolImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public InstancePool create() { + this.innerObject = + serviceManager + .serviceClient() + .getInstancePools() + .createOrUpdate(resourceGroupName, instancePoolName, this.innerModel(), Context.NONE); + return this; + } + + public InstancePool create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getInstancePools() + .createOrUpdate(resourceGroupName, instancePoolName, this.innerModel(), context); + return this; + } + + InstancePoolImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new InstancePoolInner(); + this.serviceManager = serviceManager; + this.instancePoolName = name; + } + + public InstancePoolImpl update() { + this.updateParameters = new InstancePoolUpdate(); + return this; + } + + public InstancePool apply() { + this.innerObject = + serviceManager + .serviceClient() + .getInstancePools() + .update(resourceGroupName, instancePoolName, updateParameters, Context.NONE); + return this; + } + + public InstancePool apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getInstancePools() + .update(resourceGroupName, instancePoolName, updateParameters, context); + return this; + } + + InstancePoolImpl(InstancePoolInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.instancePoolName = Utils.getValueFromIdByName(innerObject.id(), "instancePools"); + } + + public InstancePool refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getInstancePools() + .getByResourceGroupWithResponse(resourceGroupName, instancePoolName, Context.NONE) + .getValue(); + return this; + } + + public InstancePool refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getInstancePools() + .getByResourceGroupWithResponse(resourceGroupName, instancePoolName, context) + .getValue(); + return this; + } + + public InstancePoolImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public InstancePoolImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public InstancePoolImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public InstancePoolImpl withSku(Sku sku) { + this.innerModel().withSku(sku); + return this; + } + + public InstancePoolImpl withSubnetId(String subnetId) { + this.innerModel().withSubnetId(subnetId); + return this; + } + + public InstancePoolImpl withVCores(int vCores) { + this.innerModel().withVCores(vCores); + return this; + } + + public InstancePoolImpl withLicenseType(InstancePoolLicenseType licenseType) { + this.innerModel().withLicenseType(licenseType); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/InstancePoolsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/InstancePoolsClientImpl.java new file mode 100644 index 0000000000000..862c9dbe35311 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/InstancePoolsClientImpl.java @@ -0,0 +1,1584 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.InstancePoolsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.InstancePoolInner; +import com.azure.resourcemanager.sql.generated.models.InstancePoolListResult; +import com.azure.resourcemanager.sql.generated.models.InstancePoolUpdate; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in InstancePoolsClient. */ +public final class InstancePoolsClientImpl implements InstancePoolsClient { + /** The proxy service used to perform REST calls. */ + private final InstancePoolsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of InstancePoolsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + InstancePoolsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(InstancePoolsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientInstancePools to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientI") + public interface InstancePoolsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools" + + "/{instancePoolName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("instancePoolName") String instancePoolName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools" + + "/{instancePoolName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("instancePoolName") String instancePoolName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") InstancePoolInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools" + + "/{instancePoolName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("instancePoolName") String instancePoolName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools" + + "/{instancePoolName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("instancePoolName") String instancePoolName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") InstancePoolUpdate parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/instancePools") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance pool along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String instancePoolName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (instancePoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter instancePoolName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + instancePoolName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance pool along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String instancePoolName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (instancePoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter instancePoolName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + instancePoolName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance pool on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String instancePoolName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, instancePoolName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance pool along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String instancePoolName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, instancePoolName, context).block(); + } + + /** + * Gets an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public InstancePoolInner getByResourceGroup(String resourceGroupName, String instancePoolName) { + return getByResourceGroupWithResponse(resourceGroupName, instancePoolName, Context.NONE).getValue(); + } + + /** + * Creates or updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be created or updated. + * @param parameters The requested instance pool resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL instance pool along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String instancePoolName, InstancePoolInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (instancePoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter instancePoolName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + instancePoolName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be created or updated. + * @param parameters The requested instance pool resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL instance pool along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String instancePoolName, InstancePoolInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (instancePoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter instancePoolName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + instancePoolName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be created or updated. + * @param parameters The requested instance pool resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, InstancePoolInner> beginCreateOrUpdateAsync( + String resourceGroupName, String instancePoolName, InstancePoolInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, instancePoolName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + InstancePoolInner.class, + InstancePoolInner.class, + this.client.getContext()); + } + + /** + * Creates or updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be created or updated. + * @param parameters The requested instance pool resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, InstancePoolInner> beginCreateOrUpdateAsync( + String resourceGroupName, String instancePoolName, InstancePoolInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, instancePoolName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), InstancePoolInner.class, InstancePoolInner.class, context); + } + + /** + * Creates or updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be created or updated. + * @param parameters The requested instance pool resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, InstancePoolInner> beginCreateOrUpdate( + String resourceGroupName, String instancePoolName, InstancePoolInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, instancePoolName, parameters).getSyncPoller(); + } + + /** + * Creates or updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be created or updated. + * @param parameters The requested instance pool resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, InstancePoolInner> beginCreateOrUpdate( + String resourceGroupName, String instancePoolName, InstancePoolInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, instancePoolName, parameters, context).getSyncPoller(); + } + + /** + * Creates or updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be created or updated. + * @param parameters The requested instance pool resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL instance pool on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String instancePoolName, InstancePoolInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, instancePoolName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be created or updated. + * @param parameters The requested instance pool resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL instance pool on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String instancePoolName, InstancePoolInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, instancePoolName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be created or updated. + * @param parameters The requested instance pool resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public InstancePoolInner createOrUpdate( + String resourceGroupName, String instancePoolName, InstancePoolInner parameters) { + return createOrUpdateAsync(resourceGroupName, instancePoolName, parameters).block(); + } + + /** + * Creates or updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be created or updated. + * @param parameters The requested instance pool resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public InstancePoolInner createOrUpdate( + String resourceGroupName, String instancePoolName, InstancePoolInner parameters, Context context) { + return createOrUpdateAsync(resourceGroupName, instancePoolName, parameters, context).block(); + } + + /** + * Deletes an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String instancePoolName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (instancePoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter instancePoolName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + instancePoolName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String instancePoolName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (instancePoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter instancePoolName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + instancePoolName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String instancePoolName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, instancePoolName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String instancePoolName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, instancePoolName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String instancePoolName) { + return beginDeleteAsync(resourceGroupName, instancePoolName).getSyncPoller(); + } + + /** + * Deletes an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String instancePoolName, Context context) { + return beginDeleteAsync(resourceGroupName, instancePoolName, context).getSyncPoller(); + } + + /** + * Deletes an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String instancePoolName) { + return beginDeleteAsync(resourceGroupName, instancePoolName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String instancePoolName, Context context) { + return beginDeleteAsync(resourceGroupName, instancePoolName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String instancePoolName) { + deleteAsync(resourceGroupName, instancePoolName).block(); + } + + /** + * Deletes an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String instancePoolName, Context context) { + deleteAsync(resourceGroupName, instancePoolName, context).block(); + } + + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @param parameters The requested instance pool resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL instance pool along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String instancePoolName, InstancePoolUpdate parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (instancePoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter instancePoolName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + instancePoolName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @param parameters The requested instance pool resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL instance pool along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String instancePoolName, InstancePoolUpdate parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (instancePoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter instancePoolName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + instancePoolName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @param parameters The requested instance pool resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, InstancePoolInner> beginUpdateAsync( + String resourceGroupName, String instancePoolName, InstancePoolUpdate parameters) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, instancePoolName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + InstancePoolInner.class, + InstancePoolInner.class, + this.client.getContext()); + } + + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @param parameters The requested instance pool resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, InstancePoolInner> beginUpdateAsync( + String resourceGroupName, String instancePoolName, InstancePoolUpdate parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, instancePoolName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), InstancePoolInner.class, InstancePoolInner.class, context); + } + + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @param parameters The requested instance pool resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, InstancePoolInner> beginUpdate( + String resourceGroupName, String instancePoolName, InstancePoolUpdate parameters) { + return beginUpdateAsync(resourceGroupName, instancePoolName, parameters).getSyncPoller(); + } + + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @param parameters The requested instance pool resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, InstancePoolInner> beginUpdate( + String resourceGroupName, String instancePoolName, InstancePoolUpdate parameters, Context context) { + return beginUpdateAsync(resourceGroupName, instancePoolName, parameters, context).getSyncPoller(); + } + + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @param parameters The requested instance pool resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL instance pool on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String instancePoolName, InstancePoolUpdate parameters) { + return beginUpdateAsync(resourceGroupName, instancePoolName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @param parameters The requested instance pool resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL instance pool on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String instancePoolName, InstancePoolUpdate parameters, Context context) { + return beginUpdateAsync(resourceGroupName, instancePoolName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @param parameters The requested instance pool resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public InstancePoolInner update(String resourceGroupName, String instancePoolName, InstancePoolUpdate parameters) { + return updateAsync(resourceGroupName, instancePoolName, parameters).block(); + } + + /** + * Updates an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be updated. + * @param parameters The requested instance pool resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL instance pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public InstancePoolInner update( + String resourceGroupName, String instancePoolName, InstancePoolUpdate parameters, Context context) { + return updateAsync(resourceGroupName, instancePoolName, parameters, context).block(); + } + + /** + * Gets a list of instance pools in the resource group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of instance pools in the resource group along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of instance pools in the resource group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of instance pools in the resource group along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of instance pools in the resource group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of instance pools in the resource group as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of instance pools in the resource group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of instance pools in the resource group as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of instance pools in the resource group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of instance pools in the resource group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Gets a list of instance pools in the resource group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of instance pools in the resource group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Gets a list of all instance pools in the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all instance pools in the subscription along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of all instance pools in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all instance pools in the subscription along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of all instance pools in the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all instance pools in the subscription as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of all instance pools in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all instance pools in the subscription as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of all instance pools in the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all instance pools in the subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Gets a list of all instance pools in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all instance pools in the subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Azure SQL instance pools along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Azure SQL instance pools along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Azure SQL instance pools along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Azure SQL instance pools along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/InstancePoolsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/InstancePoolsImpl.java new file mode 100644 index 0000000000000..f0fe20c398a66 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/InstancePoolsImpl.java @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.InstancePoolsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.InstancePoolInner; +import com.azure.resourcemanager.sql.generated.models.InstancePool; +import com.azure.resourcemanager.sql.generated.models.InstancePools; + +public final class InstancePoolsImpl implements InstancePools { + private static final ClientLogger LOGGER = new ClientLogger(InstancePoolsImpl.class); + + private final InstancePoolsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public InstancePoolsImpl( + InstancePoolsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String instancePoolName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, instancePoolName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new InstancePoolImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public InstancePool getByResourceGroup(String resourceGroupName, String instancePoolName) { + InstancePoolInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, instancePoolName); + if (inner != null) { + return new InstancePoolImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String instancePoolName) { + this.serviceClient().delete(resourceGroupName, instancePoolName); + } + + public void delete(String resourceGroupName, String instancePoolName, Context context) { + this.serviceClient().delete(resourceGroupName, instancePoolName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new InstancePoolImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new InstancePoolImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new InstancePoolImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new InstancePoolImpl(inner1, this.manager())); + } + + public InstancePool getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String instancePoolName = Utils.getValueFromIdByName(id, "instancePools"); + if (instancePoolName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'instancePools'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, instancePoolName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String instancePoolName = Utils.getValueFromIdByName(id, "instancePools"); + if (instancePoolName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'instancePools'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, instancePoolName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String instancePoolName = Utils.getValueFromIdByName(id, "instancePools"); + if (instancePoolName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'instancePools'.", id))); + } + this.delete(resourceGroupName, instancePoolName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String instancePoolName = Utils.getValueFromIdByName(id, "instancePools"); + if (instancePoolName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'instancePools'.", id))); + } + this.delete(resourceGroupName, instancePoolName, context); + } + + private InstancePoolsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public InstancePoolImpl define(String name) { + return new InstancePoolImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobAgentImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobAgentImpl.java new file mode 100644 index 0000000000000..7ffac9c0044be --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobAgentImpl.java @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.JobAgentInner; +import com.azure.resourcemanager.sql.generated.models.JobAgent; +import com.azure.resourcemanager.sql.generated.models.JobAgentState; +import com.azure.resourcemanager.sql.generated.models.JobAgentUpdate; +import com.azure.resourcemanager.sql.generated.models.Sku; +import java.util.Collections; +import java.util.Map; + +public final class JobAgentImpl implements JobAgent, JobAgent.Definition, JobAgent.Update { + private JobAgentInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public Sku sku() { + return this.innerModel().sku(); + } + + public String databaseId() { + return this.innerModel().databaseId(); + } + + public JobAgentState state() { + return this.innerModel().state(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public JobAgentInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String jobAgentName; + + private JobAgentUpdate updateParameters; + + public JobAgentImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public JobAgent create() { + this.innerObject = + serviceManager + .serviceClient() + .getJobAgents() + .createOrUpdate(resourceGroupName, serverName, jobAgentName, this.innerModel(), Context.NONE); + return this; + } + + public JobAgent create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getJobAgents() + .createOrUpdate(resourceGroupName, serverName, jobAgentName, this.innerModel(), context); + return this; + } + + JobAgentImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new JobAgentInner(); + this.serviceManager = serviceManager; + this.jobAgentName = name; + } + + public JobAgentImpl update() { + this.updateParameters = new JobAgentUpdate(); + return this; + } + + public JobAgent apply() { + this.innerObject = + serviceManager + .serviceClient() + .getJobAgents() + .update(resourceGroupName, serverName, jobAgentName, updateParameters, Context.NONE); + return this; + } + + public JobAgent apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getJobAgents() + .update(resourceGroupName, serverName, jobAgentName, updateParameters, context); + return this; + } + + JobAgentImpl(JobAgentInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.jobAgentName = Utils.getValueFromIdByName(innerObject.id(), "jobAgents"); + } + + public JobAgent refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getJobAgents() + .getWithResponse(resourceGroupName, serverName, jobAgentName, Context.NONE) + .getValue(); + return this; + } + + public JobAgent refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getJobAgents() + .getWithResponse(resourceGroupName, serverName, jobAgentName, context) + .getValue(); + return this; + } + + public JobAgentImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public JobAgentImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public JobAgentImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public JobAgentImpl withSku(Sku sku) { + this.innerModel().withSku(sku); + return this; + } + + public JobAgentImpl withDatabaseId(String databaseId) { + this.innerModel().withDatabaseId(databaseId); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobAgentsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobAgentsClientImpl.java new file mode 100644 index 0000000000000..cd033f4ae0736 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobAgentsClientImpl.java @@ -0,0 +1,1436 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.JobAgentsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.JobAgentInner; +import com.azure.resourcemanager.sql.generated.models.JobAgentListResult; +import com.azure.resourcemanager.sql.generated.models.JobAgentUpdate; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in JobAgentsClient. */ +public final class JobAgentsClientImpl implements JobAgentsClient { + /** The proxy service used to perform REST calls. */ + private final JobAgentsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of JobAgentsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + JobAgentsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(JobAgentsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientJobAgents to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientJ") + public interface JobAgentsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/jobAgents") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") JobAgentInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") JobAgentUpdate parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job agents in a server along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job agents in a server along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job agents in a server as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job agents in a server as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job agents in a server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job agents in a server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job agent along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String jobAgentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job agent along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String jobAgentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job agent on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serverName, String jobAgentName) { + return getWithResponseAsync(resourceGroupName, serverName, jobAgentName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job agent along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String jobAgentName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, jobAgentName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobAgentInner get(String resourceGroupName, String serverName, String jobAgentName) { + return getWithResponse(resourceGroupName, serverName, jobAgentName, Context.NONE).getValue(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL job agent along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverName, String jobAgentName, JobAgentInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL job agent along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverName, String jobAgentName, JobAgentInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, JobAgentInner> beginCreateOrUpdateAsync( + String resourceGroupName, String serverName, String jobAgentName, JobAgentInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, jobAgentName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + JobAgentInner.class, + JobAgentInner.class, + this.client.getContext()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, JobAgentInner> beginCreateOrUpdateAsync( + String resourceGroupName, String serverName, String jobAgentName, JobAgentInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, jobAgentName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), JobAgentInner.class, JobAgentInner.class, context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, JobAgentInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String jobAgentName, JobAgentInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, jobAgentName, parameters).getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, JobAgentInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String jobAgentName, JobAgentInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, jobAgentName, parameters, context) + .getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL job agent on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serverName, String jobAgentName, JobAgentInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, jobAgentName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL job agent on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serverName, String jobAgentName, JobAgentInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, jobAgentName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobAgentInner createOrUpdate( + String resourceGroupName, String serverName, String jobAgentName, JobAgentInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, jobAgentName, parameters).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobAgentInner createOrUpdate( + String resourceGroupName, String serverName, String jobAgentName, JobAgentInner parameters, Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, jobAgentName, parameters, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, String jobAgentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, String jobAgentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String jobAgentName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, serverName, jobAgentName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String jobAgentName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, jobAgentName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String jobAgentName) { + return beginDeleteAsync(resourceGroupName, serverName, jobAgentName).getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String jobAgentName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, jobAgentName, context).getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String serverName, String jobAgentName) { + return beginDeleteAsync(resourceGroupName, serverName, jobAgentName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String serverName, String jobAgentName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, jobAgentName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, String jobAgentName) { + deleteAsync(resourceGroupName, serverName, jobAgentName).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, String jobAgentName, Context context) { + deleteAsync(resourceGroupName, serverName, jobAgentName, context).block(); + } + + /** + * 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 parameters The update to the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL job agent along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String serverName, String jobAgentName, JobAgentUpdate parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 parameters The update to the job agent. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL job agent along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String serverName, String jobAgentName, JobAgentUpdate parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 parameters The update to the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, JobAgentInner> beginUpdateAsync( + String resourceGroupName, String serverName, String jobAgentName, JobAgentUpdate parameters) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, serverName, jobAgentName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + JobAgentInner.class, + JobAgentInner.class, + this.client.getContext()); + } + + /** + * 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 parameters The update to the job agent. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, JobAgentInner> beginUpdateAsync( + String resourceGroupName, String serverName, String jobAgentName, JobAgentUpdate parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, serverName, jobAgentName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), JobAgentInner.class, JobAgentInner.class, context); + } + + /** + * 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 parameters The update to the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, JobAgentInner> beginUpdate( + String resourceGroupName, String serverName, String jobAgentName, JobAgentUpdate parameters) { + return beginUpdateAsync(resourceGroupName, serverName, jobAgentName, parameters).getSyncPoller(); + } + + /** + * 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 parameters The update to the job agent. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, JobAgentInner> beginUpdate( + String resourceGroupName, String serverName, String jobAgentName, JobAgentUpdate parameters, Context context) { + return beginUpdateAsync(resourceGroupName, serverName, jobAgentName, parameters, context).getSyncPoller(); + } + + /** + * 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 parameters The update to the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL job agent on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String serverName, String jobAgentName, JobAgentUpdate parameters) { + return beginUpdateAsync(resourceGroupName, serverName, jobAgentName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 parameters The update to the job agent. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL job agent on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String serverName, String jobAgentName, JobAgentUpdate parameters, Context context) { + return beginUpdateAsync(resourceGroupName, serverName, jobAgentName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 parameters The update to the job agent. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobAgentInner update( + String resourceGroupName, String serverName, String jobAgentName, JobAgentUpdate parameters) { + return updateAsync(resourceGroupName, serverName, jobAgentName, parameters).block(); + } + + /** + * 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 parameters The update to the job agent. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL job agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobAgentInner update( + String resourceGroupName, String serverName, String jobAgentName, JobAgentUpdate parameters, Context context) { + return updateAsync(resourceGroupName, serverName, jobAgentName, parameters, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Azure SQL job agents along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByServerNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Azure SQL job agents along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServerNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobAgentsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobAgentsImpl.java new file mode 100644 index 0000000000000..c538be4dfc216 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobAgentsImpl.java @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.JobAgentsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.JobAgentInner; +import com.azure.resourcemanager.sql.generated.models.JobAgent; +import com.azure.resourcemanager.sql.generated.models.JobAgents; + +public final class JobAgentsImpl implements JobAgents { + private static final ClientLogger LOGGER = new ClientLogger(JobAgentsImpl.class); + + private final JobAgentsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public JobAgentsImpl( + JobAgentsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new JobAgentImpl(inner1, this.manager())); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { + PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new JobAgentImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String jobAgentName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, jobAgentName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new JobAgentImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public JobAgent get(String resourceGroupName, String serverName, String jobAgentName) { + JobAgentInner inner = this.serviceClient().get(resourceGroupName, serverName, jobAgentName); + if (inner != null) { + return new JobAgentImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String serverName, String jobAgentName) { + this.serviceClient().delete(resourceGroupName, serverName, jobAgentName); + } + + public void delete(String resourceGroupName, String serverName, String jobAgentName, Context context) { + this.serviceClient().delete(resourceGroupName, serverName, jobAgentName, context); + } + + public JobAgent getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String jobAgentName = Utils.getValueFromIdByName(id, "jobAgents"); + if (jobAgentName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobAgents'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, jobAgentName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String jobAgentName = Utils.getValueFromIdByName(id, "jobAgents"); + if (jobAgentName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobAgents'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, jobAgentName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String jobAgentName = Utils.getValueFromIdByName(id, "jobAgents"); + if (jobAgentName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobAgents'.", id))); + } + this.delete(resourceGroupName, serverName, jobAgentName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String jobAgentName = Utils.getValueFromIdByName(id, "jobAgents"); + if (jobAgentName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobAgents'.", id))); + } + this.delete(resourceGroupName, serverName, jobAgentName, context); + } + + private JobAgentsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public JobAgentImpl define(String name) { + return new JobAgentImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobCredentialImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobCredentialImpl.java new file mode 100644 index 0000000000000..617d4fd4aa468 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobCredentialImpl.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.JobCredentialInner; +import com.azure.resourcemanager.sql.generated.models.JobCredential; + +public final class JobCredentialImpl implements JobCredential, JobCredential.Definition, JobCredential.Update { + private JobCredentialInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String username() { + return this.innerModel().username(); + } + + public String password() { + return this.innerModel().password(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public JobCredentialInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String jobAgentName; + + private String credentialName; + + public JobCredentialImpl withExistingJobAgent(String resourceGroupName, String serverName, String jobAgentName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.jobAgentName = jobAgentName; + return this; + } + + public JobCredential create() { + this.innerObject = + serviceManager + .serviceClient() + .getJobCredentials() + .createOrUpdateWithResponse( + resourceGroupName, serverName, jobAgentName, credentialName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public JobCredential create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getJobCredentials() + .createOrUpdateWithResponse( + resourceGroupName, serverName, jobAgentName, credentialName, this.innerModel(), context) + .getValue(); + return this; + } + + JobCredentialImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new JobCredentialInner(); + this.serviceManager = serviceManager; + this.credentialName = name; + } + + public JobCredentialImpl update() { + return this; + } + + public JobCredential apply() { + this.innerObject = + serviceManager + .serviceClient() + .getJobCredentials() + .createOrUpdateWithResponse( + resourceGroupName, serverName, jobAgentName, credentialName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public JobCredential apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getJobCredentials() + .createOrUpdateWithResponse( + resourceGroupName, serverName, jobAgentName, credentialName, this.innerModel(), context) + .getValue(); + return this; + } + + JobCredentialImpl( + JobCredentialInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.jobAgentName = Utils.getValueFromIdByName(innerObject.id(), "jobAgents"); + this.credentialName = Utils.getValueFromIdByName(innerObject.id(), "credentials"); + } + + public JobCredential refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getJobCredentials() + .getWithResponse(resourceGroupName, serverName, jobAgentName, credentialName, Context.NONE) + .getValue(); + return this; + } + + public JobCredential refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getJobCredentials() + .getWithResponse(resourceGroupName, serverName, jobAgentName, credentialName, context) + .getValue(); + return this; + } + + public JobCredentialImpl withUsername(String username) { + this.innerModel().withUsername(username); + return this; + } + + public JobCredentialImpl withPassword(String password) { + this.innerModel().withPassword(password); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobCredentialsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobCredentialsClientImpl.java new file mode 100644 index 0000000000000..ecfb598667be0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobCredentialsClientImpl.java @@ -0,0 +1,987 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.JobCredentialsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.JobCredentialInner; +import com.azure.resourcemanager.sql.generated.models.JobCredentialListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in JobCredentialsClient. */ +public final class JobCredentialsClientImpl implements JobCredentialsClient { + /** The proxy service used to perform REST calls. */ + private final JobCredentialsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of JobCredentialsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + JobCredentialsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(JobCredentialsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientJobCredentials to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientJ") + public interface JobCredentialsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/credentials") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByAgent( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/credentials/{credentialName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("credentialName") String credentialName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/credentials/{credentialName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("credentialName") String credentialName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") JobCredentialInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/credentials/{credentialName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("credentialName") String credentialName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByAgentNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of jobs credentials along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByAgentSinglePageAsync( + String resourceGroupName, String serverName, String jobAgentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByAgent( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of jobs credentials along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByAgentSinglePageAsync( + String resourceGroupName, String serverName, String jobAgentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByAgent( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of jobs credentials as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByAgentAsync( + String resourceGroupName, String serverName, String jobAgentName) { + return new PagedFlux<>( + () -> listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName), + nextLink -> listByAgentNextSinglePageAsync(nextLink)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of jobs credentials as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByAgentAsync( + String resourceGroupName, String serverName, String jobAgentName, Context context) { + return new PagedFlux<>( + () -> listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName, context), + nextLink -> listByAgentNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of jobs credentials as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByAgent( + String resourceGroupName, String serverName, String jobAgentName) { + return new PagedIterable<>(listByAgentAsync(resourceGroupName, serverName, jobAgentName)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of jobs credentials as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByAgent( + String resourceGroupName, String serverName, String jobAgentName, Context context) { + return new PagedIterable<>(listByAgentAsync(resourceGroupName, serverName, jobAgentName, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a jobs credential along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String jobAgentName, String credentialName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (credentialName == null) { + return Mono.error(new IllegalArgumentException("Parameter credentialName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + credentialName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a jobs credential along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String jobAgentName, String credentialName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (credentialName == null) { + return Mono.error(new IllegalArgumentException("Parameter credentialName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + credentialName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a jobs credential on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String jobAgentName, String credentialName) { + return getWithResponseAsync(resourceGroupName, serverName, jobAgentName, credentialName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a jobs credential along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String jobAgentName, String credentialName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, jobAgentName, credentialName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a jobs credential. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobCredentialInner get( + String resourceGroupName, String serverName, String jobAgentName, String credentialName) { + return getWithResponse(resourceGroupName, serverName, jobAgentName, credentialName, Context.NONE).getValue(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a stored credential that can be used by a job to connect to target databases along with {@link Response} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String credentialName, + JobCredentialInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (credentialName == null) { + return Mono.error(new IllegalArgumentException("Parameter credentialName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + credentialName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a stored credential that can be used by a job to connect to target databases along with {@link Response} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String credentialName, + JobCredentialInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (credentialName == null) { + return Mono.error(new IllegalArgumentException("Parameter credentialName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + credentialName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a stored credential that can be used by a job to connect to target databases on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String credentialName, + JobCredentialInner parameters) { + return createOrUpdateWithResponseAsync(resourceGroupName, serverName, jobAgentName, credentialName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a stored credential that can be used by a job to connect to target databases along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String credentialName, + JobCredentialInner parameters, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, serverName, jobAgentName, credentialName, parameters, context) + .block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a stored credential that can be used by a job to connect to target databases. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobCredentialInner createOrUpdate( + String resourceGroupName, + String serverName, + String jobAgentName, + String credentialName, + JobCredentialInner parameters) { + return createOrUpdateWithResponse( + resourceGroupName, serverName, jobAgentName, credentialName, parameters, Context.NONE) + .getValue(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String serverName, String jobAgentName, String credentialName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (credentialName == null) { + return Mono.error(new IllegalArgumentException("Parameter credentialName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + credentialName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String serverName, String jobAgentName, String credentialName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (credentialName == null) { + return Mono.error(new IllegalArgumentException("Parameter credentialName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + credentialName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String serverName, String jobAgentName, String credentialName) { + return deleteWithResponseAsync(resourceGroupName, serverName, jobAgentName, credentialName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, String serverName, String jobAgentName, String credentialName, Context context) { + return deleteWithResponseAsync(resourceGroupName, serverName, jobAgentName, credentialName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, String jobAgentName, String credentialName) { + deleteWithResponse(resourceGroupName, serverName, jobAgentName, credentialName, Context.NONE); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job credentials along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByAgentNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByAgentNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job credentials along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByAgentNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByAgentNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobCredentialsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobCredentialsImpl.java new file mode 100644 index 0000000000000..d8d7b3b96aa16 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobCredentialsImpl.java @@ -0,0 +1,224 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.JobCredentialsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.JobCredentialInner; +import com.azure.resourcemanager.sql.generated.models.JobCredential; +import com.azure.resourcemanager.sql.generated.models.JobCredentials; + +public final class JobCredentialsImpl implements JobCredentials { + private static final ClientLogger LOGGER = new ClientLogger(JobCredentialsImpl.class); + + private final JobCredentialsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public JobCredentialsImpl( + JobCredentialsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByAgent(String resourceGroupName, String serverName, String jobAgentName) { + PagedIterable inner = + this.serviceClient().listByAgent(resourceGroupName, serverName, jobAgentName); + return Utils.mapPage(inner, inner1 -> new JobCredentialImpl(inner1, this.manager())); + } + + public PagedIterable listByAgent( + String resourceGroupName, String serverName, String jobAgentName, Context context) { + PagedIterable inner = + this.serviceClient().listByAgent(resourceGroupName, serverName, jobAgentName, context); + return Utils.mapPage(inner, inner1 -> new JobCredentialImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String jobAgentName, String credentialName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, jobAgentName, credentialName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new JobCredentialImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public JobCredential get(String resourceGroupName, String serverName, String jobAgentName, String credentialName) { + JobCredentialInner inner = + this.serviceClient().get(resourceGroupName, serverName, jobAgentName, credentialName); + if (inner != null) { + return new JobCredentialImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse( + String resourceGroupName, String serverName, String jobAgentName, String credentialName, Context context) { + return this + .serviceClient() + .deleteWithResponse(resourceGroupName, serverName, jobAgentName, credentialName, context); + } + + public void delete(String resourceGroupName, String serverName, String jobAgentName, String credentialName) { + this.serviceClient().delete(resourceGroupName, serverName, jobAgentName, credentialName); + } + + public JobCredential getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String jobAgentName = Utils.getValueFromIdByName(id, "jobAgents"); + if (jobAgentName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobAgents'.", id))); + } + String credentialName = Utils.getValueFromIdByName(id, "credentials"); + if (credentialName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'credentials'.", id))); + } + return this + .getWithResponse(resourceGroupName, serverName, jobAgentName, credentialName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String jobAgentName = Utils.getValueFromIdByName(id, "jobAgents"); + if (jobAgentName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobAgents'.", id))); + } + String credentialName = Utils.getValueFromIdByName(id, "credentials"); + if (credentialName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'credentials'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, jobAgentName, credentialName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String jobAgentName = Utils.getValueFromIdByName(id, "jobAgents"); + if (jobAgentName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobAgents'.", id))); + } + String credentialName = Utils.getValueFromIdByName(id, "credentials"); + if (credentialName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'credentials'.", id))); + } + this.deleteWithResponse(resourceGroupName, serverName, jobAgentName, credentialName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String jobAgentName = Utils.getValueFromIdByName(id, "jobAgents"); + if (jobAgentName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobAgents'.", id))); + } + String credentialName = Utils.getValueFromIdByName(id, "credentials"); + if (credentialName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'credentials'.", id))); + } + return this.deleteWithResponse(resourceGroupName, serverName, jobAgentName, credentialName, context); + } + + private JobCredentialsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public JobCredentialImpl define(String name) { + return new JobCredentialImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobExecutionImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobExecutionImpl.java new file mode 100644 index 0000000000000..6270223f5a13b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobExecutionImpl.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.JobExecutionInner; +import com.azure.resourcemanager.sql.generated.models.JobExecution; +import com.azure.resourcemanager.sql.generated.models.JobExecutionLifecycle; +import com.azure.resourcemanager.sql.generated.models.JobExecutionTarget; +import com.azure.resourcemanager.sql.generated.models.ProvisioningState; +import java.time.OffsetDateTime; +import java.util.UUID; + +public final class JobExecutionImpl implements JobExecution { + private JobExecutionInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + JobExecutionImpl(JobExecutionInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public Integer jobVersion() { + return this.innerModel().jobVersion(); + } + + public String stepName() { + return this.innerModel().stepName(); + } + + public Integer stepId() { + return this.innerModel().stepId(); + } + + public UUID jobExecutionId() { + return this.innerModel().jobExecutionId(); + } + + public JobExecutionLifecycle lifecycle() { + return this.innerModel().lifecycle(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public OffsetDateTime createTime() { + return this.innerModel().createTime(); + } + + public OffsetDateTime startTime() { + return this.innerModel().startTime(); + } + + public OffsetDateTime endTime() { + return this.innerModel().endTime(); + } + + public Integer currentAttempts() { + return this.innerModel().currentAttempts(); + } + + public OffsetDateTime currentAttemptStartTime() { + return this.innerModel().currentAttemptStartTime(); + } + + public String lastMessage() { + return this.innerModel().lastMessage(); + } + + public JobExecutionTarget target() { + return this.innerModel().target(); + } + + public JobExecutionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobExecutionsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobExecutionsClientImpl.java new file mode 100644 index 0000000000000..8a752d50b1e3f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobExecutionsClientImpl.java @@ -0,0 +1,2190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.JobExecutionsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.JobExecutionInner; +import com.azure.resourcemanager.sql.generated.models.JobExecutionListResult; +import java.nio.ByteBuffer; +import java.time.OffsetDateTime; +import java.util.UUID; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in JobExecutionsClient. */ +public final class JobExecutionsClientImpl implements JobExecutionsClient { + /** The proxy service used to perform REST calls. */ + private final JobExecutionsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of JobExecutionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + JobExecutionsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(JobExecutionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientJobExecutions to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientJ") + public interface JobExecutionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/executions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByAgent( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @QueryParam("createTimeMin") OffsetDateTime createTimeMin, + @QueryParam("createTimeMax") OffsetDateTime createTimeMax, + @QueryParam("endTimeMin") OffsetDateTime endTimeMin, + @QueryParam("endTimeMax") OffsetDateTime endTimeMax, + @QueryParam("isActive") Boolean isActive, + @QueryParam("$skip") Integer skip, + @QueryParam("$top") Integer top, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}/cancel") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> cancel( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("jobName") String jobName, + @PathParam("jobExecutionId") UUID jobExecutionId, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/start") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("jobName") String jobName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByJob( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("jobName") String jobName, + @QueryParam("createTimeMin") OffsetDateTime createTimeMin, + @QueryParam("createTimeMax") OffsetDateTime createTimeMax, + @QueryParam("endTimeMin") OffsetDateTime endTimeMin, + @QueryParam("endTimeMax") OffsetDateTime endTimeMax, + @QueryParam("isActive") Boolean isActive, + @QueryParam("$skip") Integer skip, + @QueryParam("$top") Integer top, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("jobName") String jobName, + @PathParam("jobExecutionId") UUID jobExecutionId, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("jobName") String jobName, + @PathParam("jobExecutionId") UUID jobExecutionId, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByAgentNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByJobNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByAgentSinglePageAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByAgent( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByAgentSinglePageAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByAgent( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByAgentAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top) { + return new PagedFlux<>( + () -> + listByAgentSinglePageAsync( + resourceGroupName, + serverName, + jobAgentName, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top), + nextLink -> listByAgentNextSinglePageAsync(nextLink)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByAgentAsync( + String resourceGroupName, String serverName, String jobAgentName) { + final OffsetDateTime createTimeMin = null; + final OffsetDateTime createTimeMax = null; + final OffsetDateTime endTimeMin = null; + final OffsetDateTime endTimeMax = null; + final Boolean isActive = null; + final Integer skip = null; + final Integer top = null; + return new PagedFlux<>( + () -> + listByAgentSinglePageAsync( + resourceGroupName, + serverName, + jobAgentName, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top), + nextLink -> listByAgentNextSinglePageAsync(nextLink)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByAgentAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + Context context) { + return new PagedFlux<>( + () -> + listByAgentSinglePageAsync( + resourceGroupName, + serverName, + jobAgentName, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top, + context), + nextLink -> listByAgentNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByAgent( + String resourceGroupName, String serverName, String jobAgentName) { + final OffsetDateTime createTimeMin = null; + final OffsetDateTime createTimeMax = null; + final OffsetDateTime endTimeMin = null; + final OffsetDateTime endTimeMax = null; + final Boolean isActive = null; + final Integer skip = null; + final Integer top = null; + return new PagedIterable<>( + listByAgentAsync( + resourceGroupName, + serverName, + jobAgentName, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByAgent( + String resourceGroupName, + String serverName, + String jobAgentName, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + Context context) { + return new PagedIterable<>( + listByAgentAsync( + resourceGroupName, + serverName, + jobAgentName, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top, + context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> cancelWithResponseAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (jobExecutionId == null) { + return Mono.error(new IllegalArgumentException("Parameter jobExecutionId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .cancel( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> cancelWithResponseAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (jobExecutionId == null) { + return Mono.error(new IllegalArgumentException("Parameter jobExecutionId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .cancel( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono cancelAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + return cancelWithResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId) + .flatMap(ignored -> Mono.empty()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response cancelWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + Context context) { + return cancelWithResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, context) + .block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void cancel( + String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + cancelWithResponse(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, Context.NONE); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an execution of a job along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an execution of a job along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an execution of a job. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, JobExecutionInner> beginCreateAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName) { + Mono>> mono = + createWithResponseAsync(resourceGroupName, serverName, jobAgentName, jobName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + JobExecutionInner.class, + JobExecutionInner.class, + this.client.getContext()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an execution of a job. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, JobExecutionInner> beginCreateAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createWithResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), JobExecutionInner.class, JobExecutionInner.class, context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an execution of a job. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, JobExecutionInner> beginCreate( + String resourceGroupName, String serverName, String jobAgentName, String jobName) { + return beginCreateAsync(resourceGroupName, serverName, jobAgentName, jobName).getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an execution of a job. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, JobExecutionInner> beginCreate( + String resourceGroupName, String serverName, String jobAgentName, String jobName, Context context) { + return beginCreateAsync(resourceGroupName, serverName, jobAgentName, jobName, context).getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an execution of a job on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName) { + return beginCreateAsync(resourceGroupName, serverName, jobAgentName, jobName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an execution of a job on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName, Context context) { + return beginCreateAsync(resourceGroupName, serverName, jobAgentName, jobName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an execution of a job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobExecutionInner create(String resourceGroupName, String serverName, String jobAgentName, String jobName) { + return createAsync(resourceGroupName, serverName, jobAgentName, jobName).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an execution of a job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobExecutionInner create( + String resourceGroupName, String serverName, String jobAgentName, String jobName, Context context) { + return createAsync(resourceGroupName, serverName, jobAgentName, jobName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByJobSinglePageAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByJob( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByJobSinglePageAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByJob( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByJobAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top) { + return new PagedFlux<>( + () -> + listByJobSinglePageAsync( + resourceGroupName, + serverName, + jobAgentName, + jobName, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top), + nextLink -> listByJobNextSinglePageAsync(nextLink)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByJobAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName) { + final OffsetDateTime createTimeMin = null; + final OffsetDateTime createTimeMax = null; + final OffsetDateTime endTimeMin = null; + final OffsetDateTime endTimeMax = null; + final Boolean isActive = null; + final Integer skip = null; + final Integer top = null; + return new PagedFlux<>( + () -> + listByJobSinglePageAsync( + resourceGroupName, + serverName, + jobAgentName, + jobName, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top), + nextLink -> listByJobNextSinglePageAsync(nextLink)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByJobAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + Context context) { + return new PagedFlux<>( + () -> + listByJobSinglePageAsync( + resourceGroupName, + serverName, + jobAgentName, + jobName, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top, + context), + nextLink -> listByJobNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByJob( + String resourceGroupName, String serverName, String jobAgentName, String jobName) { + final OffsetDateTime createTimeMin = null; + final OffsetDateTime createTimeMax = null; + final OffsetDateTime endTimeMin = null; + final OffsetDateTime endTimeMax = null; + final Boolean isActive = null; + final Integer skip = null; + final Integer top = null; + return new PagedIterable<>( + listByJobAsync( + resourceGroupName, + serverName, + jobAgentName, + jobName, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByJob( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + Context context) { + return new PagedIterable<>( + listByJobAsync( + resourceGroupName, + serverName, + jobAgentName, + jobName, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top, + context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job execution along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (jobExecutionId == null) { + return Mono.error(new IllegalArgumentException("Parameter jobExecutionId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job execution along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (jobExecutionId == null) { + return Mono.error(new IllegalArgumentException("Parameter jobExecutionId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job execution on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + return getWithResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job execution along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + Context context) { + return getWithResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, context) + .block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job execution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobExecutionInner get( + String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + return getWithResponse(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, Context.NONE) + .getValue(); + } + + /** + * 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. + * @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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an execution of a job along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (jobExecutionId == null) { + return Mono.error(new IllegalArgumentException("Parameter jobExecutionId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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. + * @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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an execution of a job along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (jobExecutionId == null) { + return Mono.error(new IllegalArgumentException("Parameter jobExecutionId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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. + * @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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an execution of a job. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, JobExecutionInner> beginCreateOrUpdateAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + JobExecutionInner.class, + JobExecutionInner.class, + this.client.getContext()); + } + + /** + * 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. + * @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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an execution of a job. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, JobExecutionInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), JobExecutionInner.class, JobExecutionInner.class, context); + } + + /** + * 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. + * @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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an execution of a job. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, JobExecutionInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId) + .getSyncPoller(); + } + + /** + * 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. + * @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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an execution of a job. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, JobExecutionInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, context) + .getSyncPoller(); + } + + /** + * 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. + * @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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an execution of a job on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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. + * @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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an execution of a job on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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. + * @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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an execution of a job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobExecutionInner createOrUpdate( + String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + return createOrUpdateAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId).block(); + } + + /** + * 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. + * @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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an execution of a job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobExecutionInner createOrUpdate( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, context) + .block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByAgentNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByAgentNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByAgentNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByAgentNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByJobNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByJobNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByJobNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByJobNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobExecutionsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobExecutionsImpl.java new file mode 100644 index 0000000000000..cb226895b4290 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobExecutionsImpl.java @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.JobExecutionsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.JobExecutionInner; +import com.azure.resourcemanager.sql.generated.models.JobExecution; +import com.azure.resourcemanager.sql.generated.models.JobExecutions; +import java.time.OffsetDateTime; +import java.util.UUID; + +public final class JobExecutionsImpl implements JobExecutions { + private static final ClientLogger LOGGER = new ClientLogger(JobExecutionsImpl.class); + + private final JobExecutionsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public JobExecutionsImpl( + JobExecutionsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByAgent(String resourceGroupName, String serverName, String jobAgentName) { + PagedIterable inner = + this.serviceClient().listByAgent(resourceGroupName, serverName, jobAgentName); + return Utils.mapPage(inner, inner1 -> new JobExecutionImpl(inner1, this.manager())); + } + + public PagedIterable listByAgent( + String resourceGroupName, + String serverName, + String jobAgentName, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByAgent( + resourceGroupName, + serverName, + jobAgentName, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top, + context); + return Utils.mapPage(inner, inner1 -> new JobExecutionImpl(inner1, this.manager())); + } + + public Response cancelWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + Context context) { + return this + .serviceClient() + .cancelWithResponse(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, context); + } + + public void cancel( + String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + this.serviceClient().cancel(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId); + } + + public JobExecution create(String resourceGroupName, String serverName, String jobAgentName, String jobName) { + JobExecutionInner inner = this.serviceClient().create(resourceGroupName, serverName, jobAgentName, jobName); + if (inner != null) { + return new JobExecutionImpl(inner, this.manager()); + } else { + return null; + } + } + + public JobExecution create( + String resourceGroupName, String serverName, String jobAgentName, String jobName, Context context) { + JobExecutionInner inner = + this.serviceClient().create(resourceGroupName, serverName, jobAgentName, jobName, context); + if (inner != null) { + return new JobExecutionImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listByJob( + String resourceGroupName, String serverName, String jobAgentName, String jobName) { + PagedIterable inner = + this.serviceClient().listByJob(resourceGroupName, serverName, jobAgentName, jobName); + return Utils.mapPage(inner, inner1 -> new JobExecutionImpl(inner1, this.manager())); + } + + public PagedIterable listByJob( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByJob( + resourceGroupName, + serverName, + jobAgentName, + jobName, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top, + context); + return Utils.mapPage(inner, inner1 -> new JobExecutionImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new JobExecutionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public JobExecution get( + String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + JobExecutionInner inner = + this.serviceClient().get(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId); + if (inner != null) { + return new JobExecutionImpl(inner, this.manager()); + } else { + return null; + } + } + + public JobExecution createOrUpdate( + String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + JobExecutionInner inner = + this.serviceClient().createOrUpdate(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId); + if (inner != null) { + return new JobExecutionImpl(inner, this.manager()); + } else { + return null; + } + } + + public JobExecution createOrUpdate( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + Context context) { + JobExecutionInner inner = + this + .serviceClient() + .createOrUpdate(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, context); + if (inner != null) { + return new JobExecutionImpl(inner, this.manager()); + } else { + return null; + } + } + + private JobExecutionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobImpl.java new file mode 100644 index 0000000000000..9510af8152c03 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobImpl.java @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.JobInner; +import com.azure.resourcemanager.sql.generated.models.Job; +import com.azure.resourcemanager.sql.generated.models.JobSchedule; + +public final class JobImpl implements Job, Job.Definition, Job.Update { + private JobInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String description() { + return this.innerModel().description(); + } + + public Integer version() { + return this.innerModel().version(); + } + + public JobSchedule schedule() { + return this.innerModel().schedule(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public JobInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String jobAgentName; + + private String jobName; + + public JobImpl withExistingJobAgent(String resourceGroupName, String serverName, String jobAgentName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.jobAgentName = jobAgentName; + return this; + } + + public Job create() { + this.innerObject = + serviceManager + .serviceClient() + .getJobs() + .createOrUpdateWithResponse( + resourceGroupName, serverName, jobAgentName, jobName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public Job create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getJobs() + .createOrUpdateWithResponse( + resourceGroupName, serverName, jobAgentName, jobName, this.innerModel(), context) + .getValue(); + return this; + } + + JobImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new JobInner(); + this.serviceManager = serviceManager; + this.jobName = name; + } + + public JobImpl update() { + return this; + } + + public Job apply() { + this.innerObject = + serviceManager + .serviceClient() + .getJobs() + .createOrUpdateWithResponse( + resourceGroupName, serverName, jobAgentName, jobName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public Job apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getJobs() + .createOrUpdateWithResponse( + resourceGroupName, serverName, jobAgentName, jobName, this.innerModel(), context) + .getValue(); + return this; + } + + JobImpl(JobInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.jobAgentName = Utils.getValueFromIdByName(innerObject.id(), "jobAgents"); + this.jobName = Utils.getValueFromIdByName(innerObject.id(), "jobs"); + } + + public Job refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getJobs() + .getWithResponse(resourceGroupName, serverName, jobAgentName, jobName, Context.NONE) + .getValue(); + return this; + } + + public Job refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getJobs() + .getWithResponse(resourceGroupName, serverName, jobAgentName, jobName, context) + .getValue(); + return this; + } + + public JobImpl withDescription(String description) { + this.innerModel().withDescription(description); + return this; + } + + public JobImpl withSchedule(JobSchedule schedule) { + this.innerModel().withSchedule(schedule); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobStepExecutionsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobStepExecutionsClientImpl.java new file mode 100644 index 0000000000000..5a3c784c4f3df --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobStepExecutionsClientImpl.java @@ -0,0 +1,866 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.JobStepExecutionsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.JobExecutionInner; +import com.azure.resourcemanager.sql.generated.models.JobExecutionListResult; +import java.time.OffsetDateTime; +import java.util.UUID; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in JobStepExecutionsClient. */ +public final class JobStepExecutionsClientImpl implements JobStepExecutionsClient { + /** The proxy service used to perform REST calls. */ + private final JobStepExecutionsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of JobStepExecutionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + JobStepExecutionsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(JobStepExecutionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientJobStepExecutions to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientJ") + public interface JobStepExecutionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}/steps") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByJobExecution( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("jobName") String jobName, + @PathParam("jobExecutionId") UUID jobExecutionId, + @QueryParam("createTimeMin") OffsetDateTime createTimeMin, + @QueryParam("createTimeMax") OffsetDateTime createTimeMax, + @QueryParam("endTimeMin") OffsetDateTime endTimeMin, + @QueryParam("endTimeMax") OffsetDateTime endTimeMax, + @QueryParam("isActive") Boolean isActive, + @QueryParam("$skip") Integer skip, + @QueryParam("$top") Integer top, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}/steps/{stepName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("jobName") String jobName, + @PathParam("jobExecutionId") UUID jobExecutionId, + @PathParam("stepName") String stepName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByJobExecutionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByJobExecutionSinglePageAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (jobExecutionId == null) { + return Mono.error(new IllegalArgumentException("Parameter jobExecutionId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByJobExecution( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByJobExecutionSinglePageAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (jobExecutionId == null) { + return Mono.error(new IllegalArgumentException("Parameter jobExecutionId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByJobExecution( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByJobExecutionAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top) { + return new PagedFlux<>( + () -> + listByJobExecutionSinglePageAsync( + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top), + nextLink -> listByJobExecutionNextSinglePageAsync(nextLink)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByJobExecutionAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + final OffsetDateTime createTimeMin = null; + final OffsetDateTime createTimeMax = null; + final OffsetDateTime endTimeMin = null; + final OffsetDateTime endTimeMax = null; + final Boolean isActive = null; + final Integer skip = null; + final Integer top = null; + return new PagedFlux<>( + () -> + listByJobExecutionSinglePageAsync( + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top), + nextLink -> listByJobExecutionNextSinglePageAsync(nextLink)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByJobExecutionAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + Context context) { + return new PagedFlux<>( + () -> + listByJobExecutionSinglePageAsync( + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top, + context), + nextLink -> listByJobExecutionNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByJobExecution( + String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + final OffsetDateTime createTimeMin = null; + final OffsetDateTime createTimeMax = null; + final OffsetDateTime endTimeMin = null; + final OffsetDateTime endTimeMax = null; + final Boolean isActive = null; + final Integer skip = null; + final Integer top = null; + return new PagedIterable<>( + listByJobExecutionAsync( + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByJobExecution( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + Context context) { + return new PagedIterable<>( + listByJobExecutionAsync( + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top, + context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a step execution of a job execution along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (jobExecutionId == null) { + return Mono.error(new IllegalArgumentException("Parameter jobExecutionId is required and cannot be null.")); + } + if (stepName == null) { + return Mono.error(new IllegalArgumentException("Parameter stepName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + stepName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a step execution of a job execution along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (jobExecutionId == null) { + return Mono.error(new IllegalArgumentException("Parameter jobExecutionId is required and cannot be null.")); + } + if (stepName == null) { + return Mono.error(new IllegalArgumentException("Parameter stepName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + stepName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a step execution of a job execution on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName) { + return getWithResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a step execution of a job execution along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName, + Context context) { + return getWithResponseAsync( + resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName, context) + .block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a step execution of a job execution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobExecutionInner get( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName) { + return getWithResponse( + resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName, Context.NONE) + .getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByJobExecutionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByJobExecutionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByJobExecutionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByJobExecutionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobStepExecutionsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobStepExecutionsImpl.java new file mode 100644 index 0000000000000..b15698b21a01e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobStepExecutionsImpl.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.JobStepExecutionsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.JobExecutionInner; +import com.azure.resourcemanager.sql.generated.models.JobExecution; +import com.azure.resourcemanager.sql.generated.models.JobStepExecutions; +import java.time.OffsetDateTime; +import java.util.UUID; + +public final class JobStepExecutionsImpl implements JobStepExecutions { + private static final ClientLogger LOGGER = new ClientLogger(JobStepExecutionsImpl.class); + + private final JobStepExecutionsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public JobStepExecutionsImpl( + JobStepExecutionsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByJobExecution( + String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + PagedIterable inner = + this + .serviceClient() + .listByJobExecution(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId); + return Utils.mapPage(inner, inner1 -> new JobExecutionImpl(inner1, this.manager())); + } + + public PagedIterable listByJobExecution( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByJobExecution( + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top, + context); + return Utils.mapPage(inner, inner1 -> new JobExecutionImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse( + resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new JobExecutionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public JobExecution get( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName) { + JobExecutionInner inner = + this.serviceClient().get(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName); + if (inner != null) { + return new JobExecutionImpl(inner, this.manager()); + } else { + return null; + } + } + + private JobStepExecutionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobStepImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobStepImpl.java new file mode 100644 index 0000000000000..60c6d2525d8a2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobStepImpl.java @@ -0,0 +1,199 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.JobStepInner; +import com.azure.resourcemanager.sql.generated.models.JobStep; +import com.azure.resourcemanager.sql.generated.models.JobStepAction; +import com.azure.resourcemanager.sql.generated.models.JobStepExecutionOptions; +import com.azure.resourcemanager.sql.generated.models.JobStepOutput; + +public final class JobStepImpl implements JobStep, JobStep.Definition, JobStep.Update { + private JobStepInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public Integer stepId() { + return this.innerModel().stepId(); + } + + public String targetGroup() { + return this.innerModel().targetGroup(); + } + + public String credential() { + return this.innerModel().credential(); + } + + public JobStepAction action() { + return this.innerModel().action(); + } + + public JobStepOutput output() { + return this.innerModel().output(); + } + + public JobStepExecutionOptions executionOptions() { + return this.innerModel().executionOptions(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public JobStepInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String jobAgentName; + + private String jobName; + + private String stepName; + + public JobStepImpl withExistingJob( + String resourceGroupName, String serverName, String jobAgentName, String jobName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.jobAgentName = jobAgentName; + this.jobName = jobName; + return this; + } + + public JobStep create() { + this.innerObject = + serviceManager + .serviceClient() + .getJobSteps() + .createOrUpdateWithResponse( + resourceGroupName, serverName, jobAgentName, jobName, stepName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public JobStep create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getJobSteps() + .createOrUpdateWithResponse( + resourceGroupName, serverName, jobAgentName, jobName, stepName, this.innerModel(), context) + .getValue(); + return this; + } + + JobStepImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new JobStepInner(); + this.serviceManager = serviceManager; + this.stepName = name; + } + + public JobStepImpl update() { + return this; + } + + public JobStep apply() { + this.innerObject = + serviceManager + .serviceClient() + .getJobSteps() + .createOrUpdateWithResponse( + resourceGroupName, serverName, jobAgentName, jobName, stepName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public JobStep apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getJobSteps() + .createOrUpdateWithResponse( + resourceGroupName, serverName, jobAgentName, jobName, stepName, this.innerModel(), context) + .getValue(); + return this; + } + + JobStepImpl(JobStepInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.jobAgentName = Utils.getValueFromIdByName(innerObject.id(), "jobAgents"); + this.jobName = Utils.getValueFromIdByName(innerObject.id(), "jobs"); + this.stepName = Utils.getValueFromIdByName(innerObject.id(), "steps"); + } + + public JobStep refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getJobSteps() + .getWithResponse(resourceGroupName, serverName, jobAgentName, jobName, stepName, Context.NONE) + .getValue(); + return this; + } + + public JobStep refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getJobSteps() + .getWithResponse(resourceGroupName, serverName, jobAgentName, jobName, stepName, context) + .getValue(); + return this; + } + + public JobStepImpl withStepId(Integer stepId) { + this.innerModel().withStepId(stepId); + return this; + } + + public JobStepImpl withTargetGroup(String targetGroup) { + this.innerModel().withTargetGroup(targetGroup); + return this; + } + + public JobStepImpl withCredential(String credential) { + this.innerModel().withCredential(credential); + return this; + } + + public JobStepImpl withAction(JobStepAction action) { + this.innerModel().withAction(action); + return this; + } + + public JobStepImpl withOutput(JobStepOutput output) { + this.innerModel().withOutput(output); + return this; + } + + public JobStepImpl withExecutionOptions(JobStepExecutionOptions executionOptions) { + this.innerModel().withExecutionOptions(executionOptions); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobStepsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobStepsClientImpl.java new file mode 100644 index 0000000000000..5c518af61b157 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobStepsClientImpl.java @@ -0,0 +1,1665 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.JobStepsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.JobStepInner; +import com.azure.resourcemanager.sql.generated.models.JobStepListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in JobStepsClient. */ +public final class JobStepsClientImpl implements JobStepsClient { + /** The proxy service used to perform REST calls. */ + private final JobStepsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of JobStepsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + JobStepsClientImpl(SqlManagementClientImpl client) { + this.service = RestProxy.create(JobStepsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientJobSteps to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientJ") + public interface JobStepsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/versions/{jobVersion}/steps") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByVersion( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("jobName") String jobName, + @PathParam("jobVersion") int jobVersion, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/versions/{jobVersion}/steps/{stepName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByVersion( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("jobName") String jobName, + @PathParam("jobVersion") int jobVersion, + @PathParam("stepName") String stepName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/steps") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByJob( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("jobName") String jobName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/steps/{stepName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("jobName") String jobName, + @PathParam("stepName") String stepName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/steps/{stepName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("jobName") String jobName, + @PathParam("stepName") String stepName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") JobStepInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/steps/{stepName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("jobName") String jobName, + @PathParam("stepName") String stepName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByVersionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByJobNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all job steps in the specified job version along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByVersionSinglePageAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName, int jobVersion) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByVersion( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobVersion, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all job steps in the specified job version along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByVersionSinglePageAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + int jobVersion, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByVersion( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobVersion, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all job steps in the specified job version as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByVersionAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName, int jobVersion) { + return new PagedFlux<>( + () -> listByVersionSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion), + nextLink -> listByVersionNextSinglePageAsync(nextLink)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all job steps in the specified job version as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByVersionAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + int jobVersion, + Context context) { + return new PagedFlux<>( + () -> + listByVersionSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion, context), + nextLink -> listByVersionNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all job steps in the specified job version as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByVersion( + String resourceGroupName, String serverName, String jobAgentName, String jobName, int jobVersion) { + return new PagedIterable<>( + listByVersionAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all job steps in the specified job version as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByVersion( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + int jobVersion, + Context context) { + return new PagedIterable<>( + listByVersionAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified version of a job step along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByVersionWithResponseAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + int jobVersion, + String stepName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (stepName == null) { + return Mono.error(new IllegalArgumentException("Parameter stepName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByVersion( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobVersion, + stepName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified version of a job step along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByVersionWithResponseAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + int jobVersion, + String stepName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (stepName == null) { + return Mono.error(new IllegalArgumentException("Parameter stepName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByVersion( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobVersion, + stepName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified version of a job step on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByVersionAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + int jobVersion, + String stepName) { + return getByVersionWithResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion, stepName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified version of a job step along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByVersionWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + int jobVersion, + String stepName, + Context context) { + return getByVersionWithResponseAsync( + resourceGroupName, serverName, jobAgentName, jobName, jobVersion, stepName, context) + .block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified version of a job step. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobStepInner getByVersion( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + int jobVersion, + String stepName) { + return getByVersionWithResponse( + resourceGroupName, serverName, jobAgentName, jobName, jobVersion, stepName, Context.NONE) + .getValue(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all job steps for a job's current version along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByJobSinglePageAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByJob( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all job steps for a job's current version along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByJobSinglePageAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByJob( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all job steps for a job's current version as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByJobAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName) { + return new PagedFlux<>( + () -> listByJobSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName), + nextLink -> listByJobNextSinglePageAsync(nextLink)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all job steps for a job's current version as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByJobAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName, Context context) { + return new PagedFlux<>( + () -> listByJobSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, context), + nextLink -> listByJobNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all job steps for a job's current version as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByJob( + String resourceGroupName, String serverName, String jobAgentName, String jobName) { + return new PagedIterable<>(listByJobAsync(resourceGroupName, serverName, jobAgentName, jobName)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all job steps for a job's current version as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByJob( + String resourceGroupName, String serverName, String jobAgentName, String jobName, Context context) { + return new PagedIterable<>(listByJobAsync(resourceGroupName, serverName, jobAgentName, jobName, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job step in a job's current version along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName, String stepName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (stepName == null) { + return Mono.error(new IllegalArgumentException("Parameter stepName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + stepName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job step in a job's current version along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + String stepName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (stepName == null) { + return Mono.error(new IllegalArgumentException("Parameter stepName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + stepName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job step in a job's current version on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName, String stepName) { + return getWithResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, stepName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job step in a job's current version along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + String stepName, + Context context) { + return getWithResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, stepName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job step in a job's current version. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobStepInner get( + String resourceGroupName, String serverName, String jobAgentName, String jobName, String stepName) { + return getWithResponse(resourceGroupName, serverName, jobAgentName, jobName, stepName, Context.NONE).getValue(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job step along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + String stepName, + JobStepInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (stepName == null) { + return Mono.error(new IllegalArgumentException("Parameter stepName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + stepName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job step along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + String stepName, + JobStepInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (stepName == null) { + return Mono.error(new IllegalArgumentException("Parameter stepName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + stepName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job step on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + String stepName, + JobStepInner parameters) { + return createOrUpdateWithResponseAsync( + resourceGroupName, serverName, jobAgentName, jobName, stepName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job step along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + String stepName, + JobStepInner parameters, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, serverName, jobAgentName, jobName, stepName, parameters, context) + .block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job step. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobStepInner createOrUpdate( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + String stepName, + JobStepInner parameters) { + return createOrUpdateWithResponse( + resourceGroupName, serverName, jobAgentName, jobName, stepName, parameters, Context.NONE) + .getValue(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName, String stepName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (stepName == null) { + return Mono.error(new IllegalArgumentException("Parameter stepName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + stepName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + String stepName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (stepName == null) { + return Mono.error(new IllegalArgumentException("Parameter stepName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + stepName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName, String stepName) { + return deleteWithResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, stepName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + String stepName, + Context context) { + return deleteWithResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, stepName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, String serverName, String jobAgentName, String jobName, String stepName) { + deleteWithResponse(resourceGroupName, serverName, jobAgentName, jobName, stepName, Context.NONE); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job steps along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByVersionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByVersionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job steps along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByVersionNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByVersionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job steps along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByJobNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByJobNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job steps along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByJobNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByJobNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobStepsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobStepsImpl.java new file mode 100644 index 0000000000000..9b9504ffac7d6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobStepsImpl.java @@ -0,0 +1,328 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.JobStepsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.JobStepInner; +import com.azure.resourcemanager.sql.generated.models.JobStep; +import com.azure.resourcemanager.sql.generated.models.JobSteps; + +public final class JobStepsImpl implements JobSteps { + private static final ClientLogger LOGGER = new ClientLogger(JobStepsImpl.class); + + private final JobStepsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public JobStepsImpl(JobStepsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByVersion( + String resourceGroupName, String serverName, String jobAgentName, String jobName, int jobVersion) { + PagedIterable inner = + this.serviceClient().listByVersion(resourceGroupName, serverName, jobAgentName, jobName, jobVersion); + return Utils.mapPage(inner, inner1 -> new JobStepImpl(inner1, this.manager())); + } + + public PagedIterable listByVersion( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + int jobVersion, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByVersion(resourceGroupName, serverName, jobAgentName, jobName, jobVersion, context); + return Utils.mapPage(inner, inner1 -> new JobStepImpl(inner1, this.manager())); + } + + public Response getByVersionWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + int jobVersion, + String stepName, + Context context) { + Response inner = + this + .serviceClient() + .getByVersionWithResponse( + resourceGroupName, serverName, jobAgentName, jobName, jobVersion, stepName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new JobStepImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public JobStep getByVersion( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + int jobVersion, + String stepName) { + JobStepInner inner = + this + .serviceClient() + .getByVersion(resourceGroupName, serverName, jobAgentName, jobName, jobVersion, stepName); + if (inner != null) { + return new JobStepImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listByJob( + String resourceGroupName, String serverName, String jobAgentName, String jobName) { + PagedIterable inner = + this.serviceClient().listByJob(resourceGroupName, serverName, jobAgentName, jobName); + return Utils.mapPage(inner, inner1 -> new JobStepImpl(inner1, this.manager())); + } + + public PagedIterable listByJob( + String resourceGroupName, String serverName, String jobAgentName, String jobName, Context context) { + PagedIterable inner = + this.serviceClient().listByJob(resourceGroupName, serverName, jobAgentName, jobName, context); + return Utils.mapPage(inner, inner1 -> new JobStepImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + String stepName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, serverName, jobAgentName, jobName, stepName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new JobStepImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public JobStep get( + String resourceGroupName, String serverName, String jobAgentName, String jobName, String stepName) { + JobStepInner inner = this.serviceClient().get(resourceGroupName, serverName, jobAgentName, jobName, stepName); + if (inner != null) { + return new JobStepImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + String stepName, + Context context) { + return this + .serviceClient() + .deleteWithResponse(resourceGroupName, serverName, jobAgentName, jobName, stepName, context); + } + + public void delete( + String resourceGroupName, String serverName, String jobAgentName, String jobName, String stepName) { + this.serviceClient().delete(resourceGroupName, serverName, jobAgentName, jobName, stepName); + } + + public JobStep getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String jobAgentName = Utils.getValueFromIdByName(id, "jobAgents"); + if (jobAgentName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobAgents'.", id))); + } + String jobName = Utils.getValueFromIdByName(id, "jobs"); + if (jobName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobs'.", id))); + } + String stepName = Utils.getValueFromIdByName(id, "steps"); + if (stepName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'steps'.", id))); + } + return this + .getWithResponse(resourceGroupName, serverName, jobAgentName, jobName, stepName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String jobAgentName = Utils.getValueFromIdByName(id, "jobAgents"); + if (jobAgentName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobAgents'.", id))); + } + String jobName = Utils.getValueFromIdByName(id, "jobs"); + if (jobName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobs'.", id))); + } + String stepName = Utils.getValueFromIdByName(id, "steps"); + if (stepName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'steps'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, jobAgentName, jobName, stepName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String jobAgentName = Utils.getValueFromIdByName(id, "jobAgents"); + if (jobAgentName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobAgents'.", id))); + } + String jobName = Utils.getValueFromIdByName(id, "jobs"); + if (jobName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobs'.", id))); + } + String stepName = Utils.getValueFromIdByName(id, "steps"); + if (stepName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'steps'.", id))); + } + this.deleteWithResponse(resourceGroupName, serverName, jobAgentName, jobName, stepName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String jobAgentName = Utils.getValueFromIdByName(id, "jobAgents"); + if (jobAgentName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobAgents'.", id))); + } + String jobName = Utils.getValueFromIdByName(id, "jobs"); + if (jobName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobs'.", id))); + } + String stepName = Utils.getValueFromIdByName(id, "steps"); + if (stepName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'steps'.", id))); + } + return this.deleteWithResponse(resourceGroupName, serverName, jobAgentName, jobName, stepName, context); + } + + private JobStepsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public JobStepImpl define(String name) { + return new JobStepImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobTargetExecutionsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobTargetExecutionsClientImpl.java new file mode 100644 index 0000000000000..5925efd09cc36 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobTargetExecutionsClientImpl.java @@ -0,0 +1,1474 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.JobTargetExecutionsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.JobExecutionInner; +import com.azure.resourcemanager.sql.generated.models.JobExecutionListResult; +import java.time.OffsetDateTime; +import java.util.UUID; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in JobTargetExecutionsClient. */ +public final class JobTargetExecutionsClientImpl implements JobTargetExecutionsClient { + /** The proxy service used to perform REST calls. */ + private final JobTargetExecutionsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of JobTargetExecutionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + JobTargetExecutionsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(JobTargetExecutionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientJobTargetExecutions to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientJ") + public interface JobTargetExecutionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}/targets") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByJobExecution( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("jobName") String jobName, + @PathParam("jobExecutionId") UUID jobExecutionId, + @QueryParam("createTimeMin") OffsetDateTime createTimeMin, + @QueryParam("createTimeMax") OffsetDateTime createTimeMax, + @QueryParam("endTimeMin") OffsetDateTime endTimeMin, + @QueryParam("endTimeMax") OffsetDateTime endTimeMax, + @QueryParam("isActive") Boolean isActive, + @QueryParam("$skip") Integer skip, + @QueryParam("$top") Integer top, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}/steps/{stepName}" + + "/targets") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByStep( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("jobName") String jobName, + @PathParam("jobExecutionId") UUID jobExecutionId, + @PathParam("stepName") String stepName, + @QueryParam("createTimeMin") OffsetDateTime createTimeMin, + @QueryParam("createTimeMax") OffsetDateTime createTimeMax, + @QueryParam("endTimeMin") OffsetDateTime endTimeMin, + @QueryParam("endTimeMax") OffsetDateTime endTimeMax, + @QueryParam("isActive") Boolean isActive, + @QueryParam("$skip") Integer skip, + @QueryParam("$top") Integer top, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/executions/{jobExecutionId}/steps/{stepName}" + + "/targets/{targetId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("jobName") String jobName, + @PathParam("jobExecutionId") UUID jobExecutionId, + @PathParam("stepName") String stepName, + @PathParam("targetId") UUID targetId, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByJobExecutionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByStepNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByJobExecutionSinglePageAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (jobExecutionId == null) { + return Mono.error(new IllegalArgumentException("Parameter jobExecutionId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByJobExecution( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByJobExecutionSinglePageAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (jobExecutionId == null) { + return Mono.error(new IllegalArgumentException("Parameter jobExecutionId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByJobExecution( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByJobExecutionAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top) { + return new PagedFlux<>( + () -> + listByJobExecutionSinglePageAsync( + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top), + nextLink -> listByJobExecutionNextSinglePageAsync(nextLink)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByJobExecutionAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + final OffsetDateTime createTimeMin = null; + final OffsetDateTime createTimeMax = null; + final OffsetDateTime endTimeMin = null; + final OffsetDateTime endTimeMax = null; + final Boolean isActive = null; + final Integer skip = null; + final Integer top = null; + return new PagedFlux<>( + () -> + listByJobExecutionSinglePageAsync( + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top), + nextLink -> listByJobExecutionNextSinglePageAsync(nextLink)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByJobExecutionAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + Context context) { + return new PagedFlux<>( + () -> + listByJobExecutionSinglePageAsync( + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top, + context), + nextLink -> listByJobExecutionNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByJobExecution( + String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + final OffsetDateTime createTimeMin = null; + final OffsetDateTime createTimeMax = null; + final OffsetDateTime endTimeMin = null; + final OffsetDateTime endTimeMax = null; + final Boolean isActive = null; + final Integer skip = null; + final Integer top = null; + return new PagedIterable<>( + listByJobExecutionAsync( + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByJobExecution( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + Context context) { + return new PagedIterable<>( + listByJobExecutionAsync( + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top, + context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByStepSinglePageAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (jobExecutionId == null) { + return Mono.error(new IllegalArgumentException("Parameter jobExecutionId is required and cannot be null.")); + } + if (stepName == null) { + return Mono.error(new IllegalArgumentException("Parameter stepName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByStep( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + stepName, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByStepSinglePageAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (jobExecutionId == null) { + return Mono.error(new IllegalArgumentException("Parameter jobExecutionId is required and cannot be null.")); + } + if (stepName == null) { + return Mono.error(new IllegalArgumentException("Parameter stepName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByStep( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + stepName, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByStepAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top) { + return new PagedFlux<>( + () -> + listByStepSinglePageAsync( + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + stepName, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top), + nextLink -> listByStepNextSinglePageAsync(nextLink)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByStepAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName) { + final OffsetDateTime createTimeMin = null; + final OffsetDateTime createTimeMax = null; + final OffsetDateTime endTimeMin = null; + final OffsetDateTime endTimeMax = null; + final Boolean isActive = null; + final Integer skip = null; + final Integer top = null; + return new PagedFlux<>( + () -> + listByStepSinglePageAsync( + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + stepName, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top), + nextLink -> listByStepNextSinglePageAsync(nextLink)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByStepAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + Context context) { + return new PagedFlux<>( + () -> + listByStepSinglePageAsync( + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + stepName, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top, + context), + nextLink -> listByStepNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByStep( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName) { + final OffsetDateTime createTimeMin = null; + final OffsetDateTime createTimeMax = null; + final OffsetDateTime endTimeMin = null; + final OffsetDateTime endTimeMax = null; + final Boolean isActive = null; + final Integer skip = null; + final Integer top = null; + return new PagedIterable<>( + listByStepAsync( + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + stepName, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByStep( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + Context context) { + return new PagedIterable<>( + listByStepAsync( + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + stepName, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top, + context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a target execution along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName, + UUID targetId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (jobExecutionId == null) { + return Mono.error(new IllegalArgumentException("Parameter jobExecutionId is required and cannot be null.")); + } + if (stepName == null) { + return Mono.error(new IllegalArgumentException("Parameter stepName is required and cannot be null.")); + } + if (targetId == null) { + return Mono.error(new IllegalArgumentException("Parameter targetId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + stepName, + targetId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a target execution along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName, + UUID targetId, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (jobExecutionId == null) { + return Mono.error(new IllegalArgumentException("Parameter jobExecutionId is required and cannot be null.")); + } + if (stepName == null) { + return Mono.error(new IllegalArgumentException("Parameter stepName is required and cannot be null.")); + } + if (targetId == null) { + return Mono.error(new IllegalArgumentException("Parameter targetId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + stepName, + targetId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a target execution on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName, + UUID targetId) { + return getWithResponseAsync( + resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName, targetId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a target execution along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName, + UUID targetId, + Context context) { + return getWithResponseAsync( + resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName, targetId, context) + .block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a target execution. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobExecutionInner get( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName, + UUID targetId) { + return getWithResponse( + resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName, targetId, Context.NONE) + .getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByJobExecutionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByJobExecutionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByJobExecutionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByJobExecutionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByStepNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByStepNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByStepNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByStepNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobTargetExecutionsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobTargetExecutionsImpl.java new file mode 100644 index 0000000000000..1350a0b01af89 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobTargetExecutionsImpl.java @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.JobTargetExecutionsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.JobExecutionInner; +import com.azure.resourcemanager.sql.generated.models.JobExecution; +import com.azure.resourcemanager.sql.generated.models.JobTargetExecutions; +import java.time.OffsetDateTime; +import java.util.UUID; + +public final class JobTargetExecutionsImpl implements JobTargetExecutions { + private static final ClientLogger LOGGER = new ClientLogger(JobTargetExecutionsImpl.class); + + private final JobTargetExecutionsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public JobTargetExecutionsImpl( + JobTargetExecutionsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByJobExecution( + String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) { + PagedIterable inner = + this + .serviceClient() + .listByJobExecution(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId); + return Utils.mapPage(inner, inner1 -> new JobExecutionImpl(inner1, this.manager())); + } + + public PagedIterable listByJobExecution( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByJobExecution( + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top, + context); + return Utils.mapPage(inner, inner1 -> new JobExecutionImpl(inner1, this.manager())); + } + + public PagedIterable listByStep( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName) { + PagedIterable inner = + this + .serviceClient() + .listByStep(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName); + return Utils.mapPage(inner, inner1 -> new JobExecutionImpl(inner1, this.manager())); + } + + public PagedIterable listByStep( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByStep( + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobExecutionId, + stepName, + createTimeMin, + createTimeMax, + endTimeMin, + endTimeMax, + isActive, + skip, + top, + context); + return Utils.mapPage(inner, inner1 -> new JobExecutionImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName, + UUID targetId, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse( + resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName, targetId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new JobExecutionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public JobExecution get( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName, + UUID targetId) { + JobExecutionInner inner = + this + .serviceClient() + .get(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId, stepName, targetId); + if (inner != null) { + return new JobExecutionImpl(inner, this.manager()); + } else { + return null; + } + } + + private JobTargetExecutionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobTargetGroupImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobTargetGroupImpl.java new file mode 100644 index 0000000000000..b6eefa3dd813c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobTargetGroupImpl.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.JobTargetGroupInner; +import com.azure.resourcemanager.sql.generated.models.JobTarget; +import com.azure.resourcemanager.sql.generated.models.JobTargetGroup; +import java.util.Collections; +import java.util.List; + +public final class JobTargetGroupImpl implements JobTargetGroup, JobTargetGroup.Definition, JobTargetGroup.Update { + private JobTargetGroupInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public List members() { + List inner = this.innerModel().members(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public JobTargetGroupInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String jobAgentName; + + private String targetGroupName; + + public JobTargetGroupImpl withExistingJobAgent(String resourceGroupName, String serverName, String jobAgentName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.jobAgentName = jobAgentName; + return this; + } + + public JobTargetGroup create() { + this.innerObject = + serviceManager + .serviceClient() + .getJobTargetGroups() + .createOrUpdateWithResponse( + resourceGroupName, serverName, jobAgentName, targetGroupName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public JobTargetGroup create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getJobTargetGroups() + .createOrUpdateWithResponse( + resourceGroupName, serverName, jobAgentName, targetGroupName, this.innerModel(), context) + .getValue(); + return this; + } + + JobTargetGroupImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new JobTargetGroupInner(); + this.serviceManager = serviceManager; + this.targetGroupName = name; + } + + public JobTargetGroupImpl update() { + return this; + } + + public JobTargetGroup apply() { + this.innerObject = + serviceManager + .serviceClient() + .getJobTargetGroups() + .createOrUpdateWithResponse( + resourceGroupName, serverName, jobAgentName, targetGroupName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public JobTargetGroup apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getJobTargetGroups() + .createOrUpdateWithResponse( + resourceGroupName, serverName, jobAgentName, targetGroupName, this.innerModel(), context) + .getValue(); + return this; + } + + JobTargetGroupImpl( + JobTargetGroupInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.jobAgentName = Utils.getValueFromIdByName(innerObject.id(), "jobAgents"); + this.targetGroupName = Utils.getValueFromIdByName(innerObject.id(), "targetGroups"); + } + + public JobTargetGroup refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getJobTargetGroups() + .getWithResponse(resourceGroupName, serverName, jobAgentName, targetGroupName, Context.NONE) + .getValue(); + return this; + } + + public JobTargetGroup refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getJobTargetGroups() + .getWithResponse(resourceGroupName, serverName, jobAgentName, targetGroupName, context) + .getValue(); + return this; + } + + public JobTargetGroupImpl withMembers(List members) { + this.innerModel().withMembers(members); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobTargetGroupsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobTargetGroupsClientImpl.java new file mode 100644 index 0000000000000..bb342dca9c0e0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobTargetGroupsClientImpl.java @@ -0,0 +1,990 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.JobTargetGroupsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.JobTargetGroupInner; +import com.azure.resourcemanager.sql.generated.models.JobTargetGroupListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in JobTargetGroupsClient. */ +public final class JobTargetGroupsClientImpl implements JobTargetGroupsClient { + /** The proxy service used to perform REST calls. */ + private final JobTargetGroupsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of JobTargetGroupsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + JobTargetGroupsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(JobTargetGroupsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientJobTargetGroups to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientJ") + public interface JobTargetGroupsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/targetGroups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByAgent( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/targetGroups/{targetGroupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("targetGroupName") String targetGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/targetGroups/{targetGroupName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("targetGroupName") String targetGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") JobTargetGroupInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/targetGroups/{targetGroupName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("targetGroupName") String targetGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByAgentNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all target groups in an agent along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByAgentSinglePageAsync( + String resourceGroupName, String serverName, String jobAgentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByAgent( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all target groups in an agent along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByAgentSinglePageAsync( + String resourceGroupName, String serverName, String jobAgentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByAgent( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all target groups in an agent as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByAgentAsync( + String resourceGroupName, String serverName, String jobAgentName) { + return new PagedFlux<>( + () -> listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName), + nextLink -> listByAgentNextSinglePageAsync(nextLink)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all target groups in an agent as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByAgentAsync( + String resourceGroupName, String serverName, String jobAgentName, Context context) { + return new PagedFlux<>( + () -> listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName, context), + nextLink -> listByAgentNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all target groups in an agent as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByAgent( + String resourceGroupName, String serverName, String jobAgentName) { + return new PagedIterable<>(listByAgentAsync(resourceGroupName, serverName, jobAgentName)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all target groups in an agent as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByAgent( + String resourceGroupName, String serverName, String jobAgentName, Context context) { + return new PagedIterable<>(listByAgentAsync(resourceGroupName, serverName, jobAgentName, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a target group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String jobAgentName, String targetGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (targetGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter targetGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + targetGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a target group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String jobAgentName, String targetGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (targetGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter targetGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + targetGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a target group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String jobAgentName, String targetGroupName) { + return getWithResponseAsync(resourceGroupName, serverName, jobAgentName, targetGroupName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a target group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String jobAgentName, String targetGroupName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, jobAgentName, targetGroupName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a target group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobTargetGroupInner get( + String resourceGroupName, String serverName, String jobAgentName, String targetGroupName) { + return getWithResponse(resourceGroupName, serverName, jobAgentName, targetGroupName, Context.NONE).getValue(); + } + + /** + * 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 parameters The requested state of the target group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a group of job targets along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String targetGroupName, + JobTargetGroupInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (targetGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter targetGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + targetGroupName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 parameters The requested state of the target group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a group of job targets along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String targetGroupName, + JobTargetGroupInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (targetGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter targetGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + targetGroupName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 parameters The requested state of the target group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a group of job targets on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String targetGroupName, + JobTargetGroupInner parameters) { + return createOrUpdateWithResponseAsync(resourceGroupName, serverName, jobAgentName, targetGroupName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 parameters The requested state of the target group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a group of job targets along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String targetGroupName, + JobTargetGroupInner parameters, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, serverName, jobAgentName, targetGroupName, parameters, context) + .block(); + } + + /** + * 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 parameters The requested state of the target group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a group of job targets. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobTargetGroupInner createOrUpdate( + String resourceGroupName, + String serverName, + String jobAgentName, + String targetGroupName, + JobTargetGroupInner parameters) { + return createOrUpdateWithResponse( + resourceGroupName, serverName, jobAgentName, targetGroupName, parameters, Context.NONE) + .getValue(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String serverName, String jobAgentName, String targetGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (targetGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter targetGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + targetGroupName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String serverName, String jobAgentName, String targetGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (targetGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter targetGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + targetGroupName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String serverName, String jobAgentName, String targetGroupName) { + return deleteWithResponseAsync(resourceGroupName, serverName, jobAgentName, targetGroupName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, String serverName, String jobAgentName, String targetGroupName, Context context) { + return deleteWithResponseAsync(resourceGroupName, serverName, jobAgentName, targetGroupName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName) { + deleteWithResponse(resourceGroupName, serverName, jobAgentName, targetGroupName, Context.NONE); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of target groups along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByAgentNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByAgentNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of target groups along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByAgentNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByAgentNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobTargetGroupsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobTargetGroupsImpl.java new file mode 100644 index 0000000000000..a4a7ec6d12ced --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobTargetGroupsImpl.java @@ -0,0 +1,225 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.JobTargetGroupsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.JobTargetGroupInner; +import com.azure.resourcemanager.sql.generated.models.JobTargetGroup; +import com.azure.resourcemanager.sql.generated.models.JobTargetGroups; + +public final class JobTargetGroupsImpl implements JobTargetGroups { + private static final ClientLogger LOGGER = new ClientLogger(JobTargetGroupsImpl.class); + + private final JobTargetGroupsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public JobTargetGroupsImpl( + JobTargetGroupsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByAgent(String resourceGroupName, String serverName, String jobAgentName) { + PagedIterable inner = + this.serviceClient().listByAgent(resourceGroupName, serverName, jobAgentName); + return Utils.mapPage(inner, inner1 -> new JobTargetGroupImpl(inner1, this.manager())); + } + + public PagedIterable listByAgent( + String resourceGroupName, String serverName, String jobAgentName, Context context) { + PagedIterable inner = + this.serviceClient().listByAgent(resourceGroupName, serverName, jobAgentName, context); + return Utils.mapPage(inner, inner1 -> new JobTargetGroupImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String jobAgentName, String targetGroupName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, jobAgentName, targetGroupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new JobTargetGroupImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public JobTargetGroup get( + String resourceGroupName, String serverName, String jobAgentName, String targetGroupName) { + JobTargetGroupInner inner = + this.serviceClient().get(resourceGroupName, serverName, jobAgentName, targetGroupName); + if (inner != null) { + return new JobTargetGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse( + String resourceGroupName, String serverName, String jobAgentName, String targetGroupName, Context context) { + return this + .serviceClient() + .deleteWithResponse(resourceGroupName, serverName, jobAgentName, targetGroupName, context); + } + + public void delete(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName) { + this.serviceClient().delete(resourceGroupName, serverName, jobAgentName, targetGroupName); + } + + public JobTargetGroup getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String jobAgentName = Utils.getValueFromIdByName(id, "jobAgents"); + if (jobAgentName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobAgents'.", id))); + } + String targetGroupName = Utils.getValueFromIdByName(id, "targetGroups"); + if (targetGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'targetGroups'.", id))); + } + return this + .getWithResponse(resourceGroupName, serverName, jobAgentName, targetGroupName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String jobAgentName = Utils.getValueFromIdByName(id, "jobAgents"); + if (jobAgentName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobAgents'.", id))); + } + String targetGroupName = Utils.getValueFromIdByName(id, "targetGroups"); + if (targetGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'targetGroups'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, jobAgentName, targetGroupName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String jobAgentName = Utils.getValueFromIdByName(id, "jobAgents"); + if (jobAgentName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobAgents'.", id))); + } + String targetGroupName = Utils.getValueFromIdByName(id, "targetGroups"); + if (targetGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'targetGroups'.", id))); + } + this.deleteWithResponse(resourceGroupName, serverName, jobAgentName, targetGroupName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String jobAgentName = Utils.getValueFromIdByName(id, "jobAgents"); + if (jobAgentName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobAgents'.", id))); + } + String targetGroupName = Utils.getValueFromIdByName(id, "targetGroups"); + if (targetGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'targetGroups'.", id))); + } + return this.deleteWithResponse(resourceGroupName, serverName, jobAgentName, targetGroupName, context); + } + + private JobTargetGroupsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public JobTargetGroupImpl define(String name) { + return new JobTargetGroupImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobVersionImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobVersionImpl.java new file mode 100644 index 0000000000000..1bcd2181deb00 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobVersionImpl.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.JobVersionInner; +import com.azure.resourcemanager.sql.generated.models.JobVersion; + +public final class JobVersionImpl implements JobVersion { + private JobVersionInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + JobVersionImpl(JobVersionInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public JobVersionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobVersionsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobVersionsClientImpl.java new file mode 100644 index 0000000000000..ef44b0c22b504 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobVersionsClientImpl.java @@ -0,0 +1,590 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.JobVersionsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.JobVersionInner; +import com.azure.resourcemanager.sql.generated.models.JobVersionListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in JobVersionsClient. */ +public final class JobVersionsClientImpl implements JobVersionsClient { + /** The proxy service used to perform REST calls. */ + private final JobVersionsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of JobVersionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + JobVersionsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(JobVersionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientJobVersions to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientJ") + public interface JobVersionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/versions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByJob( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("jobName") String jobName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}/versions/{jobVersion}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("jobName") String jobName, + @PathParam("jobVersion") int jobVersion, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByJobNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all versions of a job along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByJobSinglePageAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByJob( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all versions of a job along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByJobSinglePageAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByJob( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all versions of a job as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByJobAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName) { + return new PagedFlux<>( + () -> listByJobSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName), + nextLink -> listByJobNextSinglePageAsync(nextLink)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all versions of a job as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByJobAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName, Context context) { + return new PagedFlux<>( + () -> listByJobSinglePageAsync(resourceGroupName, serverName, jobAgentName, jobName, context), + nextLink -> listByJobNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all versions of a job as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByJob( + String resourceGroupName, String serverName, String jobAgentName, String jobName) { + return new PagedIterable<>(listByJobAsync(resourceGroupName, serverName, jobAgentName, jobName)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all versions of a job as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByJob( + String resourceGroupName, String serverName, String jobAgentName, String jobName, Context context) { + return new PagedIterable<>(listByJobAsync(resourceGroupName, serverName, jobAgentName, jobName, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job version along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName, int jobVersion) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobVersion, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job version along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + int jobVersion, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + jobVersion, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job version on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName, int jobVersion) { + return getWithResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job version along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + int jobVersion, + Context context) { + return getWithResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobVersion, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job version. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobVersionInner get( + String resourceGroupName, String serverName, String jobAgentName, String jobName, int jobVersion) { + return getWithResponse(resourceGroupName, serverName, jobAgentName, jobName, jobVersion, Context.NONE) + .getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job versions along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByJobNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByJobNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job versions along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByJobNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByJobNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobVersionsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobVersionsImpl.java new file mode 100644 index 0000000000000..ac4f52c7fce27 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobVersionsImpl.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.JobVersionsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.JobVersionInner; +import com.azure.resourcemanager.sql.generated.models.JobVersion; +import com.azure.resourcemanager.sql.generated.models.JobVersions; + +public final class JobVersionsImpl implements JobVersions { + private static final ClientLogger LOGGER = new ClientLogger(JobVersionsImpl.class); + + private final JobVersionsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public JobVersionsImpl( + JobVersionsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByJob( + String resourceGroupName, String serverName, String jobAgentName, String jobName) { + PagedIterable inner = + this.serviceClient().listByJob(resourceGroupName, serverName, jobAgentName, jobName); + return Utils.mapPage(inner, inner1 -> new JobVersionImpl(inner1, this.manager())); + } + + public PagedIterable listByJob( + String resourceGroupName, String serverName, String jobAgentName, String jobName, Context context) { + PagedIterable inner = + this.serviceClient().listByJob(resourceGroupName, serverName, jobAgentName, jobName, context); + return Utils.mapPage(inner, inner1 -> new JobVersionImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + int jobVersion, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, serverName, jobAgentName, jobName, jobVersion, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new JobVersionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public JobVersion get( + String resourceGroupName, String serverName, String jobAgentName, String jobName, int jobVersion) { + JobVersionInner inner = + this.serviceClient().get(resourceGroupName, serverName, jobAgentName, jobName, jobVersion); + if (inner != null) { + return new JobVersionImpl(inner, this.manager()); + } else { + return null; + } + } + + private JobVersionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobsClientImpl.java new file mode 100644 index 0000000000000..851754344b2f9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobsClientImpl.java @@ -0,0 +1,966 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.JobsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.JobInner; +import com.azure.resourcemanager.sql.generated.models.JobListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in JobsClient. */ +public final class JobsClientImpl implements JobsClient { + /** The proxy service used to perform REST calls. */ + private final JobsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of JobsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + JobsClientImpl(SqlManagementClientImpl client) { + this.service = RestProxy.create(JobsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientJobs to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientJ") + public interface JobsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/jobs") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByAgent( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("jobName") String jobName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("jobName") String jobName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") JobInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/jobAgents/{jobAgentName}/jobs/{jobName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("jobAgentName") String jobAgentName, + @PathParam("jobName") String jobName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByAgentNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of jobs along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByAgentSinglePageAsync( + String resourceGroupName, String serverName, String jobAgentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByAgent( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of jobs along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByAgentSinglePageAsync( + String resourceGroupName, String serverName, String jobAgentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByAgent( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of jobs as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByAgentAsync(String resourceGroupName, String serverName, String jobAgentName) { + return new PagedFlux<>( + () -> listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName), + nextLink -> listByAgentNextSinglePageAsync(nextLink)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of jobs as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByAgentAsync( + String resourceGroupName, String serverName, String jobAgentName, Context context) { + return new PagedFlux<>( + () -> listByAgentSinglePageAsync(resourceGroupName, serverName, jobAgentName, context), + nextLink -> listByAgentNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of jobs as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByAgent(String resourceGroupName, String serverName, String jobAgentName) { + return new PagedIterable<>(listByAgentAsync(resourceGroupName, serverName, jobAgentName)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of jobs as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByAgent( + String resourceGroupName, String serverName, String jobAgentName, Context context) { + return new PagedIterable<>(listByAgentAsync(resourceGroupName, serverName, jobAgentName, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName) { + return getWithResponseAsync(resourceGroupName, serverName, jobAgentName, jobName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String jobAgentName, String jobName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobInner get(String resourceGroupName, String serverName, String jobAgentName, String jobName) { + return getWithResponse(resourceGroupName, serverName, jobAgentName, jobName, Context.NONE).getValue(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName, JobInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + JobInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName, JobInner parameters) { + return createOrUpdateWithResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + JobInner parameters, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, serverName, jobAgentName, jobName, parameters, context) + .block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobInner createOrUpdate( + String resourceGroupName, String serverName, String jobAgentName, String jobName, JobInner parameters) { + return createOrUpdateWithResponse( + resourceGroupName, serverName, jobAgentName, jobName, parameters, Context.NONE) + .getValue(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String serverName, String jobAgentName, String jobName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (jobAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + jobAgentName, + jobName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName) { + return deleteWithResponseAsync(resourceGroupName, serverName, jobAgentName, jobName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, String serverName, String jobAgentName, String jobName, Context context) { + return deleteWithResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, String jobAgentName, String jobName) { + deleteWithResponse(resourceGroupName, serverName, jobAgentName, jobName, Context.NONE); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of jobs along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByAgentNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByAgentNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of jobs along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByAgentNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByAgentNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobsImpl.java new file mode 100644 index 0000000000000..6cabcac8c6094 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/JobsImpl.java @@ -0,0 +1,217 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.JobsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.JobInner; +import com.azure.resourcemanager.sql.generated.models.Job; +import com.azure.resourcemanager.sql.generated.models.Jobs; + +public final class JobsImpl implements Jobs { + private static final ClientLogger LOGGER = new ClientLogger(JobsImpl.class); + + private final JobsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public JobsImpl(JobsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByAgent(String resourceGroupName, String serverName, String jobAgentName) { + PagedIterable inner = this.serviceClient().listByAgent(resourceGroupName, serverName, jobAgentName); + return Utils.mapPage(inner, inner1 -> new JobImpl(inner1, this.manager())); + } + + public PagedIterable listByAgent( + String resourceGroupName, String serverName, String jobAgentName, Context context) { + PagedIterable inner = + this.serviceClient().listByAgent(resourceGroupName, serverName, jobAgentName, context); + return Utils.mapPage(inner, inner1 -> new JobImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String jobAgentName, String jobName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, jobAgentName, jobName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new JobImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Job get(String resourceGroupName, String serverName, String jobAgentName, String jobName) { + JobInner inner = this.serviceClient().get(resourceGroupName, serverName, jobAgentName, jobName); + if (inner != null) { + return new JobImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse( + String resourceGroupName, String serverName, String jobAgentName, String jobName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, serverName, jobAgentName, jobName, context); + } + + public void delete(String resourceGroupName, String serverName, String jobAgentName, String jobName) { + this.serviceClient().delete(resourceGroupName, serverName, jobAgentName, jobName); + } + + public Job getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String jobAgentName = Utils.getValueFromIdByName(id, "jobAgents"); + if (jobAgentName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobAgents'.", id))); + } + String jobName = Utils.getValueFromIdByName(id, "jobs"); + if (jobName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobs'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, jobAgentName, jobName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String jobAgentName = Utils.getValueFromIdByName(id, "jobAgents"); + if (jobAgentName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobAgents'.", id))); + } + String jobName = Utils.getValueFromIdByName(id, "jobs"); + if (jobName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobs'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, jobAgentName, jobName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String jobAgentName = Utils.getValueFromIdByName(id, "jobAgents"); + if (jobAgentName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobAgents'.", id))); + } + String jobName = Utils.getValueFromIdByName(id, "jobs"); + if (jobName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobs'.", id))); + } + this.deleteWithResponse(resourceGroupName, serverName, jobAgentName, jobName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String jobAgentName = Utils.getValueFromIdByName(id, "jobAgents"); + if (jobAgentName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobAgents'.", id))); + } + String jobName = Utils.getValueFromIdByName(id, "jobs"); + if (jobName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobs'.", id))); + } + return this.deleteWithResponse(resourceGroupName, serverName, jobAgentName, jobName, context); + } + + private JobsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public JobImpl define(String name) { + return new JobImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LedgerDigestUploadsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LedgerDigestUploadsImpl.java new file mode 100644 index 0000000000000..ca87063043305 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LedgerDigestUploadsImpl.java @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.LedgerDigestUploadsInner; +import com.azure.resourcemanager.sql.generated.models.LedgerDigestUploads; +import com.azure.resourcemanager.sql.generated.models.LedgerDigestUploadsName; +import com.azure.resourcemanager.sql.generated.models.LedgerDigestUploadsState; + +public final class LedgerDigestUploadsImpl + implements LedgerDigestUploads, LedgerDigestUploads.Definition, LedgerDigestUploads.Update { + private LedgerDigestUploadsInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String digestStorageEndpoint() { + return this.innerModel().digestStorageEndpoint(); + } + + public LedgerDigestUploadsState state() { + return this.innerModel().state(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public LedgerDigestUploadsInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String databaseName; + + private LedgerDigestUploadsName ledgerDigestUploads; + + public LedgerDigestUploadsImpl withExistingDatabase( + String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + + public LedgerDigestUploads create() { + this.innerObject = + serviceManager + .serviceClient() + .getLedgerDigestUploadsOperations() + .createOrUpdate( + resourceGroupName, serverName, databaseName, ledgerDigestUploads, this.innerModel(), Context.NONE); + return this; + } + + public LedgerDigestUploads create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getLedgerDigestUploadsOperations() + .createOrUpdate( + resourceGroupName, serverName, databaseName, ledgerDigestUploads, this.innerModel(), context); + return this; + } + + LedgerDigestUploadsImpl( + LedgerDigestUploadsName name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new LedgerDigestUploadsInner(); + this.serviceManager = serviceManager; + this.ledgerDigestUploads = name; + } + + public LedgerDigestUploadsImpl update() { + return this; + } + + public LedgerDigestUploads apply() { + this.innerObject = + serviceManager + .serviceClient() + .getLedgerDigestUploadsOperations() + .createOrUpdate( + resourceGroupName, serverName, databaseName, ledgerDigestUploads, this.innerModel(), Context.NONE); + return this; + } + + public LedgerDigestUploads apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getLedgerDigestUploadsOperations() + .createOrUpdate( + resourceGroupName, serverName, databaseName, ledgerDigestUploads, this.innerModel(), context); + return this; + } + + LedgerDigestUploadsImpl( + LedgerDigestUploadsInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "databases"); + this.ledgerDigestUploads = + LedgerDigestUploadsName.fromString(Utils.getValueFromIdByName(innerObject.id(), "ledgerDigestUploads")); + } + + public LedgerDigestUploads refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getLedgerDigestUploadsOperations() + .getWithResponse(resourceGroupName, serverName, databaseName, ledgerDigestUploads, Context.NONE) + .getValue(); + return this; + } + + public LedgerDigestUploads refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getLedgerDigestUploadsOperations() + .getWithResponse(resourceGroupName, serverName, databaseName, ledgerDigestUploads, context) + .getValue(); + return this; + } + + public LedgerDigestUploads disable() { + return serviceManager + .ledgerDigestUploadsOperations() + .disable(resourceGroupName, serverName, databaseName, ledgerDigestUploads); + } + + public LedgerDigestUploads disable(Context context) { + return serviceManager + .ledgerDigestUploadsOperations() + .disable(resourceGroupName, serverName, databaseName, ledgerDigestUploads, context); + } + + public LedgerDigestUploadsImpl withDigestStorageEndpoint(String digestStorageEndpoint) { + this.innerModel().withDigestStorageEndpoint(digestStorageEndpoint); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LedgerDigestUploadsOperationsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LedgerDigestUploadsOperationsClientImpl.java new file mode 100644 index 0000000000000..a3ad9b454e2f2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LedgerDigestUploadsOperationsClientImpl.java @@ -0,0 +1,1321 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.LedgerDigestUploadsOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.LedgerDigestUploadsInner; +import com.azure.resourcemanager.sql.generated.models.LedgerDigestUploadsListResult; +import com.azure.resourcemanager.sql.generated.models.LedgerDigestUploadsName; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in LedgerDigestUploadsOperationsClient. */ +public final class LedgerDigestUploadsOperationsClientImpl implements LedgerDigestUploadsOperationsClient { + /** The proxy service used to perform REST calls. */ + private final LedgerDigestUploadsOperationsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of LedgerDigestUploadsOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + LedgerDigestUploadsOperationsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + LedgerDigestUploadsOperationsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientLedgerDigestUploadsOperations to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientL") + public interface LedgerDigestUploadsOperationsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/ledgerDigestUploads/{ledgerDigestUploads}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("ledgerDigestUploads") LedgerDigestUploadsName ledgerDigestUploads, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/ledgerDigestUploads/{ledgerDigestUploads}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("ledgerDigestUploads") LedgerDigestUploadsName ledgerDigestUploads, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") LedgerDigestUploadsInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/ledgerDigestUploads") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/ledgerDigestUploads/{ledgerDigestUploads}/disable") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> disable( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("ledgerDigestUploads") LedgerDigestUploadsName ledgerDigestUploads, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabaseNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the current ledger digest upload configuration for 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 ledgerDigestUploads The ledgerDigestUploads parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current ledger digest upload configuration for a database along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, LedgerDigestUploadsName ledgerDigestUploads) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (ledgerDigestUploads == null) { + return Mono + .error(new IllegalArgumentException("Parameter ledgerDigestUploads is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + ledgerDigestUploads, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the current ledger digest upload configuration for 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 ledgerDigestUploads The ledgerDigestUploads parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current ledger digest upload configuration for a database along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + LedgerDigestUploadsName ledgerDigestUploads, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (ledgerDigestUploads == null) { + return Mono + .error(new IllegalArgumentException("Parameter ledgerDigestUploads is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + ledgerDigestUploads, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets the current ledger digest upload configuration for 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 ledgerDigestUploads The ledgerDigestUploads parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current ledger digest upload configuration for a database on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String databaseName, LedgerDigestUploadsName ledgerDigestUploads) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, ledgerDigestUploads) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the current ledger digest upload configuration for 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 ledgerDigestUploads The ledgerDigestUploads parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current ledger digest upload configuration for a database along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + LedgerDigestUploadsName ledgerDigestUploads, + Context context) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, ledgerDigestUploads, context).block(); + } + + /** + * Gets the current ledger digest upload configuration for 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 ledgerDigestUploads The ledgerDigestUploads parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current ledger digest upload configuration for a database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LedgerDigestUploadsInner get( + String resourceGroupName, String serverName, String databaseName, LedgerDigestUploadsName ledgerDigestUploads) { + return getWithResponse(resourceGroupName, serverName, databaseName, ledgerDigestUploads, Context.NONE) + .getValue(); + } + + /** + * Enables upload ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads parameter. + * @param parameters Azure SQL Database ledger digest upload settings. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure SQL Database ledger digest upload settings along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + LedgerDigestUploadsName ledgerDigestUploads, + LedgerDigestUploadsInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (ledgerDigestUploads == null) { + return Mono + .error(new IllegalArgumentException("Parameter ledgerDigestUploads is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + ledgerDigestUploads, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Enables upload ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads parameter. + * @param parameters Azure SQL Database ledger digest upload settings. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure SQL Database ledger digest upload settings along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + LedgerDigestUploadsName ledgerDigestUploads, + LedgerDigestUploadsInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (ledgerDigestUploads == null) { + return Mono + .error(new IllegalArgumentException("Parameter ledgerDigestUploads is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + ledgerDigestUploads, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Enables upload ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads parameter. + * @param parameters Azure SQL Database ledger digest upload settings. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of azure SQL Database ledger digest upload settings. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, LedgerDigestUploadsInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + LedgerDigestUploadsName ledgerDigestUploads, + LedgerDigestUploadsInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, serverName, databaseName, ledgerDigestUploads, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + LedgerDigestUploadsInner.class, + LedgerDigestUploadsInner.class, + this.client.getContext()); + } + + /** + * Enables upload ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads parameter. + * @param parameters Azure SQL Database ledger digest upload settings. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of azure SQL Database ledger digest upload settings. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, LedgerDigestUploadsInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + LedgerDigestUploadsName ledgerDigestUploads, + LedgerDigestUploadsInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, serverName, databaseName, ledgerDigestUploads, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + LedgerDigestUploadsInner.class, + LedgerDigestUploadsInner.class, + context); + } + + /** + * Enables upload ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads parameter. + * @param parameters Azure SQL Database ledger digest upload settings. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of azure SQL Database ledger digest upload settings. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, LedgerDigestUploadsInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + LedgerDigestUploadsName ledgerDigestUploads, + LedgerDigestUploadsInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, ledgerDigestUploads, parameters) + .getSyncPoller(); + } + + /** + * Enables upload ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads parameter. + * @param parameters Azure SQL Database ledger digest upload settings. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of azure SQL Database ledger digest upload settings. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, LedgerDigestUploadsInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + LedgerDigestUploadsName ledgerDigestUploads, + LedgerDigestUploadsInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, serverName, databaseName, ledgerDigestUploads, parameters, context) + .getSyncPoller(); + } + + /** + * Enables upload ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads parameter. + * @param parameters Azure SQL Database ledger digest upload settings. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure SQL Database ledger digest upload settings on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + LedgerDigestUploadsName ledgerDigestUploads, + LedgerDigestUploadsInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, ledgerDigestUploads, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Enables upload ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads parameter. + * @param parameters Azure SQL Database ledger digest upload settings. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure SQL Database ledger digest upload settings on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + LedgerDigestUploadsName ledgerDigestUploads, + LedgerDigestUploadsInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, serverName, databaseName, ledgerDigestUploads, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Enables upload ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads parameter. + * @param parameters Azure SQL Database ledger digest upload settings. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure SQL Database ledger digest upload settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LedgerDigestUploadsInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + LedgerDigestUploadsName ledgerDigestUploads, + LedgerDigestUploadsInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, databaseName, ledgerDigestUploads, parameters) + .block(); + } + + /** + * Enables upload ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads parameter. + * @param parameters Azure SQL Database ledger digest upload settings. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure SQL Database ledger digest upload settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LedgerDigestUploadsInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + LedgerDigestUploadsName ledgerDigestUploads, + LedgerDigestUploadsInner parameters, + Context context) { + return createOrUpdateAsync( + resourceGroupName, serverName, databaseName, ledgerDigestUploads, parameters, context) + .block(); + } + + /** + * Gets all ledger digest upload settings on 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all ledger digest upload settings on a database along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets all ledger digest upload settings on 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all ledger digest upload settings on a database along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets all ledger digest upload settings on 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all ledger digest upload settings on a database as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Gets all ledger digest upload settings on 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all ledger digest upload settings on a database as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, context), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all ledger digest upload settings on 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all ledger digest upload settings on a database as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName)); + } + + /** + * Gets all ledger digest upload settings on 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all ledger digest upload settings on a database as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName, context)); + } + + /** + * Disables uploading ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure SQL Database ledger digest upload settings along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> disableWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, LedgerDigestUploadsName ledgerDigestUploads) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (ledgerDigestUploads == null) { + return Mono + .error(new IllegalArgumentException("Parameter ledgerDigestUploads is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .disable( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + ledgerDigestUploads, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Disables uploading ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure SQL Database ledger digest upload settings along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> disableWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + LedgerDigestUploadsName ledgerDigestUploads, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (ledgerDigestUploads == null) { + return Mono + .error(new IllegalArgumentException("Parameter ledgerDigestUploads is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .disable( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + ledgerDigestUploads, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Disables uploading ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of azure SQL Database ledger digest upload settings. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, LedgerDigestUploadsInner> beginDisableAsync( + String resourceGroupName, String serverName, String databaseName, LedgerDigestUploadsName ledgerDigestUploads) { + Mono>> mono = + disableWithResponseAsync(resourceGroupName, serverName, databaseName, ledgerDigestUploads); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + LedgerDigestUploadsInner.class, + LedgerDigestUploadsInner.class, + this.client.getContext()); + } + + /** + * Disables uploading ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of azure SQL Database ledger digest upload settings. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, LedgerDigestUploadsInner> beginDisableAsync( + String resourceGroupName, + String serverName, + String databaseName, + LedgerDigestUploadsName ledgerDigestUploads, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + disableWithResponseAsync(resourceGroupName, serverName, databaseName, ledgerDigestUploads, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + LedgerDigestUploadsInner.class, + LedgerDigestUploadsInner.class, + context); + } + + /** + * Disables uploading ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of azure SQL Database ledger digest upload settings. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, LedgerDigestUploadsInner> beginDisable( + String resourceGroupName, String serverName, String databaseName, LedgerDigestUploadsName ledgerDigestUploads) { + return beginDisableAsync(resourceGroupName, serverName, databaseName, ledgerDigestUploads).getSyncPoller(); + } + + /** + * Disables uploading ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of azure SQL Database ledger digest upload settings. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, LedgerDigestUploadsInner> beginDisable( + String resourceGroupName, + String serverName, + String databaseName, + LedgerDigestUploadsName ledgerDigestUploads, + Context context) { + return beginDisableAsync(resourceGroupName, serverName, databaseName, ledgerDigestUploads, context) + .getSyncPoller(); + } + + /** + * Disables uploading ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure SQL Database ledger digest upload settings on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono disableAsync( + String resourceGroupName, String serverName, String databaseName, LedgerDigestUploadsName ledgerDigestUploads) { + return beginDisableAsync(resourceGroupName, serverName, databaseName, ledgerDigestUploads) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Disables uploading ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure SQL Database ledger digest upload settings on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono disableAsync( + String resourceGroupName, + String serverName, + String databaseName, + LedgerDigestUploadsName ledgerDigestUploads, + Context context) { + return beginDisableAsync(resourceGroupName, serverName, databaseName, ledgerDigestUploads, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Disables uploading ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure SQL Database ledger digest upload settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LedgerDigestUploadsInner disable( + String resourceGroupName, String serverName, String databaseName, LedgerDigestUploadsName ledgerDigestUploads) { + return disableAsync(resourceGroupName, serverName, databaseName, ledgerDigestUploads).block(); + } + + /** + * Disables uploading ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure SQL Database ledger digest upload settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LedgerDigestUploadsInner disable( + String resourceGroupName, + String serverName, + String databaseName, + LedgerDigestUploadsName ledgerDigestUploads, + Context context) { + return disableAsync(resourceGroupName, serverName, databaseName, ledgerDigestUploads, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of ledger digest upload settings along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of ledger digest upload settings along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LedgerDigestUploadsOperationsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LedgerDigestUploadsOperationsImpl.java new file mode 100644 index 0000000000000..68d5e3593f4ef --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LedgerDigestUploadsOperationsImpl.java @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.LedgerDigestUploadsOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.LedgerDigestUploadsInner; +import com.azure.resourcemanager.sql.generated.models.LedgerDigestUploads; +import com.azure.resourcemanager.sql.generated.models.LedgerDigestUploadsName; +import com.azure.resourcemanager.sql.generated.models.LedgerDigestUploadsOperations; + +public final class LedgerDigestUploadsOperationsImpl implements LedgerDigestUploadsOperations { + private static final ClientLogger LOGGER = new ClientLogger(LedgerDigestUploadsOperationsImpl.class); + + private final LedgerDigestUploadsOperationsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public LedgerDigestUploadsOperationsImpl( + LedgerDigestUploadsOperationsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + LedgerDigestUploadsName ledgerDigestUploads, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, serverName, databaseName, ledgerDigestUploads, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new LedgerDigestUploadsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public LedgerDigestUploads get( + String resourceGroupName, String serverName, String databaseName, LedgerDigestUploadsName ledgerDigestUploads) { + LedgerDigestUploadsInner inner = + this.serviceClient().get(resourceGroupName, serverName, databaseName, ledgerDigestUploads); + if (inner != null) { + return new LedgerDigestUploadsImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName); + return Utils.mapPage(inner, inner1 -> new LedgerDigestUploadsImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName, context); + return Utils.mapPage(inner, inner1 -> new LedgerDigestUploadsImpl(inner1, this.manager())); + } + + public LedgerDigestUploads disable( + String resourceGroupName, String serverName, String databaseName, LedgerDigestUploadsName ledgerDigestUploads) { + LedgerDigestUploadsInner inner = + this.serviceClient().disable(resourceGroupName, serverName, databaseName, ledgerDigestUploads); + if (inner != null) { + return new LedgerDigestUploadsImpl(inner, this.manager()); + } else { + return null; + } + } + + public LedgerDigestUploads disable( + String resourceGroupName, + String serverName, + String databaseName, + LedgerDigestUploadsName ledgerDigestUploads, + Context context) { + LedgerDigestUploadsInner inner = + this.serviceClient().disable(resourceGroupName, serverName, databaseName, ledgerDigestUploads, context); + if (inner != null) { + return new LedgerDigestUploadsImpl(inner, this.manager()); + } else { + return null; + } + } + + public LedgerDigestUploads getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String ledgerDigestUploadsLocal = Utils.getValueFromIdByName(id, "ledgerDigestUploads"); + if (ledgerDigestUploadsLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'ledgerDigestUploads'.", id))); + } + LedgerDigestUploadsName ledgerDigestUploads = LedgerDigestUploadsName.fromString(ledgerDigestUploadsLocal); + return this + .getWithResponse(resourceGroupName, serverName, databaseName, ledgerDigestUploads, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String ledgerDigestUploadsLocal = Utils.getValueFromIdByName(id, "ledgerDigestUploads"); + if (ledgerDigestUploadsLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'ledgerDigestUploads'.", id))); + } + LedgerDigestUploadsName ledgerDigestUploads = LedgerDigestUploadsName.fromString(ledgerDigestUploadsLocal); + return this.getWithResponse(resourceGroupName, serverName, databaseName, ledgerDigestUploads, context); + } + + private LedgerDigestUploadsOperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public LedgerDigestUploadsImpl define(LedgerDigestUploadsName name) { + return new LedgerDigestUploadsImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LocationCapabilitiesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LocationCapabilitiesImpl.java new file mode 100644 index 0000000000000..74286783c119b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LocationCapabilitiesImpl.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.LocationCapabilitiesInner; +import com.azure.resourcemanager.sql.generated.models.CapabilityStatus; +import com.azure.resourcemanager.sql.generated.models.LocationCapabilities; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceVersionCapability; +import com.azure.resourcemanager.sql.generated.models.ServerVersionCapability; +import java.util.Collections; +import java.util.List; + +public final class LocationCapabilitiesImpl implements LocationCapabilities { + private LocationCapabilitiesInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + LocationCapabilitiesImpl( + LocationCapabilitiesInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public List supportedServerVersions() { + List inner = this.innerModel().supportedServerVersions(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List supportedManagedInstanceVersions() { + List inner = this.innerModel().supportedManagedInstanceVersions(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public CapabilityStatus status() { + return this.innerModel().status(); + } + + public String reason() { + return this.innerModel().reason(); + } + + public LocationCapabilitiesInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LogicalDatabaseTransparentDataEncryptionImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LogicalDatabaseTransparentDataEncryptionImpl.java new file mode 100644 index 0000000000000..87a4e2af59564 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LogicalDatabaseTransparentDataEncryptionImpl.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.LogicalDatabaseTransparentDataEncryptionInner; +import com.azure.resourcemanager.sql.generated.models.LogicalDatabaseTransparentDataEncryption; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionName; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionState; + +public final class LogicalDatabaseTransparentDataEncryptionImpl + implements LogicalDatabaseTransparentDataEncryption, + LogicalDatabaseTransparentDataEncryption.Definition, + LogicalDatabaseTransparentDataEncryption.Update { + private LogicalDatabaseTransparentDataEncryptionInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public TransparentDataEncryptionState state() { + return this.innerModel().state(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public LogicalDatabaseTransparentDataEncryptionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String databaseName; + + private TransparentDataEncryptionName tdeName; + + public LogicalDatabaseTransparentDataEncryptionImpl withExistingDatabase( + String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + + public LogicalDatabaseTransparentDataEncryption create() { + this.innerObject = + serviceManager + .serviceClient() + .getTransparentDataEncryptions() + .createOrUpdateWithResponse( + resourceGroupName, serverName, databaseName, tdeName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public LogicalDatabaseTransparentDataEncryption create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getTransparentDataEncryptions() + .createOrUpdateWithResponse( + resourceGroupName, serverName, databaseName, tdeName, this.innerModel(), context) + .getValue(); + return this; + } + + LogicalDatabaseTransparentDataEncryptionImpl( + TransparentDataEncryptionName name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new LogicalDatabaseTransparentDataEncryptionInner(); + this.serviceManager = serviceManager; + this.tdeName = name; + } + + public LogicalDatabaseTransparentDataEncryptionImpl update() { + return this; + } + + public LogicalDatabaseTransparentDataEncryption apply() { + this.innerObject = + serviceManager + .serviceClient() + .getTransparentDataEncryptions() + .createOrUpdateWithResponse( + resourceGroupName, serverName, databaseName, tdeName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public LogicalDatabaseTransparentDataEncryption apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getTransparentDataEncryptions() + .createOrUpdateWithResponse( + resourceGroupName, serverName, databaseName, tdeName, this.innerModel(), context) + .getValue(); + return this; + } + + LogicalDatabaseTransparentDataEncryptionImpl( + LogicalDatabaseTransparentDataEncryptionInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "databases"); + this.tdeName = + TransparentDataEncryptionName + .fromString(Utils.getValueFromIdByName(innerObject.id(), "transparentDataEncryption")); + } + + public LogicalDatabaseTransparentDataEncryption refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getTransparentDataEncryptions() + .getWithResponse(resourceGroupName, serverName, databaseName, tdeName, Context.NONE) + .getValue(); + return this; + } + + public LogicalDatabaseTransparentDataEncryption refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getTransparentDataEncryptions() + .getWithResponse(resourceGroupName, serverName, databaseName, tdeName, context) + .getValue(); + return this; + } + + public LogicalDatabaseTransparentDataEncryptionImpl withState(TransparentDataEncryptionState state) { + this.innerModel().withState(state); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionBackupImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionBackupImpl.java new file mode 100644 index 0000000000000..c88c00883e3cd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionBackupImpl.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.LongTermRetentionBackupInner; +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.azure.resourcemanager.sql.generated.models.LongTermRetentionBackup; +import java.time.OffsetDateTime; + +public final class LongTermRetentionBackupImpl implements LongTermRetentionBackup { + private LongTermRetentionBackupInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + LongTermRetentionBackupImpl( + LongTermRetentionBackupInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String serverName() { + return this.innerModel().serverName(); + } + + public OffsetDateTime serverCreateTime() { + return this.innerModel().serverCreateTime(); + } + + public String databaseName() { + return this.innerModel().databaseName(); + } + + public OffsetDateTime databaseDeletionTime() { + return this.innerModel().databaseDeletionTime(); + } + + public OffsetDateTime backupTime() { + return this.innerModel().backupTime(); + } + + public OffsetDateTime backupExpirationTime() { + return this.innerModel().backupExpirationTime(); + } + + public BackupStorageRedundancy backupStorageRedundancy() { + return this.innerModel().backupStorageRedundancy(); + } + + public BackupStorageRedundancy requestedBackupStorageRedundancy() { + return this.innerModel().requestedBackupStorageRedundancy(); + } + + public LongTermRetentionBackupInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionBackupOperationResultImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionBackupOperationResultImpl.java new file mode 100644 index 0000000000000..c01fb27309d45 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionBackupOperationResultImpl.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.LongTermRetentionBackupOperationResultInner; +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.azure.resourcemanager.sql.generated.models.LongTermRetentionBackupOperationResult; +import java.util.UUID; + +public final class LongTermRetentionBackupOperationResultImpl implements LongTermRetentionBackupOperationResult { + private LongTermRetentionBackupOperationResultInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + LongTermRetentionBackupOperationResultImpl( + LongTermRetentionBackupOperationResultInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public UUID requestId() { + return this.innerModel().requestId(); + } + + public String operationType() { + return this.innerModel().operationType(); + } + + public String fromBackupResourceId() { + return this.innerModel().fromBackupResourceId(); + } + + public String toBackupResourceId() { + return this.innerModel().toBackupResourceId(); + } + + public BackupStorageRedundancy targetBackupStorageRedundancy() { + return this.innerModel().targetBackupStorageRedundancy(); + } + + public String status() { + return this.innerModel().status(); + } + + public String message() { + return this.innerModel().message(); + } + + public LongTermRetentionBackupOperationResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionBackupsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionBackupsClientImpl.java new file mode 100644 index 0000000000000..0627919b1d54f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionBackupsClientImpl.java @@ -0,0 +1,5407 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.LongTermRetentionBackupsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.LongTermRetentionBackupInner; +import com.azure.resourcemanager.sql.generated.fluent.models.LongTermRetentionBackupOperationResultInner; +import com.azure.resourcemanager.sql.generated.models.CopyLongTermRetentionBackupParameters; +import com.azure.resourcemanager.sql.generated.models.DatabaseState; +import com.azure.resourcemanager.sql.generated.models.LongTermRetentionBackupListResult; +import com.azure.resourcemanager.sql.generated.models.UpdateLongTermRetentionBackupParameters; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in LongTermRetentionBackupsClient. */ +public final class LongTermRetentionBackupsClientImpl implements LongTermRetentionBackupsClient { + /** The proxy service used to perform REST calls. */ + private final LongTermRetentionBackupsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of LongTermRetentionBackupsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + LongTermRetentionBackupsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create(LongTermRetentionBackupsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientLongTermRetentionBackups to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientL") + public interface LongTermRetentionBackupsService { + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers" + + "/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}" + + "/longTermRetentionBackups/{backupName}/copy") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> copy( + @HostParam("$host") String endpoint, + @PathParam("locationName") String locationName, + @PathParam("longTermRetentionServerName") String longTermRetentionServerName, + @PathParam("longTermRetentionDatabaseName") String longTermRetentionDatabaseName, + @PathParam("backupName") String backupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") CopyLongTermRetentionBackupParameters parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers" + + "/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}" + + "/longTermRetentionBackups/{backupName}/update") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("locationName") String locationName, + @PathParam("longTermRetentionServerName") String longTermRetentionServerName, + @PathParam("longTermRetentionDatabaseName") String longTermRetentionDatabaseName, + @PathParam("backupName") String backupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") UpdateLongTermRetentionBackupParameters parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers" + + "/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}" + + "/longTermRetentionBackups/{backupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("locationName") String locationName, + @PathParam("longTermRetentionServerName") String longTermRetentionServerName, + @PathParam("longTermRetentionDatabaseName") String longTermRetentionDatabaseName, + @PathParam("backupName") String backupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers" + + "/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}" + + "/longTermRetentionBackups/{backupName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("locationName") String locationName, + @PathParam("longTermRetentionServerName") String longTermRetentionServerName, + @PathParam("longTermRetentionDatabaseName") String longTermRetentionDatabaseName, + @PathParam("backupName") String backupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers" + + "/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}" + + "/longTermRetentionBackups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @PathParam("locationName") String locationName, + @PathParam("longTermRetentionServerName") String longTermRetentionServerName, + @PathParam("longTermRetentionDatabaseName") String longTermRetentionDatabaseName, + @QueryParam("onlyLatestPerDatabase") Boolean onlyLatestPerDatabase, + @QueryParam("databaseState") DatabaseState databaseState, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByLocation( + @HostParam("$host") String endpoint, + @PathParam("locationName") String locationName, + @QueryParam("onlyLatestPerDatabase") Boolean onlyLatestPerDatabase, + @QueryParam("databaseState") DatabaseState databaseState, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers" + + "/{longTermRetentionServerName}/longTermRetentionBackups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @PathParam("locationName") String locationName, + @PathParam("longTermRetentionServerName") String longTermRetentionServerName, + @QueryParam("onlyLatestPerDatabase") Boolean onlyLatestPerDatabase, + @QueryParam("databaseState") DatabaseState databaseState, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations" + + "/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases" + + "/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}/copy") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> copyByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("locationName") String locationName, + @PathParam("longTermRetentionServerName") String longTermRetentionServerName, + @PathParam("longTermRetentionDatabaseName") String longTermRetentionDatabaseName, + @PathParam("backupName") String backupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") CopyLongTermRetentionBackupParameters parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations" + + "/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases" + + "/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}/update") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> updateByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("locationName") String locationName, + @PathParam("longTermRetentionServerName") String longTermRetentionServerName, + @PathParam("longTermRetentionDatabaseName") String longTermRetentionDatabaseName, + @PathParam("backupName") String backupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") UpdateLongTermRetentionBackupParameters parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations" + + "/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases" + + "/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("locationName") String locationName, + @PathParam("longTermRetentionServerName") String longTermRetentionServerName, + @PathParam("longTermRetentionDatabaseName") String longTermRetentionDatabaseName, + @PathParam("backupName") String backupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations" + + "/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases" + + "/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> deleteByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("locationName") String locationName, + @PathParam("longTermRetentionServerName") String longTermRetentionServerName, + @PathParam("longTermRetentionDatabaseName") String longTermRetentionDatabaseName, + @PathParam("backupName") String backupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations" + + "/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases" + + "/{longTermRetentionDatabaseName}/longTermRetentionBackups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("locationName") String locationName, + @PathParam("longTermRetentionServerName") String longTermRetentionServerName, + @PathParam("longTermRetentionDatabaseName") String longTermRetentionDatabaseName, + @QueryParam("onlyLatestPerDatabase") Boolean onlyLatestPerDatabase, + @QueryParam("databaseState") DatabaseState databaseState, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations" + + "/{locationName}/longTermRetentionBackups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupLocation( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("locationName") String locationName, + @QueryParam("onlyLatestPerDatabase") Boolean onlyLatestPerDatabase, + @QueryParam("databaseState") DatabaseState databaseState, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations" + + "/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("locationName") String locationName, + @PathParam("longTermRetentionServerName") String longTermRetentionServerName, + @QueryParam("onlyLatestPerDatabase") Boolean onlyLatestPerDatabase, + @QueryParam("databaseState") DatabaseState databaseState, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabaseNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByLocationNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupDatabaseNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupLocationNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Copy an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> copyWithResponseAsync( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (longTermRetentionServerName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionServerName is required and cannot be null.")); + } + if (longTermRetentionDatabaseName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionDatabaseName is required and cannot be null.")); + } + if (backupName == null) { + return Mono.error(new IllegalArgumentException("Parameter backupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .copy( + this.client.getEndpoint(), + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Copy an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> copyWithResponseAsync( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (longTermRetentionServerName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionServerName is required and cannot be null.")); + } + if (longTermRetentionDatabaseName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionDatabaseName is required and cannot be null.")); + } + if (backupName == null) { + return Mono.error(new IllegalArgumentException("Parameter backupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .copy( + this.client.getEndpoint(), + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Copy an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux< + PollResult, LongTermRetentionBackupOperationResultInner> + beginCopyAsync( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters) { + Mono>> mono = + copyWithResponseAsync( + locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + LongTermRetentionBackupOperationResultInner.class, + LongTermRetentionBackupOperationResultInner.class, + this.client.getContext()); + } + + /** + * Copy an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux< + PollResult, LongTermRetentionBackupOperationResultInner> + beginCopyAsync( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + copyWithResponseAsync( + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters, + context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + LongTermRetentionBackupOperationResultInner.class, + LongTermRetentionBackupOperationResultInner.class, + context); + } + + /** + * Copy an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller< + PollResult, LongTermRetentionBackupOperationResultInner> + beginCopy( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters) { + return beginCopyAsync( + locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters) + .getSyncPoller(); + } + + /** + * Copy an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller< + PollResult, LongTermRetentionBackupOperationResultInner> + beginCopy( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters, + Context context) { + return beginCopyAsync( + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters, + context) + .getSyncPoller(); + } + + /** + * Copy an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono copyAsync( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters) { + return beginCopyAsync( + locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Copy an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono copyAsync( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters, + Context context) { + return beginCopyAsync( + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters, + context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Copy an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LongTermRetentionBackupOperationResultInner copy( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters) { + return copyAsync( + locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters) + .block(); + } + + /** + * Copy an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LongTermRetentionBackupOperationResultInner copy( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters, + Context context) { + return copyAsync( + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters, + context) + .block(); + } + + /** + * Updates an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (longTermRetentionServerName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionServerName is required and cannot be null.")); + } + if (longTermRetentionDatabaseName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionDatabaseName is required and cannot be null.")); + } + if (backupName == null) { + return Mono.error(new IllegalArgumentException("Parameter backupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (longTermRetentionServerName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionServerName is required and cannot be null.")); + } + if (longTermRetentionDatabaseName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionDatabaseName is required and cannot be null.")); + } + if (backupName == null) { + return Mono.error(new IllegalArgumentException("Parameter backupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Updates an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux< + PollResult, LongTermRetentionBackupOperationResultInner> + beginUpdateAsync( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters) { + Mono>> mono = + updateWithResponseAsync( + locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + LongTermRetentionBackupOperationResultInner.class, + LongTermRetentionBackupOperationResultInner.class, + this.client.getContext()); + } + + /** + * Updates an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux< + PollResult, LongTermRetentionBackupOperationResultInner> + beginUpdateAsync( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync( + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters, + context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + LongTermRetentionBackupOperationResultInner.class, + LongTermRetentionBackupOperationResultInner.class, + context); + } + + /** + * Updates an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller< + PollResult, LongTermRetentionBackupOperationResultInner> + beginUpdate( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters) { + return beginUpdateAsync( + locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters) + .getSyncPoller(); + } + + /** + * Updates an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller< + PollResult, LongTermRetentionBackupOperationResultInner> + beginUpdate( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters, + Context context) { + return beginUpdateAsync( + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters, + context) + .getSyncPoller(); + } + + /** + * Updates an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters) { + return beginUpdateAsync( + locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters, + Context context) { + return beginUpdateAsync( + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters, + context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LongTermRetentionBackupOperationResultInner update( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters) { + return updateAsync( + locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters) + .block(); + } + + /** + * Updates an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LongTermRetentionBackupOperationResultInner update( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters, + Context context) { + return updateAsync( + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters, + context) + .block(); + } + + /** + * Gets a long term retention backup. + * + * @param locationName The location of the database. + * @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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (longTermRetentionServerName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionServerName is required and cannot be null.")); + } + if (longTermRetentionDatabaseName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionDatabaseName is required and cannot be null.")); + } + if (backupName == null) { + return Mono.error(new IllegalArgumentException("Parameter backupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (longTermRetentionServerName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionServerName is required and cannot be null.")); + } + if (longTermRetentionDatabaseName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionDatabaseName is required and cannot be null.")); + } + if (backupName == null) { + return Mono.error(new IllegalArgumentException("Parameter backupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a long term retention backup. + * + * @param locationName The location of the database. + * @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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName) { + return getWithResponseAsync( + locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + Context context) { + return getWithResponseAsync( + locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, context) + .block(); + } + + /** + * Gets a long term retention backup. + * + * @param locationName The location of the database. + * @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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LongTermRetentionBackupInner get( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName) { + return getWithResponse( + locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, Context.NONE) + .getValue(); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (longTermRetentionServerName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionServerName is required and cannot be null.")); + } + if (longTermRetentionDatabaseName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionDatabaseName is required and cannot be null.")); + } + if (backupName == null) { + return Mono.error(new IllegalArgumentException("Parameter backupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (longTermRetentionServerName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionServerName is required and cannot be null.")); + } + if (longTermRetentionDatabaseName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionDatabaseName is required and cannot be null.")); + } + if (backupName == null) { + return Mono.error(new IllegalArgumentException("Parameter backupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName) { + Mono>> mono = + deleteWithResponseAsync( + locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync( + locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName) { + return beginDeleteAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName) + .getSyncPoller(); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + Context context) { + return beginDeleteAsync( + locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, context) + .getSyncPoller(); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName) { + return beginDeleteAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + Context context) { + return beginDeleteAsync( + locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName) { + deleteAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName).block(); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + Context context) { + deleteAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, context) + .block(); + } + + /** + * Lists all long term retention backups for a database. + * + * @param locationName The location of the database. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (longTermRetentionServerName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionServerName is required and cannot be null.")); + } + if (longTermRetentionDatabaseName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionDatabaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + onlyLatestPerDatabase, + databaseState, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all long term retention backups for a database. + * + * @param locationName The location of the database. + * @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (longTermRetentionServerName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionServerName is required and cannot be null.")); + } + if (longTermRetentionDatabaseName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionDatabaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + onlyLatestPerDatabase, + databaseState, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all long term retention backups for a database. + * + * @param locationName The location of the database. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState) { + return new PagedFlux<>( + () -> + listByDatabaseSinglePageAsync( + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + onlyLatestPerDatabase, + databaseState), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Lists all long term retention backups for a database. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName) { + final Boolean onlyLatestPerDatabase = null; + final DatabaseState databaseState = null; + return new PagedFlux<>( + () -> + listByDatabaseSinglePageAsync( + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + onlyLatestPerDatabase, + databaseState), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Lists all long term retention backups for a database. + * + * @param locationName The location of the database. + * @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + return new PagedFlux<>( + () -> + listByDatabaseSinglePageAsync( + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + onlyLatestPerDatabase, + databaseState, + context), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all long term retention backups for a database. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName) { + final Boolean onlyLatestPerDatabase = null; + final DatabaseState databaseState = null; + return new PagedIterable<>( + listByDatabaseAsync( + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + onlyLatestPerDatabase, + databaseState)); + } + + /** + * Lists all long term retention backups for a database. + * + * @param locationName The location of the database. + * @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + return new PagedIterable<>( + listByDatabaseAsync( + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + onlyLatestPerDatabase, + databaseState, + context)); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationSinglePageAsync( + String locationName, Boolean onlyLatestPerDatabase, DatabaseState databaseState) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByLocation( + this.client.getEndpoint(), + locationName, + onlyLatestPerDatabase, + databaseState, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationSinglePageAsync( + String locationName, Boolean onlyLatestPerDatabase, DatabaseState databaseState, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByLocation( + this.client.getEndpoint(), + locationName, + onlyLatestPerDatabase, + databaseState, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByLocationAsync( + String locationName, Boolean onlyLatestPerDatabase, DatabaseState databaseState) { + return new PagedFlux<>( + () -> listByLocationSinglePageAsync(locationName, onlyLatestPerDatabase, databaseState), + nextLink -> listByLocationNextSinglePageAsync(nextLink)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByLocationAsync(String locationName) { + final Boolean onlyLatestPerDatabase = null; + final DatabaseState databaseState = null; + return new PagedFlux<>( + () -> listByLocationSinglePageAsync(locationName, onlyLatestPerDatabase, databaseState), + nextLink -> listByLocationNextSinglePageAsync(nextLink)); + } + + /** + * 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByLocationAsync( + String locationName, Boolean onlyLatestPerDatabase, DatabaseState databaseState, Context context) { + return new PagedFlux<>( + () -> listByLocationSinglePageAsync(locationName, onlyLatestPerDatabase, databaseState, context), + nextLink -> listByLocationNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByLocation(String locationName) { + final Boolean onlyLatestPerDatabase = null; + final DatabaseState databaseState = null; + return new PagedIterable<>(listByLocationAsync(locationName, onlyLatestPerDatabase, databaseState)); + } + + /** + * 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByLocation( + String locationName, Boolean onlyLatestPerDatabase, DatabaseState databaseState, Context context) { + return new PagedIterable<>(listByLocationAsync(locationName, onlyLatestPerDatabase, databaseState, context)); + } + + /** + * Lists the long term retention backups for a given server. + * + * @param locationName The location of the database. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String locationName, + String longTermRetentionServerName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (longTermRetentionServerName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionServerName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + locationName, + longTermRetentionServerName, + onlyLatestPerDatabase, + databaseState, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the long term retention backups for a given server. + * + * @param locationName The location of the database. + * @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String locationName, + String longTermRetentionServerName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (longTermRetentionServerName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionServerName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + locationName, + longTermRetentionServerName, + onlyLatestPerDatabase, + databaseState, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the long term retention backups for a given server. + * + * @param locationName The location of the database. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String locationName, + String longTermRetentionServerName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState) { + return new PagedFlux<>( + () -> + listByServerSinglePageAsync( + locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Lists the long term retention backups for a given server. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String locationName, String longTermRetentionServerName) { + final Boolean onlyLatestPerDatabase = null; + final DatabaseState databaseState = null; + return new PagedFlux<>( + () -> + listByServerSinglePageAsync( + locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Lists the long term retention backups for a given server. + * + * @param locationName The location of the database. + * @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String locationName, + String longTermRetentionServerName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + return new PagedFlux<>( + () -> + listByServerSinglePageAsync( + locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the long term retention backups for a given server. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String locationName, String longTermRetentionServerName) { + final Boolean onlyLatestPerDatabase = null; + final DatabaseState databaseState = null; + return new PagedIterable<>( + listByServerAsync(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState)); + } + + /** + * Lists the long term retention backups for a given server. + * + * @param locationName The location of the database. + * @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String locationName, + String longTermRetentionServerName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + return new PagedIterable<>( + listByServerAsync( + locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, context)); + } + + /** + * Copy an existing long term retention backup to a different server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> copyByResourceGroupWithResponseAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (longTermRetentionServerName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionServerName is required and cannot be null.")); + } + if (longTermRetentionDatabaseName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionDatabaseName is required and cannot be null.")); + } + if (backupName == null) { + return Mono.error(new IllegalArgumentException("Parameter backupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .copyByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Copy an existing long term retention backup to a different server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> copyByResourceGroupWithResponseAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (longTermRetentionServerName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionServerName is required and cannot be null.")); + } + if (longTermRetentionDatabaseName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionDatabaseName is required and cannot be null.")); + } + if (backupName == null) { + return Mono.error(new IllegalArgumentException("Parameter backupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .copyByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Copy an existing long term retention backup to a different server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux< + PollResult, LongTermRetentionBackupOperationResultInner> + beginCopyByResourceGroupAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters) { + Mono>> mono = + copyByResourceGroupWithResponseAsync( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + LongTermRetentionBackupOperationResultInner.class, + LongTermRetentionBackupOperationResultInner.class, + this.client.getContext()); + } + + /** + * Copy an existing long term retention backup to a different server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux< + PollResult, LongTermRetentionBackupOperationResultInner> + beginCopyByResourceGroupAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + copyByResourceGroupWithResponseAsync( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters, + context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + LongTermRetentionBackupOperationResultInner.class, + LongTermRetentionBackupOperationResultInner.class, + context); + } + + /** + * Copy an existing long term retention backup to a different server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller< + PollResult, LongTermRetentionBackupOperationResultInner> + beginCopyByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters) { + return beginCopyByResourceGroupAsync( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters) + .getSyncPoller(); + } + + /** + * Copy an existing long term retention backup to a different server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller< + PollResult, LongTermRetentionBackupOperationResultInner> + beginCopyByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters, + Context context) { + return beginCopyByResourceGroupAsync( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters, + context) + .getSyncPoller(); + } + + /** + * Copy an existing long term retention backup to a different server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono copyByResourceGroupAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters) { + return beginCopyByResourceGroupAsync( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Copy an existing long term retention backup to a different server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono copyByResourceGroupAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters, + Context context) { + return beginCopyByResourceGroupAsync( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters, + context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Copy an existing long term retention backup to a different server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LongTermRetentionBackupOperationResultInner copyByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters) { + return copyByResourceGroupAsync( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters) + .block(); + } + + /** + * Copy an existing long term retention backup to a different server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LongTermRetentionBackupOperationResultInner copyByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters, + Context context) { + return copyByResourceGroupAsync( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters, + context) + .block(); + } + + /** + * Updates an existing long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateByResourceGroupWithResponseAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (longTermRetentionServerName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionServerName is required and cannot be null.")); + } + if (longTermRetentionDatabaseName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionDatabaseName is required and cannot be null.")); + } + if (backupName == null) { + return Mono.error(new IllegalArgumentException("Parameter backupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .updateByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates an existing long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateByResourceGroupWithResponseAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (longTermRetentionServerName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionServerName is required and cannot be null.")); + } + if (longTermRetentionDatabaseName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionDatabaseName is required and cannot be null.")); + } + if (backupName == null) { + return Mono.error(new IllegalArgumentException("Parameter backupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .updateByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Updates an existing long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux< + PollResult, LongTermRetentionBackupOperationResultInner> + beginUpdateByResourceGroupAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters) { + Mono>> mono = + updateByResourceGroupWithResponseAsync( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + LongTermRetentionBackupOperationResultInner.class, + LongTermRetentionBackupOperationResultInner.class, + this.client.getContext()); + } + + /** + * Updates an existing long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux< + PollResult, LongTermRetentionBackupOperationResultInner> + beginUpdateByResourceGroupAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateByResourceGroupWithResponseAsync( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters, + context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + LongTermRetentionBackupOperationResultInner.class, + LongTermRetentionBackupOperationResultInner.class, + context); + } + + /** + * Updates an existing long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller< + PollResult, LongTermRetentionBackupOperationResultInner> + beginUpdateByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters) { + return beginUpdateByResourceGroupAsync( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters) + .getSyncPoller(); + } + + /** + * Updates an existing long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller< + PollResult, LongTermRetentionBackupOperationResultInner> + beginUpdateByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters, + Context context) { + return beginUpdateByResourceGroupAsync( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters, + context) + .getSyncPoller(); + } + + /** + * Updates an existing long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateByResourceGroupAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters) { + return beginUpdateByResourceGroupAsync( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates an existing long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateByResourceGroupAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters, + Context context) { + return beginUpdateByResourceGroupAsync( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters, + context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates an existing long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LongTermRetentionBackupOperationResultInner updateByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters) { + return updateByResourceGroupAsync( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters) + .block(); + } + + /** + * Updates an existing long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LongTermRetentionBackupOperationResultInner updateByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters, + Context context) { + return updateByResourceGroupAsync( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters, + context) + .block(); + } + + /** + * Gets a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (longTermRetentionServerName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionServerName is required and cannot be null.")); + } + if (longTermRetentionDatabaseName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionDatabaseName is required and cannot be null.")); + } + if (backupName == null) { + return Mono.error(new IllegalArgumentException("Parameter backupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (longTermRetentionServerName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionServerName is required and cannot be null.")); + } + if (longTermRetentionDatabaseName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionDatabaseName is required and cannot be null.")); + } + if (backupName == null) { + return Mono.error(new IllegalArgumentException("Parameter backupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName) { + return getByResourceGroupWithResponseAsync( + resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + Context context) { + return getByResourceGroupWithResponseAsync( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + context) + .block(); + } + + /** + * Gets a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LongTermRetentionBackupInner getByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName) { + return getByResourceGroupWithResponse( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + Context.NONE) + .getValue(); + } + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteByResourceGroupWithResponseAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (longTermRetentionServerName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionServerName is required and cannot be null.")); + } + if (longTermRetentionDatabaseName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionDatabaseName is required and cannot be null.")); + } + if (backupName == null) { + return Mono.error(new IllegalArgumentException("Parameter backupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + return FluxUtil + .withContext( + context -> + service + .deleteByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteByResourceGroupWithResponseAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (longTermRetentionServerName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionServerName is required and cannot be null.")); + } + if (longTermRetentionDatabaseName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionDatabaseName is required and cannot be null.")); + } + if (backupName == null) { + return Mono.error(new IllegalArgumentException("Parameter backupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + context = this.client.mergeContext(context); + return service + .deleteByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteByResourceGroupAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName) { + Mono>> mono = + deleteByResourceGroupWithResponseAsync( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteByResourceGroupAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteByResourceGroupWithResponseAsync( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName) { + return beginDeleteByResourceGroupAsync( + resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName) + .getSyncPoller(); + } + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + Context context) { + return beginDeleteByResourceGroupAsync( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + context) + .getSyncPoller(); + } + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteByResourceGroupAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName) { + return beginDeleteByResourceGroupAsync( + resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteByResourceGroupAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + Context context) { + return beginDeleteByResourceGroupAsync( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName) { + deleteByResourceGroupAsync( + resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName) + .block(); + } + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + Context context) { + deleteByResourceGroupAsync( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + context) + .block(); + } + + /** + * Lists all long term retention backups for 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 locationName The location of the database. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupDatabaseSinglePageAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (longTermRetentionServerName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionServerName is required and cannot be null.")); + } + if (longTermRetentionDatabaseName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionDatabaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroupDatabase( + this.client.getEndpoint(), + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + onlyLatestPerDatabase, + databaseState, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all long term retention backups for 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 locationName The location of the database. + * @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupDatabaseSinglePageAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (longTermRetentionServerName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionServerName is required and cannot be null.")); + } + if (longTermRetentionDatabaseName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionDatabaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupDatabase( + this.client.getEndpoint(), + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + onlyLatestPerDatabase, + databaseState, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all long term retention backups for 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 locationName The location of the database. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupDatabaseAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState) { + return new PagedFlux<>( + () -> + listByResourceGroupDatabaseSinglePageAsync( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + onlyLatestPerDatabase, + databaseState), + nextLink -> listByResourceGroupDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Lists all long term retention backups for 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 locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupDatabaseAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName) { + final Boolean onlyLatestPerDatabase = null; + final DatabaseState databaseState = null; + return new PagedFlux<>( + () -> + listByResourceGroupDatabaseSinglePageAsync( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + onlyLatestPerDatabase, + databaseState), + nextLink -> listByResourceGroupDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Lists all long term retention backups for 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 locationName The location of the database. + * @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupDatabaseAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + return new PagedFlux<>( + () -> + listByResourceGroupDatabaseSinglePageAsync( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + onlyLatestPerDatabase, + databaseState, + context), + nextLink -> listByResourceGroupDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all long term retention backups for 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 locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroupDatabase( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName) { + final Boolean onlyLatestPerDatabase = null; + final DatabaseState databaseState = null; + return new PagedIterable<>( + listByResourceGroupDatabaseAsync( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + onlyLatestPerDatabase, + databaseState)); + } + + /** + * Lists all long term retention backups for 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 locationName The location of the database. + * @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroupDatabase( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + return new PagedIterable<>( + listByResourceGroupDatabaseAsync( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + onlyLatestPerDatabase, + databaseState, + context)); + } + + /** + * Lists the long term retention backups for a given location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupLocationSinglePageAsync( + String resourceGroupName, String locationName, Boolean onlyLatestPerDatabase, DatabaseState databaseState) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroupLocation( + this.client.getEndpoint(), + resourceGroupName, + locationName, + onlyLatestPerDatabase, + databaseState, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the long term retention backups for a given location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupLocationSinglePageAsync( + String resourceGroupName, + String locationName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupLocation( + this.client.getEndpoint(), + resourceGroupName, + locationName, + onlyLatestPerDatabase, + databaseState, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the long term retention backups for a given location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupLocationAsync( + String resourceGroupName, String locationName, Boolean onlyLatestPerDatabase, DatabaseState databaseState) { + return new PagedFlux<>( + () -> + listByResourceGroupLocationSinglePageAsync( + resourceGroupName, locationName, onlyLatestPerDatabase, databaseState), + nextLink -> listByResourceGroupLocationNextSinglePageAsync(nextLink)); + } + + /** + * Lists the long term retention backups for a given location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupLocationAsync( + String resourceGroupName, String locationName) { + final Boolean onlyLatestPerDatabase = null; + final DatabaseState databaseState = null; + return new PagedFlux<>( + () -> + listByResourceGroupLocationSinglePageAsync( + resourceGroupName, locationName, onlyLatestPerDatabase, databaseState), + nextLink -> listByResourceGroupLocationNextSinglePageAsync(nextLink)); + } + + /** + * Lists the long term retention backups for a given location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupLocationAsync( + String resourceGroupName, + String locationName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + return new PagedFlux<>( + () -> + listByResourceGroupLocationSinglePageAsync( + resourceGroupName, locationName, onlyLatestPerDatabase, databaseState, context), + nextLink -> listByResourceGroupLocationNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the long term retention backups for a given location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroupLocation( + String resourceGroupName, String locationName) { + final Boolean onlyLatestPerDatabase = null; + final DatabaseState databaseState = null; + return new PagedIterable<>( + listByResourceGroupLocationAsync(resourceGroupName, locationName, onlyLatestPerDatabase, databaseState)); + } + + /** + * Lists the long term retention backups for a given location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroupLocation( + String resourceGroupName, + String locationName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + return new PagedIterable<>( + listByResourceGroupLocationAsync( + resourceGroupName, locationName, onlyLatestPerDatabase, databaseState, context)); + } + + /** + * Lists the long term retention backups 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 locationName The location of the database. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupServerSinglePageAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (longTermRetentionServerName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionServerName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroupServer( + this.client.getEndpoint(), + resourceGroupName, + locationName, + longTermRetentionServerName, + onlyLatestPerDatabase, + databaseState, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the long term retention backups 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 locationName The location of the database. + * @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupServerSinglePageAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (longTermRetentionServerName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter longTermRetentionServerName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupServer( + this.client.getEndpoint(), + resourceGroupName, + locationName, + longTermRetentionServerName, + onlyLatestPerDatabase, + databaseState, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the long term retention backups 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 locationName The location of the database. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupServerAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState) { + return new PagedFlux<>( + () -> + listByResourceGroupServerSinglePageAsync( + resourceGroupName, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState), + nextLink -> listByResourceGroupServerNextSinglePageAsync(nextLink)); + } + + /** + * Lists the long term retention backups 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 locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupServerAsync( + String resourceGroupName, String locationName, String longTermRetentionServerName) { + final Boolean onlyLatestPerDatabase = null; + final DatabaseState databaseState = null; + return new PagedFlux<>( + () -> + listByResourceGroupServerSinglePageAsync( + resourceGroupName, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState), + nextLink -> listByResourceGroupServerNextSinglePageAsync(nextLink)); + } + + /** + * Lists the long term retention backups 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 locationName The location of the database. + * @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupServerAsync( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + return new PagedFlux<>( + () -> + listByResourceGroupServerSinglePageAsync( + resourceGroupName, + locationName, + longTermRetentionServerName, + onlyLatestPerDatabase, + databaseState, + context), + nextLink -> listByResourceGroupServerNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the long term retention backups 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 locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroupServer( + String resourceGroupName, String locationName, String longTermRetentionServerName) { + final Boolean onlyLatestPerDatabase = null; + final DatabaseState databaseState = null; + return new PagedIterable<>( + listByResourceGroupServerAsync( + resourceGroupName, locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState)); + } + + /** + * Lists the long term retention backups 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 locationName The location of the database. + * @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroupServer( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + return new PagedIterable<>( + listByResourceGroupServerAsync( + resourceGroupName, + locationName, + longTermRetentionServerName, + onlyLatestPerDatabase, + databaseState, + context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByLocationNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByLocationNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByServerNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServerNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupDatabaseNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service.listByResourceGroupDatabaseNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupDatabaseNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupDatabaseNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupLocationNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service.listByResourceGroupLocationNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupLocationNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupLocationNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupServerNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupServerNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupServerNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupServerNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionBackupsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionBackupsImpl.java new file mode 100644 index 0000000000000..d7c43a27739bd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionBackupsImpl.java @@ -0,0 +1,514 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.LongTermRetentionBackupsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.LongTermRetentionBackupInner; +import com.azure.resourcemanager.sql.generated.fluent.models.LongTermRetentionBackupOperationResultInner; +import com.azure.resourcemanager.sql.generated.models.CopyLongTermRetentionBackupParameters; +import com.azure.resourcemanager.sql.generated.models.DatabaseState; +import com.azure.resourcemanager.sql.generated.models.LongTermRetentionBackup; +import com.azure.resourcemanager.sql.generated.models.LongTermRetentionBackupOperationResult; +import com.azure.resourcemanager.sql.generated.models.LongTermRetentionBackups; +import com.azure.resourcemanager.sql.generated.models.UpdateLongTermRetentionBackupParameters; + +public final class LongTermRetentionBackupsImpl implements LongTermRetentionBackups { + private static final ClientLogger LOGGER = new ClientLogger(LongTermRetentionBackupsImpl.class); + + private final LongTermRetentionBackupsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public LongTermRetentionBackupsImpl( + LongTermRetentionBackupsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public LongTermRetentionBackupOperationResult copy( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters) { + LongTermRetentionBackupOperationResultInner inner = + this + .serviceClient() + .copy(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters); + if (inner != null) { + return new LongTermRetentionBackupOperationResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public LongTermRetentionBackupOperationResult copy( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters, + Context context) { + LongTermRetentionBackupOperationResultInner inner = + this + .serviceClient() + .copy( + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters, + context); + if (inner != null) { + return new LongTermRetentionBackupOperationResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public LongTermRetentionBackupOperationResult update( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters) { + LongTermRetentionBackupOperationResultInner inner = + this + .serviceClient() + .update( + locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, parameters); + if (inner != null) { + return new LongTermRetentionBackupOperationResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public LongTermRetentionBackupOperationResult update( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters, + Context context) { + LongTermRetentionBackupOperationResultInner inner = + this + .serviceClient() + .update( + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters, + context); + if (inner != null) { + return new LongTermRetentionBackupOperationResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse( + locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new LongTermRetentionBackupImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public LongTermRetentionBackup get( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName) { + LongTermRetentionBackupInner inner = + this + .serviceClient() + .get(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName); + if (inner != null) { + return new LongTermRetentionBackupImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName) { + this + .serviceClient() + .delete(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName); + } + + public void delete( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + Context context) { + this + .serviceClient() + .delete(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, context); + } + + public PagedIterable listByDatabase( + String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName) { + PagedIterable inner = + this + .serviceClient() + .listByDatabase(locationName, longTermRetentionServerName, longTermRetentionDatabaseName); + return Utils.mapPage(inner, inner1 -> new LongTermRetentionBackupImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByDatabase( + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + onlyLatestPerDatabase, + databaseState, + context); + return Utils.mapPage(inner, inner1 -> new LongTermRetentionBackupImpl(inner1, this.manager())); + } + + public PagedIterable listByLocation(String locationName) { + PagedIterable inner = this.serviceClient().listByLocation(locationName); + return Utils.mapPage(inner, inner1 -> new LongTermRetentionBackupImpl(inner1, this.manager())); + } + + public PagedIterable listByLocation( + String locationName, Boolean onlyLatestPerDatabase, DatabaseState databaseState, Context context) { + PagedIterable inner = + this.serviceClient().listByLocation(locationName, onlyLatestPerDatabase, databaseState, context); + return Utils.mapPage(inner, inner1 -> new LongTermRetentionBackupImpl(inner1, this.manager())); + } + + public PagedIterable listByServer( + String locationName, String longTermRetentionServerName) { + PagedIterable inner = + this.serviceClient().listByServer(locationName, longTermRetentionServerName); + return Utils.mapPage(inner, inner1 -> new LongTermRetentionBackupImpl(inner1, this.manager())); + } + + public PagedIterable listByServer( + String locationName, + String longTermRetentionServerName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByServer(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, context); + return Utils.mapPage(inner, inner1 -> new LongTermRetentionBackupImpl(inner1, this.manager())); + } + + public LongTermRetentionBackupOperationResult copyByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters) { + LongTermRetentionBackupOperationResultInner inner = + this + .serviceClient() + .copyByResourceGroup( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters); + if (inner != null) { + return new LongTermRetentionBackupOperationResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public LongTermRetentionBackupOperationResult copyByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters, + Context context) { + LongTermRetentionBackupOperationResultInner inner = + this + .serviceClient() + .copyByResourceGroup( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters, + context); + if (inner != null) { + return new LongTermRetentionBackupOperationResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public LongTermRetentionBackupOperationResult updateByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters) { + LongTermRetentionBackupOperationResultInner inner = + this + .serviceClient() + .updateByResourceGroup( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters); + if (inner != null) { + return new LongTermRetentionBackupOperationResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public LongTermRetentionBackupOperationResult updateByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters, + Context context) { + LongTermRetentionBackupOperationResultInner inner = + this + .serviceClient() + .updateByResourceGroup( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + parameters, + context); + if (inner != null) { + return new LongTermRetentionBackupOperationResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + Context context) { + Response inner = + this + .serviceClient() + .getByResourceGroupWithResponse( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new LongTermRetentionBackupImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public LongTermRetentionBackup getByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName) { + LongTermRetentionBackupInner inner = + this + .serviceClient() + .getByResourceGroup( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName); + if (inner != null) { + return new LongTermRetentionBackupImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName) { + this + .serviceClient() + .deleteByResourceGroup( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName); + } + + public void deleteByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + Context context) { + this + .serviceClient() + .deleteByResourceGroup( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + backupName, + context); + } + + public PagedIterable listByResourceGroupDatabase( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName) { + PagedIterable inner = + this + .serviceClient() + .listByResourceGroupDatabase( + resourceGroupName, locationName, longTermRetentionServerName, longTermRetentionDatabaseName); + return Utils.mapPage(inner, inner1 -> new LongTermRetentionBackupImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroupDatabase( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByResourceGroupDatabase( + resourceGroupName, + locationName, + longTermRetentionServerName, + longTermRetentionDatabaseName, + onlyLatestPerDatabase, + databaseState, + context); + return Utils.mapPage(inner, inner1 -> new LongTermRetentionBackupImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroupLocation( + String resourceGroupName, String locationName) { + PagedIterable inner = + this.serviceClient().listByResourceGroupLocation(resourceGroupName, locationName); + return Utils.mapPage(inner, inner1 -> new LongTermRetentionBackupImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroupLocation( + String resourceGroupName, + String locationName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByResourceGroupLocation( + resourceGroupName, locationName, onlyLatestPerDatabase, databaseState, context); + return Utils.mapPage(inner, inner1 -> new LongTermRetentionBackupImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroupServer( + String resourceGroupName, String locationName, String longTermRetentionServerName) { + PagedIterable inner = + this + .serviceClient() + .listByResourceGroupServer(resourceGroupName, locationName, longTermRetentionServerName); + return Utils.mapPage(inner, inner1 -> new LongTermRetentionBackupImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroupServer( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByResourceGroupServer( + resourceGroupName, + locationName, + longTermRetentionServerName, + onlyLatestPerDatabase, + databaseState, + context); + return Utils.mapPage(inner, inner1 -> new LongTermRetentionBackupImpl(inner1, this.manager())); + } + + private LongTermRetentionBackupsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionManagedInstanceBackupsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionManagedInstanceBackupsClientImpl.java new file mode 100644 index 0000000000000..11b3ebbd34e61 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionManagedInstanceBackupsClientImpl.java @@ -0,0 +1,3408 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.LongTermRetentionManagedInstanceBackupsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceLongTermRetentionBackupInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseState; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceLongTermRetentionBackupListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * LongTermRetentionManagedInstanceBackupsClient. + */ +public final class LongTermRetentionManagedInstanceBackupsClientImpl + implements LongTermRetentionManagedInstanceBackupsClient { + /** The proxy service used to perform REST calls. */ + private final LongTermRetentionManagedInstanceBackupsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of LongTermRetentionManagedInstanceBackupsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + LongTermRetentionManagedInstanceBackupsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + LongTermRetentionManagedInstanceBackupsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientLongTermRetentionManagedInstanceBackups to be used + * by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientL") + public interface LongTermRetentionManagedInstanceBackupsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}" + + "/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}" + + "/longTermRetentionManagedInstanceBackups/{backupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("locationName") String locationName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("backupName") String backupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}" + + "/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}" + + "/longTermRetentionManagedInstanceBackups/{backupName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("locationName") String locationName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("backupName") String backupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}" + + "/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases/{databaseName}" + + "/longTermRetentionManagedInstanceBackups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @PathParam("locationName") String locationName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @QueryParam("onlyLatestPerDatabase") Boolean onlyLatestPerDatabase, + @QueryParam("databaseState") DatabaseState databaseState, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}" + + "/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionManagedInstanceBackups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInstance( + @HostParam("$host") String endpoint, + @PathParam("locationName") String locationName, + @PathParam("managedInstanceName") String managedInstanceName, + @QueryParam("onlyLatestPerDatabase") Boolean onlyLatestPerDatabase, + @QueryParam("databaseState") DatabaseState databaseState, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}" + + "/longTermRetentionManagedInstanceBackups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByLocation( + @HostParam("$host") String endpoint, + @PathParam("locationName") String locationName, + @QueryParam("onlyLatestPerDatabase") Boolean onlyLatestPerDatabase, + @QueryParam("databaseState") DatabaseState databaseState, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations" + + "/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases" + + "/{databaseName}/longTermRetentionManagedInstanceBackups/{backupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("locationName") String locationName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("backupName") String backupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations" + + "/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases" + + "/{databaseName}/longTermRetentionManagedInstanceBackups/{backupName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> deleteByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("locationName") String locationName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("backupName") String backupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations" + + "/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}/longTermRetentionDatabases" + + "/{databaseName}/longTermRetentionManagedInstanceBackups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("locationName") String locationName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @QueryParam("onlyLatestPerDatabase") Boolean onlyLatestPerDatabase, + @QueryParam("databaseState") DatabaseState databaseState, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations" + + "/{locationName}/longTermRetentionManagedInstances/{managedInstanceName}" + + "/longTermRetentionManagedInstanceBackups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupInstance( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("locationName") String locationName, + @PathParam("managedInstanceName") String managedInstanceName, + @QueryParam("onlyLatestPerDatabase") Boolean onlyLatestPerDatabase, + @QueryParam("databaseState") DatabaseState databaseState, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations" + + "/{locationName}/longTermRetentionManagedInstanceBackups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupLocation( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("locationName") String locationName, + @QueryParam("onlyLatestPerDatabase") Boolean onlyLatestPerDatabase, + @QueryParam("databaseState") DatabaseState databaseState, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabaseNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInstanceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByLocationNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupDatabaseNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupInstanceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupLocationNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a long term retention backup for a managed database. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup for a managed database along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String locationName, String managedInstanceName, String databaseName, String backupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (backupName == null) { + return Mono.error(new IllegalArgumentException("Parameter backupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + locationName, + managedInstanceName, + databaseName, + backupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a long term retention backup for a managed database. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup for a managed database along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String locationName, String managedInstanceName, String databaseName, String backupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (backupName == null) { + return Mono.error(new IllegalArgumentException("Parameter backupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + locationName, + managedInstanceName, + databaseName, + backupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a long term retention backup for a managed database. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup for a managed database on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String locationName, String managedInstanceName, String databaseName, String backupName) { + return getWithResponseAsync(locationName, managedInstanceName, databaseName, backupName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a long term retention backup for a managed database. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup for a managed database along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String locationName, String managedInstanceName, String databaseName, String backupName, Context context) { + return getWithResponseAsync(locationName, managedInstanceName, databaseName, backupName, context).block(); + } + + /** + * Gets a long term retention backup for a managed database. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup for a managed database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceLongTermRetentionBackupInner get( + String locationName, String managedInstanceName, String databaseName, String backupName) { + return getWithResponse(locationName, managedInstanceName, databaseName, backupName, Context.NONE).getValue(); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String locationName, String managedInstanceName, String databaseName, String backupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (backupName == null) { + return Mono.error(new IllegalArgumentException("Parameter backupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + locationName, + managedInstanceName, + databaseName, + backupName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String locationName, String managedInstanceName, String databaseName, String backupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (backupName == null) { + return Mono.error(new IllegalArgumentException("Parameter backupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + locationName, + managedInstanceName, + databaseName, + backupName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String locationName, String managedInstanceName, String databaseName, String backupName) { + Mono>> mono = + deleteWithResponseAsync(locationName, managedInstanceName, databaseName, backupName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String locationName, String managedInstanceName, String databaseName, String backupName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(locationName, managedInstanceName, databaseName, backupName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String locationName, String managedInstanceName, String databaseName, String backupName) { + return beginDeleteAsync(locationName, managedInstanceName, databaseName, backupName).getSyncPoller(); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String locationName, String managedInstanceName, String databaseName, String backupName, Context context) { + return beginDeleteAsync(locationName, managedInstanceName, databaseName, backupName, context).getSyncPoller(); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String locationName, String managedInstanceName, String databaseName, String backupName) { + return beginDeleteAsync(locationName, managedInstanceName, databaseName, backupName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String locationName, String managedInstanceName, String databaseName, String backupName, Context context) { + return beginDeleteAsync(locationName, managedInstanceName, databaseName, backupName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String locationName, String managedInstanceName, String databaseName, String backupName) { + deleteAsync(locationName, managedInstanceName, databaseName, backupName).block(); + } + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String locationName, String managedInstanceName, String databaseName, String backupName, Context context) { + deleteAsync(locationName, managedInstanceName, databaseName, backupName, context).block(); + } + + /** + * Lists all long term retention backups for a managed database. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String locationName, + String managedInstanceName, + String databaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + locationName, + managedInstanceName, + databaseName, + onlyLatestPerDatabase, + databaseState, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all long term retention backups for a managed database. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String locationName, + String managedInstanceName, + String databaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + locationName, + managedInstanceName, + databaseName, + onlyLatestPerDatabase, + databaseState, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all long term retention backups for a managed database. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String locationName, + String managedInstanceName, + String databaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState) { + return new PagedFlux<>( + () -> + listByDatabaseSinglePageAsync( + locationName, managedInstanceName, databaseName, onlyLatestPerDatabase, databaseState), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Lists all long term retention backups for a managed database. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String locationName, String managedInstanceName, String databaseName) { + final Boolean onlyLatestPerDatabase = null; + final DatabaseState databaseState = null; + return new PagedFlux<>( + () -> + listByDatabaseSinglePageAsync( + locationName, managedInstanceName, databaseName, onlyLatestPerDatabase, databaseState), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Lists all long term retention backups for a managed database. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String locationName, + String managedInstanceName, + String databaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + return new PagedFlux<>( + () -> + listByDatabaseSinglePageAsync( + locationName, managedInstanceName, databaseName, onlyLatestPerDatabase, databaseState, context), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all long term retention backups for a managed database. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String locationName, String managedInstanceName, String databaseName) { + final Boolean onlyLatestPerDatabase = null; + final DatabaseState databaseState = null; + return new PagedIterable<>( + listByDatabaseAsync(locationName, managedInstanceName, databaseName, onlyLatestPerDatabase, databaseState)); + } + + /** + * Lists all long term retention backups for a managed database. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String locationName, + String managedInstanceName, + String databaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + return new PagedIterable<>( + listByDatabaseAsync( + locationName, managedInstanceName, databaseName, onlyLatestPerDatabase, databaseState, context)); + } + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceSinglePageAsync( + String locationName, String managedInstanceName, Boolean onlyLatestPerDatabase, DatabaseState databaseState) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByInstance( + this.client.getEndpoint(), + locationName, + managedInstanceName, + onlyLatestPerDatabase, + databaseState, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceSinglePageAsync( + String locationName, + String managedInstanceName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInstance( + this.client.getEndpoint(), + locationName, + managedInstanceName, + onlyLatestPerDatabase, + databaseState, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync( + String locationName, String managedInstanceName, Boolean onlyLatestPerDatabase, DatabaseState databaseState) { + return new PagedFlux<>( + () -> + listByInstanceSinglePageAsync(locationName, managedInstanceName, onlyLatestPerDatabase, databaseState), + nextLink -> listByInstanceNextSinglePageAsync(nextLink)); + } + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync( + String locationName, String managedInstanceName) { + final Boolean onlyLatestPerDatabase = null; + final DatabaseState databaseState = null; + return new PagedFlux<>( + () -> + listByInstanceSinglePageAsync(locationName, managedInstanceName, onlyLatestPerDatabase, databaseState), + nextLink -> listByInstanceNextSinglePageAsync(nextLink)); + } + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync( + String locationName, + String managedInstanceName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + return new PagedFlux<>( + () -> + listByInstanceSinglePageAsync( + locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, context), + nextLink -> listByInstanceNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstance( + String locationName, String managedInstanceName) { + final Boolean onlyLatestPerDatabase = null; + final DatabaseState databaseState = null; + return new PagedIterable<>( + listByInstanceAsync(locationName, managedInstanceName, onlyLatestPerDatabase, databaseState)); + } + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstance( + String locationName, + String managedInstanceName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + return new PagedIterable<>( + listByInstanceAsync(locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, context)); + } + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param locationName The location of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationSinglePageAsync( + String locationName, Boolean onlyLatestPerDatabase, DatabaseState databaseState) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByLocation( + this.client.getEndpoint(), + locationName, + onlyLatestPerDatabase, + databaseState, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param locationName The location of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationSinglePageAsync( + String locationName, Boolean onlyLatestPerDatabase, DatabaseState databaseState, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByLocation( + this.client.getEndpoint(), + locationName, + onlyLatestPerDatabase, + databaseState, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param locationName The location of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByLocationAsync( + String locationName, Boolean onlyLatestPerDatabase, DatabaseState databaseState) { + return new PagedFlux<>( + () -> listByLocationSinglePageAsync(locationName, onlyLatestPerDatabase, databaseState), + nextLink -> listByLocationNextSinglePageAsync(nextLink)); + } + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param locationName The location of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByLocationAsync(String locationName) { + final Boolean onlyLatestPerDatabase = null; + final DatabaseState databaseState = null; + return new PagedFlux<>( + () -> listByLocationSinglePageAsync(locationName, onlyLatestPerDatabase, databaseState), + nextLink -> listByLocationNextSinglePageAsync(nextLink)); + } + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param locationName The location of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByLocationAsync( + String locationName, Boolean onlyLatestPerDatabase, DatabaseState databaseState, Context context) { + return new PagedFlux<>( + () -> listByLocationSinglePageAsync(locationName, onlyLatestPerDatabase, databaseState, context), + nextLink -> listByLocationNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param locationName The location of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByLocation(String locationName) { + final Boolean onlyLatestPerDatabase = null; + final DatabaseState databaseState = null; + return new PagedIterable<>(listByLocationAsync(locationName, onlyLatestPerDatabase, databaseState)); + } + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param locationName The location of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByLocation( + String locationName, Boolean onlyLatestPerDatabase, DatabaseState databaseState, Context context) { + return new PagedIterable<>(listByLocationAsync(locationName, onlyLatestPerDatabase, databaseState, context)); + } + + /** + * Gets a long term retention backup for a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup for a managed database along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + String backupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (backupName == null) { + return Mono.error(new IllegalArgumentException("Parameter backupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + locationName, + managedInstanceName, + databaseName, + backupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a long term retention backup for a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup for a managed database along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + String backupName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (backupName == null) { + return Mono.error(new IllegalArgumentException("Parameter backupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + locationName, + managedInstanceName, + databaseName, + backupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a long term retention backup for a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup for a managed database on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + String backupName) { + return getByResourceGroupWithResponseAsync( + resourceGroupName, locationName, managedInstanceName, databaseName, backupName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a long term retention backup for a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup for a managed database along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + String backupName, + Context context) { + return getByResourceGroupWithResponseAsync( + resourceGroupName, locationName, managedInstanceName, databaseName, backupName, context) + .block(); + } + + /** + * Gets a long term retention backup for a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup for a managed database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceLongTermRetentionBackupInner getByResourceGroup( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + String backupName) { + return getByResourceGroupWithResponse( + resourceGroupName, locationName, managedInstanceName, databaseName, backupName, Context.NONE) + .getValue(); + } + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteByResourceGroupWithResponseAsync( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + String backupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (backupName == null) { + return Mono.error(new IllegalArgumentException("Parameter backupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + return FluxUtil + .withContext( + context -> + service + .deleteByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + locationName, + managedInstanceName, + databaseName, + backupName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteByResourceGroupWithResponseAsync( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + String backupName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (backupName == null) { + return Mono.error(new IllegalArgumentException("Parameter backupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + context = this.client.mergeContext(context); + return service + .deleteByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + locationName, + managedInstanceName, + databaseName, + backupName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteByResourceGroupAsync( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + String backupName) { + Mono>> mono = + deleteByResourceGroupWithResponseAsync( + resourceGroupName, locationName, managedInstanceName, databaseName, backupName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteByResourceGroupAsync( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + String backupName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteByResourceGroupWithResponseAsync( + resourceGroupName, locationName, managedInstanceName, databaseName, backupName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteByResourceGroup( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + String backupName) { + return beginDeleteByResourceGroupAsync( + resourceGroupName, locationName, managedInstanceName, databaseName, backupName) + .getSyncPoller(); + } + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDeleteByResourceGroup( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + String backupName, + Context context) { + return beginDeleteByResourceGroupAsync( + resourceGroupName, locationName, managedInstanceName, databaseName, backupName, context) + .getSyncPoller(); + } + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteByResourceGroupAsync( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + String backupName) { + return beginDeleteByResourceGroupAsync( + resourceGroupName, locationName, managedInstanceName, databaseName, backupName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteByResourceGroupAsync( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + String backupName, + Context context) { + return beginDeleteByResourceGroupAsync( + resourceGroupName, locationName, managedInstanceName, databaseName, backupName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteByResourceGroup( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + String backupName) { + deleteByResourceGroupAsync(resourceGroupName, locationName, managedInstanceName, databaseName, backupName) + .block(); + } + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void deleteByResourceGroup( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + String backupName, + Context context) { + deleteByResourceGroupAsync( + resourceGroupName, locationName, managedInstanceName, databaseName, backupName, context) + .block(); + } + + /** + * Lists all long term retention backups for a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupDatabaseSinglePageAsync( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroupDatabase( + this.client.getEndpoint(), + resourceGroupName, + locationName, + managedInstanceName, + databaseName, + onlyLatestPerDatabase, + databaseState, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all long term retention backups for a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupDatabaseSinglePageAsync( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupDatabase( + this.client.getEndpoint(), + resourceGroupName, + locationName, + managedInstanceName, + databaseName, + onlyLatestPerDatabase, + databaseState, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all long term retention backups for a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupDatabaseAsync( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState) { + return new PagedFlux<>( + () -> + listByResourceGroupDatabaseSinglePageAsync( + resourceGroupName, + locationName, + managedInstanceName, + databaseName, + onlyLatestPerDatabase, + databaseState), + nextLink -> listByResourceGroupDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Lists all long term retention backups for a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupDatabaseAsync( + String resourceGroupName, String locationName, String managedInstanceName, String databaseName) { + final Boolean onlyLatestPerDatabase = null; + final DatabaseState databaseState = null; + return new PagedFlux<>( + () -> + listByResourceGroupDatabaseSinglePageAsync( + resourceGroupName, + locationName, + managedInstanceName, + databaseName, + onlyLatestPerDatabase, + databaseState), + nextLink -> listByResourceGroupDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Lists all long term retention backups for a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupDatabaseAsync( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + return new PagedFlux<>( + () -> + listByResourceGroupDatabaseSinglePageAsync( + resourceGroupName, + locationName, + managedInstanceName, + databaseName, + onlyLatestPerDatabase, + databaseState, + context), + nextLink -> listByResourceGroupDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all long term retention backups for a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroupDatabase( + String resourceGroupName, String locationName, String managedInstanceName, String databaseName) { + final Boolean onlyLatestPerDatabase = null; + final DatabaseState databaseState = null; + return new PagedIterable<>( + listByResourceGroupDatabaseAsync( + resourceGroupName, + locationName, + managedInstanceName, + databaseName, + onlyLatestPerDatabase, + databaseState)); + } + + /** + * Lists all long term retention backups for a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroupDatabase( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + return new PagedIterable<>( + listByResourceGroupDatabaseAsync( + resourceGroupName, + locationName, + managedInstanceName, + databaseName, + onlyLatestPerDatabase, + databaseState, + context)); + } + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupInstanceSinglePageAsync( + String resourceGroupName, + String locationName, + String managedInstanceName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroupInstance( + this.client.getEndpoint(), + resourceGroupName, + locationName, + managedInstanceName, + onlyLatestPerDatabase, + databaseState, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupInstanceSinglePageAsync( + String resourceGroupName, + String locationName, + String managedInstanceName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupInstance( + this.client.getEndpoint(), + resourceGroupName, + locationName, + managedInstanceName, + onlyLatestPerDatabase, + databaseState, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupInstanceAsync( + String resourceGroupName, + String locationName, + String managedInstanceName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState) { + return new PagedFlux<>( + () -> + listByResourceGroupInstanceSinglePageAsync( + resourceGroupName, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState), + nextLink -> listByResourceGroupInstanceNextSinglePageAsync(nextLink)); + } + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupInstanceAsync( + String resourceGroupName, String locationName, String managedInstanceName) { + final Boolean onlyLatestPerDatabase = null; + final DatabaseState databaseState = null; + return new PagedFlux<>( + () -> + listByResourceGroupInstanceSinglePageAsync( + resourceGroupName, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState), + nextLink -> listByResourceGroupInstanceNextSinglePageAsync(nextLink)); + } + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupInstanceAsync( + String resourceGroupName, + String locationName, + String managedInstanceName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + return new PagedFlux<>( + () -> + listByResourceGroupInstanceSinglePageAsync( + resourceGroupName, + locationName, + managedInstanceName, + onlyLatestPerDatabase, + databaseState, + context), + nextLink -> listByResourceGroupInstanceNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroupInstance( + String resourceGroupName, String locationName, String managedInstanceName) { + final Boolean onlyLatestPerDatabase = null; + final DatabaseState databaseState = null; + return new PagedIterable<>( + listByResourceGroupInstanceAsync( + resourceGroupName, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState)); + } + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroupInstance( + String resourceGroupName, + String locationName, + String managedInstanceName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + return new PagedIterable<>( + listByResourceGroupInstanceAsync( + resourceGroupName, locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, context)); + } + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupLocationSinglePageAsync( + String resourceGroupName, String locationName, Boolean onlyLatestPerDatabase, DatabaseState databaseState) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroupLocation( + this.client.getEndpoint(), + resourceGroupName, + locationName, + onlyLatestPerDatabase, + databaseState, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupLocationSinglePageAsync( + String resourceGroupName, + String locationName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupLocation( + this.client.getEndpoint(), + resourceGroupName, + locationName, + onlyLatestPerDatabase, + databaseState, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupLocationAsync( + String resourceGroupName, String locationName, Boolean onlyLatestPerDatabase, DatabaseState databaseState) { + return new PagedFlux<>( + () -> + listByResourceGroupLocationSinglePageAsync( + resourceGroupName, locationName, onlyLatestPerDatabase, databaseState), + nextLink -> listByResourceGroupLocationNextSinglePageAsync(nextLink)); + } + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupLocationAsync( + String resourceGroupName, String locationName) { + final Boolean onlyLatestPerDatabase = null; + final DatabaseState databaseState = null; + return new PagedFlux<>( + () -> + listByResourceGroupLocationSinglePageAsync( + resourceGroupName, locationName, onlyLatestPerDatabase, databaseState), + nextLink -> listByResourceGroupLocationNextSinglePageAsync(nextLink)); + } + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupLocationAsync( + String resourceGroupName, + String locationName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + return new PagedFlux<>( + () -> + listByResourceGroupLocationSinglePageAsync( + resourceGroupName, locationName, onlyLatestPerDatabase, databaseState, context), + nextLink -> listByResourceGroupLocationNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroupLocation( + String resourceGroupName, String locationName) { + final Boolean onlyLatestPerDatabase = null; + final DatabaseState databaseState = null; + return new PagedIterable<>( + listByResourceGroupLocationAsync(resourceGroupName, locationName, onlyLatestPerDatabase, databaseState)); + } + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroupLocation( + String resourceGroupName, + String locationName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + return new PagedIterable<>( + listByResourceGroupLocationAsync( + resourceGroupName, locationName, onlyLatestPerDatabase, databaseState, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByInstanceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInstanceNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByLocationNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByLocationNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByResourceGroupDatabaseNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service.listByResourceGroupDatabaseNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByResourceGroupDatabaseNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupDatabaseNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByResourceGroupInstanceNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service.listByResourceGroupInstanceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByResourceGroupInstanceNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupInstanceNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByResourceGroupLocationNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service.listByResourceGroupLocationNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByResourceGroupLocationNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupLocationNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionManagedInstanceBackupsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionManagedInstanceBackupsImpl.java new file mode 100644 index 0000000000000..98949efe1a8c4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionManagedInstanceBackupsImpl.java @@ -0,0 +1,272 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.LongTermRetentionManagedInstanceBackupsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceLongTermRetentionBackupInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseState; +import com.azure.resourcemanager.sql.generated.models.LongTermRetentionManagedInstanceBackups; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceLongTermRetentionBackup; + +public final class LongTermRetentionManagedInstanceBackupsImpl implements LongTermRetentionManagedInstanceBackups { + private static final ClientLogger LOGGER = new ClientLogger(LongTermRetentionManagedInstanceBackupsImpl.class); + + private final LongTermRetentionManagedInstanceBackupsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public LongTermRetentionManagedInstanceBackupsImpl( + LongTermRetentionManagedInstanceBackupsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String locationName, String managedInstanceName, String databaseName, String backupName, Context context) { + Response inner = + this.serviceClient().getWithResponse(locationName, managedInstanceName, databaseName, backupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ManagedInstanceLongTermRetentionBackupImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ManagedInstanceLongTermRetentionBackup get( + String locationName, String managedInstanceName, String databaseName, String backupName) { + ManagedInstanceLongTermRetentionBackupInner inner = + this.serviceClient().get(locationName, managedInstanceName, databaseName, backupName); + if (inner != null) { + return new ManagedInstanceLongTermRetentionBackupImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String locationName, String managedInstanceName, String databaseName, String backupName) { + this.serviceClient().delete(locationName, managedInstanceName, databaseName, backupName); + } + + public void delete( + String locationName, String managedInstanceName, String databaseName, String backupName, Context context) { + this.serviceClient().delete(locationName, managedInstanceName, databaseName, backupName, context); + } + + public PagedIterable listByDatabase( + String locationName, String managedInstanceName, String databaseName) { + PagedIterable inner = + this.serviceClient().listByDatabase(locationName, managedInstanceName, databaseName); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceLongTermRetentionBackupImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String locationName, + String managedInstanceName, + String databaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByDatabase( + locationName, managedInstanceName, databaseName, onlyLatestPerDatabase, databaseState, context); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceLongTermRetentionBackupImpl(inner1, this.manager())); + } + + public PagedIterable listByInstance( + String locationName, String managedInstanceName) { + PagedIterable inner = + this.serviceClient().listByInstance(locationName, managedInstanceName); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceLongTermRetentionBackupImpl(inner1, this.manager())); + } + + public PagedIterable listByInstance( + String locationName, + String managedInstanceName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByInstance(locationName, managedInstanceName, onlyLatestPerDatabase, databaseState, context); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceLongTermRetentionBackupImpl(inner1, this.manager())); + } + + public PagedIterable listByLocation(String locationName) { + PagedIterable inner = + this.serviceClient().listByLocation(locationName); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceLongTermRetentionBackupImpl(inner1, this.manager())); + } + + public PagedIterable listByLocation( + String locationName, Boolean onlyLatestPerDatabase, DatabaseState databaseState, Context context) { + PagedIterable inner = + this.serviceClient().listByLocation(locationName, onlyLatestPerDatabase, databaseState, context); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceLongTermRetentionBackupImpl(inner1, this.manager())); + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + String backupName, + Context context) { + Response inner = + this + .serviceClient() + .getByResourceGroupWithResponse( + resourceGroupName, locationName, managedInstanceName, databaseName, backupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ManagedInstanceLongTermRetentionBackupImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ManagedInstanceLongTermRetentionBackup getByResourceGroup( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + String backupName) { + ManagedInstanceLongTermRetentionBackupInner inner = + this + .serviceClient() + .getByResourceGroup(resourceGroupName, locationName, managedInstanceName, databaseName, backupName); + if (inner != null) { + return new ManagedInstanceLongTermRetentionBackupImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + String backupName) { + this + .serviceClient() + .deleteByResourceGroup(resourceGroupName, locationName, managedInstanceName, databaseName, backupName); + } + + public void deleteByResourceGroup( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + String backupName, + Context context) { + this + .serviceClient() + .deleteByResourceGroup( + resourceGroupName, locationName, managedInstanceName, databaseName, backupName, context); + } + + public PagedIterable listByResourceGroupDatabase( + String resourceGroupName, String locationName, String managedInstanceName, String databaseName) { + PagedIterable inner = + this + .serviceClient() + .listByResourceGroupDatabase(resourceGroupName, locationName, managedInstanceName, databaseName); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceLongTermRetentionBackupImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroupDatabase( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByResourceGroupDatabase( + resourceGroupName, + locationName, + managedInstanceName, + databaseName, + onlyLatestPerDatabase, + databaseState, + context); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceLongTermRetentionBackupImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroupInstance( + String resourceGroupName, String locationName, String managedInstanceName) { + PagedIterable inner = + this.serviceClient().listByResourceGroupInstance(resourceGroupName, locationName, managedInstanceName); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceLongTermRetentionBackupImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroupInstance( + String resourceGroupName, + String locationName, + String managedInstanceName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByResourceGroupInstance( + resourceGroupName, + locationName, + managedInstanceName, + onlyLatestPerDatabase, + databaseState, + context); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceLongTermRetentionBackupImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroupLocation( + String resourceGroupName, String locationName) { + PagedIterable inner = + this.serviceClient().listByResourceGroupLocation(resourceGroupName, locationName); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceLongTermRetentionBackupImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroupLocation( + String resourceGroupName, + String locationName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByResourceGroupLocation( + resourceGroupName, locationName, onlyLatestPerDatabase, databaseState, context); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceLongTermRetentionBackupImpl(inner1, this.manager())); + } + + private LongTermRetentionManagedInstanceBackupsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionPoliciesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionPoliciesClientImpl.java new file mode 100644 index 0000000000000..4e2b3cb7eb51d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionPoliciesClientImpl.java @@ -0,0 +1,967 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.LongTermRetentionPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.LongTermRetentionPolicyInner; +import com.azure.resourcemanager.sql.generated.models.LongTermRetentionPolicyListResult; +import com.azure.resourcemanager.sql.generated.models.LongTermRetentionPolicyName; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in LongTermRetentionPoliciesClient. */ +public final class LongTermRetentionPoliciesClientImpl implements LongTermRetentionPoliciesClient { + /** The proxy service used to perform REST calls. */ + private final LongTermRetentionPoliciesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of LongTermRetentionPoliciesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + LongTermRetentionPoliciesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + LongTermRetentionPoliciesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientLongTermRetentionPolicies to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientL") + public interface LongTermRetentionPoliciesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{policyName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("policyName") LongTermRetentionPolicyName policyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{policyName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("policyName") LongTermRetentionPolicyName policyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") LongTermRetentionPolicyInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabaseNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 policyName The policy name. Should always be Default. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's long term retention policy along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, LongTermRetentionPolicyName policyName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + policyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 policyName The policy name. Should always be Default. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's long term retention policy along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + LongTermRetentionPolicyName policyName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + policyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 policyName The policy name. Should always be Default. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's long term retention policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String databaseName, LongTermRetentionPolicyName policyName) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, policyName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 policyName The policy name. Should always be Default. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's long term retention policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + LongTermRetentionPolicyName policyName, + Context context) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, policyName, context).block(); + } + + /** + * 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 policyName The policy name. Should always be Default. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's long term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LongTermRetentionPolicyInner get( + String resourceGroupName, String serverName, String databaseName, LongTermRetentionPolicyName policyName) { + return getWithResponse(resourceGroupName, serverName, databaseName, policyName, Context.NONE).getValue(); + } + + /** + * 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 policyName The policy name. Should always be Default. + * @param parameters The long term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention policy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + LongTermRetentionPolicyName policyName, + LongTermRetentionPolicyInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + policyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 policyName The policy name. Should always be Default. + * @param parameters The long term retention policy info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention policy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + LongTermRetentionPolicyName policyName, + LongTermRetentionPolicyInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + policyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 policyName The policy name. Should always be Default. + * @param parameters The long term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a long term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, LongTermRetentionPolicyInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + LongTermRetentionPolicyName policyName, + LongTermRetentionPolicyInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, databaseName, policyName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + LongTermRetentionPolicyInner.class, + LongTermRetentionPolicyInner.class, + this.client.getContext()); + } + + /** + * 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 policyName The policy name. Should always be Default. + * @param parameters The long term retention policy info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a long term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, LongTermRetentionPolicyInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + LongTermRetentionPolicyName policyName, + LongTermRetentionPolicyInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, serverName, databaseName, policyName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + LongTermRetentionPolicyInner.class, + LongTermRetentionPolicyInner.class, + context); + } + + /** + * 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 policyName The policy name. Should always be Default. + * @param parameters The long term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a long term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, LongTermRetentionPolicyInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + LongTermRetentionPolicyName policyName, + LongTermRetentionPolicyInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, policyName, parameters) + .getSyncPoller(); + } + + /** + * 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 policyName The policy name. Should always be Default. + * @param parameters The long term retention policy info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a long term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, LongTermRetentionPolicyInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + LongTermRetentionPolicyName policyName, + LongTermRetentionPolicyInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, policyName, parameters, context) + .getSyncPoller(); + } + + /** + * 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 policyName The policy name. Should always be Default. + * @param parameters The long term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + LongTermRetentionPolicyName policyName, + LongTermRetentionPolicyInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, policyName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 policyName The policy name. Should always be Default. + * @param parameters The long term retention policy info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + LongTermRetentionPolicyName policyName, + LongTermRetentionPolicyInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, policyName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 policyName The policy name. Should always be Default. + * @param parameters The long term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LongTermRetentionPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + LongTermRetentionPolicyName policyName, + LongTermRetentionPolicyInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, databaseName, policyName, parameters).block(); + } + + /** + * 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 policyName The policy name. Should always be Default. + * @param parameters The long term retention policy info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LongTermRetentionPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + LongTermRetentionPolicyName policyName, + LongTermRetentionPolicyInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, databaseName, policyName, parameters, context) + .block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's long term retention policy along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's long term retention policy along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's long term retention policy as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's long term retention policy as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, context), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's long term retention policy as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's long term retention policy as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention policies along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention policies along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionPoliciesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionPoliciesImpl.java new file mode 100644 index 0000000000000..5a7473481f0cb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionPoliciesImpl.java @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.LongTermRetentionPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.LongTermRetentionPolicyInner; +import com.azure.resourcemanager.sql.generated.models.LongTermRetentionPolicies; +import com.azure.resourcemanager.sql.generated.models.LongTermRetentionPolicy; +import com.azure.resourcemanager.sql.generated.models.LongTermRetentionPolicyName; + +public final class LongTermRetentionPoliciesImpl implements LongTermRetentionPolicies { + private static final ClientLogger LOGGER = new ClientLogger(LongTermRetentionPoliciesImpl.class); + + private final LongTermRetentionPoliciesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public LongTermRetentionPoliciesImpl( + LongTermRetentionPoliciesClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + LongTermRetentionPolicyName policyName, + Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, databaseName, policyName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new LongTermRetentionPolicyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public LongTermRetentionPolicy get( + String resourceGroupName, String serverName, String databaseName, LongTermRetentionPolicyName policyName) { + LongTermRetentionPolicyInner inner = + this.serviceClient().get(resourceGroupName, serverName, databaseName, policyName); + if (inner != null) { + return new LongTermRetentionPolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName); + return Utils.mapPage(inner, inner1 -> new LongTermRetentionPolicyImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName, context); + return Utils.mapPage(inner, inner1 -> new LongTermRetentionPolicyImpl(inner1, this.manager())); + } + + public LongTermRetentionPolicy getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String policyNameLocal = Utils.getValueFromIdByName(id, "backupLongTermRetentionPolicies"); + if (policyNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment" + + " 'backupLongTermRetentionPolicies'.", + id))); + } + LongTermRetentionPolicyName policyName = LongTermRetentionPolicyName.fromString(policyNameLocal); + return this.getWithResponse(resourceGroupName, serverName, databaseName, policyName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String policyNameLocal = Utils.getValueFromIdByName(id, "backupLongTermRetentionPolicies"); + if (policyNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment" + + " 'backupLongTermRetentionPolicies'.", + id))); + } + LongTermRetentionPolicyName policyName = LongTermRetentionPolicyName.fromString(policyNameLocal); + return this.getWithResponse(resourceGroupName, serverName, databaseName, policyName, context); + } + + private LongTermRetentionPoliciesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public LongTermRetentionPolicyImpl define(LongTermRetentionPolicyName name) { + return new LongTermRetentionPolicyImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionPolicyImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionPolicyImpl.java new file mode 100644 index 0000000000000..06547bbb2cba7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/LongTermRetentionPolicyImpl.java @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.LongTermRetentionPolicyInner; +import com.azure.resourcemanager.sql.generated.models.LongTermRetentionPolicy; +import com.azure.resourcemanager.sql.generated.models.LongTermRetentionPolicyName; + +public final class LongTermRetentionPolicyImpl + implements LongTermRetentionPolicy, LongTermRetentionPolicy.Definition, LongTermRetentionPolicy.Update { + private LongTermRetentionPolicyInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String weeklyRetention() { + return this.innerModel().weeklyRetention(); + } + + public String monthlyRetention() { + return this.innerModel().monthlyRetention(); + } + + public String yearlyRetention() { + return this.innerModel().yearlyRetention(); + } + + public Integer weekOfYear() { + return this.innerModel().weekOfYear(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public LongTermRetentionPolicyInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String databaseName; + + private LongTermRetentionPolicyName policyName; + + public LongTermRetentionPolicyImpl withExistingDatabase( + String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + + public LongTermRetentionPolicy create() { + this.innerObject = + serviceManager + .serviceClient() + .getLongTermRetentionPolicies() + .createOrUpdate( + resourceGroupName, serverName, databaseName, policyName, this.innerModel(), Context.NONE); + return this; + } + + public LongTermRetentionPolicy create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getLongTermRetentionPolicies() + .createOrUpdate(resourceGroupName, serverName, databaseName, policyName, this.innerModel(), context); + return this; + } + + LongTermRetentionPolicyImpl( + LongTermRetentionPolicyName name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new LongTermRetentionPolicyInner(); + this.serviceManager = serviceManager; + this.policyName = name; + } + + public LongTermRetentionPolicyImpl update() { + return this; + } + + public LongTermRetentionPolicy apply() { + this.innerObject = + serviceManager + .serviceClient() + .getLongTermRetentionPolicies() + .createOrUpdate( + resourceGroupName, serverName, databaseName, policyName, this.innerModel(), Context.NONE); + return this; + } + + public LongTermRetentionPolicy apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getLongTermRetentionPolicies() + .createOrUpdate(resourceGroupName, serverName, databaseName, policyName, this.innerModel(), context); + return this; + } + + LongTermRetentionPolicyImpl( + LongTermRetentionPolicyInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "databases"); + this.policyName = + LongTermRetentionPolicyName + .fromString(Utils.getValueFromIdByName(innerObject.id(), "backupLongTermRetentionPolicies")); + } + + public LongTermRetentionPolicy refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getLongTermRetentionPolicies() + .getWithResponse(resourceGroupName, serverName, databaseName, policyName, Context.NONE) + .getValue(); + return this; + } + + public LongTermRetentionPolicy refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getLongTermRetentionPolicies() + .getWithResponse(resourceGroupName, serverName, databaseName, policyName, context) + .getValue(); + return this; + } + + public LongTermRetentionPolicyImpl withWeeklyRetention(String weeklyRetention) { + this.innerModel().withWeeklyRetention(weeklyRetention); + return this; + } + + public LongTermRetentionPolicyImpl withMonthlyRetention(String monthlyRetention) { + this.innerModel().withMonthlyRetention(monthlyRetention); + return this; + } + + public LongTermRetentionPolicyImpl withYearlyRetention(String yearlyRetention) { + this.innerModel().withYearlyRetention(yearlyRetention); + return this; + } + + public LongTermRetentionPolicyImpl withWeekOfYear(Integer weekOfYear) { + this.innerModel().withWeekOfYear(weekOfYear); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/MaintenanceWindowOptionsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/MaintenanceWindowOptionsImpl.java new file mode 100644 index 0000000000000..572dd71555098 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/MaintenanceWindowOptionsImpl.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.MaintenanceWindowOptionsInner; +import com.azure.resourcemanager.sql.generated.models.MaintenanceWindowOptions; +import com.azure.resourcemanager.sql.generated.models.MaintenanceWindowTimeRange; +import java.util.Collections; +import java.util.List; + +public final class MaintenanceWindowOptionsImpl implements MaintenanceWindowOptions { + private MaintenanceWindowOptionsInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + MaintenanceWindowOptionsImpl( + MaintenanceWindowOptionsInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public Boolean isEnabled() { + return this.innerModel().isEnabled(); + } + + public List maintenanceWindowCycles() { + List inner = this.innerModel().maintenanceWindowCycles(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Integer minDurationInMinutes() { + return this.innerModel().minDurationInMinutes(); + } + + public Integer defaultDurationInMinutes() { + return this.innerModel().defaultDurationInMinutes(); + } + + public Integer minCycles() { + return this.innerModel().minCycles(); + } + + public Integer timeGranularityInMinutes() { + return this.innerModel().timeGranularityInMinutes(); + } + + public Boolean allowMultipleMaintenanceWindowsPerCycle() { + return this.innerModel().allowMultipleMaintenanceWindowsPerCycle(); + } + + public MaintenanceWindowOptionsInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/MaintenanceWindowOptionsOperationsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/MaintenanceWindowOptionsOperationsClientImpl.java new file mode 100644 index 0000000000000..0e568cb988788 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/MaintenanceWindowOptionsOperationsClientImpl.java @@ -0,0 +1,272 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.MaintenanceWindowOptionsOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.MaintenanceWindowOptionsInner; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in MaintenanceWindowOptionsOperationsClient. + */ +public final class MaintenanceWindowOptionsOperationsClientImpl implements MaintenanceWindowOptionsOperationsClient { + /** The proxy service used to perform REST calls. */ + private final MaintenanceWindowOptionsOperationsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of MaintenanceWindowOptionsOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + MaintenanceWindowOptionsOperationsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + MaintenanceWindowOptionsOperationsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientMaintenanceWindowOptionsOperations to be used by + * the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + public interface MaintenanceWindowOptionsOperationsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/maintenanceWindowOptions/current") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @QueryParam("maintenanceWindowOptionsName") String maintenanceWindowOptionsName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a list of available maintenance windows. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 maintenance windows options for. + * @param maintenanceWindowOptionsName Maintenance window options name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of available maintenance windows along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String maintenanceWindowOptionsName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (maintenanceWindowOptionsName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter maintenanceWindowOptionsName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + maintenanceWindowOptionsName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of available maintenance windows. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 maintenance windows options for. + * @param maintenanceWindowOptionsName Maintenance window options name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of available maintenance windows along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String maintenanceWindowOptionsName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (maintenanceWindowOptionsName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter maintenanceWindowOptionsName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + maintenanceWindowOptionsName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a list of available maintenance windows. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 maintenance windows options for. + * @param maintenanceWindowOptionsName Maintenance window options name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of available maintenance windows on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String databaseName, String maintenanceWindowOptionsName) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, maintenanceWindowOptionsName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a list of available maintenance windows. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 maintenance windows options for. + * @param maintenanceWindowOptionsName Maintenance window options name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of available maintenance windows along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String maintenanceWindowOptionsName, + Context context) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, maintenanceWindowOptionsName, context) + .block(); + } + + /** + * Gets a list of available maintenance windows. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 maintenance windows options for. + * @param maintenanceWindowOptionsName Maintenance window options name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of available maintenance windows. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MaintenanceWindowOptionsInner get( + String resourceGroupName, String serverName, String databaseName, String maintenanceWindowOptionsName) { + return getWithResponse(resourceGroupName, serverName, databaseName, maintenanceWindowOptionsName, Context.NONE) + .getValue(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/MaintenanceWindowOptionsOperationsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/MaintenanceWindowOptionsOperationsImpl.java new file mode 100644 index 0000000000000..1c3cd5d30afbd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/MaintenanceWindowOptionsOperationsImpl.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.MaintenanceWindowOptionsOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.MaintenanceWindowOptionsInner; +import com.azure.resourcemanager.sql.generated.models.MaintenanceWindowOptions; +import com.azure.resourcemanager.sql.generated.models.MaintenanceWindowOptionsOperations; + +public final class MaintenanceWindowOptionsOperationsImpl implements MaintenanceWindowOptionsOperations { + private static final ClientLogger LOGGER = new ClientLogger(MaintenanceWindowOptionsOperationsImpl.class); + + private final MaintenanceWindowOptionsOperationsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public MaintenanceWindowOptionsOperationsImpl( + MaintenanceWindowOptionsOperationsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String maintenanceWindowOptionsName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, serverName, databaseName, maintenanceWindowOptionsName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new MaintenanceWindowOptionsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public MaintenanceWindowOptions get( + String resourceGroupName, String serverName, String databaseName, String maintenanceWindowOptionsName) { + MaintenanceWindowOptionsInner inner = + this.serviceClient().get(resourceGroupName, serverName, databaseName, maintenanceWindowOptionsName); + if (inner != null) { + return new MaintenanceWindowOptionsImpl(inner, this.manager()); + } else { + return null; + } + } + + private MaintenanceWindowOptionsOperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/MaintenanceWindowsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/MaintenanceWindowsImpl.java new file mode 100644 index 0000000000000..d42224fb1c7b0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/MaintenanceWindowsImpl.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.MaintenanceWindowsInner; +import com.azure.resourcemanager.sql.generated.models.MaintenanceWindowTimeRange; +import com.azure.resourcemanager.sql.generated.models.MaintenanceWindows; +import java.util.Collections; +import java.util.List; + +public final class MaintenanceWindowsImpl implements MaintenanceWindows { + private MaintenanceWindowsInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + MaintenanceWindowsImpl( + MaintenanceWindowsInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public List timeRanges() { + List inner = this.innerModel().timeRanges(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public MaintenanceWindowsInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/MaintenanceWindowsOperationsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/MaintenanceWindowsOperationsClientImpl.java new file mode 100644 index 0000000000000..7e7b0223376a4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/MaintenanceWindowsOperationsClientImpl.java @@ -0,0 +1,500 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.MaintenanceWindowsOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.MaintenanceWindowsInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in MaintenanceWindowsOperationsClient. */ +public final class MaintenanceWindowsOperationsClientImpl implements MaintenanceWindowsOperationsClient { + /** The proxy service used to perform REST calls. */ + private final MaintenanceWindowsOperationsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of MaintenanceWindowsOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + MaintenanceWindowsOperationsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + MaintenanceWindowsOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientMaintenanceWindowsOperations to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + public interface MaintenanceWindowsOperationsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/maintenanceWindows/current") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @QueryParam("maintenanceWindowName") String maintenanceWindowName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/maintenanceWindows/current") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @QueryParam("maintenanceWindowName") String maintenanceWindowName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") MaintenanceWindowsInner parameters, + Context context); + } + + /** + * Gets maintenance windows settings for 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 get maintenance windows for. + * @param maintenanceWindowName Maintenance window name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return maintenance windows settings for a database along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String maintenanceWindowName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (maintenanceWindowName == null) { + return Mono + .error(new IllegalArgumentException("Parameter maintenanceWindowName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + maintenanceWindowName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets maintenance windows settings for 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 get maintenance windows for. + * @param maintenanceWindowName Maintenance window name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return maintenance windows settings for a database along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String maintenanceWindowName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (maintenanceWindowName == null) { + return Mono + .error(new IllegalArgumentException("Parameter maintenanceWindowName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + maintenanceWindowName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets maintenance windows settings for 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 get maintenance windows for. + * @param maintenanceWindowName Maintenance window name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return maintenance windows settings for a database on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String databaseName, String maintenanceWindowName) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, maintenanceWindowName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets maintenance windows settings for 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 get maintenance windows for. + * @param maintenanceWindowName Maintenance window name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return maintenance windows settings for a database along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String maintenanceWindowName, + Context context) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, maintenanceWindowName, context) + .block(); + } + + /** + * Gets maintenance windows settings for 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 get maintenance windows for. + * @param maintenanceWindowName Maintenance window name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return maintenance windows settings for a database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MaintenanceWindowsInner get( + String resourceGroupName, String serverName, String databaseName, String maintenanceWindowName) { + return getWithResponse(resourceGroupName, serverName, databaseName, maintenanceWindowName, Context.NONE) + .getValue(); + } + + /** + * Sets maintenance windows settings for 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 set maintenance windows for. + * @param maintenanceWindowName Maintenance window name. + * @param parameters Maintenance windows. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String maintenanceWindowName, + MaintenanceWindowsInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (maintenanceWindowName == null) { + return Mono + .error(new IllegalArgumentException("Parameter maintenanceWindowName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + maintenanceWindowName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Sets maintenance windows settings for 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 set maintenance windows for. + * @param maintenanceWindowName Maintenance window name. + * @param parameters Maintenance windows. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String maintenanceWindowName, + MaintenanceWindowsInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (maintenanceWindowName == null) { + return Mono + .error(new IllegalArgumentException("Parameter maintenanceWindowName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + maintenanceWindowName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + context); + } + + /** + * Sets maintenance windows settings for 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 set maintenance windows for. + * @param maintenanceWindowName Maintenance window name. + * @param parameters Maintenance windows. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String maintenanceWindowName, + MaintenanceWindowsInner parameters) { + return createOrUpdateWithResponseAsync( + resourceGroupName, serverName, databaseName, maintenanceWindowName, parameters) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Sets maintenance windows settings for 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 set maintenance windows for. + * @param maintenanceWindowName Maintenance window name. + * @param parameters Maintenance windows. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String maintenanceWindowName, + MaintenanceWindowsInner parameters, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, serverName, databaseName, maintenanceWindowName, parameters, context) + .block(); + } + + /** + * Sets maintenance windows settings for 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 set maintenance windows for. + * @param maintenanceWindowName Maintenance window name. + * @param parameters Maintenance windows. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String maintenanceWindowName, + MaintenanceWindowsInner parameters) { + createOrUpdateWithResponse( + resourceGroupName, serverName, databaseName, maintenanceWindowName, parameters, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/MaintenanceWindowsOperationsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/MaintenanceWindowsOperationsImpl.java new file mode 100644 index 0000000000000..85426da23bb17 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/MaintenanceWindowsOperationsImpl.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.MaintenanceWindowsOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.MaintenanceWindowsInner; +import com.azure.resourcemanager.sql.generated.models.MaintenanceWindows; +import com.azure.resourcemanager.sql.generated.models.MaintenanceWindowsOperations; + +public final class MaintenanceWindowsOperationsImpl implements MaintenanceWindowsOperations { + private static final ClientLogger LOGGER = new ClientLogger(MaintenanceWindowsOperationsImpl.class); + + private final MaintenanceWindowsOperationsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public MaintenanceWindowsOperationsImpl( + MaintenanceWindowsOperationsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String maintenanceWindowName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, serverName, databaseName, maintenanceWindowName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new MaintenanceWindowsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public MaintenanceWindows get( + String resourceGroupName, String serverName, String databaseName, String maintenanceWindowName) { + MaintenanceWindowsInner inner = + this.serviceClient().get(resourceGroupName, serverName, databaseName, maintenanceWindowName); + if (inner != null) { + return new MaintenanceWindowsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String maintenanceWindowName, + MaintenanceWindowsInner parameters, + Context context) { + return this + .serviceClient() + .createOrUpdateWithResponse( + resourceGroupName, serverName, databaseName, maintenanceWindowName, parameters, context); + } + + public void createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String maintenanceWindowName, + MaintenanceWindowsInner parameters) { + this + .serviceClient() + .createOrUpdate(resourceGroupName, serverName, databaseName, maintenanceWindowName, parameters); + } + + private MaintenanceWindowsOperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedBackupShortTermRetentionPoliciesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedBackupShortTermRetentionPoliciesClientImpl.java new file mode 100644 index 0000000000000..af784332578ab --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedBackupShortTermRetentionPoliciesClientImpl.java @@ -0,0 +1,1403 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ManagedBackupShortTermRetentionPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedBackupShortTermRetentionPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ManagedBackupShortTermRetentionPolicyListResult; +import com.azure.resourcemanager.sql.generated.models.ManagedShortTermRetentionPolicyName; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * ManagedBackupShortTermRetentionPoliciesClient. + */ +public final class ManagedBackupShortTermRetentionPoliciesClientImpl + implements ManagedBackupShortTermRetentionPoliciesClient { + /** The proxy service used to perform REST calls. */ + private final ManagedBackupShortTermRetentionPoliciesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedBackupShortTermRetentionPoliciesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedBackupShortTermRetentionPoliciesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ManagedBackupShortTermRetentionPoliciesService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientManagedBackupShortTermRetentionPolicies to be used + * by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + public interface ManagedBackupShortTermRetentionPoliciesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/backupShortTermRetentionPolicies" + + "/{policyName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("policyName") ManagedShortTermRetentionPolicyName policyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/backupShortTermRetentionPolicies" + + "/{policyName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("policyName") ManagedShortTermRetentionPolicyName policyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ManagedBackupShortTermRetentionPolicyInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/backupShortTermRetentionPolicies" + + "/{policyName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("policyName") ManagedShortTermRetentionPolicyName policyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ManagedBackupShortTermRetentionPolicyInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/backupShortTermRetentionPolicies") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabaseNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 policyName The policy name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's short term retention policy along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + policyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 policyName The policy name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's short term retention policy along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + policyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 policyName The policy name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's short term retention policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, policyName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 policyName The policy name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's short term retention policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + Context context) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, policyName, context).block(); + } + + /** + * 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 policyName The policy name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedBackupShortTermRetentionPolicyInner get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName) { + return getWithResponse(resourceGroupName, managedInstanceName, databaseName, policyName, Context.NONE) + .getValue(); + } + + /** + * 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 policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a short term retention policy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + policyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a short term retention policy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + policyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux< + PollResult, ManagedBackupShortTermRetentionPolicyInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, policyName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedBackupShortTermRetentionPolicyInner.class, + ManagedBackupShortTermRetentionPolicyInner.class, + this.client.getContext()); + } + + /** + * 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 policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux< + PollResult, ManagedBackupShortTermRetentionPolicyInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, policyName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedBackupShortTermRetentionPolicyInner.class, + ManagedBackupShortTermRetentionPolicyInner.class, + context); + } + + /** + * 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 policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller< + PollResult, ManagedBackupShortTermRetentionPolicyInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, databaseName, policyName, parameters) + .getSyncPoller(); + } + + /** + * 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 policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller< + PollResult, ManagedBackupShortTermRetentionPolicyInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, managedInstanceName, databaseName, policyName, parameters, context) + .getSyncPoller(); + } + + /** + * 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 policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a short term retention policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, databaseName, policyName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a short term retention policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, managedInstanceName, databaseName, policyName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedBackupShortTermRetentionPolicyInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters) { + return createOrUpdateAsync(resourceGroupName, managedInstanceName, databaseName, policyName, parameters) + .block(); + } + + /** + * 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 policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedBackupShortTermRetentionPolicyInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context) { + return createOrUpdateAsync( + resourceGroupName, managedInstanceName, databaseName, policyName, parameters, context) + .block(); + } + + /** + * 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 policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a short term retention policy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + policyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a short term retention policy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + policyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux< + PollResult, ManagedBackupShortTermRetentionPolicyInner> + beginUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, policyName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedBackupShortTermRetentionPolicyInner.class, + ManagedBackupShortTermRetentionPolicyInner.class, + this.client.getContext()); + } + + /** + * 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 policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux< + PollResult, ManagedBackupShortTermRetentionPolicyInner> + beginUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, policyName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedBackupShortTermRetentionPolicyInner.class, + ManagedBackupShortTermRetentionPolicyInner.class, + context); + } + + /** + * 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 policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller< + PollResult, ManagedBackupShortTermRetentionPolicyInner> + beginUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters) { + return beginUpdateAsync(resourceGroupName, managedInstanceName, databaseName, policyName, parameters) + .getSyncPoller(); + } + + /** + * 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 policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller< + PollResult, ManagedBackupShortTermRetentionPolicyInner> + beginUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context) { + return beginUpdateAsync(resourceGroupName, managedInstanceName, databaseName, policyName, parameters, context) + .getSyncPoller(); + } + + /** + * 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 policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a short term retention policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters) { + return beginUpdateAsync(resourceGroupName, managedInstanceName, databaseName, policyName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a short term retention policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context) { + return beginUpdateAsync(resourceGroupName, managedInstanceName, databaseName, policyName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedBackupShortTermRetentionPolicyInner update( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters) { + return updateAsync(resourceGroupName, managedInstanceName, databaseName, policyName, parameters).block(); + } + + /** + * 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 policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedBackupShortTermRetentionPolicyInner update( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context) { + return updateAsync(resourceGroupName, managedInstanceName, databaseName, policyName, parameters, context) + .block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's short term retention policy list along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String managedInstanceName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's short term retention policy list along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String managedInstanceName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's short term retention policy list as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String managedInstanceName, String databaseName) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, managedInstanceName, databaseName), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's short term retention policy list as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String managedInstanceName, String databaseName, Context context) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, managedInstanceName, databaseName, context), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's short term retention policy list as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, managedInstanceName, 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's short term retention policy list as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName, Context context) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of short term retention policies along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of short term retention policies along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedBackupShortTermRetentionPoliciesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedBackupShortTermRetentionPoliciesImpl.java new file mode 100644 index 0000000000000..c8e4ca98cf91f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedBackupShortTermRetentionPoliciesImpl.java @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ManagedBackupShortTermRetentionPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedBackupShortTermRetentionPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ManagedBackupShortTermRetentionPolicies; +import com.azure.resourcemanager.sql.generated.models.ManagedBackupShortTermRetentionPolicy; +import com.azure.resourcemanager.sql.generated.models.ManagedShortTermRetentionPolicyName; + +public final class ManagedBackupShortTermRetentionPoliciesImpl implements ManagedBackupShortTermRetentionPolicies { + private static final ClientLogger LOGGER = new ClientLogger(ManagedBackupShortTermRetentionPoliciesImpl.class); + + private final ManagedBackupShortTermRetentionPoliciesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedBackupShortTermRetentionPoliciesImpl( + ManagedBackupShortTermRetentionPoliciesClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, managedInstanceName, databaseName, policyName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ManagedBackupShortTermRetentionPolicyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ManagedBackupShortTermRetentionPolicy get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName) { + ManagedBackupShortTermRetentionPolicyInner inner = + this.serviceClient().get(resourceGroupName, managedInstanceName, databaseName, policyName); + if (inner != null) { + return new ManagedBackupShortTermRetentionPolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, managedInstanceName, databaseName); + return Utils.mapPage(inner, inner1 -> new ManagedBackupShortTermRetentionPolicyImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, managedInstanceName, databaseName, context); + return Utils.mapPage(inner, inner1 -> new ManagedBackupShortTermRetentionPolicyImpl(inner1, this.manager())); + } + + public ManagedBackupShortTermRetentionPolicy getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String policyNameLocal = Utils.getValueFromIdByName(id, "backupShortTermRetentionPolicies"); + if (policyNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment" + + " 'backupShortTermRetentionPolicies'.", + id))); + } + ManagedShortTermRetentionPolicyName policyName = + ManagedShortTermRetentionPolicyName.fromString(policyNameLocal); + return this + .getWithResponse(resourceGroupName, managedInstanceName, databaseName, policyName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String policyNameLocal = Utils.getValueFromIdByName(id, "backupShortTermRetentionPolicies"); + if (policyNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment" + + " 'backupShortTermRetentionPolicies'.", + id))); + } + ManagedShortTermRetentionPolicyName policyName = + ManagedShortTermRetentionPolicyName.fromString(policyNameLocal); + return this.getWithResponse(resourceGroupName, managedInstanceName, databaseName, policyName, context); + } + + private ManagedBackupShortTermRetentionPoliciesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ManagedBackupShortTermRetentionPolicyImpl define(ManagedShortTermRetentionPolicyName name) { + return new ManagedBackupShortTermRetentionPolicyImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedBackupShortTermRetentionPolicyImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedBackupShortTermRetentionPolicyImpl.java new file mode 100644 index 0000000000000..aed36fd14dc9d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedBackupShortTermRetentionPolicyImpl.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedBackupShortTermRetentionPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ManagedBackupShortTermRetentionPolicy; +import com.azure.resourcemanager.sql.generated.models.ManagedShortTermRetentionPolicyName; + +public final class ManagedBackupShortTermRetentionPolicyImpl + implements ManagedBackupShortTermRetentionPolicy, + ManagedBackupShortTermRetentionPolicy.Definition, + ManagedBackupShortTermRetentionPolicy.Update { + private ManagedBackupShortTermRetentionPolicyInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public Integer retentionDays() { + return this.innerModel().retentionDays(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ManagedBackupShortTermRetentionPolicyInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String managedInstanceName; + + private String databaseName; + + private ManagedShortTermRetentionPolicyName policyName; + + public ManagedBackupShortTermRetentionPolicyImpl withExistingDatabase( + String resourceGroupName, String managedInstanceName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + this.databaseName = databaseName; + return this; + } + + public ManagedBackupShortTermRetentionPolicy create() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedBackupShortTermRetentionPolicies() + .createOrUpdate( + resourceGroupName, managedInstanceName, databaseName, policyName, this.innerModel(), Context.NONE); + return this; + } + + public ManagedBackupShortTermRetentionPolicy create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedBackupShortTermRetentionPolicies() + .createOrUpdate( + resourceGroupName, managedInstanceName, databaseName, policyName, this.innerModel(), context); + return this; + } + + ManagedBackupShortTermRetentionPolicyImpl( + ManagedShortTermRetentionPolicyName name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ManagedBackupShortTermRetentionPolicyInner(); + this.serviceManager = serviceManager; + this.policyName = name; + } + + public ManagedBackupShortTermRetentionPolicyImpl update() { + return this; + } + + public ManagedBackupShortTermRetentionPolicy apply() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedBackupShortTermRetentionPolicies() + .update( + resourceGroupName, managedInstanceName, databaseName, policyName, this.innerModel(), Context.NONE); + return this; + } + + public ManagedBackupShortTermRetentionPolicy apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedBackupShortTermRetentionPolicies() + .update(resourceGroupName, managedInstanceName, databaseName, policyName, this.innerModel(), context); + return this; + } + + ManagedBackupShortTermRetentionPolicyImpl( + ManagedBackupShortTermRetentionPolicyInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.managedInstanceName = Utils.getValueFromIdByName(innerObject.id(), "managedInstances"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "databases"); + this.policyName = + ManagedShortTermRetentionPolicyName + .fromString(Utils.getValueFromIdByName(innerObject.id(), "backupShortTermRetentionPolicies")); + } + + public ManagedBackupShortTermRetentionPolicy refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedBackupShortTermRetentionPolicies() + .getWithResponse(resourceGroupName, managedInstanceName, databaseName, policyName, Context.NONE) + .getValue(); + return this; + } + + public ManagedBackupShortTermRetentionPolicy refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedBackupShortTermRetentionPolicies() + .getWithResponse(resourceGroupName, managedInstanceName, databaseName, policyName, context) + .getValue(); + return this; + } + + public ManagedBackupShortTermRetentionPolicyImpl withRetentionDays(Integer retentionDays) { + this.innerModel().withRetentionDays(retentionDays); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseAdvancedThreatProtectionImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseAdvancedThreatProtectionImpl.java new file mode 100644 index 0000000000000..2c8fbc6e485aa --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseAdvancedThreatProtectionImpl.java @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedDatabaseAdvancedThreatProtectionInner; +import com.azure.resourcemanager.sql.generated.models.AdvancedThreatProtectionName; +import com.azure.resourcemanager.sql.generated.models.AdvancedThreatProtectionState; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseAdvancedThreatProtection; +import java.time.OffsetDateTime; + +public final class ManagedDatabaseAdvancedThreatProtectionImpl + implements ManagedDatabaseAdvancedThreatProtection, + ManagedDatabaseAdvancedThreatProtection.Definition, + ManagedDatabaseAdvancedThreatProtection.Update { + private ManagedDatabaseAdvancedThreatProtectionInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public AdvancedThreatProtectionState state() { + return this.innerModel().state(); + } + + public OffsetDateTime creationTime() { + return this.innerModel().creationTime(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ManagedDatabaseAdvancedThreatProtectionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String managedInstanceName; + + private String databaseName; + + private AdvancedThreatProtectionName advancedThreatProtectionName; + + public ManagedDatabaseAdvancedThreatProtectionImpl withExistingDatabase( + String resourceGroupName, String managedInstanceName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + this.databaseName = databaseName; + return this; + } + + public ManagedDatabaseAdvancedThreatProtection create() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedDatabaseAdvancedThreatProtectionSettings() + .createOrUpdateWithResponse( + resourceGroupName, + managedInstanceName, + databaseName, + advancedThreatProtectionName, + this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public ManagedDatabaseAdvancedThreatProtection create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedDatabaseAdvancedThreatProtectionSettings() + .createOrUpdateWithResponse( + resourceGroupName, + managedInstanceName, + databaseName, + advancedThreatProtectionName, + this.innerModel(), + context) + .getValue(); + return this; + } + + ManagedDatabaseAdvancedThreatProtectionImpl( + AdvancedThreatProtectionName name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ManagedDatabaseAdvancedThreatProtectionInner(); + this.serviceManager = serviceManager; + this.advancedThreatProtectionName = name; + } + + public ManagedDatabaseAdvancedThreatProtectionImpl update() { + return this; + } + + public ManagedDatabaseAdvancedThreatProtection apply() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedDatabaseAdvancedThreatProtectionSettings() + .createOrUpdateWithResponse( + resourceGroupName, + managedInstanceName, + databaseName, + advancedThreatProtectionName, + this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public ManagedDatabaseAdvancedThreatProtection apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedDatabaseAdvancedThreatProtectionSettings() + .createOrUpdateWithResponse( + resourceGroupName, + managedInstanceName, + databaseName, + advancedThreatProtectionName, + this.innerModel(), + context) + .getValue(); + return this; + } + + ManagedDatabaseAdvancedThreatProtectionImpl( + ManagedDatabaseAdvancedThreatProtectionInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.managedInstanceName = Utils.getValueFromIdByName(innerObject.id(), "managedInstances"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "databases"); + this.advancedThreatProtectionName = + AdvancedThreatProtectionName + .fromString(Utils.getValueFromIdByName(innerObject.id(), "advancedThreatProtectionSettings")); + } + + public ManagedDatabaseAdvancedThreatProtection refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedDatabaseAdvancedThreatProtectionSettings() + .getWithResponse( + resourceGroupName, managedInstanceName, databaseName, advancedThreatProtectionName, Context.NONE) + .getValue(); + return this; + } + + public ManagedDatabaseAdvancedThreatProtection refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedDatabaseAdvancedThreatProtectionSettings() + .getWithResponse( + resourceGroupName, managedInstanceName, databaseName, advancedThreatProtectionName, context) + .getValue(); + return this; + } + + public ManagedDatabaseAdvancedThreatProtectionImpl withState(AdvancedThreatProtectionState state) { + this.innerModel().withState(state); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseAdvancedThreatProtectionSettingsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseAdvancedThreatProtectionSettingsClientImpl.java new file mode 100644 index 0000000000000..493079b958b2e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseAdvancedThreatProtectionSettingsClientImpl.java @@ -0,0 +1,866 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseAdvancedThreatProtectionSettingsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedDatabaseAdvancedThreatProtectionInner; +import com.azure.resourcemanager.sql.generated.models.AdvancedThreatProtectionName; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseAdvancedThreatProtectionListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * ManagedDatabaseAdvancedThreatProtectionSettingsClient. + */ +public final class ManagedDatabaseAdvancedThreatProtectionSettingsClientImpl + implements ManagedDatabaseAdvancedThreatProtectionSettingsClient { + /** The proxy service used to perform REST calls. */ + private final ManagedDatabaseAdvancedThreatProtectionSettingsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedDatabaseAdvancedThreatProtectionSettingsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedDatabaseAdvancedThreatProtectionSettingsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ManagedDatabaseAdvancedThreatProtectionSettingsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientManagedDatabaseAdvancedThreatProtectionSettings to + * be used by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + public interface ManagedDatabaseAdvancedThreatProtectionSettingsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/advancedThreatProtectionSettings") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/advancedThreatProtectionSettings" + + "/{advancedThreatProtectionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("advancedThreatProtectionName") AdvancedThreatProtectionName advancedThreatProtectionName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/advancedThreatProtectionSettings" + + "/{advancedThreatProtectionName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("advancedThreatProtectionName") AdvancedThreatProtectionName advancedThreatProtectionName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ManagedDatabaseAdvancedThreatProtectionInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabaseNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a list of managed database's Advanced Threat Protection states. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed database's Advanced Threat Protection states along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String managedInstanceName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of managed database's Advanced Threat Protection states. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed database's Advanced Threat Protection states along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String managedInstanceName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of managed database's Advanced Threat Protection states. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed database's Advanced Threat Protection states as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String managedInstanceName, String databaseName) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, managedInstanceName, databaseName), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of managed database's Advanced Threat Protection states. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed database's Advanced Threat Protection states as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String managedInstanceName, String databaseName, Context context) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, managedInstanceName, databaseName, context), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of managed database's Advanced Threat Protection states. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed database's Advanced Threat Protection states as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName)); + } + + /** + * Gets a list of managed database's Advanced Threat Protection states. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed database's Advanced Threat Protection states as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName, Context context) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName, context)); + } + + /** + * Gets a managed database's Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's Advanced Threat Protection state along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + AdvancedThreatProtectionName advancedThreatProtectionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (advancedThreatProtectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter advancedThreatProtectionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + advancedThreatProtectionName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a managed database's Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's Advanced Threat Protection state along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + AdvancedThreatProtectionName advancedThreatProtectionName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (advancedThreatProtectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter advancedThreatProtectionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + advancedThreatProtectionName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a managed database's Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's Advanced Threat Protection state on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + AdvancedThreatProtectionName advancedThreatProtectionName) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, advancedThreatProtectionName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a managed database's Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's Advanced Threat Protection state along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + AdvancedThreatProtectionName advancedThreatProtectionName, + Context context) { + return getWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, advancedThreatProtectionName, context) + .block(); + } + + /** + * Gets a managed database's Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's Advanced Threat Protection state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedDatabaseAdvancedThreatProtectionInner get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + AdvancedThreatProtectionName advancedThreatProtectionName) { + return getWithResponse( + resourceGroupName, managedInstanceName, databaseName, advancedThreatProtectionName, Context.NONE) + .getValue(); + } + + /** + * Creates or updates a managed database's Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @param parameters The managed database Advanced Threat Protection state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database Advanced Threat Protection along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + AdvancedThreatProtectionName advancedThreatProtectionName, + ManagedDatabaseAdvancedThreatProtectionInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (advancedThreatProtectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter advancedThreatProtectionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + advancedThreatProtectionName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a managed database's Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @param parameters The managed database Advanced Threat Protection state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database Advanced Threat Protection along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + AdvancedThreatProtectionName advancedThreatProtectionName, + ManagedDatabaseAdvancedThreatProtectionInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (advancedThreatProtectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter advancedThreatProtectionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + advancedThreatProtectionName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates a managed database's Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @param parameters The managed database Advanced Threat Protection state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database Advanced Threat Protection on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + AdvancedThreatProtectionName advancedThreatProtectionName, + ManagedDatabaseAdvancedThreatProtectionInner parameters) { + return createOrUpdateWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, advancedThreatProtectionName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or updates a managed database's Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @param parameters The managed database Advanced Threat Protection state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database Advanced Threat Protection along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + AdvancedThreatProtectionName advancedThreatProtectionName, + ManagedDatabaseAdvancedThreatProtectionInner parameters, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, advancedThreatProtectionName, parameters, context) + .block(); + } + + /** + * Creates or updates a managed database's Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @param parameters The managed database Advanced Threat Protection state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database Advanced Threat Protection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedDatabaseAdvancedThreatProtectionInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + AdvancedThreatProtectionName advancedThreatProtectionName, + ManagedDatabaseAdvancedThreatProtectionInner parameters) { + return createOrUpdateWithResponse( + resourceGroupName, + managedInstanceName, + databaseName, + advancedThreatProtectionName, + parameters, + Context.NONE) + .getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the managed database's Advanced Threat Protection settings along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the managed database's Advanced Threat Protection settings along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseAdvancedThreatProtectionSettingsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseAdvancedThreatProtectionSettingsImpl.java new file mode 100644 index 0000000000000..2616b632d2e24 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseAdvancedThreatProtectionSettingsImpl.java @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseAdvancedThreatProtectionSettingsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedDatabaseAdvancedThreatProtectionInner; +import com.azure.resourcemanager.sql.generated.models.AdvancedThreatProtectionName; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseAdvancedThreatProtection; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseAdvancedThreatProtectionSettings; + +public final class ManagedDatabaseAdvancedThreatProtectionSettingsImpl + implements ManagedDatabaseAdvancedThreatProtectionSettings { + private static final ClientLogger LOGGER = + new ClientLogger(ManagedDatabaseAdvancedThreatProtectionSettingsImpl.class); + + private final ManagedDatabaseAdvancedThreatProtectionSettingsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedDatabaseAdvancedThreatProtectionSettingsImpl( + ManagedDatabaseAdvancedThreatProtectionSettingsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, managedInstanceName, databaseName); + return Utils.mapPage(inner, inner1 -> new ManagedDatabaseAdvancedThreatProtectionImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, managedInstanceName, databaseName, context); + return Utils.mapPage(inner, inner1 -> new ManagedDatabaseAdvancedThreatProtectionImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + AdvancedThreatProtectionName advancedThreatProtectionName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse( + resourceGroupName, managedInstanceName, databaseName, advancedThreatProtectionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ManagedDatabaseAdvancedThreatProtectionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ManagedDatabaseAdvancedThreatProtection get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + AdvancedThreatProtectionName advancedThreatProtectionName) { + ManagedDatabaseAdvancedThreatProtectionInner inner = + this + .serviceClient() + .get(resourceGroupName, managedInstanceName, databaseName, advancedThreatProtectionName); + if (inner != null) { + return new ManagedDatabaseAdvancedThreatProtectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public ManagedDatabaseAdvancedThreatProtection getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String advancedThreatProtectionNameLocal = Utils.getValueFromIdByName(id, "advancedThreatProtectionSettings"); + if (advancedThreatProtectionNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment" + + " 'advancedThreatProtectionSettings'.", + id))); + } + AdvancedThreatProtectionName advancedThreatProtectionName = + AdvancedThreatProtectionName.fromString(advancedThreatProtectionNameLocal); + return this + .getWithResponse( + resourceGroupName, managedInstanceName, databaseName, advancedThreatProtectionName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String advancedThreatProtectionNameLocal = Utils.getValueFromIdByName(id, "advancedThreatProtectionSettings"); + if (advancedThreatProtectionNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment" + + " 'advancedThreatProtectionSettings'.", + id))); + } + AdvancedThreatProtectionName advancedThreatProtectionName = + AdvancedThreatProtectionName.fromString(advancedThreatProtectionNameLocal); + return this + .getWithResponse( + resourceGroupName, managedInstanceName, databaseName, advancedThreatProtectionName, context); + } + + private ManagedDatabaseAdvancedThreatProtectionSettingsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ManagedDatabaseAdvancedThreatProtectionImpl define(AdvancedThreatProtectionName name) { + return new ManagedDatabaseAdvancedThreatProtectionImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseColumnsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseColumnsClientImpl.java new file mode 100644 index 0000000000000..1b33c9667dc55 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseColumnsClientImpl.java @@ -0,0 +1,1206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseColumnsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseColumnInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseColumnListResult; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ManagedDatabaseColumnsClient. */ +public final class ManagedDatabaseColumnsClientImpl implements ManagedDatabaseColumnsClient { + /** The proxy service used to perform REST calls. */ + private final ManagedDatabaseColumnsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedDatabaseColumnsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedDatabaseColumnsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create(ManagedDatabaseColumnsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientManagedDatabaseColumns to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + public interface ManagedDatabaseColumnsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/columns") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @QueryParam(value = "schema", multipleQueryParams = true) List schema, + @QueryParam(value = "table", multipleQueryParams = true) List table, + @QueryParam(value = "column", multipleQueryParams = true) List column, + @QueryParam(value = "orderBy", multipleQueryParams = true) List orderBy, + @QueryParam("$skiptoken") String skiptoken, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}/tables" + + "/{tableName}/columns") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByTable( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("schemaName") String schemaName, + @PathParam("tableName") String tableName, + @QueryParam("$filter") String filter, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}/tables" + + "/{tableName}/columns/{columnName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("schemaName") String schemaName, + @PathParam("tableName") String tableName, + @PathParam("columnName") String columnName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabaseNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByTableNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List managed database columns. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schema Array of Get3ItemsItem. + * @param table Array of Get4ItemsItem. + * @param column Array of Get5ItemsItem. + * @param orderBy Array of Get6ItemsItem. + * @param skiptoken An opaque token that identifies a starting point in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database columns along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + List schema, + List table, + List column, + List orderBy, + String skiptoken) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + List schemaConverted = + (schema == null) + ? new ArrayList<>() + : schema.stream().map(item -> Objects.toString(item, "")).collect(Collectors.toList()); + List tableConverted = + (table == null) + ? new ArrayList<>() + : table.stream().map(item -> Objects.toString(item, "")).collect(Collectors.toList()); + List columnConverted = + (column == null) + ? new ArrayList<>() + : column.stream().map(item -> Objects.toString(item, "")).collect(Collectors.toList()); + List orderByConverted = + (orderBy == null) + ? new ArrayList<>() + : orderBy.stream().map(item -> Objects.toString(item, "")).collect(Collectors.toList()); + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + schemaConverted, + tableConverted, + columnConverted, + orderByConverted, + skiptoken, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List managed database columns. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schema Array of Get3ItemsItem. + * @param table Array of Get4ItemsItem. + * @param column Array of Get5ItemsItem. + * @param orderBy Array of Get6ItemsItem. + * @param skiptoken An opaque token that identifies a starting point in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database columns along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + List schema, + List table, + List column, + List orderBy, + String skiptoken, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + List schemaConverted = + (schema == null) + ? new ArrayList<>() + : schema.stream().map(item -> Objects.toString(item, "")).collect(Collectors.toList()); + List tableConverted = + (table == null) + ? new ArrayList<>() + : table.stream().map(item -> Objects.toString(item, "")).collect(Collectors.toList()); + List columnConverted = + (column == null) + ? new ArrayList<>() + : column.stream().map(item -> Objects.toString(item, "")).collect(Collectors.toList()); + List orderByConverted = + (orderBy == null) + ? new ArrayList<>() + : orderBy.stream().map(item -> Objects.toString(item, "")).collect(Collectors.toList()); + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + schemaConverted, + tableConverted, + columnConverted, + orderByConverted, + skiptoken, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List managed database columns. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schema Array of Get3ItemsItem. + * @param table Array of Get4ItemsItem. + * @param column Array of Get5ItemsItem. + * @param orderBy Array of Get6ItemsItem. + * @param skiptoken An opaque token that identifies a starting point in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database columns as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + List schema, + List table, + List column, + List orderBy, + String skiptoken) { + return new PagedFlux<>( + () -> + listByDatabaseSinglePageAsync( + resourceGroupName, managedInstanceName, databaseName, schema, table, column, orderBy, skiptoken), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * List managed database columns. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database columns as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String managedInstanceName, String databaseName) { + final List schema = null; + final List table = null; + final List column = null; + final List orderBy = null; + final String skiptoken = null; + return new PagedFlux<>( + () -> + listByDatabaseSinglePageAsync( + resourceGroupName, managedInstanceName, databaseName, schema, table, column, orderBy, skiptoken), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * List managed database columns. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schema Array of Get3ItemsItem. + * @param table Array of Get4ItemsItem. + * @param column Array of Get5ItemsItem. + * @param orderBy Array of Get6ItemsItem. + * @param skiptoken An opaque token that identifies a starting point in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database columns as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + List schema, + List table, + List column, + List orderBy, + String skiptoken, + Context context) { + return new PagedFlux<>( + () -> + listByDatabaseSinglePageAsync( + resourceGroupName, + managedInstanceName, + databaseName, + schema, + table, + column, + orderBy, + skiptoken, + context), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * List managed database columns. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database columns as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName) { + final List schema = null; + final List table = null; + final List column = null; + final List orderBy = null; + final String skiptoken = null; + return new PagedIterable<>( + listByDatabaseAsync( + resourceGroupName, managedInstanceName, databaseName, schema, table, column, orderBy, skiptoken)); + } + + /** + * List managed database columns. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schema Array of Get3ItemsItem. + * @param table Array of Get4ItemsItem. + * @param column Array of Get5ItemsItem. + * @param orderBy Array of Get6ItemsItem. + * @param skiptoken An opaque token that identifies a starting point in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database columns as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, + String managedInstanceName, + String databaseName, + List schema, + List table, + List column, + List orderBy, + String skiptoken, + Context context) { + return new PagedIterable<>( + listByDatabaseAsync( + resourceGroupName, + managedInstanceName, + databaseName, + schema, + table, + column, + orderBy, + skiptoken, + context)); + } + + /** + * List managed database columns. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param filter An OData filter expression that filters elements in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database columns along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByTableSinglePageAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByTable( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + schemaName, + tableName, + filter, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List managed database columns. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param filter An OData filter expression that filters elements in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database columns along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByTableSinglePageAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String filter, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByTable( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + schemaName, + tableName, + filter, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List managed database columns. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param filter An OData filter expression that filters elements in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database columns as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByTableAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String filter) { + return new PagedFlux<>( + () -> + listByTableSinglePageAsync( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, filter), + nextLink -> listByTableNextSinglePageAsync(nextLink)); + } + + /** + * List managed database columns. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database columns as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByTableAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName) { + final String filter = null; + return new PagedFlux<>( + () -> + listByTableSinglePageAsync( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, filter), + nextLink -> listByTableNextSinglePageAsync(nextLink)); + } + + /** + * List managed database columns. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param filter An OData filter expression that filters elements in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database columns as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByTableAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String filter, + Context context) { + return new PagedFlux<>( + () -> + listByTableSinglePageAsync( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, filter, context), + nextLink -> listByTableNextSinglePageAsync(nextLink, context)); + } + + /** + * List managed database columns. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database columns as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByTable( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName) { + final String filter = null; + return new PagedIterable<>( + listByTableAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, filter)); + } + + /** + * List managed database columns. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param filter An OData filter expression that filters elements in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database columns as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByTable( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String filter, + Context context) { + return new PagedIterable<>( + listByTableAsync( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, filter, context)); + } + + /** + * Get managed database column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return managed database column along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (columnName == null) { + return Mono.error(new IllegalArgumentException("Parameter columnName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + schemaName, + tableName, + columnName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get managed database column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return managed database column along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (columnName == null) { + return Mono.error(new IllegalArgumentException("Parameter columnName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + schemaName, + tableName, + columnName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Get managed database column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return managed database column on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + return getWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get managed database column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return managed database column along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context) { + return getWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, context) + .block(); + } + + /** + * Get managed database column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return managed database column. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseColumnInner get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + return getWithResponse( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, Context.NONE) + .getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database columns along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database columns along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database columns along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByTableNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByTableNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database columns along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByTableNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByTableNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseColumnsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseColumnsImpl.java new file mode 100644 index 0000000000000..0f5d3918dbcfd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseColumnsImpl.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseColumnsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseColumnInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseColumn; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseColumns; +import java.util.List; + +public final class ManagedDatabaseColumnsImpl implements ManagedDatabaseColumns { + private static final ClientLogger LOGGER = new ClientLogger(ManagedDatabaseColumnsImpl.class); + + private final ManagedDatabaseColumnsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedDatabaseColumnsImpl( + ManagedDatabaseColumnsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, managedInstanceName, databaseName); + return Utils.mapPage(inner, inner1 -> new DatabaseColumnImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, + String managedInstanceName, + String databaseName, + List schema, + List table, + List column, + List orderBy, + String skiptoken, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByDatabase( + resourceGroupName, + managedInstanceName, + databaseName, + schema, + table, + column, + orderBy, + skiptoken, + context); + return Utils.mapPage(inner, inner1 -> new DatabaseColumnImpl(inner1, this.manager())); + } + + public PagedIterable listByTable( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName) { + PagedIterable inner = + this + .serviceClient() + .listByTable(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName); + return Utils.mapPage(inner, inner1 -> new DatabaseColumnImpl(inner1, this.manager())); + } + + public PagedIterable listByTable( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String filter, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByTable( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, filter, context); + return Utils.mapPage(inner, inner1 -> new DatabaseColumnImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatabaseColumnImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DatabaseColumn get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + DatabaseColumnInner inner = + this + .serviceClient() + .get(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName); + if (inner != null) { + return new DatabaseColumnImpl(inner, this.manager()); + } else { + return null; + } + } + + private ManagedDatabaseColumnsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseImpl.java new file mode 100644 index 0000000000000..363f951dd95ef --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseImpl.java @@ -0,0 +1,366 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedDatabaseInner; +import com.azure.resourcemanager.sql.generated.models.CatalogCollationType; +import com.azure.resourcemanager.sql.generated.models.CompleteDatabaseRestoreDefinition; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabase; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseCreateMode; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseMoveDefinition; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseStartMoveDefinition; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseStatus; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseUpdate; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.Map; + +public final class ManagedDatabaseImpl implements ManagedDatabase, ManagedDatabase.Definition, ManagedDatabase.Update { + private ManagedDatabaseInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String collation() { + return this.innerModel().collation(); + } + + public ManagedDatabaseStatus status() { + return this.innerModel().status(); + } + + public OffsetDateTime creationDate() { + return this.innerModel().creationDate(); + } + + public OffsetDateTime earliestRestorePoint() { + return this.innerModel().earliestRestorePoint(); + } + + public OffsetDateTime restorePointInTime() { + return this.innerModel().restorePointInTime(); + } + + public String defaultSecondaryLocation() { + return this.innerModel().defaultSecondaryLocation(); + } + + public CatalogCollationType catalogCollation() { + return this.innerModel().catalogCollation(); + } + + public ManagedDatabaseCreateMode createMode() { + return this.innerModel().createMode(); + } + + public String storageContainerUri() { + return this.innerModel().storageContainerUri(); + } + + public String sourceDatabaseId() { + return this.innerModel().sourceDatabaseId(); + } + + public String restorableDroppedDatabaseId() { + return this.innerModel().restorableDroppedDatabaseId(); + } + + public String storageContainerIdentity() { + return this.innerModel().storageContainerIdentity(); + } + + public String storageContainerSasToken() { + return this.innerModel().storageContainerSasToken(); + } + + public String failoverGroupId() { + return this.innerModel().failoverGroupId(); + } + + public String recoverableDatabaseId() { + return this.innerModel().recoverableDatabaseId(); + } + + public String longTermRetentionBackupResourceId() { + return this.innerModel().longTermRetentionBackupResourceId(); + } + + public Boolean autoCompleteRestore() { + return this.innerModel().autoCompleteRestore(); + } + + public String lastBackupName() { + return this.innerModel().lastBackupName(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ManagedDatabaseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String managedInstanceName; + + private String databaseName; + + private ManagedDatabaseUpdate updateParameters; + + public ManagedDatabaseImpl withExistingManagedInstance(String resourceGroupName, String managedInstanceName) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + return this; + } + + public ManagedDatabase create() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedDatabases() + .createOrUpdate(resourceGroupName, managedInstanceName, databaseName, this.innerModel(), Context.NONE); + return this; + } + + public ManagedDatabase create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedDatabases() + .createOrUpdate(resourceGroupName, managedInstanceName, databaseName, this.innerModel(), context); + return this; + } + + ManagedDatabaseImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ManagedDatabaseInner(); + this.serviceManager = serviceManager; + this.databaseName = name; + } + + public ManagedDatabaseImpl update() { + this.updateParameters = new ManagedDatabaseUpdate(); + return this; + } + + public ManagedDatabase apply() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedDatabases() + .update(resourceGroupName, managedInstanceName, databaseName, updateParameters, Context.NONE); + return this; + } + + public ManagedDatabase apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedDatabases() + .update(resourceGroupName, managedInstanceName, databaseName, updateParameters, context); + return this; + } + + ManagedDatabaseImpl( + ManagedDatabaseInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.managedInstanceName = Utils.getValueFromIdByName(innerObject.id(), "managedInstances"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "databases"); + } + + public ManagedDatabase refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedDatabases() + .getWithResponse(resourceGroupName, managedInstanceName, databaseName, Context.NONE) + .getValue(); + return this; + } + + public ManagedDatabase refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedDatabases() + .getWithResponse(resourceGroupName, managedInstanceName, databaseName, context) + .getValue(); + return this; + } + + public void cancelMove(ManagedDatabaseMoveDefinition parameters) { + serviceManager.managedDatabases().cancelMove(resourceGroupName, managedInstanceName, databaseName, parameters); + } + + public void cancelMove(ManagedDatabaseMoveDefinition parameters, Context context) { + serviceManager + .managedDatabases() + .cancelMove(resourceGroupName, managedInstanceName, databaseName, parameters, context); + } + + public void completeMove(ManagedDatabaseMoveDefinition parameters) { + serviceManager + .managedDatabases() + .completeMove(resourceGroupName, managedInstanceName, databaseName, parameters); + } + + public void completeMove(ManagedDatabaseMoveDefinition parameters, Context context) { + serviceManager + .managedDatabases() + .completeMove(resourceGroupName, managedInstanceName, databaseName, parameters, context); + } + + public void completeRestore(CompleteDatabaseRestoreDefinition parameters) { + serviceManager + .managedDatabases() + .completeRestore(resourceGroupName, managedInstanceName, databaseName, parameters); + } + + public void completeRestore(CompleteDatabaseRestoreDefinition parameters, Context context) { + serviceManager + .managedDatabases() + .completeRestore(resourceGroupName, managedInstanceName, databaseName, parameters, context); + } + + public void startMove(ManagedDatabaseStartMoveDefinition parameters) { + serviceManager.managedDatabases().startMove(resourceGroupName, managedInstanceName, databaseName, parameters); + } + + public void startMove(ManagedDatabaseStartMoveDefinition parameters, Context context) { + serviceManager + .managedDatabases() + .startMove(resourceGroupName, managedInstanceName, databaseName, parameters, context); + } + + public ManagedDatabaseImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public ManagedDatabaseImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public ManagedDatabaseImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public ManagedDatabaseImpl withCollation(String collation) { + this.innerModel().withCollation(collation); + return this; + } + + public ManagedDatabaseImpl withRestorePointInTime(OffsetDateTime restorePointInTime) { + this.innerModel().withRestorePointInTime(restorePointInTime); + return this; + } + + public ManagedDatabaseImpl withCatalogCollation(CatalogCollationType catalogCollation) { + this.innerModel().withCatalogCollation(catalogCollation); + return this; + } + + public ManagedDatabaseImpl withCreateMode(ManagedDatabaseCreateMode createMode) { + this.innerModel().withCreateMode(createMode); + return this; + } + + public ManagedDatabaseImpl withStorageContainerUri(String storageContainerUri) { + this.innerModel().withStorageContainerUri(storageContainerUri); + return this; + } + + public ManagedDatabaseImpl withSourceDatabaseId(String sourceDatabaseId) { + this.innerModel().withSourceDatabaseId(sourceDatabaseId); + return this; + } + + public ManagedDatabaseImpl withRestorableDroppedDatabaseId(String restorableDroppedDatabaseId) { + this.innerModel().withRestorableDroppedDatabaseId(restorableDroppedDatabaseId); + return this; + } + + public ManagedDatabaseImpl withStorageContainerIdentity(String storageContainerIdentity) { + this.innerModel().withStorageContainerIdentity(storageContainerIdentity); + return this; + } + + public ManagedDatabaseImpl withStorageContainerSasToken(String storageContainerSasToken) { + this.innerModel().withStorageContainerSasToken(storageContainerSasToken); + return this; + } + + public ManagedDatabaseImpl withRecoverableDatabaseId(String recoverableDatabaseId) { + this.innerModel().withRecoverableDatabaseId(recoverableDatabaseId); + return this; + } + + public ManagedDatabaseImpl withLongTermRetentionBackupResourceId(String longTermRetentionBackupResourceId) { + this.innerModel().withLongTermRetentionBackupResourceId(longTermRetentionBackupResourceId); + return this; + } + + public ManagedDatabaseImpl withAutoCompleteRestore(Boolean autoCompleteRestore) { + this.innerModel().withAutoCompleteRestore(autoCompleteRestore); + return this; + } + + public ManagedDatabaseImpl withLastBackupName(String lastBackupName) { + this.innerModel().withLastBackupName(lastBackupName); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseMoveOperationResultImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseMoveOperationResultImpl.java new file mode 100644 index 0000000000000..fef4b2ff1acf9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseMoveOperationResultImpl.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedDatabaseMoveOperationResultInner; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseMoveOperationResult; +import com.azure.resourcemanager.sql.generated.models.ManagementOperationState; +import com.azure.resourcemanager.sql.generated.models.MoveOperationMode; +import java.time.OffsetDateTime; + +public final class ManagedDatabaseMoveOperationResultImpl implements ManagedDatabaseMoveOperationResult { + private ManagedDatabaseMoveOperationResultInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + ManagedDatabaseMoveOperationResultImpl( + ManagedDatabaseMoveOperationResultInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String operation() { + return this.innerModel().operation(); + } + + public String operationFriendlyName() { + return this.innerModel().operationFriendlyName(); + } + + public OffsetDateTime startTime() { + return this.innerModel().startTime(); + } + + public ManagementOperationState state() { + return this.innerModel().state(); + } + + public MoveOperationMode operationMode() { + return this.innerModel().operationMode(); + } + + public String sourceManagedInstanceName() { + return this.innerModel().sourceManagedInstanceName(); + } + + public String targetManagedInstanceName() { + return this.innerModel().targetManagedInstanceName(); + } + + public String sourceManagedInstanceId() { + return this.innerModel().sourceManagedInstanceId(); + } + + public String targetManagedInstanceId() { + return this.innerModel().targetManagedInstanceId(); + } + + public String sourceDatabaseName() { + return this.innerModel().sourceDatabaseName(); + } + + public String targetDatabaseName() { + return this.innerModel().targetDatabaseName(); + } + + public Boolean isCancellable() { + return this.innerModel().isCancellable(); + } + + public Integer errorCode() { + return this.innerModel().errorCode(); + } + + public String errorDescription() { + return this.innerModel().errorDescription(); + } + + public Integer errorSeverity() { + return this.innerModel().errorSeverity(); + } + + public Boolean isUserError() { + return this.innerModel().isUserError(); + } + + public ManagedDatabaseMoveOperationResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseMoveOperationsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseMoveOperationsClientImpl.java new file mode 100644 index 0000000000000..6ed00d8ff9112 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseMoveOperationsClientImpl.java @@ -0,0 +1,584 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseMoveOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedDatabaseMoveOperationResultInner; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseMoveOperationListResult; +import java.util.UUID; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ManagedDatabaseMoveOperationsClient. */ +public final class ManagedDatabaseMoveOperationsClientImpl implements ManagedDatabaseMoveOperationsClient { + /** The proxy service used to perform REST calls. */ + private final ManagedDatabaseMoveOperationsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedDatabaseMoveOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedDatabaseMoveOperationsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ManagedDatabaseMoveOperationsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientManagedDatabaseMoveOperations to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + public interface ManagedDatabaseMoveOperationsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations" + + "/{locationName}/managedDatabaseMoveOperationResults") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByLocation( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("locationName") String locationName, + @QueryParam("onlyLatestPerDatabase") Boolean onlyLatestPerDatabase, + @QueryParam("$filter") String filter, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations" + + "/{locationName}/managedDatabaseMoveOperationResults/{operationId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("locationName") String locationName, + @PathParam("operationId") UUID operationId, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByLocationNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists managed database move operations. + * + * @param resourceGroupName The 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 locationName parameter. + * @param onlyLatestPerDatabase Whether or not to only get the latest operation for each database. Has higher + * priority than $filter. + * @param filter An OData filter expression that filters elements in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed database move operations along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationSinglePageAsync( + String resourceGroupName, String locationName, Boolean onlyLatestPerDatabase, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByLocation( + this.client.getEndpoint(), + resourceGroupName, + locationName, + onlyLatestPerDatabase, + filter, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists managed database move operations. + * + * @param resourceGroupName The 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 locationName parameter. + * @param onlyLatestPerDatabase Whether or not to only get the latest operation for each database. Has higher + * priority than $filter. + * @param filter An OData filter expression that filters elements in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed database move operations along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationSinglePageAsync( + String resourceGroupName, String locationName, Boolean onlyLatestPerDatabase, String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByLocation( + this.client.getEndpoint(), + resourceGroupName, + locationName, + onlyLatestPerDatabase, + filter, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists managed database move operations. + * + * @param resourceGroupName The 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 locationName parameter. + * @param onlyLatestPerDatabase Whether or not to only get the latest operation for each database. Has higher + * priority than $filter. + * @param filter An OData filter expression that filters elements in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed database move operations as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByLocationAsync( + String resourceGroupName, String locationName, Boolean onlyLatestPerDatabase, String filter) { + return new PagedFlux<>( + () -> listByLocationSinglePageAsync(resourceGroupName, locationName, onlyLatestPerDatabase, filter), + nextLink -> listByLocationNextSinglePageAsync(nextLink)); + } + + /** + * Lists managed database move operations. + * + * @param resourceGroupName The 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 locationName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed database move operations as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByLocationAsync( + String resourceGroupName, String locationName) { + final Boolean onlyLatestPerDatabase = null; + final String filter = null; + return new PagedFlux<>( + () -> listByLocationSinglePageAsync(resourceGroupName, locationName, onlyLatestPerDatabase, filter), + nextLink -> listByLocationNextSinglePageAsync(nextLink)); + } + + /** + * Lists managed database move operations. + * + * @param resourceGroupName The 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 locationName parameter. + * @param onlyLatestPerDatabase Whether or not to only get the latest operation for each database. Has higher + * priority than $filter. + * @param filter An OData filter expression that filters elements in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed database move operations as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByLocationAsync( + String resourceGroupName, String locationName, Boolean onlyLatestPerDatabase, String filter, Context context) { + return new PagedFlux<>( + () -> + listByLocationSinglePageAsync(resourceGroupName, locationName, onlyLatestPerDatabase, filter, context), + nextLink -> listByLocationNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists managed database move operations. + * + * @param resourceGroupName The 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 locationName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed database move operations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByLocation( + String resourceGroupName, String locationName) { + final Boolean onlyLatestPerDatabase = null; + final String filter = null; + return new PagedIterable<>(listByLocationAsync(resourceGroupName, locationName, onlyLatestPerDatabase, filter)); + } + + /** + * Lists managed database move operations. + * + * @param resourceGroupName The 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 locationName parameter. + * @param onlyLatestPerDatabase Whether or not to only get the latest operation for each database. Has higher + * priority than $filter. + * @param filter An OData filter expression that filters elements in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed database move operations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByLocation( + String resourceGroupName, String locationName, Boolean onlyLatestPerDatabase, String filter, Context context) { + return new PagedIterable<>( + listByLocationAsync(resourceGroupName, locationName, onlyLatestPerDatabase, filter, context)); + } + + /** + * Gets a managed database move operation. + * + * @param resourceGroupName The 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 locationName parameter. + * @param operationId The operationId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database move operation along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String locationName, UUID operationId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + locationName, + operationId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a managed database move operation. + * + * @param resourceGroupName The 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 locationName parameter. + * @param operationId The operationId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database move operation along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String locationName, UUID operationId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + locationName, + operationId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a managed database move operation. + * + * @param resourceGroupName The 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 locationName parameter. + * @param operationId The operationId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database move operation on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String locationName, UUID operationId) { + return getWithResponseAsync(resourceGroupName, locationName, operationId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a managed database move operation. + * + * @param resourceGroupName The 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 locationName parameter. + * @param operationId The operationId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database move operation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String locationName, UUID operationId, Context context) { + return getWithResponseAsync(resourceGroupName, locationName, operationId, context).block(); + } + + /** + * Gets a managed database move operation. + * + * @param resourceGroupName The 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 locationName parameter. + * @param operationId The operationId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database move operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedDatabaseMoveOperationResultInner get( + String resourceGroupName, String locationName, UUID operationId) { + return getWithResponse(resourceGroupName, locationName, operationId, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed database move operations along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByLocationNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed database move operations along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByLocationNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseMoveOperationsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseMoveOperationsImpl.java new file mode 100644 index 0000000000000..86f8f2364f48f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseMoveOperationsImpl.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseMoveOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedDatabaseMoveOperationResultInner; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseMoveOperationResult; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseMoveOperations; +import java.util.UUID; + +public final class ManagedDatabaseMoveOperationsImpl implements ManagedDatabaseMoveOperations { + private static final ClientLogger LOGGER = new ClientLogger(ManagedDatabaseMoveOperationsImpl.class); + + private final ManagedDatabaseMoveOperationsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedDatabaseMoveOperationsImpl( + ManagedDatabaseMoveOperationsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByLocation( + String resourceGroupName, String locationName) { + PagedIterable inner = + this.serviceClient().listByLocation(resourceGroupName, locationName); + return Utils.mapPage(inner, inner1 -> new ManagedDatabaseMoveOperationResultImpl(inner1, this.manager())); + } + + public PagedIterable listByLocation( + String resourceGroupName, String locationName, Boolean onlyLatestPerDatabase, String filter, Context context) { + PagedIterable inner = + this + .serviceClient() + .listByLocation(resourceGroupName, locationName, onlyLatestPerDatabase, filter, context); + return Utils.mapPage(inner, inner1 -> new ManagedDatabaseMoveOperationResultImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, String locationName, UUID operationId, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, locationName, operationId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ManagedDatabaseMoveOperationResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ManagedDatabaseMoveOperationResult get(String resourceGroupName, String locationName, UUID operationId) { + ManagedDatabaseMoveOperationResultInner inner = + this.serviceClient().get(resourceGroupName, locationName, operationId); + if (inner != null) { + return new ManagedDatabaseMoveOperationResultImpl(inner, this.manager()); + } else { + return null; + } + } + + private ManagedDatabaseMoveOperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseQueriesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseQueriesClientImpl.java new file mode 100644 index 0000000000000..d42b3ceca5e21 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseQueriesClientImpl.java @@ -0,0 +1,683 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseQueriesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceQueryInner; +import com.azure.resourcemanager.sql.generated.fluent.models.QueryStatisticsInner; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceQueryStatistics; +import com.azure.resourcemanager.sql.generated.models.QueryTimeGrainType; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ManagedDatabaseQueriesClient. */ +public final class ManagedDatabaseQueriesClientImpl implements ManagedDatabaseQueriesClient { + /** The proxy service used to perform REST calls. */ + private final ManagedDatabaseQueriesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedDatabaseQueriesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedDatabaseQueriesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create(ManagedDatabaseQueriesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientManagedDatabaseQueries to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + public interface ManagedDatabaseQueriesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/queries/{queryId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("queryId") String queryId, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/queries/{queryId}/statistics") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByQuery( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("queryId") String queryId, + @QueryParam("startTime") String startTime, + @QueryParam("endTime") String endTime, + @QueryParam("interval") QueryTimeGrainType interval, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByQueryNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get query by query id. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 queryId The queryId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query by query id along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, String databaseName, String queryId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (queryId == null) { + return Mono.error(new IllegalArgumentException("Parameter queryId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + queryId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get query by query id. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 queryId The queryId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query by query id along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, String databaseName, String queryId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (queryId == null) { + return Mono.error(new IllegalArgumentException("Parameter queryId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + queryId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Get query by query id. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 queryId The queryId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query by query id on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String managedInstanceName, String databaseName, String queryId) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, queryId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get query by query id. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 queryId The queryId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query by query id along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, String databaseName, String queryId, Context context) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, queryId, context).block(); + } + + /** + * Get query by query id. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 queryId The queryId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query by query id. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceQueryInner get( + String resourceGroupName, String managedInstanceName, String databaseName, String queryId) { + return getWithResponse(resourceGroupName, managedInstanceName, databaseName, queryId, Context.NONE).getValue(); + } + + /** + * Get query execution statistics by query id. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 queryId The queryId parameter. + * @param startTime Start time for observed period. + * @param endTime End time for observed period. + * @param interval The time step to be used to summarize the metric values. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query execution statistics by query id along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByQuerySinglePageAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String queryId, + String startTime, + String endTime, + QueryTimeGrainType interval) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (queryId == null) { + return Mono.error(new IllegalArgumentException("Parameter queryId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByQuery( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + queryId, + startTime, + endTime, + interval, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get query execution statistics by query id. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 queryId The queryId parameter. + * @param startTime Start time for observed period. + * @param endTime End time for observed period. + * @param interval The time step to be used to summarize the metric values. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query execution statistics by query id along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByQuerySinglePageAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String queryId, + String startTime, + String endTime, + QueryTimeGrainType interval, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (queryId == null) { + return Mono.error(new IllegalArgumentException("Parameter queryId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByQuery( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + queryId, + startTime, + endTime, + interval, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get query execution statistics by query id. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 queryId The queryId parameter. + * @param startTime Start time for observed period. + * @param endTime End time for observed period. + * @param interval The time step to be used to summarize the metric values. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query execution statistics by query id as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByQueryAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String queryId, + String startTime, + String endTime, + QueryTimeGrainType interval) { + return new PagedFlux<>( + () -> + listByQuerySinglePageAsync( + resourceGroupName, managedInstanceName, databaseName, queryId, startTime, endTime, interval), + nextLink -> listByQueryNextSinglePageAsync(nextLink)); + } + + /** + * Get query execution statistics by query id. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 queryId The queryId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query execution statistics by query id as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByQueryAsync( + String resourceGroupName, String managedInstanceName, String databaseName, String queryId) { + final String startTime = null; + final String endTime = null; + final QueryTimeGrainType interval = null; + return new PagedFlux<>( + () -> + listByQuerySinglePageAsync( + resourceGroupName, managedInstanceName, databaseName, queryId, startTime, endTime, interval), + nextLink -> listByQueryNextSinglePageAsync(nextLink)); + } + + /** + * Get query execution statistics by query id. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 queryId The queryId parameter. + * @param startTime Start time for observed period. + * @param endTime End time for observed period. + * @param interval The time step to be used to summarize the metric values. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query execution statistics by query id as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByQueryAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String queryId, + String startTime, + String endTime, + QueryTimeGrainType interval, + Context context) { + return new PagedFlux<>( + () -> + listByQuerySinglePageAsync( + resourceGroupName, + managedInstanceName, + databaseName, + queryId, + startTime, + endTime, + interval, + context), + nextLink -> listByQueryNextSinglePageAsync(nextLink, context)); + } + + /** + * Get query execution statistics by query id. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 queryId The queryId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query execution statistics by query id as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByQuery( + String resourceGroupName, String managedInstanceName, String databaseName, String queryId) { + final String startTime = null; + final String endTime = null; + final QueryTimeGrainType interval = null; + return new PagedIterable<>( + listByQueryAsync( + resourceGroupName, managedInstanceName, databaseName, queryId, startTime, endTime, interval)); + } + + /** + * Get query execution statistics by query id. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 queryId The queryId parameter. + * @param startTime Start time for observed period. + * @param endTime End time for observed period. + * @param interval The time step to be used to summarize the metric values. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query execution statistics by query id as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByQuery( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String queryId, + String startTime, + String endTime, + QueryTimeGrainType interval, + Context context) { + return new PagedIterable<>( + listByQueryAsync( + resourceGroupName, managedInstanceName, databaseName, queryId, startTime, endTime, interval, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return execution statistics for one particular query along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByQueryNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByQueryNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return execution statistics for one particular query along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByQueryNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByQueryNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseQueriesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseQueriesImpl.java new file mode 100644 index 0000000000000..38abd232d1b1c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseQueriesImpl.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseQueriesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceQueryInner; +import com.azure.resourcemanager.sql.generated.fluent.models.QueryStatisticsInner; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseQueries; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceQuery; +import com.azure.resourcemanager.sql.generated.models.QueryStatistics; +import com.azure.resourcemanager.sql.generated.models.QueryTimeGrainType; + +public final class ManagedDatabaseQueriesImpl implements ManagedDatabaseQueries { + private static final ClientLogger LOGGER = new ClientLogger(ManagedDatabaseQueriesImpl.class); + + private final ManagedDatabaseQueriesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedDatabaseQueriesImpl( + ManagedDatabaseQueriesClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, String databaseName, String queryId, Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, managedInstanceName, databaseName, queryId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ManagedInstanceQueryImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ManagedInstanceQuery get( + String resourceGroupName, String managedInstanceName, String databaseName, String queryId) { + ManagedInstanceQueryInner inner = + this.serviceClient().get(resourceGroupName, managedInstanceName, databaseName, queryId); + if (inner != null) { + return new ManagedInstanceQueryImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listByQuery( + String resourceGroupName, String managedInstanceName, String databaseName, String queryId) { + PagedIterable inner = + this.serviceClient().listByQuery(resourceGroupName, managedInstanceName, databaseName, queryId); + return Utils.mapPage(inner, inner1 -> new QueryStatisticsImpl(inner1, this.manager())); + } + + public PagedIterable listByQuery( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String queryId, + String startTime, + String endTime, + QueryTimeGrainType interval, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByQuery( + resourceGroupName, + managedInstanceName, + databaseName, + queryId, + startTime, + endTime, + interval, + context); + return Utils.mapPage(inner, inner1 -> new QueryStatisticsImpl(inner1, this.manager())); + } + + private ManagedDatabaseQueriesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseRecommendedSensitivityLabelsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseRecommendedSensitivityLabelsClientImpl.java new file mode 100644 index 0000000000000..e8141691e948b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseRecommendedSensitivityLabelsClientImpl.java @@ -0,0 +1,274 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseRecommendedSensitivityLabelsClient; +import com.azure.resourcemanager.sql.generated.models.RecommendedSensitivityLabelUpdateList; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * ManagedDatabaseRecommendedSensitivityLabelsClient. + */ +public final class ManagedDatabaseRecommendedSensitivityLabelsClientImpl + implements ManagedDatabaseRecommendedSensitivityLabelsClient { + /** The proxy service used to perform REST calls. */ + private final ManagedDatabaseRecommendedSensitivityLabelsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedDatabaseRecommendedSensitivityLabelsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedDatabaseRecommendedSensitivityLabelsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ManagedDatabaseRecommendedSensitivityLabelsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientManagedDatabaseRecommendedSensitivityLabels to be + * used by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + public interface ManagedDatabaseRecommendedSensitivityLabelsService { + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/recommendedSensitivityLabels") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") RecommendedSensitivityLabelUpdateList parameters, + Context context); + } + + /** + * Update recommended sensitivity labels states of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of recommended sensitivity label update operations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + RecommendedSensitivityLabelUpdateList parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update recommended sensitivity labels states of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of recommended sensitivity label update operations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + RecommendedSensitivityLabelUpdateList parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + context); + } + + /** + * Update recommended sensitivity labels states of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of recommended sensitivity label update operations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + RecommendedSensitivityLabelUpdateList parameters) { + return updateWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Update recommended sensitivity labels states of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of recommended sensitivity label update operations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + RecommendedSensitivityLabelUpdateList parameters, + Context context) { + return updateWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters, context) + .block(); + } + + /** + * Update recommended sensitivity labels states of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of recommended sensitivity label update operations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void update( + String resourceGroupName, + String managedInstanceName, + String databaseName, + RecommendedSensitivityLabelUpdateList parameters) { + updateWithResponse(resourceGroupName, managedInstanceName, databaseName, parameters, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseRecommendedSensitivityLabelsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseRecommendedSensitivityLabelsImpl.java new file mode 100644 index 0000000000000..81d41e9d1ef52 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseRecommendedSensitivityLabelsImpl.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseRecommendedSensitivityLabelsClient; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseRecommendedSensitivityLabels; +import com.azure.resourcemanager.sql.generated.models.RecommendedSensitivityLabelUpdateList; + +public final class ManagedDatabaseRecommendedSensitivityLabelsImpl + implements ManagedDatabaseRecommendedSensitivityLabels { + private static final ClientLogger LOGGER = new ClientLogger(ManagedDatabaseRecommendedSensitivityLabelsImpl.class); + + private final ManagedDatabaseRecommendedSensitivityLabelsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedDatabaseRecommendedSensitivityLabelsImpl( + ManagedDatabaseRecommendedSensitivityLabelsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response updateWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + RecommendedSensitivityLabelUpdateList parameters, + Context context) { + return this + .serviceClient() + .updateWithResponse(resourceGroupName, managedInstanceName, databaseName, parameters, context); + } + + public void update( + String resourceGroupName, + String managedInstanceName, + String databaseName, + RecommendedSensitivityLabelUpdateList parameters) { + this.serviceClient().update(resourceGroupName, managedInstanceName, databaseName, parameters); + } + + private ManagedDatabaseRecommendedSensitivityLabelsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseRestoreDetailsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseRestoreDetailsClientImpl.java new file mode 100644 index 0000000000000..b3a1e818e6bf7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseRestoreDetailsClientImpl.java @@ -0,0 +1,277 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseRestoreDetailsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedDatabaseRestoreDetailsResultInner; +import com.azure.resourcemanager.sql.generated.models.RestoreDetailsName; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ManagedDatabaseRestoreDetailsClient. */ +public final class ManagedDatabaseRestoreDetailsClientImpl implements ManagedDatabaseRestoreDetailsClient { + /** The proxy service used to perform REST calls. */ + private final ManagedDatabaseRestoreDetailsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedDatabaseRestoreDetailsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedDatabaseRestoreDetailsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ManagedDatabaseRestoreDetailsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientManagedDatabaseRestoreDetails to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + public interface ManagedDatabaseRestoreDetailsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/restoreDetails" + + "/{restoreDetailsName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("restoreDetailsName") RestoreDetailsName restoreDetailsName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets managed database restore details. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param restoreDetailsName The name of the restore details to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return managed database restore details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + RestoreDetailsName restoreDetailsName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (restoreDetailsName == null) { + return Mono + .error(new IllegalArgumentException("Parameter restoreDetailsName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + restoreDetailsName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets managed database restore details. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param restoreDetailsName The name of the restore details to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return managed database restore details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + RestoreDetailsName restoreDetailsName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (restoreDetailsName == null) { + return Mono + .error(new IllegalArgumentException("Parameter restoreDetailsName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + restoreDetailsName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets managed database restore details. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param restoreDetailsName The name of the restore details to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return managed database restore details on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + RestoreDetailsName restoreDetailsName) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, restoreDetailsName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets managed database restore details. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param restoreDetailsName The name of the restore details to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return managed database restore details along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + RestoreDetailsName restoreDetailsName, + Context context) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, restoreDetailsName, context) + .block(); + } + + /** + * Gets managed database restore details. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param restoreDetailsName The name of the restore details to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return managed database restore details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedDatabaseRestoreDetailsResultInner get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + RestoreDetailsName restoreDetailsName) { + return getWithResponse(resourceGroupName, managedInstanceName, databaseName, restoreDetailsName, Context.NONE) + .getValue(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseRestoreDetailsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseRestoreDetailsImpl.java new file mode 100644 index 0000000000000..57d7bd99446e0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseRestoreDetailsImpl.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseRestoreDetailsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedDatabaseRestoreDetailsResultInner; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseRestoreDetails; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseRestoreDetailsResult; +import com.azure.resourcemanager.sql.generated.models.RestoreDetailsName; + +public final class ManagedDatabaseRestoreDetailsImpl implements ManagedDatabaseRestoreDetails { + private static final ClientLogger LOGGER = new ClientLogger(ManagedDatabaseRestoreDetailsImpl.class); + + private final ManagedDatabaseRestoreDetailsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedDatabaseRestoreDetailsImpl( + ManagedDatabaseRestoreDetailsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + RestoreDetailsName restoreDetailsName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, managedInstanceName, databaseName, restoreDetailsName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ManagedDatabaseRestoreDetailsResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ManagedDatabaseRestoreDetailsResult get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + RestoreDetailsName restoreDetailsName) { + ManagedDatabaseRestoreDetailsResultInner inner = + this.serviceClient().get(resourceGroupName, managedInstanceName, databaseName, restoreDetailsName); + if (inner != null) { + return new ManagedDatabaseRestoreDetailsResultImpl(inner, this.manager()); + } else { + return null; + } + } + + private ManagedDatabaseRestoreDetailsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseRestoreDetailsResultImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseRestoreDetailsResultImpl.java new file mode 100644 index 0000000000000..a9d58b7268338 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseRestoreDetailsResultImpl.java @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedDatabaseRestoreDetailsResultInner; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseRestoreDetailsBackupSetProperties; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseRestoreDetailsResult; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseRestoreDetailsUnrestorableFileProperties; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class ManagedDatabaseRestoreDetailsResultImpl implements ManagedDatabaseRestoreDetailsResult { + private ManagedDatabaseRestoreDetailsResultInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + ManagedDatabaseRestoreDetailsResultImpl( + ManagedDatabaseRestoreDetailsResultInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String typePropertiesType() { + return this.innerModel().typePropertiesType(); + } + + public String status() { + return this.innerModel().status(); + } + + public String blockReason() { + return this.innerModel().blockReason(); + } + + public String lastUploadedFileName() { + return this.innerModel().lastUploadedFileName(); + } + + public OffsetDateTime lastUploadedFileTime() { + return this.innerModel().lastUploadedFileTime(); + } + + public String lastRestoredFileName() { + return this.innerModel().lastRestoredFileName(); + } + + public OffsetDateTime lastRestoredFileTime() { + return this.innerModel().lastRestoredFileTime(); + } + + public Integer percentCompleted() { + return this.innerModel().percentCompleted(); + } + + public Integer currentRestoredSizeMB() { + return this.innerModel().currentRestoredSizeMB(); + } + + public Integer currentRestorePlanSizeMB() { + return this.innerModel().currentRestorePlanSizeMB(); + } + + public String currentBackupType() { + return this.innerModel().currentBackupType(); + } + + public String currentRestoringFileName() { + return this.innerModel().currentRestoringFileName(); + } + + public Integer numberOfFilesDetected() { + return this.innerModel().numberOfFilesDetected(); + } + + public Integer numberOfFilesQueued() { + return this.innerModel().numberOfFilesQueued(); + } + + public Integer numberOfFilesSkipped() { + return this.innerModel().numberOfFilesSkipped(); + } + + public Integer numberOfFilesRestoring() { + return this.innerModel().numberOfFilesRestoring(); + } + + public Integer numberOfFilesRestored() { + return this.innerModel().numberOfFilesRestored(); + } + + public Integer numberOfFilesUnrestorable() { + return this.innerModel().numberOfFilesUnrestorable(); + } + + public List fullBackupSets() { + List inner = this.innerModel().fullBackupSets(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List diffBackupSets() { + List inner = this.innerModel().diffBackupSets(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List logBackupSets() { + List inner = this.innerModel().logBackupSets(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List unrestorableFiles() { + List inner = this.innerModel().unrestorableFiles(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ManagedDatabaseRestoreDetailsResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSchemasClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSchemasClientImpl.java new file mode 100644 index 0000000000000..bf87f5de01dd7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSchemasClientImpl.java @@ -0,0 +1,594 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseSchemasClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseSchemaInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseSchemaListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ManagedDatabaseSchemasClient. */ +public final class ManagedDatabaseSchemasClientImpl implements ManagedDatabaseSchemasClient { + /** The proxy service used to perform REST calls. */ + private final ManagedDatabaseSchemasService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedDatabaseSchemasClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedDatabaseSchemasClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create(ManagedDatabaseSchemasService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientManagedDatabaseSchemas to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + public interface ManagedDatabaseSchemasService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @QueryParam("$filter") String filter, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("schemaName") String schemaName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabaseNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List managed 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param filter An OData filter expression that filters elements in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database schemas along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String managedInstanceName, String databaseName, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + filter, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List managed 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param filter An OData filter expression that filters elements in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database schemas along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String managedInstanceName, String databaseName, String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + filter, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List managed 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param filter An OData filter expression that filters elements in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database schemas as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String managedInstanceName, String databaseName, String filter) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, managedInstanceName, databaseName, filter), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * List managed 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database schemas as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String managedInstanceName, String databaseName) { + final String filter = null; + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, managedInstanceName, databaseName, filter), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * List managed 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param filter An OData filter expression that filters elements in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database schemas as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String managedInstanceName, String databaseName, String filter, Context context) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, managedInstanceName, databaseName, filter, context), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * List managed 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database schemas as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName) { + final String filter = null; + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName, filter)); + } + + /** + * List managed 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param filter An OData filter expression that filters elements in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database schemas as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName, String filter, Context context) { + return new PagedIterable<>( + listByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName, filter, context)); + } + + /** + * Get managed 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return managed database schema along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, String databaseName, String schemaName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + schemaName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get managed 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return managed database schema along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, String databaseName, String schemaName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + schemaName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Get managed 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return managed database schema on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String managedInstanceName, String databaseName, String schemaName) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, schemaName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get managed 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return managed database schema along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, String databaseName, String schemaName, Context context) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, context).block(); + } + + /** + * Get managed 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return managed database schema. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseSchemaInner get( + String resourceGroupName, String managedInstanceName, String databaseName, String schemaName) { + return getWithResponse(resourceGroupName, managedInstanceName, databaseName, schemaName, Context.NONE) + .getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database schemas along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database schemas along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSchemasImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSchemasImpl.java new file mode 100644 index 0000000000000..31e9fea00fbbf --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSchemasImpl.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseSchemasClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseSchemaInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseSchema; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseSchemas; + +public final class ManagedDatabaseSchemasImpl implements ManagedDatabaseSchemas { + private static final ClientLogger LOGGER = new ClientLogger(ManagedDatabaseSchemasImpl.class); + + private final ManagedDatabaseSchemasClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedDatabaseSchemasImpl( + ManagedDatabaseSchemasClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, managedInstanceName, databaseName); + return Utils.mapPage(inner, inner1 -> new DatabaseSchemaImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, managedInstanceName, databaseName, filter, context); + return Utils.mapPage(inner, inner1 -> new DatabaseSchemaImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, String databaseName, String schemaName, Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, managedInstanceName, databaseName, schemaName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatabaseSchemaImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DatabaseSchema get( + String resourceGroupName, String managedInstanceName, String databaseName, String schemaName) { + DatabaseSchemaInner inner = + this.serviceClient().get(resourceGroupName, managedInstanceName, databaseName, schemaName); + if (inner != null) { + return new DatabaseSchemaImpl(inner, this.manager()); + } else { + return null; + } + } + + private ManagedDatabaseSchemasClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSecurityAlertPoliciesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSecurityAlertPoliciesClientImpl.java new file mode 100644 index 0000000000000..503f437876ee2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSecurityAlertPoliciesClientImpl.java @@ -0,0 +1,853 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseSecurityAlertPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedDatabaseSecurityAlertPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseSecurityAlertPolicyListResult; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyName; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * ManagedDatabaseSecurityAlertPoliciesClient. + */ +public final class ManagedDatabaseSecurityAlertPoliciesClientImpl + implements ManagedDatabaseSecurityAlertPoliciesClient { + /** The proxy service used to perform REST calls. */ + private final ManagedDatabaseSecurityAlertPoliciesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedDatabaseSecurityAlertPoliciesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedDatabaseSecurityAlertPoliciesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ManagedDatabaseSecurityAlertPoliciesService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientManagedDatabaseSecurityAlertPolicies to be used by + * the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + public interface ManagedDatabaseSecurityAlertPoliciesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/securityAlertPolicies" + + "/{securityAlertPolicyName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("securityAlertPolicyName") SecurityAlertPolicyName securityAlertPolicyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/securityAlertPolicies" + + "/{securityAlertPolicyName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("securityAlertPolicyName") SecurityAlertPolicyName securityAlertPolicyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ManagedDatabaseSecurityAlertPolicyInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/securityAlertPolicies") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabaseNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 securityAlertPolicyName The name of the security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's security alert policy along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (securityAlertPolicyName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter securityAlertPolicyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + securityAlertPolicyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 securityAlertPolicyName The name of the security alert policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's security alert policy along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (securityAlertPolicyName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter securityAlertPolicyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + securityAlertPolicyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 securityAlertPolicyName The name of the security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's security alert policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, securityAlertPolicyName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 securityAlertPolicyName The name of the security alert policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's security alert policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName, + Context context) { + return getWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, securityAlertPolicyName, context) + .block(); + } + + /** + * 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 securityAlertPolicyName The name of the security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedDatabaseSecurityAlertPolicyInner get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName) { + return getWithResponse( + resourceGroupName, managedInstanceName, databaseName, securityAlertPolicyName, Context.NONE) + .getValue(); + } + + /** + * 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 securityAlertPolicyName The name of the security alert policy. + * @param parameters The database security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database security alert policy along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName, + ManagedDatabaseSecurityAlertPolicyInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (securityAlertPolicyName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter securityAlertPolicyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + securityAlertPolicyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 securityAlertPolicyName The name of the security alert policy. + * @param parameters The database security alert policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database security alert policy along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName, + ManagedDatabaseSecurityAlertPolicyInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (securityAlertPolicyName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter securityAlertPolicyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + securityAlertPolicyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 securityAlertPolicyName The name of the security alert policy. + * @param parameters The database security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database security alert policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName, + ManagedDatabaseSecurityAlertPolicyInner parameters) { + return createOrUpdateWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, securityAlertPolicyName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 securityAlertPolicyName The name of the security alert policy. + * @param parameters The database security alert policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database security alert policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName, + ManagedDatabaseSecurityAlertPolicyInner parameters, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, securityAlertPolicyName, parameters, context) + .block(); + } + + /** + * 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 securityAlertPolicyName The name of the security alert policy. + * @param parameters The database security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedDatabaseSecurityAlertPolicyInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName, + ManagedDatabaseSecurityAlertPolicyInner parameters) { + return createOrUpdateWithResponse( + resourceGroupName, managedInstanceName, databaseName, securityAlertPolicyName, parameters, Context.NONE) + .getValue(); + } + + /** + * Gets a list of managed database's security alert policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policies are defined. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed database's security alert policies along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String managedInstanceName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of managed database's security alert policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policies are defined. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed database's security alert policies along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String managedInstanceName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of managed database's security alert policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policies are defined. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed database's security alert policies as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String managedInstanceName, String databaseName) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, managedInstanceName, databaseName), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of managed database's security alert policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policies are defined. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed database's security alert policies as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String managedInstanceName, String databaseName, Context context) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, managedInstanceName, databaseName, context), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of managed database's security alert policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policies are defined. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed database's security alert policies as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName)); + } + + /** + * Gets a list of managed database's security alert policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policies are defined. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed database's security alert policies as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName, Context context) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the managed database's security alert policies along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the managed database's security alert policies along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSecurityAlertPoliciesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSecurityAlertPoliciesImpl.java new file mode 100644 index 0000000000000..a150862f3b5b8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSecurityAlertPoliciesImpl.java @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseSecurityAlertPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedDatabaseSecurityAlertPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseSecurityAlertPolicies; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseSecurityAlertPolicy; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyName; + +public final class ManagedDatabaseSecurityAlertPoliciesImpl implements ManagedDatabaseSecurityAlertPolicies { + private static final ClientLogger LOGGER = new ClientLogger(ManagedDatabaseSecurityAlertPoliciesImpl.class); + + private final ManagedDatabaseSecurityAlertPoliciesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedDatabaseSecurityAlertPoliciesImpl( + ManagedDatabaseSecurityAlertPoliciesClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse( + resourceGroupName, managedInstanceName, databaseName, securityAlertPolicyName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ManagedDatabaseSecurityAlertPolicyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ManagedDatabaseSecurityAlertPolicy get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName) { + ManagedDatabaseSecurityAlertPolicyInner inner = + this.serviceClient().get(resourceGroupName, managedInstanceName, databaseName, securityAlertPolicyName); + if (inner != null) { + return new ManagedDatabaseSecurityAlertPolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, managedInstanceName, databaseName); + return Utils.mapPage(inner, inner1 -> new ManagedDatabaseSecurityAlertPolicyImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, managedInstanceName, databaseName, context); + return Utils.mapPage(inner, inner1 -> new ManagedDatabaseSecurityAlertPolicyImpl(inner1, this.manager())); + } + + public ManagedDatabaseSecurityAlertPolicy getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String securityAlertPolicyNameLocal = Utils.getValueFromIdByName(id, "securityAlertPolicies"); + if (securityAlertPolicyNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'securityAlertPolicies'.", + id))); + } + SecurityAlertPolicyName securityAlertPolicyName = + SecurityAlertPolicyName.fromString(securityAlertPolicyNameLocal); + return this + .getWithResponse( + resourceGroupName, managedInstanceName, databaseName, securityAlertPolicyName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String securityAlertPolicyNameLocal = Utils.getValueFromIdByName(id, "securityAlertPolicies"); + if (securityAlertPolicyNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'securityAlertPolicies'.", + id))); + } + SecurityAlertPolicyName securityAlertPolicyName = + SecurityAlertPolicyName.fromString(securityAlertPolicyNameLocal); + return this + .getWithResponse(resourceGroupName, managedInstanceName, databaseName, securityAlertPolicyName, context); + } + + private ManagedDatabaseSecurityAlertPoliciesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ManagedDatabaseSecurityAlertPolicyImpl define(SecurityAlertPolicyName name) { + return new ManagedDatabaseSecurityAlertPolicyImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSecurityAlertPolicyImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSecurityAlertPolicyImpl.java new file mode 100644 index 0000000000000..849390725939d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSecurityAlertPolicyImpl.java @@ -0,0 +1,248 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedDatabaseSecurityAlertPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseSecurityAlertPolicy; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyName; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyState; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class ManagedDatabaseSecurityAlertPolicyImpl + implements ManagedDatabaseSecurityAlertPolicy, + ManagedDatabaseSecurityAlertPolicy.Definition, + ManagedDatabaseSecurityAlertPolicy.Update { + private ManagedDatabaseSecurityAlertPolicyInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SecurityAlertPolicyState state() { + return this.innerModel().state(); + } + + public List disabledAlerts() { + List inner = this.innerModel().disabledAlerts(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List emailAddresses() { + List inner = this.innerModel().emailAddresses(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Boolean emailAccountAdmins() { + return this.innerModel().emailAccountAdmins(); + } + + public String storageEndpoint() { + return this.innerModel().storageEndpoint(); + } + + public String storageAccountAccessKey() { + return this.innerModel().storageAccountAccessKey(); + } + + public Integer retentionDays() { + return this.innerModel().retentionDays(); + } + + public OffsetDateTime creationTime() { + return this.innerModel().creationTime(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ManagedDatabaseSecurityAlertPolicyInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String managedInstanceName; + + private String databaseName; + + private SecurityAlertPolicyName securityAlertPolicyName; + + public ManagedDatabaseSecurityAlertPolicyImpl withExistingDatabase( + String resourceGroupName, String managedInstanceName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + this.databaseName = databaseName; + return this; + } + + public ManagedDatabaseSecurityAlertPolicy create() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedDatabaseSecurityAlertPolicies() + .createOrUpdateWithResponse( + resourceGroupName, + managedInstanceName, + databaseName, + securityAlertPolicyName, + this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public ManagedDatabaseSecurityAlertPolicy create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedDatabaseSecurityAlertPolicies() + .createOrUpdateWithResponse( + resourceGroupName, + managedInstanceName, + databaseName, + securityAlertPolicyName, + this.innerModel(), + context) + .getValue(); + return this; + } + + ManagedDatabaseSecurityAlertPolicyImpl( + SecurityAlertPolicyName name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ManagedDatabaseSecurityAlertPolicyInner(); + this.serviceManager = serviceManager; + this.securityAlertPolicyName = name; + } + + public ManagedDatabaseSecurityAlertPolicyImpl update() { + return this; + } + + public ManagedDatabaseSecurityAlertPolicy apply() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedDatabaseSecurityAlertPolicies() + .createOrUpdateWithResponse( + resourceGroupName, + managedInstanceName, + databaseName, + securityAlertPolicyName, + this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public ManagedDatabaseSecurityAlertPolicy apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedDatabaseSecurityAlertPolicies() + .createOrUpdateWithResponse( + resourceGroupName, + managedInstanceName, + databaseName, + securityAlertPolicyName, + this.innerModel(), + context) + .getValue(); + return this; + } + + ManagedDatabaseSecurityAlertPolicyImpl( + ManagedDatabaseSecurityAlertPolicyInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.managedInstanceName = Utils.getValueFromIdByName(innerObject.id(), "managedInstances"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "databases"); + this.securityAlertPolicyName = + SecurityAlertPolicyName.fromString(Utils.getValueFromIdByName(innerObject.id(), "securityAlertPolicies")); + } + + public ManagedDatabaseSecurityAlertPolicy refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedDatabaseSecurityAlertPolicies() + .getWithResponse( + resourceGroupName, managedInstanceName, databaseName, securityAlertPolicyName, Context.NONE) + .getValue(); + return this; + } + + public ManagedDatabaseSecurityAlertPolicy refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedDatabaseSecurityAlertPolicies() + .getWithResponse(resourceGroupName, managedInstanceName, databaseName, securityAlertPolicyName, context) + .getValue(); + return this; + } + + public ManagedDatabaseSecurityAlertPolicyImpl withState(SecurityAlertPolicyState state) { + this.innerModel().withState(state); + return this; + } + + public ManagedDatabaseSecurityAlertPolicyImpl withDisabledAlerts(List disabledAlerts) { + this.innerModel().withDisabledAlerts(disabledAlerts); + return this; + } + + public ManagedDatabaseSecurityAlertPolicyImpl withEmailAddresses(List emailAddresses) { + this.innerModel().withEmailAddresses(emailAddresses); + return this; + } + + public ManagedDatabaseSecurityAlertPolicyImpl withEmailAccountAdmins(Boolean emailAccountAdmins) { + this.innerModel().withEmailAccountAdmins(emailAccountAdmins); + return this; + } + + public ManagedDatabaseSecurityAlertPolicyImpl withStorageEndpoint(String storageEndpoint) { + this.innerModel().withStorageEndpoint(storageEndpoint); + return this; + } + + public ManagedDatabaseSecurityAlertPolicyImpl withStorageAccountAccessKey(String storageAccountAccessKey) { + this.innerModel().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + public ManagedDatabaseSecurityAlertPolicyImpl withRetentionDays(Integer retentionDays) { + this.innerModel().withRetentionDays(retentionDays); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSecurityEventsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSecurityEventsClientImpl.java new file mode 100644 index 0000000000000..39ab0f3c98f97 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSecurityEventsClientImpl.java @@ -0,0 +1,471 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseSecurityEventsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.SecurityEventInner; +import com.azure.resourcemanager.sql.generated.models.SecurityEventCollection; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ManagedDatabaseSecurityEventsClient. */ +public final class ManagedDatabaseSecurityEventsClientImpl implements ManagedDatabaseSecurityEventsClient { + /** The proxy service used to perform REST calls. */ + private final ManagedDatabaseSecurityEventsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedDatabaseSecurityEventsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedDatabaseSecurityEventsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ManagedDatabaseSecurityEventsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientManagedDatabaseSecurityEvents to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + public interface ManagedDatabaseSecurityEventsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/securityEvents") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @QueryParam("$filter") String filter, + @QueryParam("$skip") Integer skip, + @QueryParam("$top") Integer top, + @QueryParam("$skiptoken") String skiptoken, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabaseNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a list of security events. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 events are retrieved. + * @param filter An OData filter expression that filters elements in the collection. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param skiptoken An opaque token that identifies a starting point in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of security events along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String filter, + Integer skip, + Integer top, + String skiptoken) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + filter, + skip, + top, + skiptoken, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of security events. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 events are retrieved. + * @param filter An OData filter expression that filters elements in the collection. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param skiptoken An opaque token that identifies a starting point in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of security events along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String filter, + Integer skip, + Integer top, + String skiptoken, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + filter, + skip, + top, + skiptoken, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of security events. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 events are retrieved. + * @param filter An OData filter expression that filters elements in the collection. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param skiptoken An opaque token that identifies a starting point in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of security events as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String filter, + Integer skip, + Integer top, + String skiptoken) { + return new PagedFlux<>( + () -> + listByDatabaseSinglePageAsync( + resourceGroupName, managedInstanceName, databaseName, filter, skip, top, skiptoken), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of security events. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 events are retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of security events as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String managedInstanceName, String databaseName) { + final String filter = null; + final Integer skip = null; + final Integer top = null; + final String skiptoken = null; + return new PagedFlux<>( + () -> + listByDatabaseSinglePageAsync( + resourceGroupName, managedInstanceName, databaseName, filter, skip, top, skiptoken), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of security events. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 events are retrieved. + * @param filter An OData filter expression that filters elements in the collection. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param skiptoken An opaque token that identifies a starting point in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of security events as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String filter, + Integer skip, + Integer top, + String skiptoken, + Context context) { + return new PagedFlux<>( + () -> + listByDatabaseSinglePageAsync( + resourceGroupName, managedInstanceName, databaseName, filter, skip, top, skiptoken, context), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of security events. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 events are retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of security events as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName) { + final String filter = null; + final Integer skip = null; + final Integer top = null; + final String skiptoken = null; + return new PagedIterable<>( + listByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName, filter, skip, top, skiptoken)); + } + + /** + * Gets a list of security events. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 events are retrieved. + * @param filter An OData filter expression that filters elements in the collection. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param skiptoken An opaque token that identifies a starting point in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of security events as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String filter, + Integer skip, + Integer top, + String skiptoken, + Context context) { + return new PagedIterable<>( + listByDatabaseAsync( + resourceGroupName, managedInstanceName, databaseName, filter, skip, top, skiptoken, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of security events along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of security events along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSecurityEventsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSecurityEventsImpl.java new file mode 100644 index 0000000000000..fc68ef703a88f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSecurityEventsImpl.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseSecurityEventsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.SecurityEventInner; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseSecurityEvents; +import com.azure.resourcemanager.sql.generated.models.SecurityEvent; + +public final class ManagedDatabaseSecurityEventsImpl implements ManagedDatabaseSecurityEvents { + private static final ClientLogger LOGGER = new ClientLogger(ManagedDatabaseSecurityEventsImpl.class); + + private final ManagedDatabaseSecurityEventsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedDatabaseSecurityEventsImpl( + ManagedDatabaseSecurityEventsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, managedInstanceName, databaseName); + return Utils.mapPage(inner, inner1 -> new SecurityEventImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String filter, + Integer skip, + Integer top, + String skiptoken, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByDatabase( + resourceGroupName, managedInstanceName, databaseName, filter, skip, top, skiptoken, context); + return Utils.mapPage(inner, inner1 -> new SecurityEventImpl(inner1, this.manager())); + } + + private ManagedDatabaseSecurityEventsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSensitivityLabelsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSensitivityLabelsClientImpl.java new file mode 100644 index 0000000000000..4ef190412aaf9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSensitivityLabelsClientImpl.java @@ -0,0 +1,2470 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseSensitivityLabelsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.SensitivityLabelInner; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelListResult; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelSource; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelUpdateList; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ManagedDatabaseSensitivityLabelsClient. + */ +public final class ManagedDatabaseSensitivityLabelsClientImpl implements ManagedDatabaseSensitivityLabelsClient { + /** The proxy service used to perform REST calls. */ + private final ManagedDatabaseSensitivityLabelsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedDatabaseSensitivityLabelsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedDatabaseSensitivityLabelsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ManagedDatabaseSensitivityLabelsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientManagedDatabaseSensitivityLabels to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + public interface ManagedDatabaseSensitivityLabelsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}/tables" + + "/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("schemaName") String schemaName, + @PathParam("tableName") String tableName, + @PathParam("columnName") String columnName, + @PathParam("sensitivityLabelSource") SensitivityLabelSource sensitivityLabelSource, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}/tables" + + "/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("schemaName") String schemaName, + @PathParam("tableName") String tableName, + @PathParam("columnName") String columnName, + @PathParam("sensitivityLabelSource") String sensitivityLabelSource, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SensitivityLabelInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}/tables" + + "/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("schemaName") String schemaName, + @PathParam("tableName") String tableName, + @PathParam("columnName") String columnName, + @PathParam("sensitivityLabelSource") String sensitivityLabelSource, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}/tables" + + "/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}/disable") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> disableRecommendation( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("schemaName") String schemaName, + @PathParam("tableName") String tableName, + @PathParam("columnName") String columnName, + @PathParam("sensitivityLabelSource") String sensitivityLabelSource, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}/tables" + + "/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}/enable") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> enableRecommendation( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("schemaName") String schemaName, + @PathParam("tableName") String tableName, + @PathParam("columnName") String columnName, + @PathParam("sensitivityLabelSource") String sensitivityLabelSource, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/currentSensitivityLabels") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listCurrentByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @QueryParam("$skipToken") String skipToken, + @QueryParam("$count") Boolean count, + @QueryParam("$filter") String filter, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/currentSensitivityLabels") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SensitivityLabelUpdateList parameters, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/recommendedSensitivityLabels") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listRecommendedByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @QueryParam("$skipToken") String skipToken, + @QueryParam("includeDisabledRecommendations") Boolean includeDisabledRecommendations, + @QueryParam("$filter") String filter, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listCurrentByDatabaseNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listRecommendedByDatabaseNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param sensitivityLabelSource The source of the sensitivity label. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity label of a given column along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelSource sensitivityLabelSource) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (columnName == null) { + return Mono.error(new IllegalArgumentException("Parameter columnName is required and cannot be null.")); + } + if (sensitivityLabelSource == null) { + return Mono + .error( + new IllegalArgumentException("Parameter sensitivityLabelSource is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + schemaName, + tableName, + columnName, + sensitivityLabelSource, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param sensitivityLabelSource The source of the sensitivity label. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity label of a given column along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelSource sensitivityLabelSource, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (columnName == null) { + return Mono.error(new IllegalArgumentException("Parameter columnName is required and cannot be null.")); + } + if (sensitivityLabelSource == null) { + return Mono + .error( + new IllegalArgumentException("Parameter sensitivityLabelSource is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + schemaName, + tableName, + columnName, + sensitivityLabelSource, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param sensitivityLabelSource The source of the sensitivity label. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity label of a given column on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelSource sensitivityLabelSource) { + return getWithResponseAsync( + resourceGroupName, + managedInstanceName, + databaseName, + schemaName, + tableName, + columnName, + sensitivityLabelSource) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param sensitivityLabelSource The source of the sensitivity label. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity label of a given column along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelSource sensitivityLabelSource, + Context context) { + return getWithResponseAsync( + resourceGroupName, + managedInstanceName, + databaseName, + schemaName, + tableName, + columnName, + sensitivityLabelSource, + context) + .block(); + } + + /** + * Gets the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param sensitivityLabelSource The source of the sensitivity label. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity label of a given column. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SensitivityLabelInner get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelSource sensitivityLabelSource) { + return getWithResponse( + resourceGroupName, + managedInstanceName, + databaseName, + schemaName, + tableName, + columnName, + sensitivityLabelSource, + Context.NONE) + .getValue(); + } + + /** + * Creates or updates the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param parameters The column sensitivity label resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sensitivity label along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (columnName == null) { + return Mono.error(new IllegalArgumentException("Parameter columnName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String sensitivityLabelSource = "current"; + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + schemaName, + tableName, + columnName, + sensitivityLabelSource, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param parameters The column sensitivity label resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sensitivity label along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (columnName == null) { + return Mono.error(new IllegalArgumentException("Parameter columnName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String sensitivityLabelSource = "current"; + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + schemaName, + tableName, + columnName, + sensitivityLabelSource, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param parameters The column sensitivity label resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sensitivity label on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelInner parameters) { + return createOrUpdateWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or updates the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param parameters The column sensitivity label resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sensitivity label along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelInner parameters, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, + managedInstanceName, + databaseName, + schemaName, + tableName, + columnName, + parameters, + context) + .block(); + } + + /** + * Creates or updates the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param parameters The column sensitivity label resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sensitivity label. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SensitivityLabelInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelInner parameters) { + return createOrUpdateWithResponse( + resourceGroupName, + managedInstanceName, + databaseName, + schemaName, + tableName, + columnName, + parameters, + Context.NONE) + .getValue(); + } + + /** + * Deletes the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (columnName == null) { + return Mono.error(new IllegalArgumentException("Parameter columnName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String sensitivityLabelSource = "current"; + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + schemaName, + tableName, + columnName, + sensitivityLabelSource, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (columnName == null) { + return Mono.error(new IllegalArgumentException("Parameter columnName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String sensitivityLabelSource = "current"; + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + schemaName, + tableName, + columnName, + sensitivityLabelSource, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + return deleteWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context) { + return deleteWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, context) + .block(); + } + + /** + * Deletes the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + deleteWithResponse( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, Context.NONE); + } + + /** + * Disables sensitivity recommendations on a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> disableRecommendationWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (columnName == null) { + return Mono.error(new IllegalArgumentException("Parameter columnName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String sensitivityLabelSource = "recommended"; + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .disableRecommendation( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + schemaName, + tableName, + columnName, + sensitivityLabelSource, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Disables sensitivity recommendations on a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> disableRecommendationWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (columnName == null) { + return Mono.error(new IllegalArgumentException("Parameter columnName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String sensitivityLabelSource = "recommended"; + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .disableRecommendation( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + schemaName, + tableName, + columnName, + sensitivityLabelSource, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Disables sensitivity recommendations on a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono disableRecommendationAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + return disableRecommendationWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Disables sensitivity recommendations on a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response disableRecommendationWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context) { + return disableRecommendationWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, context) + .block(); + } + + /** + * Disables sensitivity recommendations on a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void disableRecommendation( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + disableRecommendationWithResponse( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, Context.NONE); + } + + /** + * Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> enableRecommendationWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (columnName == null) { + return Mono.error(new IllegalArgumentException("Parameter columnName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String sensitivityLabelSource = "recommended"; + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .enableRecommendation( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + schemaName, + tableName, + columnName, + sensitivityLabelSource, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> enableRecommendationWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (columnName == null) { + return Mono.error(new IllegalArgumentException("Parameter columnName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String sensitivityLabelSource = "recommended"; + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .enableRecommendation( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + schemaName, + tableName, + columnName, + sensitivityLabelSource, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono enableRecommendationAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + return enableRecommendationWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response enableRecommendationWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context) { + return enableRecommendationWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, context) + .block(); + } + + /** + * Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void enableRecommendation( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + enableRecommendationWithResponse( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, Context.NONE); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param skipToken The skipToken parameter. + * @param count The count parameter. + * @param filter An OData filter expression that filters elements in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity labels of a given database along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listCurrentByDatabaseSinglePageAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String skipToken, + Boolean count, + String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listCurrentByDatabase( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + skipToken, + count, + filter, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param skipToken The skipToken parameter. + * @param count The count parameter. + * @param filter An OData filter expression that filters elements in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity labels of a given database along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listCurrentByDatabaseSinglePageAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String skipToken, + Boolean count, + String filter, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listCurrentByDatabase( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + skipToken, + count, + filter, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param skipToken The skipToken parameter. + * @param count The count parameter. + * @param filter An OData filter expression that filters elements in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity labels of a given database as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listCurrentByDatabaseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String skipToken, + Boolean count, + String filter) { + return new PagedFlux<>( + () -> + listCurrentByDatabaseSinglePageAsync( + resourceGroupName, managedInstanceName, databaseName, skipToken, count, filter), + nextLink -> listCurrentByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity labels of a given database as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listCurrentByDatabaseAsync( + String resourceGroupName, String managedInstanceName, String databaseName) { + final String skipToken = null; + final Boolean count = null; + final String filter = null; + return new PagedFlux<>( + () -> + listCurrentByDatabaseSinglePageAsync( + resourceGroupName, managedInstanceName, databaseName, skipToken, count, filter), + nextLink -> listCurrentByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param skipToken The skipToken parameter. + * @param count The count parameter. + * @param filter An OData filter expression that filters elements in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity labels of a given database as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listCurrentByDatabaseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String skipToken, + Boolean count, + String filter, + Context context) { + return new PagedFlux<>( + () -> + listCurrentByDatabaseSinglePageAsync( + resourceGroupName, managedInstanceName, databaseName, skipToken, count, filter, context), + nextLink -> listCurrentByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity labels of a given database as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listCurrentByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName) { + final String skipToken = null; + final Boolean count = null; + final String filter = null; + return new PagedIterable<>( + listCurrentByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName, skipToken, count, filter)); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param skipToken The skipToken parameter. + * @param count The count parameter. + * @param filter An OData filter expression that filters elements in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity labels of a given database as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listCurrentByDatabase( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String skipToken, + Boolean count, + String filter, + Context context) { + return new PagedIterable<>( + listCurrentByDatabaseAsync( + resourceGroupName, managedInstanceName, databaseName, skipToken, count, filter, context)); + } + + /** + * Update sensitivity labels of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of sensitivity label update operations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + SensitivityLabelUpdateList parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update sensitivity labels of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of sensitivity label update operations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + SensitivityLabelUpdateList parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + context); + } + + /** + * Update sensitivity labels of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of sensitivity label update operations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + SensitivityLabelUpdateList parameters) { + return updateWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Update sensitivity labels of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of sensitivity label update operations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + SensitivityLabelUpdateList parameters, + Context context) { + return updateWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters, context) + .block(); + } + + /** + * Update sensitivity labels of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of sensitivity label update operations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void update( + String resourceGroupName, + String managedInstanceName, + String databaseName, + SensitivityLabelUpdateList parameters) { + updateWithResponse(resourceGroupName, managedInstanceName, databaseName, parameters, Context.NONE); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param skipToken The skipToken parameter. + * @param includeDisabledRecommendations Specifies whether to include disabled recommendations or not. + * @param filter An OData filter expression that filters elements in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity labels of a given database along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listRecommendedByDatabaseSinglePageAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String skipToken, + Boolean includeDisabledRecommendations, + String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listRecommendedByDatabase( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + skipToken, + includeDisabledRecommendations, + filter, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param skipToken The skipToken parameter. + * @param includeDisabledRecommendations Specifies whether to include disabled recommendations or not. + * @param filter An OData filter expression that filters elements in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity labels of a given database along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listRecommendedByDatabaseSinglePageAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String skipToken, + Boolean includeDisabledRecommendations, + String filter, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listRecommendedByDatabase( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + skipToken, + includeDisabledRecommendations, + filter, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param skipToken The skipToken parameter. + * @param includeDisabledRecommendations Specifies whether to include disabled recommendations or not. + * @param filter An OData filter expression that filters elements in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity labels of a given database as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listRecommendedByDatabaseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String skipToken, + Boolean includeDisabledRecommendations, + String filter) { + return new PagedFlux<>( + () -> + listRecommendedByDatabaseSinglePageAsync( + resourceGroupName, + managedInstanceName, + databaseName, + skipToken, + includeDisabledRecommendations, + filter), + nextLink -> listRecommendedByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity labels of a given database as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listRecommendedByDatabaseAsync( + String resourceGroupName, String managedInstanceName, String databaseName) { + final String skipToken = null; + final Boolean includeDisabledRecommendations = null; + final String filter = null; + return new PagedFlux<>( + () -> + listRecommendedByDatabaseSinglePageAsync( + resourceGroupName, + managedInstanceName, + databaseName, + skipToken, + includeDisabledRecommendations, + filter), + nextLink -> listRecommendedByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param skipToken The skipToken parameter. + * @param includeDisabledRecommendations Specifies whether to include disabled recommendations or not. + * @param filter An OData filter expression that filters elements in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity labels of a given database as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listRecommendedByDatabaseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String skipToken, + Boolean includeDisabledRecommendations, + String filter, + Context context) { + return new PagedFlux<>( + () -> + listRecommendedByDatabaseSinglePageAsync( + resourceGroupName, + managedInstanceName, + databaseName, + skipToken, + includeDisabledRecommendations, + filter, + context), + nextLink -> listRecommendedByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity labels of a given database as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listRecommendedByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName) { + final String skipToken = null; + final Boolean includeDisabledRecommendations = null; + final String filter = null; + return new PagedIterable<>( + listRecommendedByDatabaseAsync( + resourceGroupName, + managedInstanceName, + databaseName, + skipToken, + includeDisabledRecommendations, + filter)); + } + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param skipToken The skipToken parameter. + * @param includeDisabledRecommendations Specifies whether to include disabled recommendations or not. + * @param filter An OData filter expression that filters elements in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity labels of a given database as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listRecommendedByDatabase( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String skipToken, + Boolean includeDisabledRecommendations, + String filter, + Context context) { + return new PagedIterable<>( + listRecommendedByDatabaseAsync( + resourceGroupName, + managedInstanceName, + databaseName, + skipToken, + includeDisabledRecommendations, + filter, + context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sensitivity labels along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listCurrentByDatabaseNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listCurrentByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sensitivity labels along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listCurrentByDatabaseNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listCurrentByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sensitivity labels along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listRecommendedByDatabaseNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listRecommendedByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sensitivity labels along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listRecommendedByDatabaseNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listRecommendedByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSensitivityLabelsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSensitivityLabelsImpl.java new file mode 100644 index 0000000000000..f1a87f4985b0e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseSensitivityLabelsImpl.java @@ -0,0 +1,355 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseSensitivityLabelsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.SensitivityLabelInner; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseSensitivityLabels; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabel; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelSource; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelUpdateList; + +public final class ManagedDatabaseSensitivityLabelsImpl implements ManagedDatabaseSensitivityLabels { + private static final ClientLogger LOGGER = new ClientLogger(ManagedDatabaseSensitivityLabelsImpl.class); + + private final ManagedDatabaseSensitivityLabelsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedDatabaseSensitivityLabelsImpl( + ManagedDatabaseSensitivityLabelsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelSource sensitivityLabelSource, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse( + resourceGroupName, + managedInstanceName, + databaseName, + schemaName, + tableName, + columnName, + sensitivityLabelSource, + context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SensitivityLabelImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SensitivityLabel get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelSource sensitivityLabelSource) { + SensitivityLabelInner inner = + this + .serviceClient() + .get( + resourceGroupName, + managedInstanceName, + databaseName, + schemaName, + tableName, + columnName, + sensitivityLabelSource); + if (inner != null) { + return new SensitivityLabelImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context) { + return this + .serviceClient() + .deleteWithResponse( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, context); + } + + public void delete( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + this + .serviceClient() + .delete(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName); + } + + public Response disableRecommendationWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context) { + return this + .serviceClient() + .disableRecommendationWithResponse( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, context); + } + + public void disableRecommendation( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + this + .serviceClient() + .disableRecommendation( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName); + } + + public Response enableRecommendationWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context) { + return this + .serviceClient() + .enableRecommendationWithResponse( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, context); + } + + public void enableRecommendation( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + this + .serviceClient() + .enableRecommendation( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName); + } + + public PagedIterable listCurrentByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName) { + PagedIterable inner = + this.serviceClient().listCurrentByDatabase(resourceGroupName, managedInstanceName, databaseName); + return Utils.mapPage(inner, inner1 -> new SensitivityLabelImpl(inner1, this.manager())); + } + + public PagedIterable listCurrentByDatabase( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String skipToken, + Boolean count, + String filter, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listCurrentByDatabase( + resourceGroupName, managedInstanceName, databaseName, skipToken, count, filter, context); + return Utils.mapPage(inner, inner1 -> new SensitivityLabelImpl(inner1, this.manager())); + } + + public Response updateWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + SensitivityLabelUpdateList parameters, + Context context) { + return this + .serviceClient() + .updateWithResponse(resourceGroupName, managedInstanceName, databaseName, parameters, context); + } + + public void update( + String resourceGroupName, + String managedInstanceName, + String databaseName, + SensitivityLabelUpdateList parameters) { + this.serviceClient().update(resourceGroupName, managedInstanceName, databaseName, parameters); + } + + public PagedIterable listRecommendedByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName) { + PagedIterable inner = + this.serviceClient().listRecommendedByDatabase(resourceGroupName, managedInstanceName, databaseName); + return Utils.mapPage(inner, inner1 -> new SensitivityLabelImpl(inner1, this.manager())); + } + + public PagedIterable listRecommendedByDatabase( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String skipToken, + Boolean includeDisabledRecommendations, + String filter, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listRecommendedByDatabase( + resourceGroupName, + managedInstanceName, + databaseName, + skipToken, + includeDisabledRecommendations, + filter, + context); + return Utils.mapPage(inner, inner1 -> new SensitivityLabelImpl(inner1, this.manager())); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String schemaName = Utils.getValueFromIdByName(id, "schemas"); + if (schemaName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'schemas'.", id))); + } + String tableName = Utils.getValueFromIdByName(id, "tables"); + if (tableName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'tables'.", id))); + } + String columnName = Utils.getValueFromIdByName(id, "columns"); + if (columnName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'columns'.", id))); + } + this + .deleteWithResponse( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String schemaName = Utils.getValueFromIdByName(id, "schemas"); + if (schemaName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'schemas'.", id))); + } + String tableName = Utils.getValueFromIdByName(id, "tables"); + if (tableName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'tables'.", id))); + } + String columnName = Utils.getValueFromIdByName(id, "columns"); + if (columnName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'columns'.", id))); + } + return this + .deleteWithResponse( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, context); + } + + private ManagedDatabaseSensitivityLabelsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public SensitivityLabelImpl define() { + return new SensitivityLabelImpl(this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseTablesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseTablesClientImpl.java new file mode 100644 index 0000000000000..b63f38c66b017 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseTablesClientImpl.java @@ -0,0 +1,667 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseTablesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseTableInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseTableListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ManagedDatabaseTablesClient. */ +public final class ManagedDatabaseTablesClientImpl implements ManagedDatabaseTablesClient { + /** The proxy service used to perform REST calls. */ + private final ManagedDatabaseTablesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedDatabaseTablesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedDatabaseTablesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create(ManagedDatabaseTablesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientManagedDatabaseTables to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + public interface ManagedDatabaseTablesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}/tables") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySchema( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("schemaName") String schemaName, + @QueryParam("$filter") String filter, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/schemas/{schemaName}/tables" + + "/{tableName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("schemaName") String schemaName, + @PathParam("tableName") String tableName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySchemaNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List managed database tables. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param filter An OData filter expression that filters elements in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database tables along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySchemaSinglePageAsync( + String resourceGroupName, String managedInstanceName, String databaseName, String schemaName, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listBySchema( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + schemaName, + filter, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List managed database tables. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param filter An OData filter expression that filters elements in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database tables along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySchemaSinglePageAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String filter, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySchema( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + schemaName, + filter, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List managed database tables. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param filter An OData filter expression that filters elements in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database tables as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySchemaAsync( + String resourceGroupName, String managedInstanceName, String databaseName, String schemaName, String filter) { + return new PagedFlux<>( + () -> listBySchemaSinglePageAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, filter), + nextLink -> listBySchemaNextSinglePageAsync(nextLink)); + } + + /** + * List managed database tables. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database tables as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySchemaAsync( + String resourceGroupName, String managedInstanceName, String databaseName, String schemaName) { + final String filter = null; + return new PagedFlux<>( + () -> listBySchemaSinglePageAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, filter), + nextLink -> listBySchemaNextSinglePageAsync(nextLink)); + } + + /** + * List managed database tables. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param filter An OData filter expression that filters elements in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database tables as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySchemaAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String filter, + Context context) { + return new PagedFlux<>( + () -> + listBySchemaSinglePageAsync( + resourceGroupName, managedInstanceName, databaseName, schemaName, filter, context), + nextLink -> listBySchemaNextSinglePageAsync(nextLink, context)); + } + + /** + * List managed database tables. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database tables as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySchema( + String resourceGroupName, String managedInstanceName, String databaseName, String schemaName) { + final String filter = null; + return new PagedIterable<>( + listBySchemaAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, filter)); + } + + /** + * List managed database tables. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param filter An OData filter expression that filters elements in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database tables as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySchema( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String filter, + Context context) { + return new PagedIterable<>( + listBySchemaAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, filter, context)); + } + + /** + * Get managed database table. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return managed database table along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + schemaName, + tableName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get managed database table. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return managed database table along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + schemaName, + tableName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Get managed database table. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return managed database table on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get managed database table. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return managed database table along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + Context context) { + return getWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, context) + .block(); + } + + /** + * Get managed database table. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return managed database table. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseTableInner get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName) { + return getWithResponse( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, Context.NONE) + .getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database tables along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySchemaNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listBySchemaNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database tables along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySchemaNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySchemaNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseTablesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseTablesImpl.java new file mode 100644 index 0000000000000..65112423bbb2a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseTablesImpl.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseTablesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseTableInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseTable; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseTables; + +public final class ManagedDatabaseTablesImpl implements ManagedDatabaseTables { + private static final ClientLogger LOGGER = new ClientLogger(ManagedDatabaseTablesImpl.class); + + private final ManagedDatabaseTablesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedDatabaseTablesImpl( + ManagedDatabaseTablesClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listBySchema( + String resourceGroupName, String managedInstanceName, String databaseName, String schemaName) { + PagedIterable inner = + this.serviceClient().listBySchema(resourceGroupName, managedInstanceName, databaseName, schemaName); + return Utils.mapPage(inner, inner1 -> new DatabaseTableImpl(inner1, this.manager())); + } + + public PagedIterable listBySchema( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String filter, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listBySchema(resourceGroupName, managedInstanceName, databaseName, schemaName, filter, context); + return Utils.mapPage(inner, inner1 -> new DatabaseTableImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatabaseTableImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DatabaseTable get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName) { + DatabaseTableInner inner = + this.serviceClient().get(resourceGroupName, managedInstanceName, databaseName, schemaName, tableName); + if (inner != null) { + return new DatabaseTableImpl(inner, this.manager()); + } else { + return null; + } + } + + private ManagedDatabaseTablesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseTransparentDataEncryptionsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseTransparentDataEncryptionsClientImpl.java new file mode 100644 index 0000000000000..fc3694594f516 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseTransparentDataEncryptionsClientImpl.java @@ -0,0 +1,843 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseTransparentDataEncryptionsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedTransparentDataEncryptionInner; +import com.azure.resourcemanager.sql.generated.models.ManagedTransparentDataEncryptionListResult; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionName; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * ManagedDatabaseTransparentDataEncryptionsClient. + */ +public final class ManagedDatabaseTransparentDataEncryptionsClientImpl + implements ManagedDatabaseTransparentDataEncryptionsClient { + /** The proxy service used to perform REST calls. */ + private final ManagedDatabaseTransparentDataEncryptionsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedDatabaseTransparentDataEncryptionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedDatabaseTransparentDataEncryptionsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ManagedDatabaseTransparentDataEncryptionsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientManagedDatabaseTransparentDataEncryptions to be + * used by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + public interface ManagedDatabaseTransparentDataEncryptionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/transparentDataEncryption" + + "/{tdeName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("tdeName") TransparentDataEncryptionName tdeName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/transparentDataEncryption" + + "/{tdeName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("tdeName") TransparentDataEncryptionName tdeName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ManagedTransparentDataEncryptionInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/transparentDataEncryption") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabaseNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a managed database's transparent data encryption. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 transparent data encryption is defined. + * @param tdeName The name of the transparent data encryption configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's transparent data encryption along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + TransparentDataEncryptionName tdeName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (tdeName == null) { + return Mono.error(new IllegalArgumentException("Parameter tdeName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + tdeName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a managed database's transparent data encryption. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 transparent data encryption is defined. + * @param tdeName The name of the transparent data encryption configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's transparent data encryption along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + TransparentDataEncryptionName tdeName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (tdeName == null) { + return Mono.error(new IllegalArgumentException("Parameter tdeName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + tdeName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a managed database's transparent data encryption. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 transparent data encryption is defined. + * @param tdeName The name of the transparent data encryption configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's transparent data encryption on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + TransparentDataEncryptionName tdeName) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, tdeName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a managed database's transparent data encryption. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 transparent data encryption is defined. + * @param tdeName The name of the transparent data encryption configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's transparent data encryption along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + TransparentDataEncryptionName tdeName, + Context context) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, tdeName, context).block(); + } + + /** + * Gets a managed database's transparent data encryption. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 transparent data encryption is defined. + * @param tdeName The name of the transparent data encryption configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's transparent data encryption. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedTransparentDataEncryptionInner get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + TransparentDataEncryptionName tdeName) { + return getWithResponse(resourceGroupName, managedInstanceName, databaseName, tdeName, Context.NONE).getValue(); + } + + /** + * 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policy is defined. + * @param tdeName The name of the transparent data encryption configuration. + * @param parameters The database transparent data encryption. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database transparent data encryption state along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + TransparentDataEncryptionName tdeName, + ManagedTransparentDataEncryptionInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (tdeName == null) { + return Mono.error(new IllegalArgumentException("Parameter tdeName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + tdeName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policy is defined. + * @param tdeName The name of the transparent data encryption configuration. + * @param parameters The database transparent data encryption. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database transparent data encryption state along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + TransparentDataEncryptionName tdeName, + ManagedTransparentDataEncryptionInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (tdeName == null) { + return Mono.error(new IllegalArgumentException("Parameter tdeName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + tdeName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policy is defined. + * @param tdeName The name of the transparent data encryption configuration. + * @param parameters The database transparent data encryption. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database transparent data encryption state on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + TransparentDataEncryptionName tdeName, + ManagedTransparentDataEncryptionInner parameters) { + return createOrUpdateWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, tdeName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policy is defined. + * @param tdeName The name of the transparent data encryption configuration. + * @param parameters The database transparent data encryption. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database transparent data encryption state along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + TransparentDataEncryptionName tdeName, + ManagedTransparentDataEncryptionInner parameters, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, tdeName, parameters, context) + .block(); + } + + /** + * 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policy is defined. + * @param tdeName The name of the transparent data encryption configuration. + * @param parameters The database transparent data encryption. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database transparent data encryption state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedTransparentDataEncryptionInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + TransparentDataEncryptionName tdeName, + ManagedTransparentDataEncryptionInner parameters) { + return createOrUpdateWithResponse( + resourceGroupName, managedInstanceName, databaseName, tdeName, parameters, Context.NONE) + .getValue(); + } + + /** + * Gets a list of managed database's transparent data encryptions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 transparent data encryption is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed database's transparent data encryptions along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String managedInstanceName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of managed database's transparent data encryptions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 transparent data encryption is defined. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed database's transparent data encryptions along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String managedInstanceName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of managed database's transparent data encryptions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 transparent data encryption is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed database's transparent data encryptions as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String managedInstanceName, String databaseName) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, managedInstanceName, databaseName), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of managed database's transparent data encryptions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 transparent data encryption is defined. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed database's transparent data encryptions as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String managedInstanceName, String databaseName, Context context) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, managedInstanceName, databaseName, context), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of managed database's transparent data encryptions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 transparent data encryption is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed database's transparent data encryptions as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName)); + } + + /** + * Gets a list of managed database's transparent data encryptions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 transparent data encryption is defined. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed database's transparent data encryptions as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName, Context context) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed transparent data encryptions along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed transparent data encryptions along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseTransparentDataEncryptionsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseTransparentDataEncryptionsImpl.java new file mode 100644 index 0000000000000..9c16c7ba3919f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseTransparentDataEncryptionsImpl.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseTransparentDataEncryptionsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedTransparentDataEncryptionInner; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseTransparentDataEncryptions; +import com.azure.resourcemanager.sql.generated.models.ManagedTransparentDataEncryption; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionName; + +public final class ManagedDatabaseTransparentDataEncryptionsImpl implements ManagedDatabaseTransparentDataEncryptions { + private static final ClientLogger LOGGER = new ClientLogger(ManagedDatabaseTransparentDataEncryptionsImpl.class); + + private final ManagedDatabaseTransparentDataEncryptionsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedDatabaseTransparentDataEncryptionsImpl( + ManagedDatabaseTransparentDataEncryptionsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + TransparentDataEncryptionName tdeName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, managedInstanceName, databaseName, tdeName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ManagedTransparentDataEncryptionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ManagedTransparentDataEncryption get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + TransparentDataEncryptionName tdeName) { + ManagedTransparentDataEncryptionInner inner = + this.serviceClient().get(resourceGroupName, managedInstanceName, databaseName, tdeName); + if (inner != null) { + return new ManagedTransparentDataEncryptionImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, managedInstanceName, databaseName); + return Utils.mapPage(inner, inner1 -> new ManagedTransparentDataEncryptionImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, managedInstanceName, databaseName, context); + return Utils.mapPage(inner, inner1 -> new ManagedTransparentDataEncryptionImpl(inner1, this.manager())); + } + + public ManagedTransparentDataEncryption getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String tdeNameLocal = Utils.getValueFromIdByName(id, "transparentDataEncryption"); + if (tdeNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'transparentDataEncryption'.", + id))); + } + TransparentDataEncryptionName tdeName = TransparentDataEncryptionName.fromString(tdeNameLocal); + return this + .getWithResponse(resourceGroupName, managedInstanceName, databaseName, tdeName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String tdeNameLocal = Utils.getValueFromIdByName(id, "transparentDataEncryption"); + if (tdeNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'transparentDataEncryption'.", + id))); + } + TransparentDataEncryptionName tdeName = TransparentDataEncryptionName.fromString(tdeNameLocal); + return this.getWithResponse(resourceGroupName, managedInstanceName, databaseName, tdeName, context); + } + + private ManagedDatabaseTransparentDataEncryptionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ManagedTransparentDataEncryptionImpl define(TransparentDataEncryptionName name) { + return new ManagedTransparentDataEncryptionImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientImpl.java new file mode 100644 index 0000000000000..46cffed71883d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientImpl.java @@ -0,0 +1,936 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentRuleBaselineInner; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentPolicyBaselineName; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient. + */ +public final class ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientImpl + implements ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient { + /** The proxy service used to perform REST calls. */ + private final ManagedDatabaseVulnerabilityAssessmentRuleBaselinesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ManagedDatabaseVulnerabilityAssessmentRuleBaselinesService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for + * SqlManagementClientManagedDatabaseVulnerabilityAssessmentRuleBaselines to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + public interface ManagedDatabaseVulnerabilityAssessmentRuleBaselinesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments" + + "/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("ruleId") String ruleId, + @PathParam("baselineName") VulnerabilityAssessmentPolicyBaselineName baselineName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments" + + "/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("ruleId") String ruleId, + @PathParam("baselineName") VulnerabilityAssessmentPolicyBaselineName baselineName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DatabaseVulnerabilityAssessmentRuleBaselineInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments" + + "/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("ruleId") String ruleId, + @PathParam("baselineName") VulnerabilityAssessmentPolicyBaselineName baselineName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's vulnerability assessment rule baseline along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (baselineName == null) { + return Mono.error(new IllegalArgumentException("Parameter baselineName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's vulnerability assessment rule baseline along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (baselineName == null) { + return Mono.error(new IllegalArgumentException("Parameter baselineName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's vulnerability assessment rule baseline on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName) { + return getWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, ruleId, baselineName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's vulnerability assessment rule baseline along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + Context context) { + return getWithResponseAsync( + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + context) + .block(); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's vulnerability assessment rule baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseVulnerabilityAssessmentRuleBaselineInner get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName) { + return getWithResponse( + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + Context.NONE) + .getValue(); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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). + * @param parameters The requested rule baseline resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database vulnerability assessment rule baseline along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + DatabaseVulnerabilityAssessmentRuleBaselineInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (baselineName == null) { + return Mono.error(new IllegalArgumentException("Parameter baselineName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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). + * @param parameters The requested rule baseline resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database vulnerability assessment rule baseline along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + DatabaseVulnerabilityAssessmentRuleBaselineInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (baselineName == null) { + return Mono.error(new IllegalArgumentException("Parameter baselineName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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). + * @param parameters The requested rule baseline resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database vulnerability assessment rule baseline on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + DatabaseVulnerabilityAssessmentRuleBaselineInner parameters) { + return createOrUpdateWithResponseAsync( + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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). + * @param parameters The requested rule baseline resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database vulnerability assessment rule baseline along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + DatabaseVulnerabilityAssessmentRuleBaselineInner parameters, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + parameters, + context) + .block(); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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). + * @param parameters The requested rule baseline resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database vulnerability assessment rule baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseVulnerabilityAssessmentRuleBaselineInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + DatabaseVulnerabilityAssessmentRuleBaselineInner parameters) { + return createOrUpdateWithResponse( + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + parameters, + Context.NONE) + .getValue(); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (baselineName == null) { + return Mono.error(new IllegalArgumentException("Parameter baselineName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (baselineName == null) { + return Mono.error(new IllegalArgumentException("Parameter baselineName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName) { + return deleteWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, ruleId, baselineName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + Context context) { + return deleteWithResponseAsync( + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + context) + .block(); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName) { + deleteWithResponse( + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesImpl.java new file mode 100644 index 0000000000000..eaa69cb938db1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesImpl.java @@ -0,0 +1,191 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentRuleBaselineInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseVulnerabilityAssessmentRuleBaseline; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseVulnerabilityAssessmentRuleBaselines; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentPolicyBaselineName; + +public final class ManagedDatabaseVulnerabilityAssessmentRuleBaselinesImpl + implements ManagedDatabaseVulnerabilityAssessmentRuleBaselines { + private static final ClientLogger LOGGER = + new ClientLogger(ManagedDatabaseVulnerabilityAssessmentRuleBaselinesImpl.class); + + private final ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedDatabaseVulnerabilityAssessmentRuleBaselinesImpl( + ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse( + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatabaseVulnerabilityAssessmentRuleBaselineImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DatabaseVulnerabilityAssessmentRuleBaseline get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName) { + DatabaseVulnerabilityAssessmentRuleBaselineInner inner = + this + .serviceClient() + .get( + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName); + if (inner != null) { + return new DatabaseVulnerabilityAssessmentRuleBaselineImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response createOrUpdateWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + DatabaseVulnerabilityAssessmentRuleBaselineInner parameters, + Context context) { + Response inner = + this + .serviceClient() + .createOrUpdateWithResponse( + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + parameters, + context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatabaseVulnerabilityAssessmentRuleBaselineImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DatabaseVulnerabilityAssessmentRuleBaseline createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + DatabaseVulnerabilityAssessmentRuleBaselineInner parameters) { + DatabaseVulnerabilityAssessmentRuleBaselineInner inner = + this + .serviceClient() + .createOrUpdate( + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + parameters); + if (inner != null) { + return new DatabaseVulnerabilityAssessmentRuleBaselineImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + Context context) { + return this + .serviceClient() + .deleteWithResponse( + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName, + context); + } + + public void delete( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName) { + this + .serviceClient() + .delete( + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + ruleId, + baselineName); + } + + private ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseVulnerabilityAssessmentScansClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseVulnerabilityAssessmentScansClientImpl.java new file mode 100644 index 0000000000000..54dea14328029 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseVulnerabilityAssessmentScansClientImpl.java @@ -0,0 +1,1310 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseVulnerabilityAssessmentScansClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentScansExportInner; +import com.azure.resourcemanager.sql.generated.fluent.models.VulnerabilityAssessmentScanRecordInner; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentScanRecordListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * ManagedDatabaseVulnerabilityAssessmentScansClient. + */ +public final class ManagedDatabaseVulnerabilityAssessmentScansClientImpl + implements ManagedDatabaseVulnerabilityAssessmentScansClient { + /** The proxy service used to perform REST calls. */ + private final ManagedDatabaseVulnerabilityAssessmentScansService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedDatabaseVulnerabilityAssessmentScansClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedDatabaseVulnerabilityAssessmentScansClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ManagedDatabaseVulnerabilityAssessmentScansService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientManagedDatabaseVulnerabilityAssessmentScans to be + * used by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + public interface ManagedDatabaseVulnerabilityAssessmentScansService { + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments" + + "/{vulnerabilityAssessmentName}/scans/{scanId}/initiateScan") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> initiateScan( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("scanId") String scanId, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments" + + "/{vulnerabilityAssessmentName}/scans/{scanId}/export") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> export( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("scanId") String scanId, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments" + + "/{vulnerabilityAssessmentName}/scans") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments" + + "/{vulnerabilityAssessmentName}/scans/{scanId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("scanId") String scanId, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabaseNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> initiateScanWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (scanId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .initiateScan( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + scanId, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> initiateScanWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (scanId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .initiateScan( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + scanId, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginInitiateScanAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + Mono>> mono = + initiateScanWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginInitiateScanAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + initiateScanWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginInitiateScan( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + return beginInitiateScanAsync( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId) + .getSyncPoller(); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginInitiateScan( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context) { + return beginInitiateScanAsync( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId, context) + .getSyncPoller(); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono initiateScanAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + return beginInitiateScanAsync( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono initiateScanAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context) { + return beginInitiateScanAsync( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void initiateScan( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + initiateScanAsync(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId) + .block(); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void initiateScan( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context) { + initiateScanAsync( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId, context) + .block(); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database Vulnerability Assessment scan export resource along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> exportWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (scanId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .export( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + scanId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database Vulnerability Assessment scan export resource along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> exportWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (scanId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .export( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + scanId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database Vulnerability Assessment scan export resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono exportAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + return exportWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database Vulnerability Assessment scan export resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response exportWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context) { + return exportWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId, context) + .block(); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database Vulnerability Assessment scan export resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseVulnerabilityAssessmentScansExportInner export( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + return exportWithResponse( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId, Context.NONE) + .getValue(); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan records along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan records along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan records as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + return new PagedFlux<>( + () -> + listByDatabaseSinglePageAsync( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan records as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + return new PagedFlux<>( + () -> + listByDatabaseSinglePageAsync( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, context), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan records as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + return new PagedIterable<>( + listByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName)); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan records as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + return new PagedIterable<>( + listByDatabaseAsync( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, context)); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a vulnerability assessment scan record of a database along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (scanId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + scanId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a vulnerability assessment scan record of a database along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (scanId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + scanId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a vulnerability assessment scan record of a database on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + return getWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a vulnerability assessment scan record of a database along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context) { + return getWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId, context) + .block(); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a vulnerability assessment scan record of a database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VulnerabilityAssessmentScanRecordInner get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + return getWithResponse( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId, Context.NONE) + .getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan records along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan records along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseVulnerabilityAssessmentScansImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseVulnerabilityAssessmentScansImpl.java new file mode 100644 index 0000000000000..b3c7ad885d666 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseVulnerabilityAssessmentScansImpl.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseVulnerabilityAssessmentScansClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentScansExportInner; +import com.azure.resourcemanager.sql.generated.fluent.models.VulnerabilityAssessmentScanRecordInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseVulnerabilityAssessmentScansExport; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseVulnerabilityAssessmentScans; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentScanRecord; + +public final class ManagedDatabaseVulnerabilityAssessmentScansImpl + implements ManagedDatabaseVulnerabilityAssessmentScans { + private static final ClientLogger LOGGER = new ClientLogger(ManagedDatabaseVulnerabilityAssessmentScansImpl.class); + + private final ManagedDatabaseVulnerabilityAssessmentScansClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedDatabaseVulnerabilityAssessmentScansImpl( + ManagedDatabaseVulnerabilityAssessmentScansClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void initiateScan( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + this + .serviceClient() + .initiateScan(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId); + } + + public void initiateScan( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context) { + this + .serviceClient() + .initiateScan( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId, context); + } + + public Response exportWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context) { + Response inner = + this + .serviceClient() + .exportWithResponse( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatabaseVulnerabilityAssessmentScansExportImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DatabaseVulnerabilityAssessmentScansExport export( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + DatabaseVulnerabilityAssessmentScansExportInner inner = + this + .serviceClient() + .export(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId); + if (inner != null) { + return new DatabaseVulnerabilityAssessmentScansExportImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listByDatabase( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + PagedIterable inner = + this + .serviceClient() + .listByDatabase(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName); + return Utils.mapPage(inner, inner1 -> new VulnerabilityAssessmentScanRecordImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByDatabase( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, context); + return Utils.mapPage(inner, inner1 -> new VulnerabilityAssessmentScanRecordImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new VulnerabilityAssessmentScanRecordImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public VulnerabilityAssessmentScanRecord get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + VulnerabilityAssessmentScanRecordInner inner = + this + .serviceClient() + .get(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, scanId); + if (inner != null) { + return new VulnerabilityAssessmentScanRecordImpl(inner, this.manager()); + } else { + return null; + } + } + + private ManagedDatabaseVulnerabilityAssessmentScansClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseVulnerabilityAssessmentsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseVulnerabilityAssessmentsClientImpl.java new file mode 100644 index 0000000000000..d333c6b02c12f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseVulnerabilityAssessmentsClientImpl.java @@ -0,0 +1,1079 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseVulnerabilityAssessmentsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseVulnerabilityAssessmentListResult; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * ManagedDatabaseVulnerabilityAssessmentsClient. + */ +public final class ManagedDatabaseVulnerabilityAssessmentsClientImpl + implements ManagedDatabaseVulnerabilityAssessmentsClient { + /** The proxy service used to perform REST calls. */ + private final ManagedDatabaseVulnerabilityAssessmentsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedDatabaseVulnerabilityAssessmentsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedDatabaseVulnerabilityAssessmentsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ManagedDatabaseVulnerabilityAssessmentsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientManagedDatabaseVulnerabilityAssessments to be used + * by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + public interface ManagedDatabaseVulnerabilityAssessmentsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments" + + "/{vulnerabilityAssessmentName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments" + + "/{vulnerabilityAssessmentName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DatabaseVulnerabilityAssessmentInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments" + + "/{vulnerabilityAssessmentName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/vulnerabilityAssessments") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabaseNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the database's vulnerability assessment along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the database's vulnerability assessment along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the database's vulnerability assessment on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the database's vulnerability assessment along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + return getWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, context) + .block(); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the database's vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseVulnerabilityAssessmentInner get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + return getWithResponse( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, Context.NONE) + .getValue(); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database vulnerability assessment along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + DatabaseVulnerabilityAssessmentInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database vulnerability assessment along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + DatabaseVulnerabilityAssessmentInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database vulnerability assessment on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + DatabaseVulnerabilityAssessmentInner parameters) { + return createOrUpdateWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database vulnerability assessment along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + DatabaseVulnerabilityAssessmentInner parameters, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, parameters, context) + .block(); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseVulnerabilityAssessmentInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + DatabaseVulnerabilityAssessmentInner parameters) { + return createOrUpdateWithResponse( + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + parameters, + Context.NONE) + .getValue(); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + return deleteWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + return deleteWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, context) + .block(); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + deleteWithResponse( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, Context.NONE); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the database's vulnerability assessments along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String managedInstanceName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the database's vulnerability assessments along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String managedInstanceName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the database's vulnerability assessments as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String managedInstanceName, String databaseName) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, managedInstanceName, databaseName), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the database's vulnerability assessments as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String managedInstanceName, String databaseName, Context context) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, managedInstanceName, databaseName, context), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the database's vulnerability assessments as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, managedInstanceName, 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the database's vulnerability assessments as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName, Context context) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the database's vulnerability assessments along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the database's vulnerability assessments along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseVulnerabilityAssessmentsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseVulnerabilityAssessmentsImpl.java new file mode 100644 index 0000000000000..471250564a60c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabaseVulnerabilityAssessmentsImpl.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseVulnerabilityAssessmentsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseVulnerabilityAssessment; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseVulnerabilityAssessments; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +public final class ManagedDatabaseVulnerabilityAssessmentsImpl implements ManagedDatabaseVulnerabilityAssessments { + private static final ClientLogger LOGGER = new ClientLogger(ManagedDatabaseVulnerabilityAssessmentsImpl.class); + + private final ManagedDatabaseVulnerabilityAssessmentsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedDatabaseVulnerabilityAssessmentsImpl( + ManagedDatabaseVulnerabilityAssessmentsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatabaseVulnerabilityAssessmentImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DatabaseVulnerabilityAssessment get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + DatabaseVulnerabilityAssessmentInner inner = + this.serviceClient().get(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName); + if (inner != null) { + return new DatabaseVulnerabilityAssessmentImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response createOrUpdateWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + DatabaseVulnerabilityAssessmentInner parameters, + Context context) { + Response inner = + this + .serviceClient() + .createOrUpdateWithResponse( + resourceGroupName, + managedInstanceName, + databaseName, + vulnerabilityAssessmentName, + parameters, + context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatabaseVulnerabilityAssessmentImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DatabaseVulnerabilityAssessment createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + DatabaseVulnerabilityAssessmentInner parameters) { + DatabaseVulnerabilityAssessmentInner inner = + this + .serviceClient() + .createOrUpdate( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, parameters); + if (inner != null) { + return new DatabaseVulnerabilityAssessmentImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + return this + .serviceClient() + .deleteWithResponse( + resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName, context); + } + + public void delete( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName) { + this.serviceClient().delete(resourceGroupName, managedInstanceName, databaseName, vulnerabilityAssessmentName); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, managedInstanceName, databaseName); + return Utils.mapPage(inner, inner1 -> new DatabaseVulnerabilityAssessmentImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, managedInstanceName, databaseName, context); + return Utils.mapPage(inner, inner1 -> new DatabaseVulnerabilityAssessmentImpl(inner1, this.manager())); + } + + private ManagedDatabaseVulnerabilityAssessmentsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabasesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabasesClientImpl.java new file mode 100644 index 0000000000000..bac02788f3990 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabasesClientImpl.java @@ -0,0 +1,3155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabasesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedDatabaseInner; +import com.azure.resourcemanager.sql.generated.models.CompleteDatabaseRestoreDefinition; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseListResult; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseMoveDefinition; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseStartMoveDefinition; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseUpdate; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ManagedDatabasesClient. */ +public final class ManagedDatabasesClientImpl implements ManagedDatabasesClient { + /** The proxy service used to perform REST calls. */ + private final ManagedDatabasesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedDatabasesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedDatabasesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(ManagedDatabasesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientManagedDatabases to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + public interface ManagedDatabasesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInstance( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ManagedDatabaseInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ManagedDatabaseUpdate parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/cancelMove") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> cancelMove( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ManagedDatabaseMoveDefinition parameters, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/completeMove") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> completeMove( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ManagedDatabaseMoveDefinition parameters, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/completeRestore") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> completeRestore( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") CompleteDatabaseRestoreDefinition parameters, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/startMove") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> startMove( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ManagedDatabaseStartMoveDefinition parameters, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/inaccessibleManagedDatabases") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listInaccessibleByInstance( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInstanceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listInaccessibleByInstanceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed databases along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed databases along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed databases as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync(String resourceGroupName, String managedInstanceName) { + return new PagedFlux<>( + () -> listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName), + nextLink -> listByInstanceNextSinglePageAsync(nextLink)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed databases as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedFlux<>( + () -> listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName, context), + nextLink -> listByInstanceNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed databases as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstance(String resourceGroupName, String managedInstanceName) { + return new PagedIterable<>(listByInstanceAsync(resourceGroupName, managedInstanceName)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed databases as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedIterable<>(listByInstanceAsync(resourceGroupName, managedInstanceName, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String managedInstanceName, String databaseName) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, databaseName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, String databaseName, Context context) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedDatabaseInner get(String resourceGroupName, String managedInstanceName, String databaseName) { + return getWithResponse(resourceGroupName, managedInstanceName, databaseName, Context.NONE).getValue(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a managed database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ManagedDatabaseInner> beginCreateOrUpdateAsync( + String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedDatabaseInner.class, + ManagedDatabaseInner.class, + this.client.getContext()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a managed database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ManagedDatabaseInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ManagedDatabaseInner.class, ManagedDatabaseInner.class, context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a managed database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ManagedDatabaseInner> beginCreateOrUpdate( + String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, databaseName, parameters) + .getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a managed database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ManagedDatabaseInner> beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, databaseName, parameters, context) + .getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, databaseName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, databaseName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedDatabaseInner createOrUpdate( + String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseInner parameters) { + return createOrUpdateAsync(resourceGroupName, managedInstanceName, databaseName, parameters).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedDatabaseInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, managedInstanceName, databaseName, parameters, context).block(); + } + + /** + * Deletes a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String managedInstanceName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String managedInstanceName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String managedInstanceName, String databaseName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, managedInstanceName, databaseName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String managedInstanceName, String databaseName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, String databaseName) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, databaseName).getSyncPoller(); + } + + /** + * Deletes a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, String databaseName, Context context) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, databaseName, context).getSyncPoller(); + } + + /** + * Deletes a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String managedInstanceName, String databaseName) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, databaseName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String managedInstanceName, String databaseName, Context context) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, databaseName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String managedInstanceName, String databaseName) { + deleteAsync(resourceGroupName, managedInstanceName, databaseName).block(); + } + + /** + * Deletes a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String managedInstanceName, String databaseName, Context context) { + deleteAsync(resourceGroupName, managedInstanceName, databaseName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseUpdate parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseUpdate parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a managed database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ManagedDatabaseInner> beginUpdateAsync( + String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseUpdate parameters) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedDatabaseInner.class, + ManagedDatabaseInner.class, + this.client.getContext()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a managed database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ManagedDatabaseInner> beginUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseUpdate parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ManagedDatabaseInner.class, ManagedDatabaseInner.class, context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a managed database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ManagedDatabaseInner> beginUpdate( + String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseUpdate parameters) { + return beginUpdateAsync(resourceGroupName, managedInstanceName, databaseName, parameters).getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a managed database resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ManagedDatabaseInner> beginUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseUpdate parameters, + Context context) { + return beginUpdateAsync(resourceGroupName, managedInstanceName, databaseName, parameters, context) + .getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseUpdate parameters) { + return beginUpdateAsync(resourceGroupName, managedInstanceName, databaseName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseUpdate parameters, + Context context) { + return beginUpdateAsync(resourceGroupName, managedInstanceName, databaseName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedDatabaseInner update( + String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseUpdate parameters) { + return updateAsync(resourceGroupName, managedInstanceName, databaseName, parameters).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedDatabaseInner update( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseUpdate parameters, + Context context) { + return updateAsync(resourceGroupName, managedInstanceName, databaseName, parameters, context).block(); + } + + /** + * Cancels a managed database move operation. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 Parameters of the cancel managed database move operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> cancelMoveWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseMoveDefinition parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2022-02-01-preview"; + return FluxUtil + .withContext( + context -> + service + .cancelMove( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Cancels a managed database move operation. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 Parameters of the cancel managed database move operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> cancelMoveWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseMoveDefinition parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2022-02-01-preview"; + context = this.client.mergeContext(context); + return service + .cancelMove( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + context); + } + + /** + * Cancels a managed database move operation. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 Parameters of the cancel managed database move operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginCancelMoveAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseMoveDefinition parameters) { + Mono>> mono = + cancelMoveWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Cancels a managed database move operation. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 Parameters of the cancel managed database move operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginCancelMoveAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseMoveDefinition parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + cancelMoveWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Cancels a managed database move operation. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 Parameters of the cancel managed database move operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginCancelMove( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseMoveDefinition parameters) { + return beginCancelMoveAsync(resourceGroupName, managedInstanceName, databaseName, parameters).getSyncPoller(); + } + + /** + * Cancels a managed database move operation. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 Parameters of the cancel managed database move operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginCancelMove( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseMoveDefinition parameters, + Context context) { + return beginCancelMoveAsync(resourceGroupName, managedInstanceName, databaseName, parameters, context) + .getSyncPoller(); + } + + /** + * Cancels a managed database move operation. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 Parameters of the cancel managed database move operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono cancelMoveAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseMoveDefinition parameters) { + return beginCancelMoveAsync(resourceGroupName, managedInstanceName, databaseName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Cancels a managed database move operation. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 Parameters of the cancel managed database move operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono cancelMoveAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseMoveDefinition parameters, + Context context) { + return beginCancelMoveAsync(resourceGroupName, managedInstanceName, databaseName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Cancels a managed database move operation. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 Parameters of the cancel managed database move operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void cancelMove( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseMoveDefinition parameters) { + cancelMoveAsync(resourceGroupName, managedInstanceName, databaseName, parameters).block(); + } + + /** + * Cancels a managed database move operation. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 Parameters of the cancel managed database move operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void cancelMove( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseMoveDefinition parameters, + Context context) { + cancelMoveAsync(resourceGroupName, managedInstanceName, databaseName, parameters, context).block(); + } + + /** + * Completes a managed database move operation. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 Parameters of the complete managed database move operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> completeMoveWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseMoveDefinition parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2022-02-01-preview"; + return FluxUtil + .withContext( + context -> + service + .completeMove( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Completes a managed database move operation. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 Parameters of the complete managed database move operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> completeMoveWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseMoveDefinition parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2022-02-01-preview"; + context = this.client.mergeContext(context); + return service + .completeMove( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + context); + } + + /** + * Completes a managed database move operation. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 Parameters of the complete managed database move operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginCompleteMoveAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseMoveDefinition parameters) { + Mono>> mono = + completeMoveWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Completes a managed database move operation. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 Parameters of the complete managed database move operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginCompleteMoveAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseMoveDefinition parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + completeMoveWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Completes a managed database move operation. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 Parameters of the complete managed database move operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginCompleteMove( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseMoveDefinition parameters) { + return beginCompleteMoveAsync(resourceGroupName, managedInstanceName, databaseName, parameters).getSyncPoller(); + } + + /** + * Completes a managed database move operation. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 Parameters of the complete managed database move operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginCompleteMove( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseMoveDefinition parameters, + Context context) { + return beginCompleteMoveAsync(resourceGroupName, managedInstanceName, databaseName, parameters, context) + .getSyncPoller(); + } + + /** + * Completes a managed database move operation. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 Parameters of the complete managed database move operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono completeMoveAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseMoveDefinition parameters) { + return beginCompleteMoveAsync(resourceGroupName, managedInstanceName, databaseName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Completes a managed database move operation. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 Parameters of the complete managed database move operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono completeMoveAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseMoveDefinition parameters, + Context context) { + return beginCompleteMoveAsync(resourceGroupName, managedInstanceName, databaseName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Completes a managed database move operation. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 Parameters of the complete managed database move operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void completeMove( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseMoveDefinition parameters) { + completeMoveAsync(resourceGroupName, managedInstanceName, databaseName, parameters).block(); + } + + /** + * Completes a managed database move operation. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 Parameters of the complete managed database move operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void completeMove( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseMoveDefinition parameters, + Context context) { + completeMoveAsync(resourceGroupName, managedInstanceName, databaseName, parameters, context).block(); + } + + /** + * Completes the restore operation on a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The definition for completing the restore of this managed database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> completeRestoreWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + CompleteDatabaseRestoreDefinition parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2022-02-01-preview"; + return FluxUtil + .withContext( + context -> + service + .completeRestore( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Completes the restore operation on a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The definition for completing the restore of this managed database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> completeRestoreWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + CompleteDatabaseRestoreDefinition parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2022-02-01-preview"; + context = this.client.mergeContext(context); + return service + .completeRestore( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + context); + } + + /** + * Completes the restore operation on a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The definition for completing the restore of this managed database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginCompleteRestoreAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + CompleteDatabaseRestoreDefinition parameters) { + Mono>> mono = + completeRestoreWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Completes the restore operation on a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The definition for completing the restore of this managed database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginCompleteRestoreAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + CompleteDatabaseRestoreDefinition parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + completeRestoreWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Completes the restore operation on a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The definition for completing the restore of this managed database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginCompleteRestore( + String resourceGroupName, + String managedInstanceName, + String databaseName, + CompleteDatabaseRestoreDefinition parameters) { + return beginCompleteRestoreAsync(resourceGroupName, managedInstanceName, databaseName, parameters) + .getSyncPoller(); + } + + /** + * Completes the restore operation on a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The definition for completing the restore of this managed database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginCompleteRestore( + String resourceGroupName, + String managedInstanceName, + String databaseName, + CompleteDatabaseRestoreDefinition parameters, + Context context) { + return beginCompleteRestoreAsync(resourceGroupName, managedInstanceName, databaseName, parameters, context) + .getSyncPoller(); + } + + /** + * Completes the restore operation on a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The definition for completing the restore of this managed database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono completeRestoreAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + CompleteDatabaseRestoreDefinition parameters) { + return beginCompleteRestoreAsync(resourceGroupName, managedInstanceName, databaseName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Completes the restore operation on a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The definition for completing the restore of this managed database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono completeRestoreAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + CompleteDatabaseRestoreDefinition parameters, + Context context) { + return beginCompleteRestoreAsync(resourceGroupName, managedInstanceName, databaseName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Completes the restore operation on a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The definition for completing the restore of this managed database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void completeRestore( + String resourceGroupName, + String managedInstanceName, + String databaseName, + CompleteDatabaseRestoreDefinition parameters) { + completeRestoreAsync(resourceGroupName, managedInstanceName, databaseName, parameters).block(); + } + + /** + * Completes the restore operation on a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The definition for completing the restore of this managed database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void completeRestore( + String resourceGroupName, + String managedInstanceName, + String databaseName, + CompleteDatabaseRestoreDefinition parameters, + Context context) { + completeRestoreAsync(resourceGroupName, managedInstanceName, databaseName, parameters, context).block(); + } + + /** + * Starts a managed database move operation. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 Parameters of the start managed database move operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> startMoveWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseStartMoveDefinition parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2022-02-01-preview"; + return FluxUtil + .withContext( + context -> + service + .startMove( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Starts a managed database move operation. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 Parameters of the start managed database move operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> startMoveWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseStartMoveDefinition parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2022-02-01-preview"; + context = this.client.mergeContext(context); + return service + .startMove( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + context); + } + + /** + * Starts a managed database move operation. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 Parameters of the start managed database move operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginStartMoveAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseStartMoveDefinition parameters) { + Mono>> mono = + startMoveWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Starts a managed database move operation. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 Parameters of the start managed database move operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginStartMoveAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseStartMoveDefinition parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + startMoveWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Starts a managed database move operation. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 Parameters of the start managed database move operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginStartMove( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseStartMoveDefinition parameters) { + return beginStartMoveAsync(resourceGroupName, managedInstanceName, databaseName, parameters).getSyncPoller(); + } + + /** + * Starts a managed database move operation. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 Parameters of the start managed database move operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginStartMove( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseStartMoveDefinition parameters, + Context context) { + return beginStartMoveAsync(resourceGroupName, managedInstanceName, databaseName, parameters, context) + .getSyncPoller(); + } + + /** + * Starts a managed database move operation. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 Parameters of the start managed database move operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono startMoveAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseStartMoveDefinition parameters) { + return beginStartMoveAsync(resourceGroupName, managedInstanceName, databaseName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Starts a managed database move operation. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 Parameters of the start managed database move operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono startMoveAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseStartMoveDefinition parameters, + Context context) { + return beginStartMoveAsync(resourceGroupName, managedInstanceName, databaseName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Starts a managed database move operation. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 Parameters of the start managed database move operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void startMove( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseStartMoveDefinition parameters) { + startMoveAsync(resourceGroupName, managedInstanceName, databaseName, parameters).block(); + } + + /** + * Starts a managed database move operation. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 Parameters of the start managed database move operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void startMove( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseStartMoveDefinition parameters, + Context context) { + startMoveAsync(resourceGroupName, managedInstanceName, databaseName, parameters, context).block(); + } + + /** + * Gets a list of inaccessible managed databases in 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of inaccessible managed databases in a managed instance along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listInaccessibleByInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listInaccessibleByInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of inaccessible managed databases in 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of inaccessible managed databases in a managed instance along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listInaccessibleByInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listInaccessibleByInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of inaccessible managed databases in 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of inaccessible managed databases in a managed instance as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listInaccessibleByInstanceAsync( + String resourceGroupName, String managedInstanceName) { + return new PagedFlux<>( + () -> listInaccessibleByInstanceSinglePageAsync(resourceGroupName, managedInstanceName), + nextLink -> listInaccessibleByInstanceNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of inaccessible managed databases in 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of inaccessible managed databases in a managed instance as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listInaccessibleByInstanceAsync( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedFlux<>( + () -> listInaccessibleByInstanceSinglePageAsync(resourceGroupName, managedInstanceName, context), + nextLink -> listInaccessibleByInstanceNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of inaccessible managed databases in 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of inaccessible managed databases in a managed instance as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listInaccessibleByInstance( + String resourceGroupName, String managedInstanceName) { + return new PagedIterable<>(listInaccessibleByInstanceAsync(resourceGroupName, managedInstanceName)); + } + + /** + * Gets a list of inaccessible managed databases in 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of inaccessible managed databases in a managed instance as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listInaccessibleByInstance( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedIterable<>(listInaccessibleByInstanceAsync(resourceGroupName, managedInstanceName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed databases along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByInstanceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed databases along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInstanceNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed databases along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listInaccessibleByInstanceNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listInaccessibleByInstanceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed databases along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listInaccessibleByInstanceNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listInaccessibleByInstanceNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabasesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabasesImpl.java new file mode 100644 index 0000000000000..43544ca23cea3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedDatabasesImpl.java @@ -0,0 +1,283 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabasesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedDatabaseInner; +import com.azure.resourcemanager.sql.generated.models.CompleteDatabaseRestoreDefinition; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabase; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseMoveDefinition; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseStartMoveDefinition; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabases; + +public final class ManagedDatabasesImpl implements ManagedDatabases { + private static final ClientLogger LOGGER = new ClientLogger(ManagedDatabasesImpl.class); + + private final ManagedDatabasesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedDatabasesImpl( + ManagedDatabasesClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByInstance(String resourceGroupName, String managedInstanceName) { + PagedIterable inner = + this.serviceClient().listByInstance(resourceGroupName, managedInstanceName); + return Utils.mapPage(inner, inner1 -> new ManagedDatabaseImpl(inner1, this.manager())); + } + + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context) { + PagedIterable inner = + this.serviceClient().listByInstance(resourceGroupName, managedInstanceName, context); + return Utils.mapPage(inner, inner1 -> new ManagedDatabaseImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, String databaseName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, managedInstanceName, databaseName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ManagedDatabaseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ManagedDatabase get(String resourceGroupName, String managedInstanceName, String databaseName) { + ManagedDatabaseInner inner = this.serviceClient().get(resourceGroupName, managedInstanceName, databaseName); + if (inner != null) { + return new ManagedDatabaseImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String managedInstanceName, String databaseName) { + this.serviceClient().delete(resourceGroupName, managedInstanceName, databaseName); + } + + public void delete(String resourceGroupName, String managedInstanceName, String databaseName, Context context) { + this.serviceClient().delete(resourceGroupName, managedInstanceName, databaseName, context); + } + + public void cancelMove( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseMoveDefinition parameters) { + this.serviceClient().cancelMove(resourceGroupName, managedInstanceName, databaseName, parameters); + } + + public void cancelMove( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseMoveDefinition parameters, + Context context) { + this.serviceClient().cancelMove(resourceGroupName, managedInstanceName, databaseName, parameters, context); + } + + public void completeMove( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseMoveDefinition parameters) { + this.serviceClient().completeMove(resourceGroupName, managedInstanceName, databaseName, parameters); + } + + public void completeMove( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseMoveDefinition parameters, + Context context) { + this.serviceClient().completeMove(resourceGroupName, managedInstanceName, databaseName, parameters, context); + } + + public void completeRestore( + String resourceGroupName, + String managedInstanceName, + String databaseName, + CompleteDatabaseRestoreDefinition parameters) { + this.serviceClient().completeRestore(resourceGroupName, managedInstanceName, databaseName, parameters); + } + + public void completeRestore( + String resourceGroupName, + String managedInstanceName, + String databaseName, + CompleteDatabaseRestoreDefinition parameters, + Context context) { + this.serviceClient().completeRestore(resourceGroupName, managedInstanceName, databaseName, parameters, context); + } + + public void startMove( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseStartMoveDefinition parameters) { + this.serviceClient().startMove(resourceGroupName, managedInstanceName, databaseName, parameters); + } + + public void startMove( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseStartMoveDefinition parameters, + Context context) { + this.serviceClient().startMove(resourceGroupName, managedInstanceName, databaseName, parameters, context); + } + + public PagedIterable listInaccessibleByInstance( + String resourceGroupName, String managedInstanceName) { + PagedIterable inner = + this.serviceClient().listInaccessibleByInstance(resourceGroupName, managedInstanceName); + return Utils.mapPage(inner, inner1 -> new ManagedDatabaseImpl(inner1, this.manager())); + } + + public PagedIterable listInaccessibleByInstance( + String resourceGroupName, String managedInstanceName, Context context) { + PagedIterable inner = + this.serviceClient().listInaccessibleByInstance(resourceGroupName, managedInstanceName, context); + return Utils.mapPage(inner, inner1 -> new ManagedDatabaseImpl(inner1, this.manager())); + } + + public ManagedDatabase getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + return this.getWithResponse(resourceGroupName, managedInstanceName, databaseName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + return this.getWithResponse(resourceGroupName, managedInstanceName, databaseName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + this.delete(resourceGroupName, managedInstanceName, databaseName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + this.delete(resourceGroupName, managedInstanceName, databaseName, context); + } + + private ManagedDatabasesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ManagedDatabaseImpl define(String name) { + return new ManagedDatabaseImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAdministratorImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAdministratorImpl.java new file mode 100644 index 0000000000000..3e6d9a45e98ff --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAdministratorImpl.java @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceAdministratorInner; +import com.azure.resourcemanager.sql.generated.models.AdministratorName; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceAdministrator; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceAdministratorType; +import java.util.UUID; + +public final class ManagedInstanceAdministratorImpl + implements ManagedInstanceAdministrator, + ManagedInstanceAdministrator.Definition, + ManagedInstanceAdministrator.Update { + private ManagedInstanceAdministratorInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public ManagedInstanceAdministratorType administratorType() { + return this.innerModel().administratorType(); + } + + public String login() { + return this.innerModel().login(); + } + + public UUID sid() { + return this.innerModel().sid(); + } + + public UUID tenantId() { + return this.innerModel().tenantId(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ManagedInstanceAdministratorInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String managedInstanceName; + + private AdministratorName administratorName; + + public ManagedInstanceAdministratorImpl withExistingManagedInstance( + String resourceGroupName, String managedInstanceName) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + return this; + } + + public ManagedInstanceAdministrator create() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceAdministrators() + .createOrUpdate( + resourceGroupName, managedInstanceName, administratorName, this.innerModel(), Context.NONE); + return this; + } + + public ManagedInstanceAdministrator create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceAdministrators() + .createOrUpdate(resourceGroupName, managedInstanceName, administratorName, this.innerModel(), context); + return this; + } + + ManagedInstanceAdministratorImpl( + AdministratorName name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ManagedInstanceAdministratorInner(); + this.serviceManager = serviceManager; + this.administratorName = name; + } + + public ManagedInstanceAdministratorImpl update() { + return this; + } + + public ManagedInstanceAdministrator apply() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceAdministrators() + .createOrUpdate( + resourceGroupName, managedInstanceName, administratorName, this.innerModel(), Context.NONE); + return this; + } + + public ManagedInstanceAdministrator apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceAdministrators() + .createOrUpdate(resourceGroupName, managedInstanceName, administratorName, this.innerModel(), context); + return this; + } + + ManagedInstanceAdministratorImpl( + ManagedInstanceAdministratorInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.managedInstanceName = Utils.getValueFromIdByName(innerObject.id(), "managedInstances"); + this.administratorName = + AdministratorName.fromString(Utils.getValueFromIdByName(innerObject.id(), "administrators")); + } + + public ManagedInstanceAdministrator refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceAdministrators() + .getWithResponse(resourceGroupName, managedInstanceName, administratorName, Context.NONE) + .getValue(); + return this; + } + + public ManagedInstanceAdministrator refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceAdministrators() + .getWithResponse(resourceGroupName, managedInstanceName, administratorName, context) + .getValue(); + return this; + } + + public ManagedInstanceAdministratorImpl withAdministratorType(ManagedInstanceAdministratorType administratorType) { + this.innerModel().withAdministratorType(administratorType); + return this; + } + + public ManagedInstanceAdministratorImpl withLogin(String login) { + this.innerModel().withLogin(login); + return this; + } + + public ManagedInstanceAdministratorImpl withSid(UUID sid) { + this.innerModel().withSid(sid); + return this; + } + + public ManagedInstanceAdministratorImpl withTenantId(UUID tenantId) { + this.innerModel().withTenantId(tenantId); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAdministratorsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAdministratorsClientImpl.java new file mode 100644 index 0000000000000..24947ee991128 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAdministratorsClientImpl.java @@ -0,0 +1,1200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ManagedInstanceAdministratorsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceAdministratorInner; +import com.azure.resourcemanager.sql.generated.models.AdministratorName; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceAdministratorListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ManagedInstanceAdministratorsClient. */ +public final class ManagedInstanceAdministratorsClientImpl implements ManagedInstanceAdministratorsClient { + /** The proxy service used to perform REST calls. */ + private final ManagedInstanceAdministratorsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedInstanceAdministratorsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedInstanceAdministratorsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ManagedInstanceAdministratorsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientManagedInstanceAdministrators to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + public interface ManagedInstanceAdministratorsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/administrators") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInstance( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/administrators/{administratorName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("administratorName") AdministratorName administratorName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/administrators/{administratorName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("administratorName") AdministratorName administratorName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ManagedInstanceAdministratorInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/administrators/{administratorName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("administratorName") AdministratorName administratorName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInstanceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a list of managed instance 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 managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance administrators along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of managed instance 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 managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance administrators along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of managed instance 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 managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance administrators as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync( + String resourceGroupName, String managedInstanceName) { + return new PagedFlux<>( + () -> listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName), + nextLink -> listByInstanceNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of managed instance 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 managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance administrators as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedFlux<>( + () -> listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName, context), + nextLink -> listByInstanceNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of managed instance 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 managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance administrators as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName) { + return new PagedIterable<>(listByInstanceAsync(resourceGroupName, managedInstanceName)); + } + + /** + * Gets a list of managed instance 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 managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance administrators as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedIterable<>(listByInstanceAsync(resourceGroupName, managedInstanceName, context)); + } + + /** + * Gets a managed instance 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 managedInstanceName The name of the managed instance. + * @param administratorName The administratorName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance administrator along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, AdministratorName administratorName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (administratorName == null) { + return Mono + .error(new IllegalArgumentException("Parameter administratorName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + administratorName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a managed instance 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 managedInstanceName The name of the managed instance. + * @param administratorName The administratorName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance administrator along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, AdministratorName administratorName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (administratorName == null) { + return Mono + .error(new IllegalArgumentException("Parameter administratorName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + administratorName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a managed instance 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 managedInstanceName The name of the managed instance. + * @param administratorName The administratorName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance administrator on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String managedInstanceName, AdministratorName administratorName) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, administratorName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a managed instance 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 managedInstanceName The name of the managed instance. + * @param administratorName The administratorName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance administrator along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, AdministratorName administratorName, Context context) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, administratorName, context).block(); + } + + /** + * Gets a managed instance 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 managedInstanceName The name of the managed instance. + * @param administratorName The administratorName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceAdministratorInner get( + String resourceGroupName, String managedInstanceName, AdministratorName administratorName) { + return getWithResponse(resourceGroupName, managedInstanceName, administratorName, Context.NONE).getValue(); + } + + /** + * Creates or updates a managed instance 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 managedInstanceName The name of the managed instance. + * @param administratorName The administratorName parameter. + * @param parameters The requested administrator parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL managed instance administrator along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + AdministratorName administratorName, + ManagedInstanceAdministratorInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (administratorName == null) { + return Mono + .error(new IllegalArgumentException("Parameter administratorName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + administratorName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a managed instance 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 managedInstanceName The name of the managed instance. + * @param administratorName The administratorName parameter. + * @param parameters The requested administrator parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL managed instance administrator along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + AdministratorName administratorName, + ManagedInstanceAdministratorInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (administratorName == null) { + return Mono + .error(new IllegalArgumentException("Parameter administratorName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + administratorName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates a managed instance 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 managedInstanceName The name of the managed instance. + * @param administratorName The administratorName parameter. + * @param parameters The requested administrator parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an Azure SQL managed instance administrator. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ManagedInstanceAdministratorInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + AdministratorName administratorName, + ManagedInstanceAdministratorInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, managedInstanceName, administratorName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedInstanceAdministratorInner.class, + ManagedInstanceAdministratorInner.class, + this.client.getContext()); + } + + /** + * Creates or updates a managed instance 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 managedInstanceName The name of the managed instance. + * @param administratorName The administratorName parameter. + * @param parameters The requested administrator parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an Azure SQL managed instance administrator. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ManagedInstanceAdministratorInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + AdministratorName administratorName, + ManagedInstanceAdministratorInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, managedInstanceName, administratorName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedInstanceAdministratorInner.class, + ManagedInstanceAdministratorInner.class, + context); + } + + /** + * Creates or updates a managed instance 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 managedInstanceName The name of the managed instance. + * @param administratorName The administratorName parameter. + * @param parameters The requested administrator parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL managed instance administrator. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ManagedInstanceAdministratorInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + AdministratorName administratorName, + ManagedInstanceAdministratorInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, administratorName, parameters) + .getSyncPoller(); + } + + /** + * Creates or updates a managed instance 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 managedInstanceName The name of the managed instance. + * @param administratorName The administratorName parameter. + * @param parameters The requested administrator parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL managed instance administrator. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ManagedInstanceAdministratorInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + AdministratorName administratorName, + ManagedInstanceAdministratorInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, administratorName, parameters, context) + .getSyncPoller(); + } + + /** + * Creates or updates a managed instance 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 managedInstanceName The name of the managed instance. + * @param administratorName The administratorName parameter. + * @param parameters The requested administrator parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL managed instance administrator on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + AdministratorName administratorName, + ManagedInstanceAdministratorInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, administratorName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a managed instance 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 managedInstanceName The name of the managed instance. + * @param administratorName The administratorName parameter. + * @param parameters The requested administrator parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL managed instance administrator on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + AdministratorName administratorName, + ManagedInstanceAdministratorInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, administratorName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a managed instance 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 managedInstanceName The name of the managed instance. + * @param administratorName The administratorName parameter. + * @param parameters The requested administrator parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL managed instance administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceAdministratorInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + AdministratorName administratorName, + ManagedInstanceAdministratorInner parameters) { + return createOrUpdateAsync(resourceGroupName, managedInstanceName, administratorName, parameters).block(); + } + + /** + * Creates or updates a managed instance 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 managedInstanceName The name of the managed instance. + * @param administratorName The administratorName parameter. + * @param parameters The requested administrator parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL managed instance administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceAdministratorInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + AdministratorName administratorName, + ManagedInstanceAdministratorInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, managedInstanceName, administratorName, parameters, context) + .block(); + } + + /** + * Deletes a managed instance 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 managedInstanceName The name of the managed instance. + * @param administratorName The administratorName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String managedInstanceName, AdministratorName administratorName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (administratorName == null) { + return Mono + .error(new IllegalArgumentException("Parameter administratorName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + administratorName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a managed instance 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 managedInstanceName The name of the managed instance. + * @param administratorName The administratorName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String managedInstanceName, AdministratorName administratorName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (administratorName == null) { + return Mono + .error(new IllegalArgumentException("Parameter administratorName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + administratorName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes a managed instance 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 managedInstanceName The name of the managed instance. + * @param administratorName The administratorName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String managedInstanceName, AdministratorName administratorName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, managedInstanceName, administratorName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes a managed instance 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 managedInstanceName The name of the managed instance. + * @param administratorName The administratorName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String managedInstanceName, AdministratorName administratorName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, managedInstanceName, administratorName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a managed instance 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 managedInstanceName The name of the managed instance. + * @param administratorName The administratorName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, AdministratorName administratorName) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, administratorName).getSyncPoller(); + } + + /** + * Deletes a managed instance 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 managedInstanceName The name of the managed instance. + * @param administratorName The administratorName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, AdministratorName administratorName, Context context) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, administratorName, context).getSyncPoller(); + } + + /** + * Deletes a managed instance 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 managedInstanceName The name of the managed instance. + * @param administratorName The administratorName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String managedInstanceName, AdministratorName administratorName) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, administratorName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a managed instance 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 managedInstanceName The name of the managed instance. + * @param administratorName The administratorName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String managedInstanceName, AdministratorName administratorName, Context context) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, administratorName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a managed instance 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 managedInstanceName The name of the managed instance. + * @param administratorName The administratorName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String managedInstanceName, AdministratorName administratorName) { + deleteAsync(resourceGroupName, managedInstanceName, administratorName).block(); + } + + /** + * Deletes a managed instance 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 managedInstanceName The name of the managed instance. + * @param administratorName The administratorName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, String managedInstanceName, AdministratorName administratorName, Context context) { + deleteAsync(resourceGroupName, managedInstanceName, administratorName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance administrators along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByInstanceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance administrators along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInstanceNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAdministratorsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAdministratorsImpl.java new file mode 100644 index 0000000000000..fbbd76bfc1962 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAdministratorsImpl.java @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ManagedInstanceAdministratorsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceAdministratorInner; +import com.azure.resourcemanager.sql.generated.models.AdministratorName; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceAdministrator; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceAdministrators; + +public final class ManagedInstanceAdministratorsImpl implements ManagedInstanceAdministrators { + private static final ClientLogger LOGGER = new ClientLogger(ManagedInstanceAdministratorsImpl.class); + + private final ManagedInstanceAdministratorsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedInstanceAdministratorsImpl( + ManagedInstanceAdministratorsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName) { + PagedIterable inner = + this.serviceClient().listByInstance(resourceGroupName, managedInstanceName); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceAdministratorImpl(inner1, this.manager())); + } + + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context) { + PagedIterable inner = + this.serviceClient().listByInstance(resourceGroupName, managedInstanceName, context); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceAdministratorImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, AdministratorName administratorName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, managedInstanceName, administratorName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ManagedInstanceAdministratorImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ManagedInstanceAdministrator get( + String resourceGroupName, String managedInstanceName, AdministratorName administratorName) { + ManagedInstanceAdministratorInner inner = + this.serviceClient().get(resourceGroupName, managedInstanceName, administratorName); + if (inner != null) { + return new ManagedInstanceAdministratorImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String managedInstanceName, AdministratorName administratorName) { + this.serviceClient().delete(resourceGroupName, managedInstanceName, administratorName); + } + + public void delete( + String resourceGroupName, String managedInstanceName, AdministratorName administratorName, Context context) { + this.serviceClient().delete(resourceGroupName, managedInstanceName, administratorName, context); + } + + public ManagedInstanceAdministrator getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String administratorNameLocal = Utils.getValueFromIdByName(id, "administrators"); + if (administratorNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'administrators'.", id))); + } + AdministratorName administratorName = AdministratorName.fromString(administratorNameLocal); + return this.getWithResponse(resourceGroupName, managedInstanceName, administratorName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String administratorNameLocal = Utils.getValueFromIdByName(id, "administrators"); + if (administratorNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'administrators'.", id))); + } + AdministratorName administratorName = AdministratorName.fromString(administratorNameLocal); + return this.getWithResponse(resourceGroupName, managedInstanceName, administratorName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String administratorNameLocal = Utils.getValueFromIdByName(id, "administrators"); + if (administratorNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'administrators'.", id))); + } + AdministratorName administratorName = AdministratorName.fromString(administratorNameLocal); + this.delete(resourceGroupName, managedInstanceName, administratorName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String administratorNameLocal = Utils.getValueFromIdByName(id, "administrators"); + if (administratorNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'administrators'.", id))); + } + AdministratorName administratorName = AdministratorName.fromString(administratorNameLocal); + this.delete(resourceGroupName, managedInstanceName, administratorName, context); + } + + private ManagedInstanceAdministratorsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ManagedInstanceAdministratorImpl define(AdministratorName name) { + return new ManagedInstanceAdministratorImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAdvancedThreatProtectionImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAdvancedThreatProtectionImpl.java new file mode 100644 index 0000000000000..56c5c9f388ec8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAdvancedThreatProtectionImpl.java @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceAdvancedThreatProtectionInner; +import com.azure.resourcemanager.sql.generated.models.AdvancedThreatProtectionName; +import com.azure.resourcemanager.sql.generated.models.AdvancedThreatProtectionState; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceAdvancedThreatProtection; +import java.time.OffsetDateTime; + +public final class ManagedInstanceAdvancedThreatProtectionImpl + implements ManagedInstanceAdvancedThreatProtection, + ManagedInstanceAdvancedThreatProtection.Definition, + ManagedInstanceAdvancedThreatProtection.Update { + private ManagedInstanceAdvancedThreatProtectionInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public AdvancedThreatProtectionState state() { + return this.innerModel().state(); + } + + public OffsetDateTime creationTime() { + return this.innerModel().creationTime(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ManagedInstanceAdvancedThreatProtectionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String managedInstanceName; + + private AdvancedThreatProtectionName advancedThreatProtectionName; + + public ManagedInstanceAdvancedThreatProtectionImpl withExistingManagedInstance( + String resourceGroupName, String managedInstanceName) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + return this; + } + + public ManagedInstanceAdvancedThreatProtection create() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceAdvancedThreatProtectionSettings() + .createOrUpdate( + resourceGroupName, + managedInstanceName, + advancedThreatProtectionName, + this.innerModel(), + Context.NONE); + return this; + } + + public ManagedInstanceAdvancedThreatProtection create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceAdvancedThreatProtectionSettings() + .createOrUpdate( + resourceGroupName, managedInstanceName, advancedThreatProtectionName, this.innerModel(), context); + return this; + } + + ManagedInstanceAdvancedThreatProtectionImpl( + AdvancedThreatProtectionName name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ManagedInstanceAdvancedThreatProtectionInner(); + this.serviceManager = serviceManager; + this.advancedThreatProtectionName = name; + } + + public ManagedInstanceAdvancedThreatProtectionImpl update() { + return this; + } + + public ManagedInstanceAdvancedThreatProtection apply() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceAdvancedThreatProtectionSettings() + .createOrUpdate( + resourceGroupName, + managedInstanceName, + advancedThreatProtectionName, + this.innerModel(), + Context.NONE); + return this; + } + + public ManagedInstanceAdvancedThreatProtection apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceAdvancedThreatProtectionSettings() + .createOrUpdate( + resourceGroupName, managedInstanceName, advancedThreatProtectionName, this.innerModel(), context); + return this; + } + + ManagedInstanceAdvancedThreatProtectionImpl( + ManagedInstanceAdvancedThreatProtectionInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.managedInstanceName = Utils.getValueFromIdByName(innerObject.id(), "managedInstances"); + this.advancedThreatProtectionName = + AdvancedThreatProtectionName + .fromString(Utils.getValueFromIdByName(innerObject.id(), "advancedThreatProtectionSettings")); + } + + public ManagedInstanceAdvancedThreatProtection refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceAdvancedThreatProtectionSettings() + .getWithResponse(resourceGroupName, managedInstanceName, advancedThreatProtectionName, Context.NONE) + .getValue(); + return this; + } + + public ManagedInstanceAdvancedThreatProtection refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceAdvancedThreatProtectionSettings() + .getWithResponse(resourceGroupName, managedInstanceName, advancedThreatProtectionName, context) + .getValue(); + return this; + } + + public ManagedInstanceAdvancedThreatProtectionImpl withState(AdvancedThreatProtectionState state) { + this.innerModel().withState(state); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAdvancedThreatProtectionSettingsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAdvancedThreatProtectionSettingsClientImpl.java new file mode 100644 index 0000000000000..9863de4a258f2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAdvancedThreatProtectionSettingsClientImpl.java @@ -0,0 +1,961 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ManagedInstanceAdvancedThreatProtectionSettingsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceAdvancedThreatProtectionInner; +import com.azure.resourcemanager.sql.generated.models.AdvancedThreatProtectionName; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceAdvancedThreatProtectionListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * ManagedInstanceAdvancedThreatProtectionSettingsClient. + */ +public final class ManagedInstanceAdvancedThreatProtectionSettingsClientImpl + implements ManagedInstanceAdvancedThreatProtectionSettingsClient { + /** The proxy service used to perform REST calls. */ + private final ManagedInstanceAdvancedThreatProtectionSettingsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedInstanceAdvancedThreatProtectionSettingsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedInstanceAdvancedThreatProtectionSettingsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ManagedInstanceAdvancedThreatProtectionSettingsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientManagedInstanceAdvancedThreatProtectionSettings to + * be used by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + public interface ManagedInstanceAdvancedThreatProtectionSettingsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/advancedThreatProtectionSettings") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInstance( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/advancedThreatProtectionSettings" + + "/{advancedThreatProtectionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("advancedThreatProtectionName") AdvancedThreatProtectionName advancedThreatProtectionName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/advancedThreatProtectionSettings" + + "/{advancedThreatProtectionName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("advancedThreatProtectionName") AdvancedThreatProtectionName advancedThreatProtectionName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ManagedInstanceAdvancedThreatProtectionInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInstanceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get the managed instance's Advanced Threat Protection settings. + * + * @param resourceGroupName The name of the resource group that contains 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed instance's Advanced Threat Protection settings along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the managed instance's Advanced Threat Protection settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed instance's Advanced Threat Protection settings along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the managed instance's Advanced Threat Protection settings. + * + * @param resourceGroupName The name of the resource group that contains 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed instance's Advanced Threat Protection settings as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync( + String resourceGroupName, String managedInstanceName) { + return new PagedFlux<>( + () -> listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName), + nextLink -> listByInstanceNextSinglePageAsync(nextLink)); + } + + /** + * Get the managed instance's Advanced Threat Protection settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed instance's Advanced Threat Protection settings as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedFlux<>( + () -> listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName, context), + nextLink -> listByInstanceNextSinglePageAsync(nextLink, context)); + } + + /** + * Get the managed instance's Advanced Threat Protection settings. + * + * @param resourceGroupName The name of the resource group that contains 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed instance's Advanced Threat Protection settings as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName) { + return new PagedIterable<>(listByInstanceAsync(resourceGroupName, managedInstanceName)); + } + + /** + * Get the managed instance's Advanced Threat Protection settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed instance's Advanced Threat Protection settings as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedIterable<>(listByInstanceAsync(resourceGroupName, managedInstanceName, context)); + } + + /** + * Get a managed instance's Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance's Advanced Threat Protection state along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + AdvancedThreatProtectionName advancedThreatProtectionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (advancedThreatProtectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter advancedThreatProtectionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + advancedThreatProtectionName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a managed instance's Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance's Advanced Threat Protection state along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + AdvancedThreatProtectionName advancedThreatProtectionName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (advancedThreatProtectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter advancedThreatProtectionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + advancedThreatProtectionName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Get a managed instance's Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance's Advanced Threat Protection state on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String managedInstanceName, + AdvancedThreatProtectionName advancedThreatProtectionName) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, advancedThreatProtectionName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a managed instance's Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance's Advanced Threat Protection state along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + AdvancedThreatProtectionName advancedThreatProtectionName, + Context context) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, advancedThreatProtectionName, context) + .block(); + } + + /** + * Get a managed instance's Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance's Advanced Threat Protection state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceAdvancedThreatProtectionInner get( + String resourceGroupName, + String managedInstanceName, + AdvancedThreatProtectionName advancedThreatProtectionName) { + return getWithResponse(resourceGroupName, managedInstanceName, advancedThreatProtectionName, Context.NONE) + .getValue(); + } + + /** + * Creates or updates Advanced Threat Protection settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @param parameters The managed instance Advanced Threat Protection state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance Advanced Threat Protection along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + AdvancedThreatProtectionName advancedThreatProtectionName, + ManagedInstanceAdvancedThreatProtectionInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (advancedThreatProtectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter advancedThreatProtectionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + advancedThreatProtectionName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates Advanced Threat Protection settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @param parameters The managed instance Advanced Threat Protection state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance Advanced Threat Protection along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + AdvancedThreatProtectionName advancedThreatProtectionName, + ManagedInstanceAdvancedThreatProtectionInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (advancedThreatProtectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter advancedThreatProtectionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + advancedThreatProtectionName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates Advanced Threat Protection settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @param parameters The managed instance Advanced Threat Protection state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a managed instance Advanced Threat Protection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux< + PollResult, ManagedInstanceAdvancedThreatProtectionInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + AdvancedThreatProtectionName advancedThreatProtectionName, + ManagedInstanceAdvancedThreatProtectionInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, managedInstanceName, advancedThreatProtectionName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedInstanceAdvancedThreatProtectionInner.class, + ManagedInstanceAdvancedThreatProtectionInner.class, + this.client.getContext()); + } + + /** + * Creates or updates Advanced Threat Protection settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @param parameters The managed instance Advanced Threat Protection state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a managed instance Advanced Threat Protection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux< + PollResult, ManagedInstanceAdvancedThreatProtectionInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + AdvancedThreatProtectionName advancedThreatProtectionName, + ManagedInstanceAdvancedThreatProtectionInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, managedInstanceName, advancedThreatProtectionName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedInstanceAdvancedThreatProtectionInner.class, + ManagedInstanceAdvancedThreatProtectionInner.class, + context); + } + + /** + * Creates or updates Advanced Threat Protection settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @param parameters The managed instance Advanced Threat Protection state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a managed instance Advanced Threat Protection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller< + PollResult, ManagedInstanceAdvancedThreatProtectionInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + AdvancedThreatProtectionName advancedThreatProtectionName, + ManagedInstanceAdvancedThreatProtectionInner parameters) { + return beginCreateOrUpdateAsync( + resourceGroupName, managedInstanceName, advancedThreatProtectionName, parameters) + .getSyncPoller(); + } + + /** + * Creates or updates Advanced Threat Protection settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @param parameters The managed instance Advanced Threat Protection state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a managed instance Advanced Threat Protection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller< + PollResult, ManagedInstanceAdvancedThreatProtectionInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + AdvancedThreatProtectionName advancedThreatProtectionName, + ManagedInstanceAdvancedThreatProtectionInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, managedInstanceName, advancedThreatProtectionName, parameters, context) + .getSyncPoller(); + } + + /** + * Creates or updates Advanced Threat Protection settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @param parameters The managed instance Advanced Threat Protection state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance Advanced Threat Protection on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + AdvancedThreatProtectionName advancedThreatProtectionName, + ManagedInstanceAdvancedThreatProtectionInner parameters) { + return beginCreateOrUpdateAsync( + resourceGroupName, managedInstanceName, advancedThreatProtectionName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates Advanced Threat Protection settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @param parameters The managed instance Advanced Threat Protection state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance Advanced Threat Protection on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + AdvancedThreatProtectionName advancedThreatProtectionName, + ManagedInstanceAdvancedThreatProtectionInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, managedInstanceName, advancedThreatProtectionName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates Advanced Threat Protection settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @param parameters The managed instance Advanced Threat Protection state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance Advanced Threat Protection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceAdvancedThreatProtectionInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + AdvancedThreatProtectionName advancedThreatProtectionName, + ManagedInstanceAdvancedThreatProtectionInner parameters) { + return createOrUpdateAsync(resourceGroupName, managedInstanceName, advancedThreatProtectionName, parameters) + .block(); + } + + /** + * Creates or updates Advanced Threat Protection settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @param parameters The managed instance Advanced Threat Protection state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance Advanced Threat Protection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceAdvancedThreatProtectionInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + AdvancedThreatProtectionName advancedThreatProtectionName, + ManagedInstanceAdvancedThreatProtectionInner parameters, + Context context) { + return createOrUpdateAsync( + resourceGroupName, managedInstanceName, advancedThreatProtectionName, parameters, context) + .block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the managed instance's Advanced Threat Protection settings along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByInstanceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the managed instance's Advanced Threat Protection settings along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInstanceNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAdvancedThreatProtectionSettingsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAdvancedThreatProtectionSettingsImpl.java new file mode 100644 index 0000000000000..c5d99dae1278f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAdvancedThreatProtectionSettingsImpl.java @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ManagedInstanceAdvancedThreatProtectionSettingsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceAdvancedThreatProtectionInner; +import com.azure.resourcemanager.sql.generated.models.AdvancedThreatProtectionName; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceAdvancedThreatProtection; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceAdvancedThreatProtectionSettings; + +public final class ManagedInstanceAdvancedThreatProtectionSettingsImpl + implements ManagedInstanceAdvancedThreatProtectionSettings { + private static final ClientLogger LOGGER = + new ClientLogger(ManagedInstanceAdvancedThreatProtectionSettingsImpl.class); + + private final ManagedInstanceAdvancedThreatProtectionSettingsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedInstanceAdvancedThreatProtectionSettingsImpl( + ManagedInstanceAdvancedThreatProtectionSettingsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName) { + PagedIterable inner = + this.serviceClient().listByInstance(resourceGroupName, managedInstanceName); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceAdvancedThreatProtectionImpl(inner1, this.manager())); + } + + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context) { + PagedIterable inner = + this.serviceClient().listByInstance(resourceGroupName, managedInstanceName, context); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceAdvancedThreatProtectionImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + AdvancedThreatProtectionName advancedThreatProtectionName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, managedInstanceName, advancedThreatProtectionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ManagedInstanceAdvancedThreatProtectionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ManagedInstanceAdvancedThreatProtection get( + String resourceGroupName, + String managedInstanceName, + AdvancedThreatProtectionName advancedThreatProtectionName) { + ManagedInstanceAdvancedThreatProtectionInner inner = + this.serviceClient().get(resourceGroupName, managedInstanceName, advancedThreatProtectionName); + if (inner != null) { + return new ManagedInstanceAdvancedThreatProtectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public ManagedInstanceAdvancedThreatProtection getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String advancedThreatProtectionNameLocal = Utils.getValueFromIdByName(id, "advancedThreatProtectionSettings"); + if (advancedThreatProtectionNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment" + + " 'advancedThreatProtectionSettings'.", + id))); + } + AdvancedThreatProtectionName advancedThreatProtectionName = + AdvancedThreatProtectionName.fromString(advancedThreatProtectionNameLocal); + return this + .getWithResponse(resourceGroupName, managedInstanceName, advancedThreatProtectionName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String advancedThreatProtectionNameLocal = Utils.getValueFromIdByName(id, "advancedThreatProtectionSettings"); + if (advancedThreatProtectionNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment" + + " 'advancedThreatProtectionSettings'.", + id))); + } + AdvancedThreatProtectionName advancedThreatProtectionName = + AdvancedThreatProtectionName.fromString(advancedThreatProtectionNameLocal); + return this.getWithResponse(resourceGroupName, managedInstanceName, advancedThreatProtectionName, context); + } + + private ManagedInstanceAdvancedThreatProtectionSettingsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ManagedInstanceAdvancedThreatProtectionImpl define(AdvancedThreatProtectionName name) { + return new ManagedInstanceAdvancedThreatProtectionImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAzureADOnlyAuthenticationImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAzureADOnlyAuthenticationImpl.java new file mode 100644 index 0000000000000..8f68bdf1979ee --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAzureADOnlyAuthenticationImpl.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceAzureADOnlyAuthenticationInner; +import com.azure.resourcemanager.sql.generated.models.AuthenticationName; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceAzureADOnlyAuthentication; + +public final class ManagedInstanceAzureADOnlyAuthenticationImpl + implements ManagedInstanceAzureADOnlyAuthentication, + ManagedInstanceAzureADOnlyAuthentication.Definition, + ManagedInstanceAzureADOnlyAuthentication.Update { + private ManagedInstanceAzureADOnlyAuthenticationInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public boolean azureADOnlyAuthentication() { + return this.innerModel().azureADOnlyAuthentication(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ManagedInstanceAzureADOnlyAuthenticationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String managedInstanceName; + + private AuthenticationName authenticationName; + + public ManagedInstanceAzureADOnlyAuthenticationImpl withExistingManagedInstance( + String resourceGroupName, String managedInstanceName) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + return this; + } + + public ManagedInstanceAzureADOnlyAuthentication create() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceAzureADOnlyAuthentications() + .createOrUpdate( + resourceGroupName, managedInstanceName, authenticationName, this.innerModel(), Context.NONE); + return this; + } + + public ManagedInstanceAzureADOnlyAuthentication create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceAzureADOnlyAuthentications() + .createOrUpdate(resourceGroupName, managedInstanceName, authenticationName, this.innerModel(), context); + return this; + } + + ManagedInstanceAzureADOnlyAuthenticationImpl( + AuthenticationName name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ManagedInstanceAzureADOnlyAuthenticationInner(); + this.serviceManager = serviceManager; + this.authenticationName = name; + } + + public ManagedInstanceAzureADOnlyAuthenticationImpl update() { + return this; + } + + public ManagedInstanceAzureADOnlyAuthentication apply() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceAzureADOnlyAuthentications() + .createOrUpdate( + resourceGroupName, managedInstanceName, authenticationName, this.innerModel(), Context.NONE); + return this; + } + + public ManagedInstanceAzureADOnlyAuthentication apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceAzureADOnlyAuthentications() + .createOrUpdate(resourceGroupName, managedInstanceName, authenticationName, this.innerModel(), context); + return this; + } + + ManagedInstanceAzureADOnlyAuthenticationImpl( + ManagedInstanceAzureADOnlyAuthenticationInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.managedInstanceName = Utils.getValueFromIdByName(innerObject.id(), "managedInstances"); + this.authenticationName = + AuthenticationName.fromString(Utils.getValueFromIdByName(innerObject.id(), "azureADOnlyAuthentications")); + } + + public ManagedInstanceAzureADOnlyAuthentication refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceAzureADOnlyAuthentications() + .getWithResponse(resourceGroupName, managedInstanceName, authenticationName, Context.NONE) + .getValue(); + return this; + } + + public ManagedInstanceAzureADOnlyAuthentication refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceAzureADOnlyAuthentications() + .getWithResponse(resourceGroupName, managedInstanceName, authenticationName, context) + .getValue(); + return this; + } + + public ManagedInstanceAzureADOnlyAuthenticationImpl withAzureADOnlyAuthentication( + boolean azureADOnlyAuthentication) { + this.innerModel().withAzureADOnlyAuthentication(azureADOnlyAuthentication); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAzureADOnlyAuthenticationsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAzureADOnlyAuthenticationsClientImpl.java new file mode 100644 index 0000000000000..7cb3904ae0ae4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAzureADOnlyAuthenticationsClientImpl.java @@ -0,0 +1,1235 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ManagedInstanceAzureADOnlyAuthenticationsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceAzureADOnlyAuthenticationInner; +import com.azure.resourcemanager.sql.generated.models.AuthenticationName; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceAzureADOnlyAuthListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * ManagedInstanceAzureADOnlyAuthenticationsClient. + */ +public final class ManagedInstanceAzureADOnlyAuthenticationsClientImpl + implements ManagedInstanceAzureADOnlyAuthenticationsClient { + /** The proxy service used to perform REST calls. */ + private final ManagedInstanceAzureADOnlyAuthenticationsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedInstanceAzureADOnlyAuthenticationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedInstanceAzureADOnlyAuthenticationsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ManagedInstanceAzureADOnlyAuthenticationsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientManagedInstanceAzureADOnlyAuthentications to be + * used by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + public interface ManagedInstanceAzureADOnlyAuthenticationsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/azureADOnlyAuthentications/{authenticationName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("authenticationName") AuthenticationName authenticationName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/azureADOnlyAuthentications/{authenticationName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("authenticationName") AuthenticationName authenticationName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ManagedInstanceAzureADOnlyAuthenticationInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/azureADOnlyAuthentications/{authenticationName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("authenticationName") AuthenticationName authenticationName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/azureADOnlyAuthentications") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInstance( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInstanceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a specific Azure Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific Azure Active Directory only authentication property along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, AuthenticationName authenticationName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (authenticationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter authenticationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + authenticationName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a specific Azure Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific Azure Active Directory only authentication property along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, AuthenticationName authenticationName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (authenticationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter authenticationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + authenticationName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a specific Azure Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific Azure Active Directory only authentication property on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String managedInstanceName, AuthenticationName authenticationName) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, authenticationName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a specific Azure Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific Azure Active Directory only authentication property along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, AuthenticationName authenticationName, Context context) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, authenticationName, context).block(); + } + + /** + * Gets a specific Azure Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific Azure Active Directory only authentication property. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceAzureADOnlyAuthenticationInner get( + String resourceGroupName, String managedInstanceName, AuthenticationName authenticationName) { + return getWithResponse(resourceGroupName, managedInstanceName, authenticationName, Context.NONE).getValue(); + } + + /** + * Sets Server Active Directory only authentication property or updates an existing server Active Directory only + * authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @param parameters The required parameters for creating or updating an Active Directory only authentication + * property. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure Active Directory only authentication along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + AuthenticationName authenticationName, + ManagedInstanceAzureADOnlyAuthenticationInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (authenticationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter authenticationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + authenticationName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Sets Server Active Directory only authentication property or updates an existing server Active Directory only + * authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @param parameters The required parameters for creating or updating an Active Directory only authentication + * property. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure Active Directory only authentication along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + AuthenticationName authenticationName, + ManagedInstanceAzureADOnlyAuthenticationInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (authenticationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter authenticationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + authenticationName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Sets Server Active Directory only authentication property or updates an existing server Active Directory only + * authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @param parameters The required parameters for creating or updating an Active Directory only authentication + * property. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux< + PollResult, ManagedInstanceAzureADOnlyAuthenticationInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + AuthenticationName authenticationName, + ManagedInstanceAzureADOnlyAuthenticationInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, managedInstanceName, authenticationName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedInstanceAzureADOnlyAuthenticationInner.class, + ManagedInstanceAzureADOnlyAuthenticationInner.class, + this.client.getContext()); + } + + /** + * Sets Server Active Directory only authentication property or updates an existing server Active Directory only + * authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @param parameters The required parameters for creating or updating an Active Directory only authentication + * property. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux< + PollResult, ManagedInstanceAzureADOnlyAuthenticationInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + AuthenticationName authenticationName, + ManagedInstanceAzureADOnlyAuthenticationInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, managedInstanceName, authenticationName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedInstanceAzureADOnlyAuthenticationInner.class, + ManagedInstanceAzureADOnlyAuthenticationInner.class, + context); + } + + /** + * Sets Server Active Directory only authentication property or updates an existing server Active Directory only + * authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @param parameters The required parameters for creating or updating an Active Directory only authentication + * property. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller< + PollResult, ManagedInstanceAzureADOnlyAuthenticationInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + AuthenticationName authenticationName, + ManagedInstanceAzureADOnlyAuthenticationInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, authenticationName, parameters) + .getSyncPoller(); + } + + /** + * Sets Server Active Directory only authentication property or updates an existing server Active Directory only + * authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @param parameters The required parameters for creating or updating an Active Directory only authentication + * property. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller< + PollResult, ManagedInstanceAzureADOnlyAuthenticationInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + AuthenticationName authenticationName, + ManagedInstanceAzureADOnlyAuthenticationInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, authenticationName, parameters, context) + .getSyncPoller(); + } + + /** + * Sets Server Active Directory only authentication property or updates an existing server Active Directory only + * authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @param parameters The required parameters for creating or updating an Active Directory only authentication + * property. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure Active Directory only authentication on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + AuthenticationName authenticationName, + ManagedInstanceAzureADOnlyAuthenticationInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, authenticationName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Sets Server Active Directory only authentication property or updates an existing server Active Directory only + * authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @param parameters The required parameters for creating or updating an Active Directory only authentication + * property. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure Active Directory only authentication on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + AuthenticationName authenticationName, + ManagedInstanceAzureADOnlyAuthenticationInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, authenticationName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Sets Server Active Directory only authentication property or updates an existing server Active Directory only + * authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @param parameters The required parameters for creating or updating an Active Directory only authentication + * property. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceAzureADOnlyAuthenticationInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + AuthenticationName authenticationName, + ManagedInstanceAzureADOnlyAuthenticationInner parameters) { + return createOrUpdateAsync(resourceGroupName, managedInstanceName, authenticationName, parameters).block(); + } + + /** + * Sets Server Active Directory only authentication property or updates an existing server Active Directory only + * authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @param parameters The required parameters for creating or updating an Active Directory only authentication + * property. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceAzureADOnlyAuthenticationInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + AuthenticationName authenticationName, + ManagedInstanceAzureADOnlyAuthenticationInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, managedInstanceName, authenticationName, parameters, context) + .block(); + } + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String managedInstanceName, AuthenticationName authenticationName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (authenticationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter authenticationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + authenticationName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String managedInstanceName, AuthenticationName authenticationName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (authenticationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter authenticationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + authenticationName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String managedInstanceName, AuthenticationName authenticationName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, managedInstanceName, authenticationName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String managedInstanceName, AuthenticationName authenticationName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, managedInstanceName, authenticationName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, AuthenticationName authenticationName) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, authenticationName).getSyncPoller(); + } + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, AuthenticationName authenticationName, Context context) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, authenticationName, context).getSyncPoller(); + } + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String managedInstanceName, AuthenticationName authenticationName) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, authenticationName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String managedInstanceName, AuthenticationName authenticationName, Context context) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, authenticationName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String managedInstanceName, AuthenticationName authenticationName) { + deleteAsync(resourceGroupName, managedInstanceName, authenticationName).block(); + } + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, String managedInstanceName, AuthenticationName authenticationName, Context context) { + deleteAsync(resourceGroupName, managedInstanceName, authenticationName, context).block(); + } + + /** + * Gets a list of server Azure Active Directory only authentications. + * + * @param resourceGroupName The name of the resource group that contains 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server Azure Active Directory only authentications along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of server Azure Active Directory only authentications. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server Azure Active Directory only authentications along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of server Azure Active Directory only authentications. + * + * @param resourceGroupName The name of the resource group that contains 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server Azure Active Directory only authentications as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync( + String resourceGroupName, String managedInstanceName) { + return new PagedFlux<>( + () -> listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName), + nextLink -> listByInstanceNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of server Azure Active Directory only authentications. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server Azure Active Directory only authentications as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedFlux<>( + () -> listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName, context), + nextLink -> listByInstanceNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of server Azure Active Directory only authentications. + * + * @param resourceGroupName The name of the resource group that contains 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server Azure Active Directory only authentications as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName) { + return new PagedIterable<>(listByInstanceAsync(resourceGroupName, managedInstanceName)); + } + + /** + * Gets a list of server Azure Active Directory only authentications. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server Azure Active Directory only authentications as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedIterable<>(listByInstanceAsync(resourceGroupName, managedInstanceName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of active directory only authentications along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByInstanceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of active directory only authentications along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInstanceNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAzureADOnlyAuthenticationsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAzureADOnlyAuthenticationsImpl.java new file mode 100644 index 0000000000000..17665258acb48 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceAzureADOnlyAuthenticationsImpl.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ManagedInstanceAzureADOnlyAuthenticationsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceAzureADOnlyAuthenticationInner; +import com.azure.resourcemanager.sql.generated.models.AuthenticationName; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceAzureADOnlyAuthentication; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceAzureADOnlyAuthentications; + +public final class ManagedInstanceAzureADOnlyAuthenticationsImpl implements ManagedInstanceAzureADOnlyAuthentications { + private static final ClientLogger LOGGER = new ClientLogger(ManagedInstanceAzureADOnlyAuthenticationsImpl.class); + + private final ManagedInstanceAzureADOnlyAuthenticationsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedInstanceAzureADOnlyAuthenticationsImpl( + ManagedInstanceAzureADOnlyAuthenticationsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, AuthenticationName authenticationName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, managedInstanceName, authenticationName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ManagedInstanceAzureADOnlyAuthenticationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ManagedInstanceAzureADOnlyAuthentication get( + String resourceGroupName, String managedInstanceName, AuthenticationName authenticationName) { + ManagedInstanceAzureADOnlyAuthenticationInner inner = + this.serviceClient().get(resourceGroupName, managedInstanceName, authenticationName); + if (inner != null) { + return new ManagedInstanceAzureADOnlyAuthenticationImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String managedInstanceName, AuthenticationName authenticationName) { + this.serviceClient().delete(resourceGroupName, managedInstanceName, authenticationName); + } + + public void delete( + String resourceGroupName, String managedInstanceName, AuthenticationName authenticationName, Context context) { + this.serviceClient().delete(resourceGroupName, managedInstanceName, authenticationName, context); + } + + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName) { + PagedIterable inner = + this.serviceClient().listByInstance(resourceGroupName, managedInstanceName); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceAzureADOnlyAuthenticationImpl(inner1, this.manager())); + } + + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context) { + PagedIterable inner = + this.serviceClient().listByInstance(resourceGroupName, managedInstanceName, context); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceAzureADOnlyAuthenticationImpl(inner1, this.manager())); + } + + public ManagedInstanceAzureADOnlyAuthentication getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String authenticationNameLocal = Utils.getValueFromIdByName(id, "azureADOnlyAuthentications"); + if (authenticationNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'azureADOnlyAuthentications'.", + id))); + } + AuthenticationName authenticationName = AuthenticationName.fromString(authenticationNameLocal); + return this + .getWithResponse(resourceGroupName, managedInstanceName, authenticationName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String authenticationNameLocal = Utils.getValueFromIdByName(id, "azureADOnlyAuthentications"); + if (authenticationNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'azureADOnlyAuthentications'.", + id))); + } + AuthenticationName authenticationName = AuthenticationName.fromString(authenticationNameLocal); + return this.getWithResponse(resourceGroupName, managedInstanceName, authenticationName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String authenticationNameLocal = Utils.getValueFromIdByName(id, "azureADOnlyAuthentications"); + if (authenticationNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'azureADOnlyAuthentications'.", + id))); + } + AuthenticationName authenticationName = AuthenticationName.fromString(authenticationNameLocal); + this.delete(resourceGroupName, managedInstanceName, authenticationName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String authenticationNameLocal = Utils.getValueFromIdByName(id, "azureADOnlyAuthentications"); + if (authenticationNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'azureADOnlyAuthentications'.", + id))); + } + AuthenticationName authenticationName = AuthenticationName.fromString(authenticationNameLocal); + this.delete(resourceGroupName, managedInstanceName, authenticationName, context); + } + + private ManagedInstanceAzureADOnlyAuthenticationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ManagedInstanceAzureADOnlyAuthenticationImpl define(AuthenticationName name) { + return new ManagedInstanceAzureADOnlyAuthenticationImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceDtcImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceDtcImpl.java new file mode 100644 index 0000000000000..ba5761c115b91 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceDtcImpl.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceDtcInner; +import com.azure.resourcemanager.sql.generated.models.DtcName; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceDtc; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceDtcSecuritySettings; +import com.azure.resourcemanager.sql.generated.models.ProvisioningState; +import java.util.Collections; +import java.util.List; + +public final class ManagedInstanceDtcImpl + implements ManagedInstanceDtc, ManagedInstanceDtc.Definition, ManagedInstanceDtc.Update { + private ManagedInstanceDtcInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public Boolean dtcEnabled() { + return this.innerModel().dtcEnabled(); + } + + public ManagedInstanceDtcSecuritySettings securitySettings() { + return this.innerModel().securitySettings(); + } + + public List externalDnsSuffixSearchList() { + List inner = this.innerModel().externalDnsSuffixSearchList(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String dtcHostnameDnsSuffix() { + return this.innerModel().dtcHostnameDnsSuffix(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ManagedInstanceDtcInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String managedInstanceName; + + private DtcName dtcName; + + public ManagedInstanceDtcImpl withExistingManagedInstance(String resourceGroupName, String managedInstanceName) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + return this; + } + + public ManagedInstanceDtc create() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceDtcs() + .createOrUpdate(resourceGroupName, managedInstanceName, dtcName, this.innerModel(), Context.NONE); + return this; + } + + public ManagedInstanceDtc create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceDtcs() + .createOrUpdate(resourceGroupName, managedInstanceName, dtcName, this.innerModel(), context); + return this; + } + + ManagedInstanceDtcImpl(DtcName name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ManagedInstanceDtcInner(); + this.serviceManager = serviceManager; + this.dtcName = name; + } + + public ManagedInstanceDtcImpl update() { + return this; + } + + public ManagedInstanceDtc apply() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceDtcs() + .createOrUpdate(resourceGroupName, managedInstanceName, dtcName, this.innerModel(), Context.NONE); + return this; + } + + public ManagedInstanceDtc apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceDtcs() + .createOrUpdate(resourceGroupName, managedInstanceName, dtcName, this.innerModel(), context); + return this; + } + + ManagedInstanceDtcImpl( + ManagedInstanceDtcInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.managedInstanceName = Utils.getValueFromIdByName(innerObject.id(), "managedInstances"); + this.dtcName = DtcName.fromString(Utils.getValueFromIdByName(innerObject.id(), "dtc")); + } + + public ManagedInstanceDtc refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceDtcs() + .getWithResponse(resourceGroupName, managedInstanceName, dtcName, Context.NONE) + .getValue(); + return this; + } + + public ManagedInstanceDtc refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceDtcs() + .getWithResponse(resourceGroupName, managedInstanceName, dtcName, context) + .getValue(); + return this; + } + + public ManagedInstanceDtcImpl withDtcEnabled(Boolean dtcEnabled) { + this.innerModel().withDtcEnabled(dtcEnabled); + return this; + } + + public ManagedInstanceDtcImpl withSecuritySettings(ManagedInstanceDtcSecuritySettings securitySettings) { + this.innerModel().withSecuritySettings(securitySettings); + return this; + } + + public ManagedInstanceDtcImpl withExternalDnsSuffixSearchList(List externalDnsSuffixSearchList) { + this.innerModel().withExternalDnsSuffixSearchList(externalDnsSuffixSearchList); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceDtcsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceDtcsClientImpl.java new file mode 100644 index 0000000000000..ecfde381196b5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceDtcsClientImpl.java @@ -0,0 +1,885 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ManagedInstanceDtcsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceDtcInner; +import com.azure.resourcemanager.sql.generated.models.DtcName; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceDtcListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ManagedInstanceDtcsClient. */ +public final class ManagedInstanceDtcsClientImpl implements ManagedInstanceDtcsClient { + /** The proxy service used to perform REST calls. */ + private final ManagedInstanceDtcsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedInstanceDtcsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedInstanceDtcsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(ManagedInstanceDtcsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientManagedInstanceDtcs to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + public interface ManagedInstanceDtcsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/dtc") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByManagedInstance( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/dtc/{dtcName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("dtcName") DtcName dtcName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/dtc/{dtcName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("dtcName") DtcName dtcName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ManagedInstanceDtcInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByManagedInstanceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a list of managed instance DTC settings. + * + * @param resourceGroupName The name of the resource group that contains 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance DTC settings along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByManagedInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByManagedInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of managed instance DTC settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance DTC settings along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByManagedInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByManagedInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of managed instance DTC settings. + * + * @param resourceGroupName The name of the resource group that contains 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance DTC settings as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByManagedInstanceAsync( + String resourceGroupName, String managedInstanceName) { + return new PagedFlux<>( + () -> listByManagedInstanceSinglePageAsync(resourceGroupName, managedInstanceName), + nextLink -> listByManagedInstanceNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of managed instance DTC settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance DTC settings as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByManagedInstanceAsync( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedFlux<>( + () -> listByManagedInstanceSinglePageAsync(resourceGroupName, managedInstanceName, context), + nextLink -> listByManagedInstanceNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of managed instance DTC settings. + * + * @param resourceGroupName The name of the resource group that contains 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance DTC settings as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByManagedInstance( + String resourceGroupName, String managedInstanceName) { + return new PagedIterable<>(listByManagedInstanceAsync(resourceGroupName, managedInstanceName)); + } + + /** + * Gets a list of managed instance DTC settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance DTC settings as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByManagedInstance( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedIterable<>(listByManagedInstanceAsync(resourceGroupName, managedInstanceName, context)); + } + + /** + * Gets managed instance DTC settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param dtcName The name of the managed instance DTC. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return managed instance DTC settings along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, DtcName dtcName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (dtcName == null) { + return Mono.error(new IllegalArgumentException("Parameter dtcName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + dtcName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets managed instance DTC settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param dtcName The name of the managed instance DTC. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return managed instance DTC settings along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, DtcName dtcName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (dtcName == null) { + return Mono.error(new IllegalArgumentException("Parameter dtcName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + dtcName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets managed instance DTC settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param dtcName The name of the managed instance DTC. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return managed instance DTC settings on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String managedInstanceName, DtcName dtcName) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, dtcName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets managed instance DTC settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param dtcName The name of the managed instance DTC. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return managed instance DTC settings along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, DtcName dtcName, Context context) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, dtcName, context).block(); + } + + /** + * Gets managed instance DTC settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param dtcName The name of the managed instance DTC. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return managed instance DTC settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceDtcInner get(String resourceGroupName, String managedInstanceName, DtcName dtcName) { + return getWithResponse(resourceGroupName, managedInstanceName, dtcName, Context.NONE).getValue(); + } + + /** + * Updates managed instance DTC settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param dtcName The name of the managed instance DTC. + * @param parameters Managed instance DTC settings. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return sQL Managed Instance DTC along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String managedInstanceName, DtcName dtcName, ManagedInstanceDtcInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (dtcName == null) { + return Mono.error(new IllegalArgumentException("Parameter dtcName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2022-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + dtcName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates managed instance DTC settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param dtcName The name of the managed instance DTC. + * @param parameters Managed instance DTC settings. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return sQL Managed Instance DTC along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + DtcName dtcName, + ManagedInstanceDtcInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (dtcName == null) { + return Mono.error(new IllegalArgumentException("Parameter dtcName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2022-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + dtcName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Updates managed instance DTC settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param dtcName The name of the managed instance DTC. + * @param parameters Managed instance DTC settings. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of sQL Managed Instance DTC. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ManagedInstanceDtcInner> beginCreateOrUpdateAsync( + String resourceGroupName, String managedInstanceName, DtcName dtcName, ManagedInstanceDtcInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, managedInstanceName, dtcName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedInstanceDtcInner.class, + ManagedInstanceDtcInner.class, + this.client.getContext()); + } + + /** + * Updates managed instance DTC settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param dtcName The name of the managed instance DTC. + * @param parameters Managed instance DTC settings. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of sQL Managed Instance DTC. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ManagedInstanceDtcInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + DtcName dtcName, + ManagedInstanceDtcInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, managedInstanceName, dtcName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedInstanceDtcInner.class, + ManagedInstanceDtcInner.class, + context); + } + + /** + * Updates managed instance DTC settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param dtcName The name of the managed instance DTC. + * @param parameters Managed instance DTC settings. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of sQL Managed Instance DTC. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ManagedInstanceDtcInner> beginCreateOrUpdate( + String resourceGroupName, String managedInstanceName, DtcName dtcName, ManagedInstanceDtcInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, dtcName, parameters).getSyncPoller(); + } + + /** + * Updates managed instance DTC settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param dtcName The name of the managed instance DTC. + * @param parameters Managed instance DTC settings. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of sQL Managed Instance DTC. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ManagedInstanceDtcInner> beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + DtcName dtcName, + ManagedInstanceDtcInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, dtcName, parameters, context) + .getSyncPoller(); + } + + /** + * Updates managed instance DTC settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param dtcName The name of the managed instance DTC. + * @param parameters Managed instance DTC settings. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return sQL Managed Instance DTC on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String managedInstanceName, DtcName dtcName, ManagedInstanceDtcInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, dtcName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates managed instance DTC settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param dtcName The name of the managed instance DTC. + * @param parameters Managed instance DTC settings. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return sQL Managed Instance DTC on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + DtcName dtcName, + ManagedInstanceDtcInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, dtcName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates managed instance DTC settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param dtcName The name of the managed instance DTC. + * @param parameters Managed instance DTC settings. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return sQL Managed Instance DTC. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceDtcInner createOrUpdate( + String resourceGroupName, String managedInstanceName, DtcName dtcName, ManagedInstanceDtcInner parameters) { + return createOrUpdateAsync(resourceGroupName, managedInstanceName, dtcName, parameters).block(); + } + + /** + * Updates managed instance DTC settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param dtcName The name of the managed instance DTC. + * @param parameters Managed instance DTC settings. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return sQL Managed Instance DTC. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceDtcInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + DtcName dtcName, + ManagedInstanceDtcInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, managedInstanceName, dtcName, parameters, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance's DTCs along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByManagedInstanceNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByManagedInstanceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance's DTCs along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByManagedInstanceNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByManagedInstanceNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceDtcsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceDtcsImpl.java new file mode 100644 index 0000000000000..465260cde4388 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceDtcsImpl.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ManagedInstanceDtcsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceDtcInner; +import com.azure.resourcemanager.sql.generated.models.DtcName; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceDtc; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceDtcs; + +public final class ManagedInstanceDtcsImpl implements ManagedInstanceDtcs { + private static final ClientLogger LOGGER = new ClientLogger(ManagedInstanceDtcsImpl.class); + + private final ManagedInstanceDtcsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedInstanceDtcsImpl( + ManagedInstanceDtcsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByManagedInstance( + String resourceGroupName, String managedInstanceName) { + PagedIterable inner = + this.serviceClient().listByManagedInstance(resourceGroupName, managedInstanceName); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceDtcImpl(inner1, this.manager())); + } + + public PagedIterable listByManagedInstance( + String resourceGroupName, String managedInstanceName, Context context) { + PagedIterable inner = + this.serviceClient().listByManagedInstance(resourceGroupName, managedInstanceName, context); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceDtcImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, DtcName dtcName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, managedInstanceName, dtcName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ManagedInstanceDtcImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ManagedInstanceDtc get(String resourceGroupName, String managedInstanceName, DtcName dtcName) { + ManagedInstanceDtcInner inner = this.serviceClient().get(resourceGroupName, managedInstanceName, dtcName); + if (inner != null) { + return new ManagedInstanceDtcImpl(inner, this.manager()); + } else { + return null; + } + } + + public ManagedInstanceDtc getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String dtcNameLocal = Utils.getValueFromIdByName(id, "dtc"); + if (dtcNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'dtc'.", id))); + } + DtcName dtcName = DtcName.fromString(dtcNameLocal); + return this.getWithResponse(resourceGroupName, managedInstanceName, dtcName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String dtcNameLocal = Utils.getValueFromIdByName(id, "dtc"); + if (dtcNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'dtc'.", id))); + } + DtcName dtcName = DtcName.fromString(dtcNameLocal); + return this.getWithResponse(resourceGroupName, managedInstanceName, dtcName, context); + } + + private ManagedInstanceDtcsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ManagedInstanceDtcImpl define(DtcName name) { + return new ManagedInstanceDtcImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceEncryptionProtectorImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceEncryptionProtectorImpl.java new file mode 100644 index 0000000000000..7eb520046463d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceEncryptionProtectorImpl.java @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceEncryptionProtectorInner; +import com.azure.resourcemanager.sql.generated.models.EncryptionProtectorName; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceEncryptionProtector; +import com.azure.resourcemanager.sql.generated.models.ServerKeyType; + +public final class ManagedInstanceEncryptionProtectorImpl + implements ManagedInstanceEncryptionProtector, + ManagedInstanceEncryptionProtector.Definition, + ManagedInstanceEncryptionProtector.Update { + private ManagedInstanceEncryptionProtectorInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String kind() { + return this.innerModel().kind(); + } + + public String serverKeyName() { + return this.innerModel().serverKeyName(); + } + + public ServerKeyType serverKeyType() { + return this.innerModel().serverKeyType(); + } + + public String uri() { + return this.innerModel().uri(); + } + + public String thumbprint() { + return this.innerModel().thumbprint(); + } + + public Boolean autoRotationEnabled() { + return this.innerModel().autoRotationEnabled(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ManagedInstanceEncryptionProtectorInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String managedInstanceName; + + private EncryptionProtectorName encryptionProtectorName; + + public ManagedInstanceEncryptionProtectorImpl withExistingManagedInstance( + String resourceGroupName, String managedInstanceName) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + return this; + } + + public ManagedInstanceEncryptionProtector create() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceEncryptionProtectors() + .createOrUpdate( + resourceGroupName, managedInstanceName, encryptionProtectorName, this.innerModel(), Context.NONE); + return this; + } + + public ManagedInstanceEncryptionProtector create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceEncryptionProtectors() + .createOrUpdate( + resourceGroupName, managedInstanceName, encryptionProtectorName, this.innerModel(), context); + return this; + } + + ManagedInstanceEncryptionProtectorImpl( + EncryptionProtectorName name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ManagedInstanceEncryptionProtectorInner(); + this.serviceManager = serviceManager; + this.encryptionProtectorName = name; + } + + public ManagedInstanceEncryptionProtectorImpl update() { + return this; + } + + public ManagedInstanceEncryptionProtector apply() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceEncryptionProtectors() + .createOrUpdate( + resourceGroupName, managedInstanceName, encryptionProtectorName, this.innerModel(), Context.NONE); + return this; + } + + public ManagedInstanceEncryptionProtector apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceEncryptionProtectors() + .createOrUpdate( + resourceGroupName, managedInstanceName, encryptionProtectorName, this.innerModel(), context); + return this; + } + + ManagedInstanceEncryptionProtectorImpl( + ManagedInstanceEncryptionProtectorInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.managedInstanceName = Utils.getValueFromIdByName(innerObject.id(), "managedInstances"); + this.encryptionProtectorName = + EncryptionProtectorName.fromString(Utils.getValueFromIdByName(innerObject.id(), "encryptionProtector")); + } + + public ManagedInstanceEncryptionProtector refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceEncryptionProtectors() + .getWithResponse(resourceGroupName, managedInstanceName, encryptionProtectorName, Context.NONE) + .getValue(); + return this; + } + + public ManagedInstanceEncryptionProtector refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceEncryptionProtectors() + .getWithResponse(resourceGroupName, managedInstanceName, encryptionProtectorName, context) + .getValue(); + return this; + } + + public void revalidate() { + serviceManager + .managedInstanceEncryptionProtectors() + .revalidate(resourceGroupName, managedInstanceName, encryptionProtectorName); + } + + public void revalidate(Context context) { + serviceManager + .managedInstanceEncryptionProtectors() + .revalidate(resourceGroupName, managedInstanceName, encryptionProtectorName, context); + } + + public ManagedInstanceEncryptionProtectorImpl withServerKeyName(String serverKeyName) { + this.innerModel().withServerKeyName(serverKeyName); + return this; + } + + public ManagedInstanceEncryptionProtectorImpl withServerKeyType(ServerKeyType serverKeyType) { + this.innerModel().withServerKeyType(serverKeyType); + return this; + } + + public ManagedInstanceEncryptionProtectorImpl withAutoRotationEnabled(Boolean autoRotationEnabled) { + this.innerModel().withAutoRotationEnabled(autoRotationEnabled); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceEncryptionProtectorsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceEncryptionProtectorsClientImpl.java new file mode 100644 index 0000000000000..6d9f65e51f767 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceEncryptionProtectorsClientImpl.java @@ -0,0 +1,1238 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ManagedInstanceEncryptionProtectorsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceEncryptionProtectorInner; +import com.azure.resourcemanager.sql.generated.models.EncryptionProtectorName; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceEncryptionProtectorListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ManagedInstanceEncryptionProtectorsClient. + */ +public final class ManagedInstanceEncryptionProtectorsClientImpl implements ManagedInstanceEncryptionProtectorsClient { + /** The proxy service used to perform REST calls. */ + private final ManagedInstanceEncryptionProtectorsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedInstanceEncryptionProtectorsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedInstanceEncryptionProtectorsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ManagedInstanceEncryptionProtectorsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientManagedInstanceEncryptionProtectors to be used by + * the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + public interface ManagedInstanceEncryptionProtectorsService { + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/encryptionProtector/{encryptionProtectorName}/revalidate") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> revalidate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("encryptionProtectorName") EncryptionProtectorName encryptionProtectorName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/encryptionProtector") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInstance( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/encryptionProtector/{encryptionProtectorName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("encryptionProtectorName") EncryptionProtectorName encryptionProtectorName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/encryptionProtector/{encryptionProtectorName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("encryptionProtectorName") EncryptionProtectorName encryptionProtectorName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ManagedInstanceEncryptionProtectorInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInstanceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Revalidates 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 encryptionProtectorName The name of the encryption protector to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> revalidateWithResponseAsync( + String resourceGroupName, String managedInstanceName, EncryptionProtectorName encryptionProtectorName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (encryptionProtectorName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter encryptionProtectorName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .revalidate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + encryptionProtectorName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Revalidates 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 encryptionProtectorName The name of the encryption protector to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> revalidateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + EncryptionProtectorName encryptionProtectorName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (encryptionProtectorName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter encryptionProtectorName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .revalidate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + encryptionProtectorName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Revalidates 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 encryptionProtectorName The name of the encryption protector to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRevalidateAsync( + String resourceGroupName, String managedInstanceName, EncryptionProtectorName encryptionProtectorName) { + Mono>> mono = + revalidateWithResponseAsync(resourceGroupName, managedInstanceName, encryptionProtectorName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Revalidates 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 encryptionProtectorName The name of the encryption protector to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRevalidateAsync( + String resourceGroupName, + String managedInstanceName, + EncryptionProtectorName encryptionProtectorName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + revalidateWithResponseAsync(resourceGroupName, managedInstanceName, encryptionProtectorName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Revalidates 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 encryptionProtectorName The name of the encryption protector to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRevalidate( + String resourceGroupName, String managedInstanceName, EncryptionProtectorName encryptionProtectorName) { + return beginRevalidateAsync(resourceGroupName, managedInstanceName, encryptionProtectorName).getSyncPoller(); + } + + /** + * Revalidates 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 encryptionProtectorName The name of the encryption protector to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRevalidate( + String resourceGroupName, + String managedInstanceName, + EncryptionProtectorName encryptionProtectorName, + Context context) { + return beginRevalidateAsync(resourceGroupName, managedInstanceName, encryptionProtectorName, context) + .getSyncPoller(); + } + + /** + * Revalidates 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 encryptionProtectorName The name of the encryption protector to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono revalidateAsync( + String resourceGroupName, String managedInstanceName, EncryptionProtectorName encryptionProtectorName) { + return beginRevalidateAsync(resourceGroupName, managedInstanceName, encryptionProtectorName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Revalidates 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 encryptionProtectorName The name of the encryption protector to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono revalidateAsync( + String resourceGroupName, + String managedInstanceName, + EncryptionProtectorName encryptionProtectorName, + Context context) { + return beginRevalidateAsync(resourceGroupName, managedInstanceName, encryptionProtectorName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Revalidates 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 encryptionProtectorName The name of the encryption protector to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void revalidate( + String resourceGroupName, String managedInstanceName, EncryptionProtectorName encryptionProtectorName) { + revalidateAsync(resourceGroupName, managedInstanceName, encryptionProtectorName).block(); + } + + /** + * Revalidates 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 encryptionProtectorName The name of the encryption protector to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void revalidate( + String resourceGroupName, + String managedInstanceName, + EncryptionProtectorName encryptionProtectorName, + Context context) { + revalidateAsync(resourceGroupName, managedInstanceName, encryptionProtectorName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance encryption protectors along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance encryption protectors along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance encryption protectors as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync( + String resourceGroupName, String managedInstanceName) { + return new PagedFlux<>( + () -> listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName), + nextLink -> listByInstanceNextSinglePageAsync(nextLink)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance encryption protectors as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedFlux<>( + () -> listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName, context), + nextLink -> listByInstanceNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance encryption protectors as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName) { + return new PagedIterable<>(listByInstanceAsync(resourceGroupName, managedInstanceName)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance encryption protectors as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedIterable<>(listByInstanceAsync(resourceGroupName, managedInstanceName, context)); + } + + /** + * 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 encryptionProtectorName The name of the encryption protector to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance encryption protector along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, EncryptionProtectorName encryptionProtectorName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (encryptionProtectorName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter encryptionProtectorName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + encryptionProtectorName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 encryptionProtectorName The name of the encryption protector to be retrieved. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance encryption protector along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + EncryptionProtectorName encryptionProtectorName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (encryptionProtectorName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter encryptionProtectorName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + encryptionProtectorName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 encryptionProtectorName The name of the encryption protector to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance encryption protector on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String managedInstanceName, EncryptionProtectorName encryptionProtectorName) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, encryptionProtectorName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 encryptionProtectorName The name of the encryption protector to be retrieved. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance encryption protector along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + EncryptionProtectorName encryptionProtectorName, + Context context) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, encryptionProtectorName, context).block(); + } + + /** + * 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 encryptionProtectorName The name of the encryption protector to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance encryption protector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceEncryptionProtectorInner get( + String resourceGroupName, String managedInstanceName, EncryptionProtectorName encryptionProtectorName) { + return getWithResponse(resourceGroupName, managedInstanceName, encryptionProtectorName, Context.NONE) + .getValue(); + } + + /** + * 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 encryptionProtectorName The name of the encryption protector to be updated. + * @param parameters The requested encryption protector resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed instance encryption protector along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + EncryptionProtectorName encryptionProtectorName, + ManagedInstanceEncryptionProtectorInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (encryptionProtectorName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter encryptionProtectorName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + encryptionProtectorName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 encryptionProtectorName The name of the encryption protector to be updated. + * @param parameters The requested encryption protector resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed instance encryption protector along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + EncryptionProtectorName encryptionProtectorName, + ManagedInstanceEncryptionProtectorInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (encryptionProtectorName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter encryptionProtectorName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + encryptionProtectorName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 encryptionProtectorName The name of the encryption protector to be updated. + * @param parameters The requested encryption protector resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the managed instance encryption protector. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ManagedInstanceEncryptionProtectorInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + EncryptionProtectorName encryptionProtectorName, + ManagedInstanceEncryptionProtectorInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, managedInstanceName, encryptionProtectorName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedInstanceEncryptionProtectorInner.class, + ManagedInstanceEncryptionProtectorInner.class, + this.client.getContext()); + } + + /** + * 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 encryptionProtectorName The name of the encryption protector to be updated. + * @param parameters The requested encryption protector resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the managed instance encryption protector. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ManagedInstanceEncryptionProtectorInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + EncryptionProtectorName encryptionProtectorName, + ManagedInstanceEncryptionProtectorInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, managedInstanceName, encryptionProtectorName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedInstanceEncryptionProtectorInner.class, + ManagedInstanceEncryptionProtectorInner.class, + context); + } + + /** + * 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 encryptionProtectorName The name of the encryption protector to be updated. + * @param parameters The requested encryption protector resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the managed instance encryption protector. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ManagedInstanceEncryptionProtectorInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + EncryptionProtectorName encryptionProtectorName, + ManagedInstanceEncryptionProtectorInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, encryptionProtectorName, parameters) + .getSyncPoller(); + } + + /** + * 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 encryptionProtectorName The name of the encryption protector to be updated. + * @param parameters The requested encryption protector resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the managed instance encryption protector. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ManagedInstanceEncryptionProtectorInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + EncryptionProtectorName encryptionProtectorName, + ManagedInstanceEncryptionProtectorInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, managedInstanceName, encryptionProtectorName, parameters, context) + .getSyncPoller(); + } + + /** + * 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 encryptionProtectorName The name of the encryption protector to be updated. + * @param parameters The requested encryption protector resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed instance encryption protector on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + EncryptionProtectorName encryptionProtectorName, + ManagedInstanceEncryptionProtectorInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, encryptionProtectorName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 encryptionProtectorName The name of the encryption protector to be updated. + * @param parameters The requested encryption protector resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed instance encryption protector on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + EncryptionProtectorName encryptionProtectorName, + ManagedInstanceEncryptionProtectorInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, managedInstanceName, encryptionProtectorName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 encryptionProtectorName The name of the encryption protector to be updated. + * @param parameters The requested encryption protector resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed instance encryption protector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceEncryptionProtectorInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + EncryptionProtectorName encryptionProtectorName, + ManagedInstanceEncryptionProtectorInner parameters) { + return createOrUpdateAsync(resourceGroupName, managedInstanceName, encryptionProtectorName, parameters).block(); + } + + /** + * 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 encryptionProtectorName The name of the encryption protector to be updated. + * @param parameters The requested encryption protector resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed instance encryption protector. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceEncryptionProtectorInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + EncryptionProtectorName encryptionProtectorName, + ManagedInstanceEncryptionProtectorInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, managedInstanceName, encryptionProtectorName, parameters, context) + .block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance encryption protectors along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByInstanceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance encryption protectors along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInstanceNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceEncryptionProtectorsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceEncryptionProtectorsImpl.java new file mode 100644 index 0000000000000..e410ce782ff05 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceEncryptionProtectorsImpl.java @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ManagedInstanceEncryptionProtectorsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceEncryptionProtectorInner; +import com.azure.resourcemanager.sql.generated.models.EncryptionProtectorName; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceEncryptionProtector; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceEncryptionProtectors; + +public final class ManagedInstanceEncryptionProtectorsImpl implements ManagedInstanceEncryptionProtectors { + private static final ClientLogger LOGGER = new ClientLogger(ManagedInstanceEncryptionProtectorsImpl.class); + + private final ManagedInstanceEncryptionProtectorsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedInstanceEncryptionProtectorsImpl( + ManagedInstanceEncryptionProtectorsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void revalidate( + String resourceGroupName, String managedInstanceName, EncryptionProtectorName encryptionProtectorName) { + this.serviceClient().revalidate(resourceGroupName, managedInstanceName, encryptionProtectorName); + } + + public void revalidate( + String resourceGroupName, + String managedInstanceName, + EncryptionProtectorName encryptionProtectorName, + Context context) { + this.serviceClient().revalidate(resourceGroupName, managedInstanceName, encryptionProtectorName, context); + } + + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName) { + PagedIterable inner = + this.serviceClient().listByInstance(resourceGroupName, managedInstanceName); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceEncryptionProtectorImpl(inner1, this.manager())); + } + + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context) { + PagedIterable inner = + this.serviceClient().listByInstance(resourceGroupName, managedInstanceName, context); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceEncryptionProtectorImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + EncryptionProtectorName encryptionProtectorName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, managedInstanceName, encryptionProtectorName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ManagedInstanceEncryptionProtectorImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ManagedInstanceEncryptionProtector get( + String resourceGroupName, String managedInstanceName, EncryptionProtectorName encryptionProtectorName) { + ManagedInstanceEncryptionProtectorInner inner = + this.serviceClient().get(resourceGroupName, managedInstanceName, encryptionProtectorName); + if (inner != null) { + return new ManagedInstanceEncryptionProtectorImpl(inner, this.manager()); + } else { + return null; + } + } + + public ManagedInstanceEncryptionProtector getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String encryptionProtectorNameLocal = Utils.getValueFromIdByName(id, "encryptionProtector"); + if (encryptionProtectorNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'encryptionProtector'.", id))); + } + EncryptionProtectorName encryptionProtectorName = + EncryptionProtectorName.fromString(encryptionProtectorNameLocal); + return this + .getWithResponse(resourceGroupName, managedInstanceName, encryptionProtectorName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String encryptionProtectorNameLocal = Utils.getValueFromIdByName(id, "encryptionProtector"); + if (encryptionProtectorNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'encryptionProtector'.", id))); + } + EncryptionProtectorName encryptionProtectorName = + EncryptionProtectorName.fromString(encryptionProtectorNameLocal); + return this.getWithResponse(resourceGroupName, managedInstanceName, encryptionProtectorName, context); + } + + private ManagedInstanceEncryptionProtectorsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ManagedInstanceEncryptionProtectorImpl define(EncryptionProtectorName name) { + return new ManagedInstanceEncryptionProtectorImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceImpl.java new file mode 100644 index 0000000000000..9668050251a99 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceImpl.java @@ -0,0 +1,527 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceInner; +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.azure.resourcemanager.sql.generated.models.ManagedInstance; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceExternalAdministrator; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceLicenseType; +import com.azure.resourcemanager.sql.generated.models.ManagedInstancePecProperty; +import com.azure.resourcemanager.sql.generated.models.ManagedInstancePropertiesProvisioningState; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceProxyOverride; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceUpdate; +import com.azure.resourcemanager.sql.generated.models.ManagedServerCreateMode; +import com.azure.resourcemanager.sql.generated.models.ReplicaType; +import com.azure.resourcemanager.sql.generated.models.ResourceIdentity; +import com.azure.resourcemanager.sql.generated.models.ServicePrincipal; +import com.azure.resourcemanager.sql.generated.models.Sku; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class ManagedInstanceImpl implements ManagedInstance, ManagedInstance.Definition, ManagedInstance.Update { + private ManagedInstanceInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public ResourceIdentity identity() { + return this.innerModel().identity(); + } + + public Sku sku() { + return this.innerModel().sku(); + } + + public ManagedInstancePropertiesProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public ManagedServerCreateMode managedInstanceCreateMode() { + return this.innerModel().managedInstanceCreateMode(); + } + + public String fullyQualifiedDomainName() { + return this.innerModel().fullyQualifiedDomainName(); + } + + public String administratorLogin() { + return this.innerModel().administratorLogin(); + } + + public String administratorLoginPassword() { + return this.innerModel().administratorLoginPassword(); + } + + public String subnetId() { + return this.innerModel().subnetId(); + } + + public String state() { + return this.innerModel().state(); + } + + public ManagedInstanceLicenseType licenseType() { + return this.innerModel().licenseType(); + } + + public Integer vCores() { + return this.innerModel().vCores(); + } + + public Integer storageSizeInGB() { + return this.innerModel().storageSizeInGB(); + } + + public String collation() { + return this.innerModel().collation(); + } + + public String dnsZone() { + return this.innerModel().dnsZone(); + } + + public String dnsZonePartner() { + return this.innerModel().dnsZonePartner(); + } + + public Boolean publicDataEndpointEnabled() { + return this.innerModel().publicDataEndpointEnabled(); + } + + public String sourceManagedInstanceId() { + return this.innerModel().sourceManagedInstanceId(); + } + + public OffsetDateTime restorePointInTime() { + return this.innerModel().restorePointInTime(); + } + + public ManagedInstanceProxyOverride proxyOverride() { + return this.innerModel().proxyOverride(); + } + + public String timezoneId() { + return this.innerModel().timezoneId(); + } + + public String instancePoolId() { + return this.innerModel().instancePoolId(); + } + + public String maintenanceConfigurationId() { + return this.innerModel().maintenanceConfigurationId(); + } + + public List privateEndpointConnections() { + List inner = this.innerModel().privateEndpointConnections(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String minimalTlsVersion() { + return this.innerModel().minimalTlsVersion(); + } + + public BackupStorageRedundancy currentBackupStorageRedundancy() { + return this.innerModel().currentBackupStorageRedundancy(); + } + + public BackupStorageRedundancy requestedBackupStorageRedundancy() { + return this.innerModel().requestedBackupStorageRedundancy(); + } + + public Boolean zoneRedundant() { + return this.innerModel().zoneRedundant(); + } + + public String primaryUserAssignedIdentityId() { + return this.innerModel().primaryUserAssignedIdentityId(); + } + + public String keyId() { + return this.innerModel().keyId(); + } + + public ManagedInstanceExternalAdministrator administrators() { + return this.innerModel().administrators(); + } + + public ServicePrincipal servicePrincipal() { + return this.innerModel().servicePrincipal(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ManagedInstanceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String managedInstanceName; + + private ManagedInstanceUpdate updateParameters; + + public ManagedInstanceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public ManagedInstance create() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstances() + .createOrUpdate(resourceGroupName, managedInstanceName, this.innerModel(), Context.NONE); + return this; + } + + public ManagedInstance create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstances() + .createOrUpdate(resourceGroupName, managedInstanceName, this.innerModel(), context); + return this; + } + + ManagedInstanceImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ManagedInstanceInner(); + this.serviceManager = serviceManager; + this.managedInstanceName = name; + } + + public ManagedInstanceImpl update() { + this.updateParameters = new ManagedInstanceUpdate(); + return this; + } + + public ManagedInstance apply() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstances() + .update(resourceGroupName, managedInstanceName, updateParameters, Context.NONE); + return this; + } + + public ManagedInstance apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstances() + .update(resourceGroupName, managedInstanceName, updateParameters, context); + return this; + } + + ManagedInstanceImpl( + ManagedInstanceInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.managedInstanceName = Utils.getValueFromIdByName(innerObject.id(), "managedInstances"); + } + + public ManagedInstance refresh() { + String localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstances() + .getByResourceGroupWithResponse(resourceGroupName, managedInstanceName, localExpand, Context.NONE) + .getValue(); + return this; + } + + public ManagedInstance refresh(Context context) { + String localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstances() + .getByResourceGroupWithResponse(resourceGroupName, managedInstanceName, localExpand, context) + .getValue(); + return this; + } + + public void failover() { + serviceManager.managedInstances().failover(resourceGroupName, managedInstanceName); + } + + public void failover(ReplicaType replicaType, Context context) { + serviceManager.managedInstances().failover(resourceGroupName, managedInstanceName, replicaType, context); + } + + public ManagedInstanceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public ManagedInstanceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public ManagedInstanceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public ManagedInstanceImpl withIdentity(ResourceIdentity identity) { + if (isInCreateMode()) { + this.innerModel().withIdentity(identity); + return this; + } else { + this.updateParameters.withIdentity(identity); + return this; + } + } + + public ManagedInstanceImpl withSku(Sku sku) { + if (isInCreateMode()) { + this.innerModel().withSku(sku); + return this; + } else { + this.updateParameters.withSku(sku); + return this; + } + } + + public ManagedInstanceImpl withManagedInstanceCreateMode(ManagedServerCreateMode managedInstanceCreateMode) { + this.innerModel().withManagedInstanceCreateMode(managedInstanceCreateMode); + return this; + } + + public ManagedInstanceImpl withAdministratorLogin(String administratorLogin) { + this.innerModel().withAdministratorLogin(administratorLogin); + return this; + } + + public ManagedInstanceImpl withAdministratorLoginPassword(String administratorLoginPassword) { + if (isInCreateMode()) { + this.innerModel().withAdministratorLoginPassword(administratorLoginPassword); + return this; + } else { + this.updateParameters.withAdministratorLoginPassword(administratorLoginPassword); + return this; + } + } + + public ManagedInstanceImpl withSubnetId(String subnetId) { + if (isInCreateMode()) { + this.innerModel().withSubnetId(subnetId); + return this; + } else { + this.updateParameters.withSubnetId(subnetId); + return this; + } + } + + public ManagedInstanceImpl withLicenseType(ManagedInstanceLicenseType licenseType) { + if (isInCreateMode()) { + this.innerModel().withLicenseType(licenseType); + return this; + } else { + this.updateParameters.withLicenseType(licenseType); + return this; + } + } + + public ManagedInstanceImpl withVCores(Integer vCores) { + if (isInCreateMode()) { + this.innerModel().withVCores(vCores); + return this; + } else { + this.updateParameters.withVCores(vCores); + return this; + } + } + + public ManagedInstanceImpl withStorageSizeInGB(Integer storageSizeInGB) { + if (isInCreateMode()) { + this.innerModel().withStorageSizeInGB(storageSizeInGB); + return this; + } else { + this.updateParameters.withStorageSizeInGB(storageSizeInGB); + return this; + } + } + + public ManagedInstanceImpl withCollation(String collation) { + this.innerModel().withCollation(collation); + return this; + } + + public ManagedInstanceImpl withDnsZonePartner(String dnsZonePartner) { + this.innerModel().withDnsZonePartner(dnsZonePartner); + return this; + } + + public ManagedInstanceImpl withPublicDataEndpointEnabled(Boolean publicDataEndpointEnabled) { + if (isInCreateMode()) { + this.innerModel().withPublicDataEndpointEnabled(publicDataEndpointEnabled); + return this; + } else { + this.updateParameters.withPublicDataEndpointEnabled(publicDataEndpointEnabled); + return this; + } + } + + public ManagedInstanceImpl withSourceManagedInstanceId(String sourceManagedInstanceId) { + this.innerModel().withSourceManagedInstanceId(sourceManagedInstanceId); + return this; + } + + public ManagedInstanceImpl withRestorePointInTime(OffsetDateTime restorePointInTime) { + this.innerModel().withRestorePointInTime(restorePointInTime); + return this; + } + + public ManagedInstanceImpl withProxyOverride(ManagedInstanceProxyOverride proxyOverride) { + if (isInCreateMode()) { + this.innerModel().withProxyOverride(proxyOverride); + return this; + } else { + this.updateParameters.withProxyOverride(proxyOverride); + return this; + } + } + + public ManagedInstanceImpl withTimezoneId(String timezoneId) { + this.innerModel().withTimezoneId(timezoneId); + return this; + } + + public ManagedInstanceImpl withInstancePoolId(String instancePoolId) { + if (isInCreateMode()) { + this.innerModel().withInstancePoolId(instancePoolId); + return this; + } else { + this.updateParameters.withInstancePoolId(instancePoolId); + return this; + } + } + + public ManagedInstanceImpl withMaintenanceConfigurationId(String maintenanceConfigurationId) { + if (isInCreateMode()) { + this.innerModel().withMaintenanceConfigurationId(maintenanceConfigurationId); + return this; + } else { + this.updateParameters.withMaintenanceConfigurationId(maintenanceConfigurationId); + return this; + } + } + + public ManagedInstanceImpl withMinimalTlsVersion(String minimalTlsVersion) { + if (isInCreateMode()) { + this.innerModel().withMinimalTlsVersion(minimalTlsVersion); + return this; + } else { + this.updateParameters.withMinimalTlsVersion(minimalTlsVersion); + return this; + } + } + + public ManagedInstanceImpl withRequestedBackupStorageRedundancy( + BackupStorageRedundancy requestedBackupStorageRedundancy) { + this.innerModel().withRequestedBackupStorageRedundancy(requestedBackupStorageRedundancy); + return this; + } + + public ManagedInstanceImpl withZoneRedundant(Boolean zoneRedundant) { + if (isInCreateMode()) { + this.innerModel().withZoneRedundant(zoneRedundant); + return this; + } else { + this.updateParameters.withZoneRedundant(zoneRedundant); + return this; + } + } + + public ManagedInstanceImpl withPrimaryUserAssignedIdentityId(String primaryUserAssignedIdentityId) { + if (isInCreateMode()) { + this.innerModel().withPrimaryUserAssignedIdentityId(primaryUserAssignedIdentityId); + return this; + } else { + this.updateParameters.withPrimaryUserAssignedIdentityId(primaryUserAssignedIdentityId); + return this; + } + } + + public ManagedInstanceImpl withKeyId(String keyId) { + this.innerModel().withKeyId(keyId); + return this; + } + + public ManagedInstanceImpl withAdministrators(ManagedInstanceExternalAdministrator administrators) { + this.innerModel().withAdministrators(administrators); + return this; + } + + public ManagedInstanceImpl withServicePrincipal(ServicePrincipal servicePrincipal) { + if (isInCreateMode()) { + this.innerModel().withServicePrincipal(servicePrincipal); + return this; + } else { + this.updateParameters.withServicePrincipal(servicePrincipal); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceKeyImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceKeyImpl.java new file mode 100644 index 0000000000000..803986aa88f5b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceKeyImpl.java @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceKeyInner; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceKey; +import com.azure.resourcemanager.sql.generated.models.ServerKeyType; +import java.time.OffsetDateTime; + +public final class ManagedInstanceKeyImpl + implements ManagedInstanceKey, ManagedInstanceKey.Definition, ManagedInstanceKey.Update { + private ManagedInstanceKeyInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String kind() { + return this.innerModel().kind(); + } + + public ServerKeyType serverKeyType() { + return this.innerModel().serverKeyType(); + } + + public String uri() { + return this.innerModel().uri(); + } + + public String thumbprint() { + return this.innerModel().thumbprint(); + } + + public OffsetDateTime creationDate() { + return this.innerModel().creationDate(); + } + + public Boolean autoRotationEnabled() { + return this.innerModel().autoRotationEnabled(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ManagedInstanceKeyInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String managedInstanceName; + + private String keyName; + + public ManagedInstanceKeyImpl withExistingManagedInstance(String resourceGroupName, String managedInstanceName) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + return this; + } + + public ManagedInstanceKey create() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceKeys() + .createOrUpdate(resourceGroupName, managedInstanceName, keyName, this.innerModel(), Context.NONE); + return this; + } + + public ManagedInstanceKey create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceKeys() + .createOrUpdate(resourceGroupName, managedInstanceName, keyName, this.innerModel(), context); + return this; + } + + ManagedInstanceKeyImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ManagedInstanceKeyInner(); + this.serviceManager = serviceManager; + this.keyName = name; + } + + public ManagedInstanceKeyImpl update() { + return this; + } + + public ManagedInstanceKey apply() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceKeys() + .createOrUpdate(resourceGroupName, managedInstanceName, keyName, this.innerModel(), Context.NONE); + return this; + } + + public ManagedInstanceKey apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceKeys() + .createOrUpdate(resourceGroupName, managedInstanceName, keyName, this.innerModel(), context); + return this; + } + + ManagedInstanceKeyImpl( + ManagedInstanceKeyInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.managedInstanceName = Utils.getValueFromIdByName(innerObject.id(), "managedInstances"); + this.keyName = Utils.getValueFromIdByName(innerObject.id(), "keys"); + } + + public ManagedInstanceKey refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceKeys() + .getWithResponse(resourceGroupName, managedInstanceName, keyName, Context.NONE) + .getValue(); + return this; + } + + public ManagedInstanceKey refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceKeys() + .getWithResponse(resourceGroupName, managedInstanceName, keyName, context) + .getValue(); + return this; + } + + public ManagedInstanceKeyImpl withServerKeyType(ServerKeyType serverKeyType) { + this.innerModel().withServerKeyType(serverKeyType); + return this; + } + + public ManagedInstanceKeyImpl withUri(String uri) { + this.innerModel().withUri(uri); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceKeysClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceKeysClientImpl.java new file mode 100644 index 0000000000000..03d82bcb8975d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceKeysClientImpl.java @@ -0,0 +1,1190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ManagedInstanceKeysClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceKeyInner; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceKeyListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ManagedInstanceKeysClient. */ +public final class ManagedInstanceKeysClientImpl implements ManagedInstanceKeysClient { + /** The proxy service used to perform REST calls. */ + private final ManagedInstanceKeysService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedInstanceKeysClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedInstanceKeysClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(ManagedInstanceKeysService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientManagedInstanceKeys to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + public interface ManagedInstanceKeysService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/keys") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInstance( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @QueryParam("$filter") String filter, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/keys/{keyName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("keyName") String keyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/keys/{keyName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("keyName") String keyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ManagedInstanceKeyInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/keys/{keyName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("keyName") String keyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInstanceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance keys along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + filter, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance keys along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName, String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + filter, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance keys as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync( + String resourceGroupName, String managedInstanceName, String filter) { + return new PagedFlux<>( + () -> listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName, filter), + nextLink -> listByInstanceNextSinglePageAsync(nextLink)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance keys as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync( + String resourceGroupName, String managedInstanceName) { + final String filter = null; + return new PagedFlux<>( + () -> listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName, filter), + nextLink -> listByInstanceNextSinglePageAsync(nextLink)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance keys as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync( + String resourceGroupName, String managedInstanceName, String filter, Context context) { + return new PagedFlux<>( + () -> listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName, filter, context), + nextLink -> listByInstanceNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance keys as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstance(String resourceGroupName, String managedInstanceName) { + final String filter = null; + return new PagedIterable<>(listByInstanceAsync(resourceGroupName, managedInstanceName, filter)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance keys as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, String filter, Context context) { + return new PagedIterable<>(listByInstanceAsync(resourceGroupName, managedInstanceName, filter, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance key along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, String keyName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (keyName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + keyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance key along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, String keyName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (keyName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + keyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance key on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String managedInstanceName, String keyName) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, keyName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance key along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, String keyName, Context context) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, keyName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceKeyInner get(String resourceGroupName, String managedInstanceName, String keyName) { + return getWithResponse(resourceGroupName, managedInstanceName, keyName, Context.NONE).getValue(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance key along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String managedInstanceName, String keyName, ManagedInstanceKeyInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (keyName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + keyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance key along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String keyName, + ManagedInstanceKeyInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (keyName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + keyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a managed instance key. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ManagedInstanceKeyInner> beginCreateOrUpdateAsync( + String resourceGroupName, String managedInstanceName, String keyName, ManagedInstanceKeyInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, managedInstanceName, keyName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedInstanceKeyInner.class, + ManagedInstanceKeyInner.class, + this.client.getContext()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a managed instance key. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ManagedInstanceKeyInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String keyName, + ManagedInstanceKeyInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, managedInstanceName, keyName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedInstanceKeyInner.class, + ManagedInstanceKeyInner.class, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a managed instance key. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ManagedInstanceKeyInner> beginCreateOrUpdate( + String resourceGroupName, String managedInstanceName, String keyName, ManagedInstanceKeyInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, keyName, parameters).getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a managed instance key. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ManagedInstanceKeyInner> beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String keyName, + ManagedInstanceKeyInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, keyName, parameters, context) + .getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance key on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String managedInstanceName, String keyName, ManagedInstanceKeyInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, keyName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance key on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String keyName, + ManagedInstanceKeyInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, keyName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceKeyInner createOrUpdate( + String resourceGroupName, String managedInstanceName, String keyName, ManagedInstanceKeyInner parameters) { + return createOrUpdateAsync(resourceGroupName, managedInstanceName, keyName, parameters).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceKeyInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String keyName, + ManagedInstanceKeyInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, managedInstanceName, keyName, parameters, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String managedInstanceName, String keyName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (keyName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + keyName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String managedInstanceName, String keyName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (keyName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + keyName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String managedInstanceName, String keyName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, managedInstanceName, keyName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String managedInstanceName, String keyName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, managedInstanceName, keyName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, String keyName) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, keyName).getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, String keyName, Context context) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, keyName, context).getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String managedInstanceName, String keyName) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, keyName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String managedInstanceName, String keyName, Context context) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, keyName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String managedInstanceName, String keyName) { + deleteAsync(resourceGroupName, managedInstanceName, keyName).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String managedInstanceName, String keyName, Context context) { + deleteAsync(resourceGroupName, managedInstanceName, keyName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance keys along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByInstanceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance keys along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInstanceNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceKeysImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceKeysImpl.java new file mode 100644 index 0000000000000..2bb2b9cc7918f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceKeysImpl.java @@ -0,0 +1,198 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ManagedInstanceKeysClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceKeyInner; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceKey; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceKeys; + +public final class ManagedInstanceKeysImpl implements ManagedInstanceKeys { + private static final ClientLogger LOGGER = new ClientLogger(ManagedInstanceKeysImpl.class); + + private final ManagedInstanceKeysClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedInstanceKeysImpl( + ManagedInstanceKeysClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByInstance(String resourceGroupName, String managedInstanceName) { + PagedIterable inner = + this.serviceClient().listByInstance(resourceGroupName, managedInstanceName); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceKeyImpl(inner1, this.manager())); + } + + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listByInstance(resourceGroupName, managedInstanceName, filter, context); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceKeyImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, String keyName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, managedInstanceName, keyName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ManagedInstanceKeyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ManagedInstanceKey get(String resourceGroupName, String managedInstanceName, String keyName) { + ManagedInstanceKeyInner inner = this.serviceClient().get(resourceGroupName, managedInstanceName, keyName); + if (inner != null) { + return new ManagedInstanceKeyImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String managedInstanceName, String keyName) { + this.serviceClient().delete(resourceGroupName, managedInstanceName, keyName); + } + + public void delete(String resourceGroupName, String managedInstanceName, String keyName, Context context) { + this.serviceClient().delete(resourceGroupName, managedInstanceName, keyName, context); + } + + public ManagedInstanceKey getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String keyName = Utils.getValueFromIdByName(id, "keys"); + if (keyName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'keys'.", id))); + } + return this.getWithResponse(resourceGroupName, managedInstanceName, keyName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String keyName = Utils.getValueFromIdByName(id, "keys"); + if (keyName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'keys'.", id))); + } + return this.getWithResponse(resourceGroupName, managedInstanceName, keyName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String keyName = Utils.getValueFromIdByName(id, "keys"); + if (keyName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'keys'.", id))); + } + this.delete(resourceGroupName, managedInstanceName, keyName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String keyName = Utils.getValueFromIdByName(id, "keys"); + if (keyName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'keys'.", id))); + } + this.delete(resourceGroupName, managedInstanceName, keyName, context); + } + + private ManagedInstanceKeysClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ManagedInstanceKeyImpl define(String name) { + return new ManagedInstanceKeyImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceLongTermRetentionBackupImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceLongTermRetentionBackupImpl.java new file mode 100644 index 0000000000000..d816953177ef9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceLongTermRetentionBackupImpl.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceLongTermRetentionBackupInner; +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceLongTermRetentionBackup; +import java.time.OffsetDateTime; + +public final class ManagedInstanceLongTermRetentionBackupImpl implements ManagedInstanceLongTermRetentionBackup { + private ManagedInstanceLongTermRetentionBackupInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + ManagedInstanceLongTermRetentionBackupImpl( + ManagedInstanceLongTermRetentionBackupInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String managedInstanceName() { + return this.innerModel().managedInstanceName(); + } + + public OffsetDateTime managedInstanceCreateTime() { + return this.innerModel().managedInstanceCreateTime(); + } + + public String databaseName() { + return this.innerModel().databaseName(); + } + + public OffsetDateTime databaseDeletionTime() { + return this.innerModel().databaseDeletionTime(); + } + + public OffsetDateTime backupTime() { + return this.innerModel().backupTime(); + } + + public OffsetDateTime backupExpirationTime() { + return this.innerModel().backupExpirationTime(); + } + + public BackupStorageRedundancy backupStorageRedundancy() { + return this.innerModel().backupStorageRedundancy(); + } + + public ManagedInstanceLongTermRetentionBackupInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceLongTermRetentionPoliciesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceLongTermRetentionPoliciesClientImpl.java new file mode 100644 index 0000000000000..4c24cf1600e51 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceLongTermRetentionPoliciesClientImpl.java @@ -0,0 +1,1005 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ManagedInstanceLongTermRetentionPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceLongTermRetentionPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceLongTermRetentionPolicyListResult; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceLongTermRetentionPolicyName; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * ManagedInstanceLongTermRetentionPoliciesClient. + */ +public final class ManagedInstanceLongTermRetentionPoliciesClientImpl + implements ManagedInstanceLongTermRetentionPoliciesClient { + /** The proxy service used to perform REST calls. */ + private final ManagedInstanceLongTermRetentionPoliciesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedInstanceLongTermRetentionPoliciesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedInstanceLongTermRetentionPoliciesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ManagedInstanceLongTermRetentionPoliciesService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientManagedInstanceLongTermRetentionPolicies to be + * used by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + public interface ManagedInstanceLongTermRetentionPoliciesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/backupLongTermRetentionPolicies" + + "/{policyName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("policyName") ManagedInstanceLongTermRetentionPolicyName policyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/backupLongTermRetentionPolicies" + + "/{policyName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("policyName") ManagedInstanceLongTermRetentionPolicyName policyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ManagedInstanceLongTermRetentionPolicyInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/databases/{databaseName}/backupLongTermRetentionPolicies") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabaseNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's long term retention policy along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedInstanceLongTermRetentionPolicyName policyName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + policyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's long term retention policy along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedInstanceLongTermRetentionPolicyName policyName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + policyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's long term retention policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedInstanceLongTermRetentionPolicyName policyName) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, policyName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's long term retention policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedInstanceLongTermRetentionPolicyName policyName, + Context context) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, databaseName, policyName, context).block(); + } + + /** + * Gets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's long term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceLongTermRetentionPolicyInner get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedInstanceLongTermRetentionPolicyName policyName) { + return getWithResponse(resourceGroupName, managedInstanceName, databaseName, policyName, Context.NONE) + .getValue(); + } + + /** + * Sets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @param parameters The long term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention policy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedInstanceLongTermRetentionPolicyName policyName, + ManagedInstanceLongTermRetentionPolicyInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + policyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Sets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @param parameters The long term retention policy info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention policy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedInstanceLongTermRetentionPolicyName policyName, + ManagedInstanceLongTermRetentionPolicyInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + policyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Sets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @param parameters The long term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a long term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux< + PollResult, ManagedInstanceLongTermRetentionPolicyInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedInstanceLongTermRetentionPolicyName policyName, + ManagedInstanceLongTermRetentionPolicyInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, policyName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedInstanceLongTermRetentionPolicyInner.class, + ManagedInstanceLongTermRetentionPolicyInner.class, + this.client.getContext()); + } + + /** + * Sets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @param parameters The long term retention policy info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a long term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux< + PollResult, ManagedInstanceLongTermRetentionPolicyInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedInstanceLongTermRetentionPolicyName policyName, + ManagedInstanceLongTermRetentionPolicyInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, managedInstanceName, databaseName, policyName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedInstanceLongTermRetentionPolicyInner.class, + ManagedInstanceLongTermRetentionPolicyInner.class, + context); + } + + /** + * Sets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @param parameters The long term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a long term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller< + PollResult, ManagedInstanceLongTermRetentionPolicyInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedInstanceLongTermRetentionPolicyName policyName, + ManagedInstanceLongTermRetentionPolicyInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, databaseName, policyName, parameters) + .getSyncPoller(); + } + + /** + * Sets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @param parameters The long term retention policy info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a long term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller< + PollResult, ManagedInstanceLongTermRetentionPolicyInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedInstanceLongTermRetentionPolicyName policyName, + ManagedInstanceLongTermRetentionPolicyInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, managedInstanceName, databaseName, policyName, parameters, context) + .getSyncPoller(); + } + + /** + * Sets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @param parameters The long term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedInstanceLongTermRetentionPolicyName policyName, + ManagedInstanceLongTermRetentionPolicyInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, databaseName, policyName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Sets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @param parameters The long term retention policy info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedInstanceLongTermRetentionPolicyName policyName, + ManagedInstanceLongTermRetentionPolicyInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, managedInstanceName, databaseName, policyName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Sets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @param parameters The long term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceLongTermRetentionPolicyInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedInstanceLongTermRetentionPolicyName policyName, + ManagedInstanceLongTermRetentionPolicyInner parameters) { + return createOrUpdateAsync(resourceGroupName, managedInstanceName, databaseName, policyName, parameters) + .block(); + } + + /** + * Sets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @param parameters The long term retention policy info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceLongTermRetentionPolicyInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedInstanceLongTermRetentionPolicyName policyName, + ManagedInstanceLongTermRetentionPolicyInner parameters, + Context context) { + return createOrUpdateAsync( + resourceGroupName, managedInstanceName, databaseName, policyName, parameters, context) + .block(); + } + + /** + * Gets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's long term retention policy along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String managedInstanceName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's long term retention policy along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String managedInstanceName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's long term retention policy as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String managedInstanceName, String databaseName) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, managedInstanceName, databaseName), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Gets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's long term retention policy as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String managedInstanceName, String databaseName, Context context) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, managedInstanceName, databaseName, context), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's long term retention policy as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName)); + } + + /** + * Gets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's long term retention policy as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName, Context context) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, managedInstanceName, databaseName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention policies along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention policies along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceLongTermRetentionPoliciesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceLongTermRetentionPoliciesImpl.java new file mode 100644 index 0000000000000..15ce45227b68f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceLongTermRetentionPoliciesImpl.java @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ManagedInstanceLongTermRetentionPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceLongTermRetentionPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceLongTermRetentionPolicies; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceLongTermRetentionPolicy; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceLongTermRetentionPolicyName; + +public final class ManagedInstanceLongTermRetentionPoliciesImpl implements ManagedInstanceLongTermRetentionPolicies { + private static final ClientLogger LOGGER = new ClientLogger(ManagedInstanceLongTermRetentionPoliciesImpl.class); + + private final ManagedInstanceLongTermRetentionPoliciesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedInstanceLongTermRetentionPoliciesImpl( + ManagedInstanceLongTermRetentionPoliciesClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedInstanceLongTermRetentionPolicyName policyName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, managedInstanceName, databaseName, policyName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ManagedInstanceLongTermRetentionPolicyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ManagedInstanceLongTermRetentionPolicy get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedInstanceLongTermRetentionPolicyName policyName) { + ManagedInstanceLongTermRetentionPolicyInner inner = + this.serviceClient().get(resourceGroupName, managedInstanceName, databaseName, policyName); + if (inner != null) { + return new ManagedInstanceLongTermRetentionPolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, managedInstanceName, databaseName); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceLongTermRetentionPolicyImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, managedInstanceName, databaseName, context); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceLongTermRetentionPolicyImpl(inner1, this.manager())); + } + + public ManagedInstanceLongTermRetentionPolicy getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String policyNameLocal = Utils.getValueFromIdByName(id, "backupLongTermRetentionPolicies"); + if (policyNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment" + + " 'backupLongTermRetentionPolicies'.", + id))); + } + ManagedInstanceLongTermRetentionPolicyName policyName = + ManagedInstanceLongTermRetentionPolicyName.fromString(policyNameLocal); + return this + .getWithResponse(resourceGroupName, managedInstanceName, databaseName, policyName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String policyNameLocal = Utils.getValueFromIdByName(id, "backupLongTermRetentionPolicies"); + if (policyNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment" + + " 'backupLongTermRetentionPolicies'.", + id))); + } + ManagedInstanceLongTermRetentionPolicyName policyName = + ManagedInstanceLongTermRetentionPolicyName.fromString(policyNameLocal); + return this.getWithResponse(resourceGroupName, managedInstanceName, databaseName, policyName, context); + } + + private ManagedInstanceLongTermRetentionPoliciesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ManagedInstanceLongTermRetentionPolicyImpl define(ManagedInstanceLongTermRetentionPolicyName name) { + return new ManagedInstanceLongTermRetentionPolicyImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceLongTermRetentionPolicyImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceLongTermRetentionPolicyImpl.java new file mode 100644 index 0000000000000..7e8da5c00a689 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceLongTermRetentionPolicyImpl.java @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceLongTermRetentionPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceLongTermRetentionPolicy; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceLongTermRetentionPolicyName; + +public final class ManagedInstanceLongTermRetentionPolicyImpl + implements ManagedInstanceLongTermRetentionPolicy, + ManagedInstanceLongTermRetentionPolicy.Definition, + ManagedInstanceLongTermRetentionPolicy.Update { + private ManagedInstanceLongTermRetentionPolicyInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String weeklyRetention() { + return this.innerModel().weeklyRetention(); + } + + public String monthlyRetention() { + return this.innerModel().monthlyRetention(); + } + + public String yearlyRetention() { + return this.innerModel().yearlyRetention(); + } + + public Integer weekOfYear() { + return this.innerModel().weekOfYear(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ManagedInstanceLongTermRetentionPolicyInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String managedInstanceName; + + private String databaseName; + + private ManagedInstanceLongTermRetentionPolicyName policyName; + + public ManagedInstanceLongTermRetentionPolicyImpl withExistingDatabase( + String resourceGroupName, String managedInstanceName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + this.databaseName = databaseName; + return this; + } + + public ManagedInstanceLongTermRetentionPolicy create() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceLongTermRetentionPolicies() + .createOrUpdate( + resourceGroupName, managedInstanceName, databaseName, policyName, this.innerModel(), Context.NONE); + return this; + } + + public ManagedInstanceLongTermRetentionPolicy create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceLongTermRetentionPolicies() + .createOrUpdate( + resourceGroupName, managedInstanceName, databaseName, policyName, this.innerModel(), context); + return this; + } + + ManagedInstanceLongTermRetentionPolicyImpl( + ManagedInstanceLongTermRetentionPolicyName name, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ManagedInstanceLongTermRetentionPolicyInner(); + this.serviceManager = serviceManager; + this.policyName = name; + } + + public ManagedInstanceLongTermRetentionPolicyImpl update() { + return this; + } + + public ManagedInstanceLongTermRetentionPolicy apply() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceLongTermRetentionPolicies() + .createOrUpdate( + resourceGroupName, managedInstanceName, databaseName, policyName, this.innerModel(), Context.NONE); + return this; + } + + public ManagedInstanceLongTermRetentionPolicy apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceLongTermRetentionPolicies() + .createOrUpdate( + resourceGroupName, managedInstanceName, databaseName, policyName, this.innerModel(), context); + return this; + } + + ManagedInstanceLongTermRetentionPolicyImpl( + ManagedInstanceLongTermRetentionPolicyInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.managedInstanceName = Utils.getValueFromIdByName(innerObject.id(), "managedInstances"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "databases"); + this.policyName = + ManagedInstanceLongTermRetentionPolicyName + .fromString(Utils.getValueFromIdByName(innerObject.id(), "backupLongTermRetentionPolicies")); + } + + public ManagedInstanceLongTermRetentionPolicy refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceLongTermRetentionPolicies() + .getWithResponse(resourceGroupName, managedInstanceName, databaseName, policyName, Context.NONE) + .getValue(); + return this; + } + + public ManagedInstanceLongTermRetentionPolicy refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceLongTermRetentionPolicies() + .getWithResponse(resourceGroupName, managedInstanceName, databaseName, policyName, context) + .getValue(); + return this; + } + + public ManagedInstanceLongTermRetentionPolicyImpl withWeeklyRetention(String weeklyRetention) { + this.innerModel().withWeeklyRetention(weeklyRetention); + return this; + } + + public ManagedInstanceLongTermRetentionPolicyImpl withMonthlyRetention(String monthlyRetention) { + this.innerModel().withMonthlyRetention(monthlyRetention); + return this; + } + + public ManagedInstanceLongTermRetentionPolicyImpl withYearlyRetention(String yearlyRetention) { + this.innerModel().withYearlyRetention(yearlyRetention); + return this; + } + + public ManagedInstanceLongTermRetentionPolicyImpl withWeekOfYear(Integer weekOfYear) { + this.innerModel().withWeekOfYear(weekOfYear); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceOperationImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceOperationImpl.java new file mode 100644 index 0000000000000..5db981b72c755 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceOperationImpl.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceOperationInner; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceOperation; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceOperationParametersPair; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceOperationSteps; +import com.azure.resourcemanager.sql.generated.models.ManagementOperationState; +import java.time.OffsetDateTime; + +public final class ManagedInstanceOperationImpl implements ManagedInstanceOperation { + private ManagedInstanceOperationInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + ManagedInstanceOperationImpl( + ManagedInstanceOperationInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String managedInstanceName() { + return this.innerModel().managedInstanceName(); + } + + public String operation() { + return this.innerModel().operation(); + } + + public String operationFriendlyName() { + return this.innerModel().operationFriendlyName(); + } + + public Integer percentComplete() { + return this.innerModel().percentComplete(); + } + + public OffsetDateTime startTime() { + return this.innerModel().startTime(); + } + + public ManagementOperationState state() { + return this.innerModel().state(); + } + + public Integer errorCode() { + return this.innerModel().errorCode(); + } + + public String errorDescription() { + return this.innerModel().errorDescription(); + } + + public Integer errorSeverity() { + return this.innerModel().errorSeverity(); + } + + public Boolean isUserError() { + return this.innerModel().isUserError(); + } + + public OffsetDateTime estimatedCompletionTime() { + return this.innerModel().estimatedCompletionTime(); + } + + public String description() { + return this.innerModel().description(); + } + + public Boolean isCancellable() { + return this.innerModel().isCancellable(); + } + + public ManagedInstanceOperationParametersPair operationParameters() { + return this.innerModel().operationParameters(); + } + + public ManagedInstanceOperationSteps operationSteps() { + return this.innerModel().operationSteps(); + } + + public ManagedInstanceOperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceOperationsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceOperationsClientImpl.java new file mode 100644 index 0000000000000..9834a116112a4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceOperationsClientImpl.java @@ -0,0 +1,717 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.ManagedInstanceOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceOperationInner; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceOperationListResult; +import java.util.UUID; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ManagedInstanceOperationsClient. */ +public final class ManagedInstanceOperationsClientImpl implements ManagedInstanceOperationsClient { + /** The proxy service used to perform REST calls. */ + private final ManagedInstanceOperationsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedInstanceOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedInstanceOperationsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ManagedInstanceOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientManagedInstanceOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + public interface ManagedInstanceOperationsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByManagedInstance( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/operations/{operationId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("operationId") UUID operationId, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/operations/{operationId}/cancel") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> cancel( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("operationId") UUID operationId, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByManagedInstanceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a list of operations performed on the managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of operations performed on the managed instance along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByManagedInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByManagedInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of operations performed on the managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of operations performed on the managed instance along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByManagedInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByManagedInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of operations performed on the managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of operations performed on the managed instance as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByManagedInstanceAsync( + String resourceGroupName, String managedInstanceName) { + return new PagedFlux<>( + () -> listByManagedInstanceSinglePageAsync(resourceGroupName, managedInstanceName), + nextLink -> listByManagedInstanceNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of operations performed on the managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of operations performed on the managed instance as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByManagedInstanceAsync( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedFlux<>( + () -> listByManagedInstanceSinglePageAsync(resourceGroupName, managedInstanceName, context), + nextLink -> listByManagedInstanceNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of operations performed on the managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of operations performed on the managed instance as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByManagedInstance( + String resourceGroupName, String managedInstanceName) { + return new PagedIterable<>(listByManagedInstanceAsync(resourceGroupName, managedInstanceName)); + } + + /** + * Gets a list of operations performed on the managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of operations performed on the managed instance as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByManagedInstance( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedIterable<>(listByManagedInstanceAsync(resourceGroupName, managedInstanceName, context)); + } + + /** + * Gets a management operation on a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param operationId The operationId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a management operation on a managed instance along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, UUID operationId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + operationId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a management operation on a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param operationId The operationId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a management operation on a managed instance along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, UUID operationId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + operationId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a management operation on a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param operationId The operationId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a management operation on a managed instance on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String managedInstanceName, UUID operationId) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, operationId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a management operation on a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param operationId The operationId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a management operation on a managed instance along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, UUID operationId, Context context) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, operationId, context).block(); + } + + /** + * Gets a management operation on a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param operationId The operationId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a management operation on a managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceOperationInner get(String resourceGroupName, String managedInstanceName, UUID operationId) { + return getWithResponse(resourceGroupName, managedInstanceName, operationId, Context.NONE).getValue(); + } + + /** + * Cancels the asynchronous operation on the managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param operationId The operationId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> cancelWithResponseAsync( + String resourceGroupName, String managedInstanceName, UUID operationId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .cancel( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + operationId, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Cancels the asynchronous operation on the managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param operationId The operationId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> cancelWithResponseAsync( + String resourceGroupName, String managedInstanceName, UUID operationId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .cancel( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + operationId, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Cancels the asynchronous operation on the managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param operationId The operationId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono cancelAsync(String resourceGroupName, String managedInstanceName, UUID operationId) { + return cancelWithResponseAsync(resourceGroupName, managedInstanceName, operationId) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Cancels the asynchronous operation on the managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param operationId The operationId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response cancelWithResponse( + String resourceGroupName, String managedInstanceName, UUID operationId, Context context) { + return cancelWithResponseAsync(resourceGroupName, managedInstanceName, operationId, context).block(); + } + + /** + * Cancels the asynchronous operation on the managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param operationId The operationId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void cancel(String resourceGroupName, String managedInstanceName, UUID operationId) { + cancelWithResponse(resourceGroupName, managedInstanceName, operationId, Context.NONE); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list managed instance operations request along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByManagedInstanceNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByManagedInstanceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list managed instance operations request along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByManagedInstanceNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByManagedInstanceNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceOperationsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceOperationsImpl.java new file mode 100644 index 0000000000000..188d51d572da2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceOperationsImpl.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ManagedInstanceOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceOperationInner; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceOperation; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceOperations; +import java.util.UUID; + +public final class ManagedInstanceOperationsImpl implements ManagedInstanceOperations { + private static final ClientLogger LOGGER = new ClientLogger(ManagedInstanceOperationsImpl.class); + + private final ManagedInstanceOperationsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedInstanceOperationsImpl( + ManagedInstanceOperationsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByManagedInstance( + String resourceGroupName, String managedInstanceName) { + PagedIterable inner = + this.serviceClient().listByManagedInstance(resourceGroupName, managedInstanceName); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceOperationImpl(inner1, this.manager())); + } + + public PagedIterable listByManagedInstance( + String resourceGroupName, String managedInstanceName, Context context) { + PagedIterable inner = + this.serviceClient().listByManagedInstance(resourceGroupName, managedInstanceName, context); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceOperationImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, UUID operationId, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, managedInstanceName, operationId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ManagedInstanceOperationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ManagedInstanceOperation get(String resourceGroupName, String managedInstanceName, UUID operationId) { + ManagedInstanceOperationInner inner = + this.serviceClient().get(resourceGroupName, managedInstanceName, operationId); + if (inner != null) { + return new ManagedInstanceOperationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response cancelWithResponse( + String resourceGroupName, String managedInstanceName, UUID operationId, Context context) { + return this.serviceClient().cancelWithResponse(resourceGroupName, managedInstanceName, operationId, context); + } + + public void cancel(String resourceGroupName, String managedInstanceName, UUID operationId) { + this.serviceClient().cancel(resourceGroupName, managedInstanceName, operationId); + } + + private ManagedInstanceOperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstancePrivateEndpointConnectionImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstancePrivateEndpointConnectionImpl.java new file mode 100644 index 0000000000000..baced2b328332 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstancePrivateEndpointConnectionImpl.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstancePrivateEndpointConnectionInner; +import com.azure.resourcemanager.sql.generated.models.ManagedInstancePrivateEndpointConnection; +import com.azure.resourcemanager.sql.generated.models.ManagedInstancePrivateEndpointProperty; +import com.azure.resourcemanager.sql.generated.models.ManagedInstancePrivateLinkServiceConnectionStateProperty; + +public final class ManagedInstancePrivateEndpointConnectionImpl + implements ManagedInstancePrivateEndpointConnection, + ManagedInstancePrivateEndpointConnection.Definition, + ManagedInstancePrivateEndpointConnection.Update { + private ManagedInstancePrivateEndpointConnectionInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public ManagedInstancePrivateEndpointProperty privateEndpoint() { + return this.innerModel().privateEndpoint(); + } + + public ManagedInstancePrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState() { + return this.innerModel().privateLinkServiceConnectionState(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ManagedInstancePrivateEndpointConnectionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String managedInstanceName; + + private String privateEndpointConnectionName; + + public ManagedInstancePrivateEndpointConnectionImpl withExistingManagedInstance( + String resourceGroupName, String managedInstanceName) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + return this; + } + + public ManagedInstancePrivateEndpointConnection create() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstancePrivateEndpointConnections() + .createOrUpdate( + resourceGroupName, + managedInstanceName, + privateEndpointConnectionName, + this.innerModel(), + Context.NONE); + return this; + } + + public ManagedInstancePrivateEndpointConnection create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstancePrivateEndpointConnections() + .createOrUpdate( + resourceGroupName, managedInstanceName, privateEndpointConnectionName, this.innerModel(), context); + return this; + } + + ManagedInstancePrivateEndpointConnectionImpl( + String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ManagedInstancePrivateEndpointConnectionInner(); + this.serviceManager = serviceManager; + this.privateEndpointConnectionName = name; + } + + public ManagedInstancePrivateEndpointConnectionImpl update() { + return this; + } + + public ManagedInstancePrivateEndpointConnection apply() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstancePrivateEndpointConnections() + .createOrUpdate( + resourceGroupName, + managedInstanceName, + privateEndpointConnectionName, + this.innerModel(), + Context.NONE); + return this; + } + + public ManagedInstancePrivateEndpointConnection apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstancePrivateEndpointConnections() + .createOrUpdate( + resourceGroupName, managedInstanceName, privateEndpointConnectionName, this.innerModel(), context); + return this; + } + + ManagedInstancePrivateEndpointConnectionImpl( + ManagedInstancePrivateEndpointConnectionInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.managedInstanceName = Utils.getValueFromIdByName(innerObject.id(), "managedInstances"); + this.privateEndpointConnectionName = Utils.getValueFromIdByName(innerObject.id(), "privateEndpointConnections"); + } + + public ManagedInstancePrivateEndpointConnection refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstancePrivateEndpointConnections() + .getWithResponse(resourceGroupName, managedInstanceName, privateEndpointConnectionName, Context.NONE) + .getValue(); + return this; + } + + public ManagedInstancePrivateEndpointConnection refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstancePrivateEndpointConnections() + .getWithResponse(resourceGroupName, managedInstanceName, privateEndpointConnectionName, context) + .getValue(); + return this; + } + + public ManagedInstancePrivateEndpointConnectionImpl withPrivateEndpoint( + ManagedInstancePrivateEndpointProperty privateEndpoint) { + this.innerModel().withPrivateEndpoint(privateEndpoint); + return this; + } + + public ManagedInstancePrivateEndpointConnectionImpl withPrivateLinkServiceConnectionState( + ManagedInstancePrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState) { + this.innerModel().withPrivateLinkServiceConnectionState(privateLinkServiceConnectionState); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstancePrivateEndpointConnectionsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstancePrivateEndpointConnectionsClientImpl.java new file mode 100644 index 0000000000000..3c976c55a2455 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstancePrivateEndpointConnectionsClientImpl.java @@ -0,0 +1,1229 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ManagedInstancePrivateEndpointConnectionsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstancePrivateEndpointConnectionInner; +import com.azure.resourcemanager.sql.generated.models.ManagedInstancePrivateEndpointConnectionListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * ManagedInstancePrivateEndpointConnectionsClient. + */ +public final class ManagedInstancePrivateEndpointConnectionsClientImpl + implements ManagedInstancePrivateEndpointConnectionsClient { + /** The proxy service used to perform REST calls. */ + private final ManagedInstancePrivateEndpointConnectionsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedInstancePrivateEndpointConnectionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedInstancePrivateEndpointConnectionsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ManagedInstancePrivateEndpointConnectionsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientManagedInstancePrivateEndpointConnections to be + * used by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + public interface ManagedInstancePrivateEndpointConnectionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ManagedInstancePrivateEndpointConnectionInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/privateEndpointConnections") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByManagedInstance( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByManagedInstanceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, String privateEndpointConnectionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + privateEndpointConnectionName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, String privateEndpointConnectionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + privateEndpointConnectionName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String managedInstanceName, String privateEndpointConnectionName) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, privateEndpointConnectionName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, String privateEndpointConnectionName, Context context) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, privateEndpointConnectionName, context) + .block(); + } + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstancePrivateEndpointConnectionInner get( + String resourceGroupName, String managedInstanceName, String privateEndpointConnectionName) { + return getWithResponse(resourceGroupName, managedInstanceName, privateEndpointConnectionName, Context.NONE) + .getValue(); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String privateEndpointConnectionName, + ManagedInstancePrivateEndpointConnectionInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + privateEndpointConnectionName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String privateEndpointConnectionName, + ManagedInstancePrivateEndpointConnectionInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + privateEndpointConnectionName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux< + PollResult, ManagedInstancePrivateEndpointConnectionInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String privateEndpointConnectionName, + ManagedInstancePrivateEndpointConnectionInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, managedInstanceName, privateEndpointConnectionName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedInstancePrivateEndpointConnectionInner.class, + ManagedInstancePrivateEndpointConnectionInner.class, + this.client.getContext()); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux< + PollResult, ManagedInstancePrivateEndpointConnectionInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String privateEndpointConnectionName, + ManagedInstancePrivateEndpointConnectionInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, managedInstanceName, privateEndpointConnectionName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedInstancePrivateEndpointConnectionInner.class, + ManagedInstancePrivateEndpointConnectionInner.class, + context); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller< + PollResult, ManagedInstancePrivateEndpointConnectionInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String privateEndpointConnectionName, + ManagedInstancePrivateEndpointConnectionInner parameters) { + return beginCreateOrUpdateAsync( + resourceGroupName, managedInstanceName, privateEndpointConnectionName, parameters) + .getSyncPoller(); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller< + PollResult, ManagedInstancePrivateEndpointConnectionInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String privateEndpointConnectionName, + ManagedInstancePrivateEndpointConnectionInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, managedInstanceName, privateEndpointConnectionName, parameters, context) + .getSyncPoller(); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String privateEndpointConnectionName, + ManagedInstancePrivateEndpointConnectionInner parameters) { + return beginCreateOrUpdateAsync( + resourceGroupName, managedInstanceName, privateEndpointConnectionName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String privateEndpointConnectionName, + ManagedInstancePrivateEndpointConnectionInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, managedInstanceName, privateEndpointConnectionName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstancePrivateEndpointConnectionInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String privateEndpointConnectionName, + ManagedInstancePrivateEndpointConnectionInner parameters) { + return createOrUpdateAsync(resourceGroupName, managedInstanceName, privateEndpointConnectionName, parameters) + .block(); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstancePrivateEndpointConnectionInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String privateEndpointConnectionName, + ManagedInstancePrivateEndpointConnectionInner parameters, + Context context) { + return createOrUpdateAsync( + resourceGroupName, managedInstanceName, privateEndpointConnectionName, parameters, context) + .block(); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String managedInstanceName, String privateEndpointConnectionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + privateEndpointConnectionName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String managedInstanceName, String privateEndpointConnectionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + privateEndpointConnectionName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String managedInstanceName, String privateEndpointConnectionName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, managedInstanceName, privateEndpointConnectionName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String managedInstanceName, String privateEndpointConnectionName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, managedInstanceName, privateEndpointConnectionName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, String privateEndpointConnectionName) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, privateEndpointConnectionName).getSyncPoller(); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, String privateEndpointConnectionName, Context context) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, privateEndpointConnectionName, context) + .getSyncPoller(); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String managedInstanceName, String privateEndpointConnectionName) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, privateEndpointConnectionName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String managedInstanceName, String privateEndpointConnectionName, Context context) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, privateEndpointConnectionName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String managedInstanceName, String privateEndpointConnectionName) { + deleteAsync(resourceGroupName, managedInstanceName, privateEndpointConnectionName).block(); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, String managedInstanceName, String privateEndpointConnectionName, Context context) { + deleteAsync(resourceGroupName, managedInstanceName, privateEndpointConnectionName, context).block(); + } + + /** + * Gets all private endpoint connections on a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all private endpoint connections on a server along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByManagedInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByManagedInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets all private endpoint connections on a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all private endpoint connections on a server along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByManagedInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByManagedInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets all private endpoint connections on a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all private endpoint connections on a server as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByManagedInstanceAsync( + String resourceGroupName, String managedInstanceName) { + return new PagedFlux<>( + () -> listByManagedInstanceSinglePageAsync(resourceGroupName, managedInstanceName), + nextLink -> listByManagedInstanceNextSinglePageAsync(nextLink)); + } + + /** + * Gets all private endpoint connections on a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all private endpoint connections on a server as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByManagedInstanceAsync( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedFlux<>( + () -> listByManagedInstanceSinglePageAsync(resourceGroupName, managedInstanceName, context), + nextLink -> listByManagedInstanceNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all private endpoint connections on a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all private endpoint connections on a server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByManagedInstance( + String resourceGroupName, String managedInstanceName) { + return new PagedIterable<>(listByManagedInstanceAsync(resourceGroupName, managedInstanceName)); + } + + /** + * Gets all private endpoint connections on a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all private endpoint connections on a server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByManagedInstance( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedIterable<>(listByManagedInstanceAsync(resourceGroupName, managedInstanceName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private endpoint connections along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByManagedInstanceNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByManagedInstanceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private endpoint connections along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByManagedInstanceNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByManagedInstanceNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstancePrivateEndpointConnectionsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstancePrivateEndpointConnectionsImpl.java new file mode 100644 index 0000000000000..21230d059debf --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstancePrivateEndpointConnectionsImpl.java @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ManagedInstancePrivateEndpointConnectionsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstancePrivateEndpointConnectionInner; +import com.azure.resourcemanager.sql.generated.models.ManagedInstancePrivateEndpointConnection; +import com.azure.resourcemanager.sql.generated.models.ManagedInstancePrivateEndpointConnections; + +public final class ManagedInstancePrivateEndpointConnectionsImpl implements ManagedInstancePrivateEndpointConnections { + private static final ClientLogger LOGGER = new ClientLogger(ManagedInstancePrivateEndpointConnectionsImpl.class); + + private final ManagedInstancePrivateEndpointConnectionsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedInstancePrivateEndpointConnectionsImpl( + ManagedInstancePrivateEndpointConnectionsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, String privateEndpointConnectionName, Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, managedInstanceName, privateEndpointConnectionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ManagedInstancePrivateEndpointConnectionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ManagedInstancePrivateEndpointConnection get( + String resourceGroupName, String managedInstanceName, String privateEndpointConnectionName) { + ManagedInstancePrivateEndpointConnectionInner inner = + this.serviceClient().get(resourceGroupName, managedInstanceName, privateEndpointConnectionName); + if (inner != null) { + return new ManagedInstancePrivateEndpointConnectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String managedInstanceName, String privateEndpointConnectionName) { + this.serviceClient().delete(resourceGroupName, managedInstanceName, privateEndpointConnectionName); + } + + public void delete( + String resourceGroupName, String managedInstanceName, String privateEndpointConnectionName, Context context) { + this.serviceClient().delete(resourceGroupName, managedInstanceName, privateEndpointConnectionName, context); + } + + public PagedIterable listByManagedInstance( + String resourceGroupName, String managedInstanceName) { + PagedIterable inner = + this.serviceClient().listByManagedInstance(resourceGroupName, managedInstanceName); + return Utils.mapPage(inner, inner1 -> new ManagedInstancePrivateEndpointConnectionImpl(inner1, this.manager())); + } + + public PagedIterable listByManagedInstance( + String resourceGroupName, String managedInstanceName, Context context) { + PagedIterable inner = + this.serviceClient().listByManagedInstance(resourceGroupName, managedInstanceName, context); + return Utils.mapPage(inner, inner1 -> new ManagedInstancePrivateEndpointConnectionImpl(inner1, this.manager())); + } + + public ManagedInstancePrivateEndpointConnection getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String privateEndpointConnectionName = Utils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", + id))); + } + return this + .getWithResponse(resourceGroupName, managedInstanceName, privateEndpointConnectionName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String privateEndpointConnectionName = Utils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", + id))); + } + return this.getWithResponse(resourceGroupName, managedInstanceName, privateEndpointConnectionName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String privateEndpointConnectionName = Utils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", + id))); + } + this.delete(resourceGroupName, managedInstanceName, privateEndpointConnectionName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String privateEndpointConnectionName = Utils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", + id))); + } + this.delete(resourceGroupName, managedInstanceName, privateEndpointConnectionName, context); + } + + private ManagedInstancePrivateEndpointConnectionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ManagedInstancePrivateEndpointConnectionImpl define(String name) { + return new ManagedInstancePrivateEndpointConnectionImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstancePrivateLinkImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstancePrivateLinkImpl.java new file mode 100644 index 0000000000000..cf99abd95d416 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstancePrivateLinkImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstancePrivateLinkInner; +import com.azure.resourcemanager.sql.generated.models.ManagedInstancePrivateLink; +import com.azure.resourcemanager.sql.generated.models.ManagedInstancePrivateLinkProperties; + +public final class ManagedInstancePrivateLinkImpl implements ManagedInstancePrivateLink { + private ManagedInstancePrivateLinkInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + ManagedInstancePrivateLinkImpl( + ManagedInstancePrivateLinkInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public ManagedInstancePrivateLinkProperties properties() { + return this.innerModel().properties(); + } + + public ManagedInstancePrivateLinkInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstancePrivateLinkResourcesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstancePrivateLinkResourcesClientImpl.java new file mode 100644 index 0000000000000..222909c944cbc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstancePrivateLinkResourcesClientImpl.java @@ -0,0 +1,545 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.ManagedInstancePrivateLinkResourcesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstancePrivateLinkInner; +import com.azure.resourcemanager.sql.generated.models.ManagedInstancePrivateLinkListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ManagedInstancePrivateLinkResourcesClient. + */ +public final class ManagedInstancePrivateLinkResourcesClientImpl implements ManagedInstancePrivateLinkResourcesClient { + /** The proxy service used to perform REST calls. */ + private final ManagedInstancePrivateLinkResourcesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedInstancePrivateLinkResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedInstancePrivateLinkResourcesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ManagedInstancePrivateLinkResourcesService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientManagedInstancePrivateLinkResources to be used by + * the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + public interface ManagedInstancePrivateLinkResourcesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/privateLinkResources") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByManagedInstance( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/privateLinkResources/{groupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("groupName") String groupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByManagedInstanceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the private link resources for 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 managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources for SQL server along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByManagedInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByManagedInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the private link resources for 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 managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources for SQL server along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByManagedInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByManagedInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets the private link resources for 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 managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources for SQL server as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByManagedInstanceAsync( + String resourceGroupName, String managedInstanceName) { + return new PagedFlux<>( + () -> listByManagedInstanceSinglePageAsync(resourceGroupName, managedInstanceName), + nextLink -> listByManagedInstanceNextSinglePageAsync(nextLink)); + } + + /** + * Gets the private link resources for 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 managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources for SQL server as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByManagedInstanceAsync( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedFlux<>( + () -> listByManagedInstanceSinglePageAsync(resourceGroupName, managedInstanceName, context), + nextLink -> listByManagedInstanceNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets the private link resources for 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 managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources for SQL server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByManagedInstance( + String resourceGroupName, String managedInstanceName) { + return new PagedIterable<>(listByManagedInstanceAsync(resourceGroupName, managedInstanceName)); + } + + /** + * Gets the private link resources for 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 managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources for SQL server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByManagedInstance( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedIterable<>(listByManagedInstanceAsync(resourceGroupName, managedInstanceName, context)); + } + + /** + * Gets a private link resource for 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 managedInstanceName The name of the managed instance. + * @param groupName The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private link resource for SQL server along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, String groupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (groupName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + groupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a private link resource for 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 managedInstanceName The name of the managed instance. + * @param groupName The name of the private link resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private link resource for SQL server along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, String groupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (groupName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + groupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a private link resource for 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 managedInstanceName The name of the managed instance. + * @param groupName The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private link resource for SQL server on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String managedInstanceName, String groupName) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, groupName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a private link resource for 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 managedInstanceName The name of the managed instance. + * @param groupName The name of the private link resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private link resource for SQL server along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, String groupName, Context context) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, groupName, context).block(); + } + + /** + * Gets a private link resource for 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 managedInstanceName The name of the managed instance. + * @param groupName The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private link resource for SQL server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstancePrivateLinkInner get(String resourceGroupName, String managedInstanceName, String groupName) { + return getWithResponse(resourceGroupName, managedInstanceName, groupName, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

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

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private link resources along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByManagedInstanceNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByManagedInstanceNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstancePrivateLinkResourcesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstancePrivateLinkResourcesImpl.java new file mode 100644 index 0000000000000..4aa108ea56ff1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstancePrivateLinkResourcesImpl.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ManagedInstancePrivateLinkResourcesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstancePrivateLinkInner; +import com.azure.resourcemanager.sql.generated.models.ManagedInstancePrivateLink; +import com.azure.resourcemanager.sql.generated.models.ManagedInstancePrivateLinkResources; + +public final class ManagedInstancePrivateLinkResourcesImpl implements ManagedInstancePrivateLinkResources { + private static final ClientLogger LOGGER = new ClientLogger(ManagedInstancePrivateLinkResourcesImpl.class); + + private final ManagedInstancePrivateLinkResourcesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedInstancePrivateLinkResourcesImpl( + ManagedInstancePrivateLinkResourcesClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByManagedInstance( + String resourceGroupName, String managedInstanceName) { + PagedIterable inner = + this.serviceClient().listByManagedInstance(resourceGroupName, managedInstanceName); + return Utils.mapPage(inner, inner1 -> new ManagedInstancePrivateLinkImpl(inner1, this.manager())); + } + + public PagedIterable listByManagedInstance( + String resourceGroupName, String managedInstanceName, Context context) { + PagedIterable inner = + this.serviceClient().listByManagedInstance(resourceGroupName, managedInstanceName, context); + return Utils.mapPage(inner, inner1 -> new ManagedInstancePrivateLinkImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, String groupName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, managedInstanceName, groupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ManagedInstancePrivateLinkImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ManagedInstancePrivateLink get(String resourceGroupName, String managedInstanceName, String groupName) { + ManagedInstancePrivateLinkInner inner = + this.serviceClient().get(resourceGroupName, managedInstanceName, groupName); + if (inner != null) { + return new ManagedInstancePrivateLinkImpl(inner, this.manager()); + } else { + return null; + } + } + + private ManagedInstancePrivateLinkResourcesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceQueryImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceQueryImpl.java new file mode 100644 index 0000000000000..76740a7f1403b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceQueryImpl.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceQueryInner; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceQuery; + +public final class ManagedInstanceQueryImpl implements ManagedInstanceQuery { + private ManagedInstanceQueryInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + ManagedInstanceQueryImpl( + ManagedInstanceQueryInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String queryText() { + return this.innerModel().queryText(); + } + + public ManagedInstanceQueryInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceTdeCertificatesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceTdeCertificatesClientImpl.java new file mode 100644 index 0000000000000..6a413c3979f4b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceTdeCertificatesClientImpl.java @@ -0,0 +1,346 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ManagedInstanceTdeCertificatesClient; +import com.azure.resourcemanager.sql.generated.models.TdeCertificate; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ManagedInstanceTdeCertificatesClient. */ +public final class ManagedInstanceTdeCertificatesClientImpl implements ManagedInstanceTdeCertificatesClient { + /** The proxy service used to perform REST calls. */ + private final ManagedInstanceTdeCertificatesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedInstanceTdeCertificatesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedInstanceTdeCertificatesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ManagedInstanceTdeCertificatesService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientManagedInstanceTdeCertificates to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + public interface ManagedInstanceTdeCertificatesService { + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/tdeCertificates") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") TdeCertificate parameters, + Context context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, String managedInstanceName, TdeCertificate parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, String managedInstanceName, TdeCertificate parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginCreateAsync( + String resourceGroupName, String managedInstanceName, TdeCertificate parameters) { + Mono>> mono = + createWithResponseAsync(resourceGroupName, managedInstanceName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginCreateAsync( + String resourceGroupName, String managedInstanceName, TdeCertificate parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createWithResponseAsync(resourceGroupName, managedInstanceName, parameters, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginCreate( + String resourceGroupName, String managedInstanceName, TdeCertificate parameters) { + return beginCreateAsync(resourceGroupName, managedInstanceName, parameters).getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginCreate( + String resourceGroupName, String managedInstanceName, TdeCertificate parameters, Context context) { + return beginCreateAsync(resourceGroupName, managedInstanceName, parameters, context).getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String managedInstanceName, TdeCertificate parameters) { + return beginCreateAsync(resourceGroupName, managedInstanceName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String managedInstanceName, TdeCertificate parameters, Context context) { + return beginCreateAsync(resourceGroupName, managedInstanceName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void create(String resourceGroupName, String managedInstanceName, TdeCertificate parameters) { + createAsync(resourceGroupName, managedInstanceName, parameters).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void create( + String resourceGroupName, String managedInstanceName, TdeCertificate parameters, Context context) { + createAsync(resourceGroupName, managedInstanceName, parameters, context).block(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceTdeCertificatesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceTdeCertificatesImpl.java new file mode 100644 index 0000000000000..a0c7e3fb9c191 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceTdeCertificatesImpl.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ManagedInstanceTdeCertificatesClient; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceTdeCertificates; +import com.azure.resourcemanager.sql.generated.models.TdeCertificate; + +public final class ManagedInstanceTdeCertificatesImpl implements ManagedInstanceTdeCertificates { + private static final ClientLogger LOGGER = new ClientLogger(ManagedInstanceTdeCertificatesImpl.class); + + private final ManagedInstanceTdeCertificatesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedInstanceTdeCertificatesImpl( + ManagedInstanceTdeCertificatesClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void create(String resourceGroupName, String managedInstanceName, TdeCertificate parameters) { + this.serviceClient().create(resourceGroupName, managedInstanceName, parameters); + } + + public void create( + String resourceGroupName, String managedInstanceName, TdeCertificate parameters, Context context) { + this.serviceClient().create(resourceGroupName, managedInstanceName, parameters, context); + } + + private ManagedInstanceTdeCertificatesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceVulnerabilityAssessmentImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceVulnerabilityAssessmentImpl.java new file mode 100644 index 0000000000000..3aa53417483f9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceVulnerabilityAssessmentImpl.java @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceVulnerabilityAssessmentInner; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceVulnerabilityAssessment; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentRecurringScansProperties; + +public final class ManagedInstanceVulnerabilityAssessmentImpl + implements ManagedInstanceVulnerabilityAssessment, + ManagedInstanceVulnerabilityAssessment.Definition, + ManagedInstanceVulnerabilityAssessment.Update { + private ManagedInstanceVulnerabilityAssessmentInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String storageContainerPath() { + return this.innerModel().storageContainerPath(); + } + + public String storageContainerSasKey() { + return this.innerModel().storageContainerSasKey(); + } + + public String storageAccountAccessKey() { + return this.innerModel().storageAccountAccessKey(); + } + + public VulnerabilityAssessmentRecurringScansProperties recurringScans() { + return this.innerModel().recurringScans(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ManagedInstanceVulnerabilityAssessmentInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String managedInstanceName; + + private VulnerabilityAssessmentName vulnerabilityAssessmentName; + + public ManagedInstanceVulnerabilityAssessmentImpl withExistingManagedInstance( + String resourceGroupName, String managedInstanceName) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + return this; + } + + public ManagedInstanceVulnerabilityAssessment create() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceVulnerabilityAssessments() + .createOrUpdateWithResponse( + resourceGroupName, + managedInstanceName, + vulnerabilityAssessmentName, + this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public ManagedInstanceVulnerabilityAssessment create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceVulnerabilityAssessments() + .createOrUpdateWithResponse( + resourceGroupName, managedInstanceName, vulnerabilityAssessmentName, this.innerModel(), context) + .getValue(); + return this; + } + + ManagedInstanceVulnerabilityAssessmentImpl( + VulnerabilityAssessmentName name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ManagedInstanceVulnerabilityAssessmentInner(); + this.serviceManager = serviceManager; + this.vulnerabilityAssessmentName = name; + } + + public ManagedInstanceVulnerabilityAssessmentImpl update() { + return this; + } + + public ManagedInstanceVulnerabilityAssessment apply() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceVulnerabilityAssessments() + .createOrUpdateWithResponse( + resourceGroupName, + managedInstanceName, + vulnerabilityAssessmentName, + this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public ManagedInstanceVulnerabilityAssessment apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceVulnerabilityAssessments() + .createOrUpdateWithResponse( + resourceGroupName, managedInstanceName, vulnerabilityAssessmentName, this.innerModel(), context) + .getValue(); + return this; + } + + ManagedInstanceVulnerabilityAssessmentImpl( + ManagedInstanceVulnerabilityAssessmentInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.managedInstanceName = Utils.getValueFromIdByName(innerObject.id(), "managedInstances"); + this.vulnerabilityAssessmentName = + VulnerabilityAssessmentName + .fromString(Utils.getValueFromIdByName(innerObject.id(), "vulnerabilityAssessments")); + } + + public ManagedInstanceVulnerabilityAssessment refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceVulnerabilityAssessments() + .getWithResponse(resourceGroupName, managedInstanceName, vulnerabilityAssessmentName, Context.NONE) + .getValue(); + return this; + } + + public ManagedInstanceVulnerabilityAssessment refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedInstanceVulnerabilityAssessments() + .getWithResponse(resourceGroupName, managedInstanceName, vulnerabilityAssessmentName, context) + .getValue(); + return this; + } + + public ManagedInstanceVulnerabilityAssessmentImpl withStorageContainerPath(String storageContainerPath) { + this.innerModel().withStorageContainerPath(storageContainerPath); + return this; + } + + public ManagedInstanceVulnerabilityAssessmentImpl withStorageContainerSasKey(String storageContainerSasKey) { + this.innerModel().withStorageContainerSasKey(storageContainerSasKey); + return this; + } + + public ManagedInstanceVulnerabilityAssessmentImpl withStorageAccountAccessKey(String storageAccountAccessKey) { + this.innerModel().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + public ManagedInstanceVulnerabilityAssessmentImpl withRecurringScans( + VulnerabilityAssessmentRecurringScansProperties recurringScans) { + this.innerModel().withRecurringScans(recurringScans); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceVulnerabilityAssessmentsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceVulnerabilityAssessmentsClientImpl.java new file mode 100644 index 0000000000000..4598017d894f9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceVulnerabilityAssessmentsClientImpl.java @@ -0,0 +1,996 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.ManagedInstanceVulnerabilityAssessmentsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceVulnerabilityAssessmentInner; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceVulnerabilityAssessmentListResult; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * ManagedInstanceVulnerabilityAssessmentsClient. + */ +public final class ManagedInstanceVulnerabilityAssessmentsClientImpl + implements ManagedInstanceVulnerabilityAssessmentsClient { + /** The proxy service used to perform REST calls. */ + private final ManagedInstanceVulnerabilityAssessmentsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedInstanceVulnerabilityAssessmentsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedInstanceVulnerabilityAssessmentsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ManagedInstanceVulnerabilityAssessmentsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientManagedInstanceVulnerabilityAssessments to be used + * by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + public interface ManagedInstanceVulnerabilityAssessmentsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ManagedInstanceVulnerabilityAssessmentInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/vulnerabilityAssessments") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInstance( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInstanceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed instance's vulnerability assessment along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, VulnerabilityAssessmentName vulnerabilityAssessmentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed instance's vulnerability assessment along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed instance's vulnerability assessment on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String managedInstanceName, VulnerabilityAssessmentName vulnerabilityAssessmentName) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, vulnerabilityAssessmentName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed instance's vulnerability assessment along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, vulnerabilityAssessmentName, context) + .block(); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed instance's vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceVulnerabilityAssessmentInner get( + String resourceGroupName, String managedInstanceName, VulnerabilityAssessmentName vulnerabilityAssessmentName) { + return getWithResponse(resourceGroupName, managedInstanceName, vulnerabilityAssessmentName, Context.NONE) + .getValue(); + } + + /** + * Creates or updates the managed instance's vulnerability assessment. Learn more about setting SQL vulnerability + * assessment with managed identity - + * https://docs.microsoft.com/azure/azure-sql/database/sql-database-vulnerability-assessment-storage. + * + * @param resourceGroupName The name of the resource group that contains 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance vulnerability assessment along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + ManagedInstanceVulnerabilityAssessmentInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates the managed instance's vulnerability assessment. Learn more about setting SQL vulnerability + * assessment with managed identity - + * https://docs.microsoft.com/azure/azure-sql/database/sql-database-vulnerability-assessment-storage. + * + * @param resourceGroupName The name of the resource group that contains 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance vulnerability assessment along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + ManagedInstanceVulnerabilityAssessmentInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates the managed instance's vulnerability assessment. Learn more about setting SQL vulnerability + * assessment with managed identity - + * https://docs.microsoft.com/azure/azure-sql/database/sql-database-vulnerability-assessment-storage. + * + * @param resourceGroupName The name of the resource group that contains 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance vulnerability assessment on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + ManagedInstanceVulnerabilityAssessmentInner parameters) { + return createOrUpdateWithResponseAsync( + resourceGroupName, managedInstanceName, vulnerabilityAssessmentName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or updates the managed instance's vulnerability assessment. Learn more about setting SQL vulnerability + * assessment with managed identity - + * https://docs.microsoft.com/azure/azure-sql/database/sql-database-vulnerability-assessment-storage. + * + * @param resourceGroupName The name of the resource group that contains 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance vulnerability assessment along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String managedInstanceName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + ManagedInstanceVulnerabilityAssessmentInner parameters, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, managedInstanceName, vulnerabilityAssessmentName, parameters, context) + .block(); + } + + /** + * Creates or updates the managed instance's vulnerability assessment. Learn more about setting SQL vulnerability + * assessment with managed identity - + * https://docs.microsoft.com/azure/azure-sql/database/sql-database-vulnerability-assessment-storage. + * + * @param resourceGroupName The name of the resource group that contains 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceVulnerabilityAssessmentInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + ManagedInstanceVulnerabilityAssessmentInner parameters) { + return createOrUpdateWithResponse( + resourceGroupName, managedInstanceName, vulnerabilityAssessmentName, parameters, Context.NONE) + .getValue(); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String managedInstanceName, VulnerabilityAssessmentName vulnerabilityAssessmentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String managedInstanceName, VulnerabilityAssessmentName vulnerabilityAssessmentName) { + return deleteWithResponseAsync(resourceGroupName, managedInstanceName, vulnerabilityAssessmentName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, + String managedInstanceName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + return deleteWithResponseAsync(resourceGroupName, managedInstanceName, vulnerabilityAssessmentName, context) + .block(); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, String managedInstanceName, VulnerabilityAssessmentName vulnerabilityAssessmentName) { + deleteWithResponse(resourceGroupName, managedInstanceName, vulnerabilityAssessmentName, Context.NONE); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed instance's vulnerability assessment policies along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed instance's vulnerability assessment policies along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed instance's vulnerability assessment policies as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync( + String resourceGroupName, String managedInstanceName) { + return new PagedFlux<>( + () -> listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName), + nextLink -> listByInstanceNextSinglePageAsync(nextLink)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed instance's vulnerability assessment policies as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedFlux<>( + () -> listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName, context), + nextLink -> listByInstanceNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed instance's vulnerability assessment policies as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName) { + return new PagedIterable<>(listByInstanceAsync(resourceGroupName, 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed instance's vulnerability assessment policies as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedIterable<>(listByInstanceAsync(resourceGroupName, managedInstanceName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the ManagedInstance's vulnerability assessments along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByInstanceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the ManagedInstance's vulnerability assessments along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInstanceNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceVulnerabilityAssessmentsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceVulnerabilityAssessmentsImpl.java new file mode 100644 index 0000000000000..86f50b41c0d77 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstanceVulnerabilityAssessmentsImpl.java @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ManagedInstanceVulnerabilityAssessmentsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceVulnerabilityAssessmentInner; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceVulnerabilityAssessment; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceVulnerabilityAssessments; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +public final class ManagedInstanceVulnerabilityAssessmentsImpl implements ManagedInstanceVulnerabilityAssessments { + private static final ClientLogger LOGGER = new ClientLogger(ManagedInstanceVulnerabilityAssessmentsImpl.class); + + private final ManagedInstanceVulnerabilityAssessmentsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedInstanceVulnerabilityAssessmentsImpl( + ManagedInstanceVulnerabilityAssessmentsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, managedInstanceName, vulnerabilityAssessmentName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ManagedInstanceVulnerabilityAssessmentImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ManagedInstanceVulnerabilityAssessment get( + String resourceGroupName, String managedInstanceName, VulnerabilityAssessmentName vulnerabilityAssessmentName) { + ManagedInstanceVulnerabilityAssessmentInner inner = + this.serviceClient().get(resourceGroupName, managedInstanceName, vulnerabilityAssessmentName); + if (inner != null) { + return new ManagedInstanceVulnerabilityAssessmentImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse( + String resourceGroupName, + String managedInstanceName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + return this + .serviceClient() + .deleteWithResponse(resourceGroupName, managedInstanceName, vulnerabilityAssessmentName, context); + } + + public void delete( + String resourceGroupName, String managedInstanceName, VulnerabilityAssessmentName vulnerabilityAssessmentName) { + this.serviceClient().delete(resourceGroupName, managedInstanceName, vulnerabilityAssessmentName); + } + + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName) { + PagedIterable inner = + this.serviceClient().listByInstance(resourceGroupName, managedInstanceName); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceVulnerabilityAssessmentImpl(inner1, this.manager())); + } + + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context) { + PagedIterable inner = + this.serviceClient().listByInstance(resourceGroupName, managedInstanceName, context); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceVulnerabilityAssessmentImpl(inner1, this.manager())); + } + + public ManagedInstanceVulnerabilityAssessment getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String vulnerabilityAssessmentNameLocal = Utils.getValueFromIdByName(id, "vulnerabilityAssessments"); + if (vulnerabilityAssessmentNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'vulnerabilityAssessments'.", + id))); + } + VulnerabilityAssessmentName vulnerabilityAssessmentName = + VulnerabilityAssessmentName.fromString(vulnerabilityAssessmentNameLocal); + return this + .getWithResponse(resourceGroupName, managedInstanceName, vulnerabilityAssessmentName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String vulnerabilityAssessmentNameLocal = Utils.getValueFromIdByName(id, "vulnerabilityAssessments"); + if (vulnerabilityAssessmentNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'vulnerabilityAssessments'.", + id))); + } + VulnerabilityAssessmentName vulnerabilityAssessmentName = + VulnerabilityAssessmentName.fromString(vulnerabilityAssessmentNameLocal); + return this.getWithResponse(resourceGroupName, managedInstanceName, vulnerabilityAssessmentName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String vulnerabilityAssessmentNameLocal = Utils.getValueFromIdByName(id, "vulnerabilityAssessments"); + if (vulnerabilityAssessmentNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'vulnerabilityAssessments'.", + id))); + } + VulnerabilityAssessmentName vulnerabilityAssessmentName = + VulnerabilityAssessmentName.fromString(vulnerabilityAssessmentNameLocal); + this.deleteWithResponse(resourceGroupName, managedInstanceName, vulnerabilityAssessmentName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String vulnerabilityAssessmentNameLocal = Utils.getValueFromIdByName(id, "vulnerabilityAssessments"); + if (vulnerabilityAssessmentNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'vulnerabilityAssessments'.", + id))); + } + VulnerabilityAssessmentName vulnerabilityAssessmentName = + VulnerabilityAssessmentName.fromString(vulnerabilityAssessmentNameLocal); + return this.deleteWithResponse(resourceGroupName, managedInstanceName, vulnerabilityAssessmentName, context); + } + + private ManagedInstanceVulnerabilityAssessmentsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ManagedInstanceVulnerabilityAssessmentImpl define(VulnerabilityAssessmentName name) { + return new ManagedInstanceVulnerabilityAssessmentImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstancesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstancesClientImpl.java new file mode 100644 index 0000000000000..694bd70cfdbd3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstancesClientImpl.java @@ -0,0 +1,2776 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ManagedInstancesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceInner; +import com.azure.resourcemanager.sql.generated.fluent.models.TopQueriesInner; +import com.azure.resourcemanager.sql.generated.models.AggregationFunctionType; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceListResult; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceUpdate; +import com.azure.resourcemanager.sql.generated.models.MetricType; +import com.azure.resourcemanager.sql.generated.models.QueryTimeGrainType; +import com.azure.resourcemanager.sql.generated.models.ReplicaType; +import com.azure.resourcemanager.sql.generated.models.TopQueriesListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ManagedInstancesClient. */ +public final class ManagedInstancesClientImpl implements ManagedInstancesClient { + /** The proxy service used to perform REST calls. */ + private final ManagedInstancesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedInstancesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedInstancesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(ManagedInstancesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientManagedInstances to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + public interface ManagedInstancesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools" + + "/{instancePoolName}/managedInstances") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInstancePool( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("instancePoolName") String instancePoolName, + @QueryParam("$expand") String expand, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/managedInstances") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("$expand") String expand, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("$expand") String expand, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @QueryParam("$expand") String expand, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ManagedInstanceInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ManagedInstanceUpdate parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/topqueries") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByManagedInstance( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @QueryParam("numberOfQueries") Integer numberOfQueries, + @QueryParam("databases") String databases, + @QueryParam("startTime") String startTime, + @QueryParam("endTime") String endTime, + @QueryParam("interval") QueryTimeGrainType interval, + @QueryParam("aggregationFunction") AggregationFunctionType aggregationFunction, + @QueryParam("observationMetric") MetricType observationMetric, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/failover") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> failover( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @QueryParam("replicaType") ReplicaType replicaType, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInstancePoolNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByManagedInstanceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a list of all managed instances in an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The instance pool name. + * @param expand The child resources to include in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all managed instances in an instance pool along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstancePoolSinglePageAsync( + String resourceGroupName, String instancePoolName, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (instancePoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter instancePoolName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByInstancePool( + this.client.getEndpoint(), + resourceGroupName, + instancePoolName, + expand, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of all managed instances in an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The instance pool name. + * @param expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all managed instances in an instance pool along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstancePoolSinglePageAsync( + String resourceGroupName, String instancePoolName, String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (instancePoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter instancePoolName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInstancePool( + this.client.getEndpoint(), + resourceGroupName, + instancePoolName, + expand, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of all managed instances in an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The instance pool name. + * @param expand The child resources to include in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all managed instances in an instance pool as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstancePoolAsync( + String resourceGroupName, String instancePoolName, String expand) { + return new PagedFlux<>( + () -> listByInstancePoolSinglePageAsync(resourceGroupName, instancePoolName, expand), + nextLink -> listByInstancePoolNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of all managed instances in an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The instance pool name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all managed instances in an instance pool as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstancePoolAsync(String resourceGroupName, String instancePoolName) { + final String expand = null; + return new PagedFlux<>( + () -> listByInstancePoolSinglePageAsync(resourceGroupName, instancePoolName, expand), + nextLink -> listByInstancePoolNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of all managed instances in an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The instance pool name. + * @param expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all managed instances in an instance pool as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstancePoolAsync( + String resourceGroupName, String instancePoolName, String expand, Context context) { + return new PagedFlux<>( + () -> listByInstancePoolSinglePageAsync(resourceGroupName, instancePoolName, expand, context), + nextLink -> listByInstancePoolNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of all managed instances in an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The instance pool name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all managed instances in an instance pool as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstancePool(String resourceGroupName, String instancePoolName) { + final String expand = null; + return new PagedIterable<>(listByInstancePoolAsync(resourceGroupName, instancePoolName, expand)); + } + + /** + * Gets a list of all managed instances in an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The instance pool name. + * @param expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all managed instances in an instance pool as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstancePool( + String resourceGroupName, String instancePoolName, String expand, Context context) { + return new PagedIterable<>(listByInstancePoolAsync(resourceGroupName, instancePoolName, expand, context)); + } + + /** + * Gets a list of all managed instances in the subscription. + * + * @param expand The child resources to include in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all managed instances in the subscription along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + expand, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of all managed instances in the subscription. + * + * @param expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all managed instances in the subscription along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), expand, this.client.getSubscriptionId(), apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of all managed instances in the subscription. + * + * @param expand The child resources to include in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all managed instances in the subscription as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String expand) { + return new PagedFlux<>(() -> listSinglePageAsync(expand), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of all managed instances in the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all managed instances in the subscription as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final String expand = null; + return new PagedFlux<>(() -> listSinglePageAsync(expand), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of all managed instances in the subscription. + * + * @param expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all managed instances in the subscription as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String expand, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(expand, context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of all managed instances in the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all managed instances in the subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final String expand = null; + return new PagedIterable<>(listAsync(expand)); + } + + /** + * Gets a list of all managed instances in the subscription. + * + * @param expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all managed instances in the subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String expand, Context context) { + return new PagedIterable<>(listAsync(expand, context)); + } + + /** + * 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 expand The child resources to include in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instances in a resource group along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + expand, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instances in a resource group along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + expand, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 expand The child resources to include in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instances in a resource group as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, String expand) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, expand), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instances in a resource group as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + final String expand = null; + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, expand), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * 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 expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instances in a resource group as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, String expand, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, expand, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instances in a resource group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + final String expand = null; + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, expand)); + } + + /** + * 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 expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instances in a resource group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup( + String resourceGroupName, String expand, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, expand, context)); + } + + /** + * 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 expand The child resources to include in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String managedInstanceName, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + expand, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String managedInstanceName, String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + expand, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String managedInstanceName) { + final String expand = null; + return getByResourceGroupWithResponseAsync(resourceGroupName, managedInstanceName, expand) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String managedInstanceName, String expand, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, managedInstanceName, expand, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceInner getByResourceGroup(String resourceGroupName, String managedInstanceName) { + final String expand = null; + return getByResourceGroupWithResponse(resourceGroupName, managedInstanceName, expand, Context.NONE).getValue(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL managed instance along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String managedInstanceName, ManagedInstanceInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL managed instance along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String managedInstanceName, ManagedInstanceInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ManagedInstanceInner> beginCreateOrUpdateAsync( + String resourceGroupName, String managedInstanceName, ManagedInstanceInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, managedInstanceName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedInstanceInner.class, + ManagedInstanceInner.class, + this.client.getContext()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ManagedInstanceInner> beginCreateOrUpdateAsync( + String resourceGroupName, String managedInstanceName, ManagedInstanceInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, managedInstanceName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ManagedInstanceInner.class, ManagedInstanceInner.class, context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ManagedInstanceInner> beginCreateOrUpdate( + String resourceGroupName, String managedInstanceName, ManagedInstanceInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, parameters).getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ManagedInstanceInner> beginCreateOrUpdate( + String resourceGroupName, String managedInstanceName, ManagedInstanceInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, parameters, context).getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL managed instance on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String managedInstanceName, ManagedInstanceInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL managed instance on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String managedInstanceName, ManagedInstanceInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceInner createOrUpdate( + String resourceGroupName, String managedInstanceName, ManagedInstanceInner parameters) { + return createOrUpdateAsync(resourceGroupName, managedInstanceName, parameters).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceInner createOrUpdate( + String resourceGroupName, String managedInstanceName, ManagedInstanceInner parameters, Context context) { + return createOrUpdateAsync(resourceGroupName, managedInstanceName, parameters, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String managedInstanceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String managedInstanceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String managedInstanceName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, managedInstanceName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String managedInstanceName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, managedInstanceName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String managedInstanceName) { + return beginDeleteAsync(resourceGroupName, managedInstanceName).getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, Context context) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, context).getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String managedInstanceName) { + return beginDeleteAsync(resourceGroupName, managedInstanceName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String managedInstanceName, Context context) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String managedInstanceName) { + deleteAsync(resourceGroupName, managedInstanceName).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String managedInstanceName, Context context) { + deleteAsync(resourceGroupName, managedInstanceName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL managed instance along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String managedInstanceName, ManagedInstanceUpdate parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL managed instance along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String managedInstanceName, ManagedInstanceUpdate parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ManagedInstanceInner> beginUpdateAsync( + String resourceGroupName, String managedInstanceName, ManagedInstanceUpdate parameters) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, managedInstanceName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedInstanceInner.class, + ManagedInstanceInner.class, + this.client.getContext()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ManagedInstanceInner> beginUpdateAsync( + String resourceGroupName, String managedInstanceName, ManagedInstanceUpdate parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, managedInstanceName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ManagedInstanceInner.class, ManagedInstanceInner.class, context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ManagedInstanceInner> beginUpdate( + String resourceGroupName, String managedInstanceName, ManagedInstanceUpdate parameters) { + return beginUpdateAsync(resourceGroupName, managedInstanceName, parameters).getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ManagedInstanceInner> beginUpdate( + String resourceGroupName, String managedInstanceName, ManagedInstanceUpdate parameters, Context context) { + return beginUpdateAsync(resourceGroupName, managedInstanceName, parameters, context).getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL managed instance on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String managedInstanceName, ManagedInstanceUpdate parameters) { + return beginUpdateAsync(resourceGroupName, managedInstanceName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL managed instance on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String managedInstanceName, ManagedInstanceUpdate parameters, Context context) { + return beginUpdateAsync(resourceGroupName, managedInstanceName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceInner update( + String resourceGroupName, String managedInstanceName, ManagedInstanceUpdate parameters) { + return updateAsync(resourceGroupName, managedInstanceName, parameters).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL managed instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedInstanceInner update( + String resourceGroupName, String managedInstanceName, ManagedInstanceUpdate parameters, Context context) { + return updateAsync(resourceGroupName, managedInstanceName, parameters, context).block(); + } + + /** + * Get top resource consuming queries of 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 numberOfQueries How many 'top queries' to return. Default is 5. + * @param databases Comma separated list of databases to be included into search. All DB's are included if this + * parameter is not specified. + * @param startTime Start time for observed period. + * @param endTime End time for observed period. + * @param interval The time step to be used to summarize the metric values. Default value is PT1H. + * @param aggregationFunction Aggregation function to be used, default value is 'sum'. + * @param observationMetric Metric to be used for ranking top queries. Default is 'cpu'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return top resource consuming queries of a managed instance along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByManagedInstanceSinglePageAsync( + String resourceGroupName, + String managedInstanceName, + Integer numberOfQueries, + String databases, + String startTime, + String endTime, + QueryTimeGrainType interval, + AggregationFunctionType aggregationFunction, + MetricType observationMetric) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByManagedInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + numberOfQueries, + databases, + startTime, + endTime, + interval, + aggregationFunction, + observationMetric, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get top resource consuming queries of 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 numberOfQueries How many 'top queries' to return. Default is 5. + * @param databases Comma separated list of databases to be included into search. All DB's are included if this + * parameter is not specified. + * @param startTime Start time for observed period. + * @param endTime End time for observed period. + * @param interval The time step to be used to summarize the metric values. Default value is PT1H. + * @param aggregationFunction Aggregation function to be used, default value is 'sum'. + * @param observationMetric Metric to be used for ranking top queries. Default is 'cpu'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return top resource consuming queries of a managed instance along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByManagedInstanceSinglePageAsync( + String resourceGroupName, + String managedInstanceName, + Integer numberOfQueries, + String databases, + String startTime, + String endTime, + QueryTimeGrainType interval, + AggregationFunctionType aggregationFunction, + MetricType observationMetric, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByManagedInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + numberOfQueries, + databases, + startTime, + endTime, + interval, + aggregationFunction, + observationMetric, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get top resource consuming queries of 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 numberOfQueries How many 'top queries' to return. Default is 5. + * @param databases Comma separated list of databases to be included into search. All DB's are included if this + * parameter is not specified. + * @param startTime Start time for observed period. + * @param endTime End time for observed period. + * @param interval The time step to be used to summarize the metric values. Default value is PT1H. + * @param aggregationFunction Aggregation function to be used, default value is 'sum'. + * @param observationMetric Metric to be used for ranking top queries. Default is 'cpu'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return top resource consuming queries of a managed instance as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByManagedInstanceAsync( + String resourceGroupName, + String managedInstanceName, + Integer numberOfQueries, + String databases, + String startTime, + String endTime, + QueryTimeGrainType interval, + AggregationFunctionType aggregationFunction, + MetricType observationMetric) { + return new PagedFlux<>( + () -> + listByManagedInstanceSinglePageAsync( + resourceGroupName, + managedInstanceName, + numberOfQueries, + databases, + startTime, + endTime, + interval, + aggregationFunction, + observationMetric), + nextLink -> listByManagedInstanceNextSinglePageAsync(nextLink)); + } + + /** + * Get top resource consuming queries of 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return top resource consuming queries of a managed instance as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByManagedInstanceAsync( + String resourceGroupName, String managedInstanceName) { + final Integer numberOfQueries = null; + final String databases = null; + final String startTime = null; + final String endTime = null; + final QueryTimeGrainType interval = null; + final AggregationFunctionType aggregationFunction = null; + final MetricType observationMetric = null; + return new PagedFlux<>( + () -> + listByManagedInstanceSinglePageAsync( + resourceGroupName, + managedInstanceName, + numberOfQueries, + databases, + startTime, + endTime, + interval, + aggregationFunction, + observationMetric), + nextLink -> listByManagedInstanceNextSinglePageAsync(nextLink)); + } + + /** + * Get top resource consuming queries of 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 numberOfQueries How many 'top queries' to return. Default is 5. + * @param databases Comma separated list of databases to be included into search. All DB's are included if this + * parameter is not specified. + * @param startTime Start time for observed period. + * @param endTime End time for observed period. + * @param interval The time step to be used to summarize the metric values. Default value is PT1H. + * @param aggregationFunction Aggregation function to be used, default value is 'sum'. + * @param observationMetric Metric to be used for ranking top queries. Default is 'cpu'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return top resource consuming queries of a managed instance as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByManagedInstanceAsync( + String resourceGroupName, + String managedInstanceName, + Integer numberOfQueries, + String databases, + String startTime, + String endTime, + QueryTimeGrainType interval, + AggregationFunctionType aggregationFunction, + MetricType observationMetric, + Context context) { + return new PagedFlux<>( + () -> + listByManagedInstanceSinglePageAsync( + resourceGroupName, + managedInstanceName, + numberOfQueries, + databases, + startTime, + endTime, + interval, + aggregationFunction, + observationMetric, + context), + nextLink -> listByManagedInstanceNextSinglePageAsync(nextLink, context)); + } + + /** + * Get top resource consuming queries of 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return top resource consuming queries of a managed instance as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByManagedInstance(String resourceGroupName, String managedInstanceName) { + final Integer numberOfQueries = null; + final String databases = null; + final String startTime = null; + final String endTime = null; + final QueryTimeGrainType interval = null; + final AggregationFunctionType aggregationFunction = null; + final MetricType observationMetric = null; + return new PagedIterable<>( + listByManagedInstanceAsync( + resourceGroupName, + managedInstanceName, + numberOfQueries, + databases, + startTime, + endTime, + interval, + aggregationFunction, + observationMetric)); + } + + /** + * Get top resource consuming queries of 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 numberOfQueries How many 'top queries' to return. Default is 5. + * @param databases Comma separated list of databases to be included into search. All DB's are included if this + * parameter is not specified. + * @param startTime Start time for observed period. + * @param endTime End time for observed period. + * @param interval The time step to be used to summarize the metric values. Default value is PT1H. + * @param aggregationFunction Aggregation function to be used, default value is 'sum'. + * @param observationMetric Metric to be used for ranking top queries. Default is 'cpu'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return top resource consuming queries of a managed instance as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByManagedInstance( + String resourceGroupName, + String managedInstanceName, + Integer numberOfQueries, + String databases, + String startTime, + String endTime, + QueryTimeGrainType interval, + AggregationFunctionType aggregationFunction, + MetricType observationMetric, + Context context) { + return new PagedIterable<>( + listByManagedInstanceAsync( + resourceGroupName, + managedInstanceName, + numberOfQueries, + databases, + startTime, + endTime, + interval, + aggregationFunction, + observationMetric, + context)); + } + + /** + * Failovers 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 to failover. + * @param replicaType The type of replica to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> failoverWithResponseAsync( + String resourceGroupName, String managedInstanceName, ReplicaType replicaType) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + return FluxUtil + .withContext( + context -> + service + .failover( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + replicaType, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Failovers 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 to failover. + * @param replicaType The type of replica to be failed over. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> failoverWithResponseAsync( + String resourceGroupName, String managedInstanceName, ReplicaType replicaType, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + context = this.client.mergeContext(context); + return service + .failover( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + replicaType, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Failovers 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 to failover. + * @param replicaType The type of replica to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginFailoverAsync( + String resourceGroupName, String managedInstanceName, ReplicaType replicaType) { + Mono>> mono = + failoverWithResponseAsync(resourceGroupName, managedInstanceName, replicaType); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Failovers 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 to failover. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginFailoverAsync( + String resourceGroupName, String managedInstanceName) { + final ReplicaType replicaType = null; + Mono>> mono = + failoverWithResponseAsync(resourceGroupName, managedInstanceName, replicaType); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Failovers 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 to failover. + * @param replicaType The type of replica to be failed over. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginFailoverAsync( + String resourceGroupName, String managedInstanceName, ReplicaType replicaType, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + failoverWithResponseAsync(resourceGroupName, managedInstanceName, replicaType, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Failovers 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 to failover. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginFailover(String resourceGroupName, String managedInstanceName) { + final ReplicaType replicaType = null; + return beginFailoverAsync(resourceGroupName, managedInstanceName, replicaType).getSyncPoller(); + } + + /** + * Failovers 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 to failover. + * @param replicaType The type of replica to be failed over. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginFailover( + String resourceGroupName, String managedInstanceName, ReplicaType replicaType, Context context) { + return beginFailoverAsync(resourceGroupName, managedInstanceName, replicaType, context).getSyncPoller(); + } + + /** + * Failovers 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 to failover. + * @param replicaType The type of replica to be failed over. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono failoverAsync(String resourceGroupName, String managedInstanceName, ReplicaType replicaType) { + return beginFailoverAsync(resourceGroupName, managedInstanceName, replicaType) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Failovers 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 to failover. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono failoverAsync(String resourceGroupName, String managedInstanceName) { + final ReplicaType replicaType = null; + return beginFailoverAsync(resourceGroupName, managedInstanceName, replicaType) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Failovers 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 to failover. + * @param replicaType The type of replica to be failed over. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono failoverAsync( + String resourceGroupName, String managedInstanceName, ReplicaType replicaType, Context context) { + return beginFailoverAsync(resourceGroupName, managedInstanceName, replicaType, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Failovers 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 to failover. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void failover(String resourceGroupName, String managedInstanceName) { + final ReplicaType replicaType = null; + failoverAsync(resourceGroupName, managedInstanceName, replicaType).block(); + } + + /** + * Failovers 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 to failover. + * @param replicaType The type of replica to be failed over. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void failover( + String resourceGroupName, String managedInstanceName, ReplicaType replicaType, Context context) { + failoverAsync(resourceGroupName, managedInstanceName, replicaType, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instances along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstancePoolNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByInstancePoolNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instances along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstancePoolNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInstancePoolNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instances along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instances along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instances along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instances along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of top resource consuming queries on managed instance along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByManagedInstanceNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByManagedInstanceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of top resource consuming queries on managed instance along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByManagedInstanceNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByManagedInstanceNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstancesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstancesImpl.java new file mode 100644 index 0000000000000..034196ef972c9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedInstancesImpl.java @@ -0,0 +1,246 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ManagedInstancesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceInner; +import com.azure.resourcemanager.sql.generated.fluent.models.TopQueriesInner; +import com.azure.resourcemanager.sql.generated.models.AggregationFunctionType; +import com.azure.resourcemanager.sql.generated.models.ManagedInstance; +import com.azure.resourcemanager.sql.generated.models.ManagedInstances; +import com.azure.resourcemanager.sql.generated.models.MetricType; +import com.azure.resourcemanager.sql.generated.models.QueryTimeGrainType; +import com.azure.resourcemanager.sql.generated.models.ReplicaType; +import com.azure.resourcemanager.sql.generated.models.TopQueries; + +public final class ManagedInstancesImpl implements ManagedInstances { + private static final ClientLogger LOGGER = new ClientLogger(ManagedInstancesImpl.class); + + private final ManagedInstancesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedInstancesImpl( + ManagedInstancesClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByInstancePool(String resourceGroupName, String instancePoolName) { + PagedIterable inner = + this.serviceClient().listByInstancePool(resourceGroupName, instancePoolName); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceImpl(inner1, this.manager())); + } + + public PagedIterable listByInstancePool( + String resourceGroupName, String instancePoolName, String expand, Context context) { + PagedIterable inner = + this.serviceClient().listByInstancePool(resourceGroupName, instancePoolName, expand, context); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceImpl(inner1, this.manager())); + } + + public PagedIterable list(String expand, Context context) { + PagedIterable inner = this.serviceClient().list(expand, context); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup( + String resourceGroupName, String expand, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, expand, context); + return Utils.mapPage(inner, inner1 -> new ManagedInstanceImpl(inner1, this.manager())); + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String managedInstanceName, String expand, Context context) { + Response inner = + this + .serviceClient() + .getByResourceGroupWithResponse(resourceGroupName, managedInstanceName, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ManagedInstanceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ManagedInstance getByResourceGroup(String resourceGroupName, String managedInstanceName) { + ManagedInstanceInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, managedInstanceName); + if (inner != null) { + return new ManagedInstanceImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String managedInstanceName) { + this.serviceClient().delete(resourceGroupName, managedInstanceName); + } + + public void delete(String resourceGroupName, String managedInstanceName, Context context) { + this.serviceClient().delete(resourceGroupName, managedInstanceName, context); + } + + public PagedIterable listByManagedInstance(String resourceGroupName, String managedInstanceName) { + PagedIterable inner = + this.serviceClient().listByManagedInstance(resourceGroupName, managedInstanceName); + return Utils.mapPage(inner, inner1 -> new TopQueriesImpl(inner1, this.manager())); + } + + public PagedIterable listByManagedInstance( + String resourceGroupName, + String managedInstanceName, + Integer numberOfQueries, + String databases, + String startTime, + String endTime, + QueryTimeGrainType interval, + AggregationFunctionType aggregationFunction, + MetricType observationMetric, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByManagedInstance( + resourceGroupName, + managedInstanceName, + numberOfQueries, + databases, + startTime, + endTime, + interval, + aggregationFunction, + observationMetric, + context); + return Utils.mapPage(inner, inner1 -> new TopQueriesImpl(inner1, this.manager())); + } + + public void failover(String resourceGroupName, String managedInstanceName) { + this.serviceClient().failover(resourceGroupName, managedInstanceName); + } + + public void failover( + String resourceGroupName, String managedInstanceName, ReplicaType replicaType, Context context) { + this.serviceClient().failover(resourceGroupName, managedInstanceName, replicaType, context); + } + + public ManagedInstance getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String localExpand = null; + return this + .getByResourceGroupWithResponse(resourceGroupName, managedInstanceName, localExpand, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, String expand, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, managedInstanceName, expand, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + this.delete(resourceGroupName, managedInstanceName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + this.delete(resourceGroupName, managedInstanceName, context); + } + + private ManagedInstancesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ManagedInstanceImpl define(String name) { + return new ManagedInstanceImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientImpl.java new file mode 100644 index 0000000000000..429bdb1fa2f00 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientImpl.java @@ -0,0 +1,1453 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedBackupShortTermRetentionPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ManagedBackupShortTermRetentionPolicyListResult; +import com.azure.resourcemanager.sql.generated.models.ManagedShortTermRetentionPolicyName; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient. + */ +public final class ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientImpl + implements ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient { + /** The proxy service used to perform REST calls. */ + private final ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for + * SqlManagementClientManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + public interface ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/restorableDroppedDatabases/{restorableDroppedDatabaseId}" + + "/backupShortTermRetentionPolicies/{policyName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("restorableDroppedDatabaseId") String restorableDroppedDatabaseId, + @PathParam("policyName") ManagedShortTermRetentionPolicyName policyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/restorableDroppedDatabases/{restorableDroppedDatabaseId}" + + "/backupShortTermRetentionPolicies/{policyName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("restorableDroppedDatabaseId") String restorableDroppedDatabaseId, + @PathParam("policyName") ManagedShortTermRetentionPolicyName policyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ManagedBackupShortTermRetentionPolicyInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/restorableDroppedDatabases/{restorableDroppedDatabaseId}" + + "/backupShortTermRetentionPolicies/{policyName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("restorableDroppedDatabaseId") String restorableDroppedDatabaseId, + @PathParam("policyName") ManagedShortTermRetentionPolicyName policyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ManagedBackupShortTermRetentionPolicyInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/restorableDroppedDatabases/{restorableDroppedDatabaseId}" + + "/backupShortTermRetentionPolicies") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByRestorableDroppedDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("restorableDroppedDatabaseId") String restorableDroppedDatabaseId, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByRestorableDroppedDatabaseNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 restorableDroppedDatabaseId parameter. + * @param policyName The policy name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a dropped database's short term retention policy along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (restorableDroppedDatabaseId == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter restorableDroppedDatabaseId is required and cannot be null.")); + } + if (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + restorableDroppedDatabaseId, + policyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 restorableDroppedDatabaseId parameter. + * @param policyName The policy name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a dropped database's short term retention policy along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (restorableDroppedDatabaseId == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter restorableDroppedDatabaseId is required and cannot be null.")); + } + if (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + restorableDroppedDatabaseId, + policyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 restorableDroppedDatabaseId parameter. + * @param policyName The policy name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a dropped database's short term retention policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 restorableDroppedDatabaseId parameter. + * @param policyName The policy name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a dropped database's short term retention policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + Context context) { + return getWithResponseAsync( + resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, context) + .block(); + } + + /** + * 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 restorableDroppedDatabaseId parameter. + * @param policyName The policy name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a dropped database's short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedBackupShortTermRetentionPolicyInner get( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName) { + return getWithResponse( + resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, Context.NONE) + .getValue(); + } + + /** + * Sets 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a short term retention policy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (restorableDroppedDatabaseId == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter restorableDroppedDatabaseId is required and cannot be null.")); + } + if (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + restorableDroppedDatabaseId, + policyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Sets 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a short term retention policy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (restorableDroppedDatabaseId == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter restorableDroppedDatabaseId is required and cannot be null.")); + } + if (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + restorableDroppedDatabaseId, + policyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Sets 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux< + PollResult, ManagedBackupShortTermRetentionPolicyInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedBackupShortTermRetentionPolicyInner.class, + ManagedBackupShortTermRetentionPolicyInner.class, + this.client.getContext()); + } + + /** + * Sets 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux< + PollResult, ManagedBackupShortTermRetentionPolicyInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedBackupShortTermRetentionPolicyInner.class, + ManagedBackupShortTermRetentionPolicyInner.class, + context); + } + + /** + * Sets 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller< + PollResult, ManagedBackupShortTermRetentionPolicyInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters) { + return beginCreateOrUpdateAsync( + resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, parameters) + .getSyncPoller(); + } + + /** + * Sets 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller< + PollResult, ManagedBackupShortTermRetentionPolicyInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, parameters, context) + .getSyncPoller(); + } + + /** + * Sets 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a short term retention policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters) { + return beginCreateOrUpdateAsync( + resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Sets 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a short term retention policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Sets 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedBackupShortTermRetentionPolicyInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters) { + return createOrUpdateAsync( + resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, parameters) + .block(); + } + + /** + * Sets 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedBackupShortTermRetentionPolicyInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context) { + return createOrUpdateAsync( + resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, parameters, context) + .block(); + } + + /** + * Sets 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a short term retention policy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (restorableDroppedDatabaseId == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter restorableDroppedDatabaseId is required and cannot be null.")); + } + if (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + restorableDroppedDatabaseId, + policyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Sets 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a short term retention policy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (restorableDroppedDatabaseId == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter restorableDroppedDatabaseId is required and cannot be null.")); + } + if (policyName == null) { + return Mono.error(new IllegalArgumentException("Parameter policyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + restorableDroppedDatabaseId, + policyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Sets 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux< + PollResult, ManagedBackupShortTermRetentionPolicyInner> + beginUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters) { + Mono>> mono = + updateWithResponseAsync( + resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedBackupShortTermRetentionPolicyInner.class, + ManagedBackupShortTermRetentionPolicyInner.class, + this.client.getContext()); + } + + /** + * Sets 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux< + PollResult, ManagedBackupShortTermRetentionPolicyInner> + beginUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync( + resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedBackupShortTermRetentionPolicyInner.class, + ManagedBackupShortTermRetentionPolicyInner.class, + context); + } + + /** + * Sets 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller< + PollResult, ManagedBackupShortTermRetentionPolicyInner> + beginUpdate( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters) { + return beginUpdateAsync( + resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, parameters) + .getSyncPoller(); + } + + /** + * Sets 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller< + PollResult, ManagedBackupShortTermRetentionPolicyInner> + beginUpdate( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context) { + return beginUpdateAsync( + resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, parameters, context) + .getSyncPoller(); + } + + /** + * Sets 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a short term retention policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters) { + return beginUpdateAsync( + resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Sets 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a short term retention policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context) { + return beginUpdateAsync( + resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Sets 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedBackupShortTermRetentionPolicyInner update( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters) { + return updateAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, parameters) + .block(); + } + + /** + * Sets 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a short term retention policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedBackupShortTermRetentionPolicyInner update( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context) { + return updateAsync( + resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, parameters, context) + .block(); + } + + /** + * 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 restorableDroppedDatabaseId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a dropped database's short term retention policy list along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByRestorableDroppedDatabaseSinglePageAsync( + String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (restorableDroppedDatabaseId == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter restorableDroppedDatabaseId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByRestorableDroppedDatabase( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + restorableDroppedDatabaseId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 restorableDroppedDatabaseId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a dropped database's short term retention policy list along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByRestorableDroppedDatabaseSinglePageAsync( + String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (restorableDroppedDatabaseId == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter restorableDroppedDatabaseId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByRestorableDroppedDatabase( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + restorableDroppedDatabaseId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 restorableDroppedDatabaseId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a dropped database's short term retention policy list as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByRestorableDroppedDatabaseAsync( + String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId) { + return new PagedFlux<>( + () -> + listByRestorableDroppedDatabaseSinglePageAsync( + resourceGroupName, managedInstanceName, restorableDroppedDatabaseId), + nextLink -> listByRestorableDroppedDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * 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 restorableDroppedDatabaseId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a dropped database's short term retention policy list as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByRestorableDroppedDatabaseAsync( + String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, Context context) { + return new PagedFlux<>( + () -> + listByRestorableDroppedDatabaseSinglePageAsync( + resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, context), + nextLink -> listByRestorableDroppedDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 restorableDroppedDatabaseId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a dropped database's short term retention policy list as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByRestorableDroppedDatabase( + String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId) { + return new PagedIterable<>( + listByRestorableDroppedDatabaseAsync(resourceGroupName, managedInstanceName, 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 restorableDroppedDatabaseId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a dropped database's short term retention policy list as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByRestorableDroppedDatabase( + String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, Context context) { + return new PagedIterable<>( + listByRestorableDroppedDatabaseAsync( + resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of short term retention policies along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByRestorableDroppedDatabaseNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service.listByRestorableDroppedDatabaseNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of short term retention policies along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByRestorableDroppedDatabaseNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByRestorableDroppedDatabaseNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesImpl.java new file mode 100644 index 0000000000000..b2e42c6e93510 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesImpl.java @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedBackupShortTermRetentionPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ManagedBackupShortTermRetentionPolicy; +import com.azure.resourcemanager.sql.generated.models.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies; +import com.azure.resourcemanager.sql.generated.models.ManagedShortTermRetentionPolicyName; + +public final class ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesImpl + implements ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies { + private static final ClientLogger LOGGER = + new ClientLogger(ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesImpl.class); + + private final ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesImpl( + ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse( + resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ManagedBackupShortTermRetentionPolicyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ManagedBackupShortTermRetentionPolicy get( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName) { + ManagedBackupShortTermRetentionPolicyInner inner = + this.serviceClient().get(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName); + if (inner != null) { + return new ManagedBackupShortTermRetentionPolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public ManagedBackupShortTermRetentionPolicy createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters) { + ManagedBackupShortTermRetentionPolicyInner inner = + this + .serviceClient() + .createOrUpdate( + resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, parameters); + if (inner != null) { + return new ManagedBackupShortTermRetentionPolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public ManagedBackupShortTermRetentionPolicy createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context) { + ManagedBackupShortTermRetentionPolicyInner inner = + this + .serviceClient() + .createOrUpdate( + resourceGroupName, + managedInstanceName, + restorableDroppedDatabaseId, + policyName, + parameters, + context); + if (inner != null) { + return new ManagedBackupShortTermRetentionPolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public ManagedBackupShortTermRetentionPolicy update( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters) { + ManagedBackupShortTermRetentionPolicyInner inner = + this + .serviceClient() + .update(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, policyName, parameters); + if (inner != null) { + return new ManagedBackupShortTermRetentionPolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public ManagedBackupShortTermRetentionPolicy update( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context) { + ManagedBackupShortTermRetentionPolicyInner inner = + this + .serviceClient() + .update( + resourceGroupName, + managedInstanceName, + restorableDroppedDatabaseId, + policyName, + parameters, + context); + if (inner != null) { + return new ManagedBackupShortTermRetentionPolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listByRestorableDroppedDatabase( + String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId) { + PagedIterable inner = + this + .serviceClient() + .listByRestorableDroppedDatabase(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId); + return Utils.mapPage(inner, inner1 -> new ManagedBackupShortTermRetentionPolicyImpl(inner1, this.manager())); + } + + public PagedIterable listByRestorableDroppedDatabase( + String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, Context context) { + PagedIterable inner = + this + .serviceClient() + .listByRestorableDroppedDatabase( + resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, context); + return Utils.mapPage(inner, inner1 -> new ManagedBackupShortTermRetentionPolicyImpl(inner1, this.manager())); + } + + private ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedServerDnsAliasImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedServerDnsAliasImpl.java new file mode 100644 index 0000000000000..91f09a44a9b3b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedServerDnsAliasImpl.java @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedServerDnsAliasInner; +import com.azure.resourcemanager.sql.generated.models.ManagedServerDnsAlias; +import com.azure.resourcemanager.sql.generated.models.ManagedServerDnsAliasAcquisition; +import com.azure.resourcemanager.sql.generated.models.ManagedServerDnsAliasCreation; + +public final class ManagedServerDnsAliasImpl + implements ManagedServerDnsAlias, ManagedServerDnsAlias.Definition, ManagedServerDnsAlias.Update { + private ManagedServerDnsAliasInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String azureDnsRecord() { + return this.innerModel().azureDnsRecord(); + } + + public String publicAzureDnsRecord() { + return this.innerModel().publicAzureDnsRecord(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ManagedServerDnsAliasInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String managedInstanceName; + + private String dnsAliasName; + + private ManagedServerDnsAliasCreation createParameters; + + private ManagedServerDnsAliasCreation updateParameters; + + public ManagedServerDnsAliasImpl withExistingManagedInstance(String resourceGroupName, String managedInstanceName) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + return this; + } + + public ManagedServerDnsAlias create() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedServerDnsAliases() + .createOrUpdate(resourceGroupName, managedInstanceName, dnsAliasName, createParameters, Context.NONE); + return this; + } + + public ManagedServerDnsAlias create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedServerDnsAliases() + .createOrUpdate(resourceGroupName, managedInstanceName, dnsAliasName, createParameters, context); + return this; + } + + ManagedServerDnsAliasImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ManagedServerDnsAliasInner(); + this.serviceManager = serviceManager; + this.dnsAliasName = name; + this.createParameters = new ManagedServerDnsAliasCreation(); + } + + public ManagedServerDnsAliasImpl update() { + this.updateParameters = new ManagedServerDnsAliasCreation(); + return this; + } + + public ManagedServerDnsAlias apply() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedServerDnsAliases() + .createOrUpdate(resourceGroupName, managedInstanceName, dnsAliasName, updateParameters, Context.NONE); + return this; + } + + public ManagedServerDnsAlias apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedServerDnsAliases() + .createOrUpdate(resourceGroupName, managedInstanceName, dnsAliasName, updateParameters, context); + return this; + } + + ManagedServerDnsAliasImpl( + ManagedServerDnsAliasInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.managedInstanceName = Utils.getValueFromIdByName(innerObject.id(), "managedInstances"); + this.dnsAliasName = Utils.getValueFromIdByName(innerObject.id(), "dnsAliases"); + } + + public ManagedServerDnsAlias refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedServerDnsAliases() + .getWithResponse(resourceGroupName, managedInstanceName, dnsAliasName, Context.NONE) + .getValue(); + return this; + } + + public ManagedServerDnsAlias refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedServerDnsAliases() + .getWithResponse(resourceGroupName, managedInstanceName, dnsAliasName, context) + .getValue(); + return this; + } + + public ManagedServerDnsAlias acquire(ManagedServerDnsAliasAcquisition parameters) { + return serviceManager + .managedServerDnsAliases() + .acquire(resourceGroupName, managedInstanceName, dnsAliasName, parameters); + } + + public ManagedServerDnsAlias acquire(ManagedServerDnsAliasAcquisition parameters, Context context) { + return serviceManager + .managedServerDnsAliases() + .acquire(resourceGroupName, managedInstanceName, dnsAliasName, parameters, context); + } + + public ManagedServerDnsAliasImpl withCreateDnsRecord(Boolean createDnsRecord) { + if (isInCreateMode()) { + this.createParameters.withCreateDnsRecord(createDnsRecord); + return this; + } else { + this.updateParameters.withCreateDnsRecord(createDnsRecord); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedServerDnsAliasesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedServerDnsAliasesClientImpl.java new file mode 100644 index 0000000000000..7a3f6cecd649a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedServerDnsAliasesClientImpl.java @@ -0,0 +1,1541 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ManagedServerDnsAliasesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedServerDnsAliasInner; +import com.azure.resourcemanager.sql.generated.models.ManagedServerDnsAliasAcquisition; +import com.azure.resourcemanager.sql.generated.models.ManagedServerDnsAliasCreation; +import com.azure.resourcemanager.sql.generated.models.ManagedServerDnsAliasListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ManagedServerDnsAliasesClient. */ +public final class ManagedServerDnsAliasesClientImpl implements ManagedServerDnsAliasesClient { + /** The proxy service used to perform REST calls. */ + private final ManagedServerDnsAliasesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedServerDnsAliasesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedServerDnsAliasesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create(ManagedServerDnsAliasesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientManagedServerDnsAliases to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + public interface ManagedServerDnsAliasesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/dnsAliases") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByManagedInstance( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/dnsAliases/{dnsAliasName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("dnsAliasName") String dnsAliasName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/dnsAliases/{dnsAliasName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("dnsAliasName") String dnsAliasName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ManagedServerDnsAliasCreation parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/dnsAliases/{dnsAliasName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("dnsAliasName") String dnsAliasName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/dnsAliases/{dnsAliasName}/acquire") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> acquire( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("dnsAliasName") String dnsAliasName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ManagedServerDnsAliasAcquisition parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByManagedInstanceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a list of managed server DNS aliases for a managed server. + * + * @param resourceGroupName The name of the resource group that contains 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed server DNS aliases for a managed server along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByManagedInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByManagedInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of managed server DNS aliases for a managed server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed server DNS aliases for a managed server along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByManagedInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByManagedInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of managed server DNS aliases for a managed server. + * + * @param resourceGroupName The name of the resource group that contains 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed server DNS aliases for a managed server as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByManagedInstanceAsync( + String resourceGroupName, String managedInstanceName) { + return new PagedFlux<>( + () -> listByManagedInstanceSinglePageAsync(resourceGroupName, managedInstanceName), + nextLink -> listByManagedInstanceNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of managed server DNS aliases for a managed server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed server DNS aliases for a managed server as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByManagedInstanceAsync( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedFlux<>( + () -> listByManagedInstanceSinglePageAsync(resourceGroupName, managedInstanceName, context), + nextLink -> listByManagedInstanceNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of managed server DNS aliases for a managed server. + * + * @param resourceGroupName The name of the resource group that contains 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed server DNS aliases for a managed server as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByManagedInstance( + String resourceGroupName, String managedInstanceName) { + return new PagedIterable<>(listByManagedInstanceAsync(resourceGroupName, managedInstanceName)); + } + + /** + * Gets a list of managed server DNS aliases for a managed server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed server DNS aliases for a managed server as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByManagedInstance( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedIterable<>(listByManagedInstanceAsync(resourceGroupName, managedInstanceName, context)); + } + + /** + * 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 managedInstanceName The name of the managed instance. + * @param dnsAliasName The dnsAliasName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server DNS alias along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, String dnsAliasName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (dnsAliasName == null) { + return Mono.error(new IllegalArgumentException("Parameter dnsAliasName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + dnsAliasName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 managedInstanceName The name of the managed instance. + * @param dnsAliasName The dnsAliasName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server DNS alias along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, String dnsAliasName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (dnsAliasName == null) { + return Mono.error(new IllegalArgumentException("Parameter dnsAliasName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + dnsAliasName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 managedInstanceName The name of the managed instance. + * @param dnsAliasName The dnsAliasName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server DNS alias on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String managedInstanceName, String dnsAliasName) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, dnsAliasName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 managedInstanceName The name of the managed instance. + * @param dnsAliasName The dnsAliasName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server DNS alias along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, String dnsAliasName, Context context) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, dnsAliasName, context).block(); + } + + /** + * 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 managedInstanceName The name of the managed instance. + * @param dnsAliasName The dnsAliasName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server DNS alias. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedServerDnsAliasInner get(String resourceGroupName, String managedInstanceName, String dnsAliasName) { + return getWithResponse(resourceGroupName, managedInstanceName, dnsAliasName, Context.NONE).getValue(); + } + + /** + * Creates a managed 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 managedInstanceName The name of the managed instance. + * @param dnsAliasName The dnsAliasName parameter. + * @param parameters A managed server dns alias creation request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed server DNS alias along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String dnsAliasName, + ManagedServerDnsAliasCreation parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (dnsAliasName == null) { + return Mono.error(new IllegalArgumentException("Parameter dnsAliasName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + dnsAliasName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates a managed 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 managedInstanceName The name of the managed instance. + * @param dnsAliasName The dnsAliasName parameter. + * @param parameters A managed server dns alias creation request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed server DNS alias along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String dnsAliasName, + ManagedServerDnsAliasCreation parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (dnsAliasName == null) { + return Mono.error(new IllegalArgumentException("Parameter dnsAliasName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + dnsAliasName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates a managed 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 managedInstanceName The name of the managed instance. + * @param dnsAliasName The dnsAliasName parameter. + * @param parameters A managed server dns alias creation request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a managed server DNS alias. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ManagedServerDnsAliasInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String dnsAliasName, + ManagedServerDnsAliasCreation parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, managedInstanceName, dnsAliasName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedServerDnsAliasInner.class, + ManagedServerDnsAliasInner.class, + this.client.getContext()); + } + + /** + * Creates a managed 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 managedInstanceName The name of the managed instance. + * @param dnsAliasName The dnsAliasName parameter. + * @param parameters A managed server dns alias creation request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a managed server DNS alias. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ManagedServerDnsAliasInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String dnsAliasName, + ManagedServerDnsAliasCreation parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, managedInstanceName, dnsAliasName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedServerDnsAliasInner.class, + ManagedServerDnsAliasInner.class, + context); + } + + /** + * Creates a managed 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 managedInstanceName The name of the managed instance. + * @param dnsAliasName The dnsAliasName parameter. + * @param parameters A managed server dns alias creation request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a managed server DNS alias. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ManagedServerDnsAliasInner> beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String dnsAliasName, + ManagedServerDnsAliasCreation parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, dnsAliasName, parameters) + .getSyncPoller(); + } + + /** + * Creates a managed 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 managedInstanceName The name of the managed instance. + * @param dnsAliasName The dnsAliasName parameter. + * @param parameters A managed server dns alias creation request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a managed server DNS alias. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ManagedServerDnsAliasInner> beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String dnsAliasName, + ManagedServerDnsAliasCreation parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, dnsAliasName, parameters, context) + .getSyncPoller(); + } + + /** + * Creates a managed 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 managedInstanceName The name of the managed instance. + * @param dnsAliasName The dnsAliasName parameter. + * @param parameters A managed server dns alias creation request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed server DNS alias on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String dnsAliasName, + ManagedServerDnsAliasCreation parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, dnsAliasName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a managed 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 managedInstanceName The name of the managed instance. + * @param dnsAliasName The dnsAliasName parameter. + * @param parameters A managed server dns alias creation request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed server DNS alias on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String dnsAliasName, + ManagedServerDnsAliasCreation parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, dnsAliasName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a managed 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 managedInstanceName The name of the managed instance. + * @param dnsAliasName The dnsAliasName parameter. + * @param parameters A managed server dns alias creation request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed server DNS alias. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedServerDnsAliasInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String dnsAliasName, + ManagedServerDnsAliasCreation parameters) { + return createOrUpdateAsync(resourceGroupName, managedInstanceName, dnsAliasName, parameters).block(); + } + + /** + * Creates a managed 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 managedInstanceName The name of the managed instance. + * @param dnsAliasName The dnsAliasName parameter. + * @param parameters A managed server dns alias creation request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed server DNS alias. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedServerDnsAliasInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String dnsAliasName, + ManagedServerDnsAliasCreation parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, managedInstanceName, dnsAliasName, parameters, context).block(); + } + + /** + * Deletes the managed 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 managedInstanceName The name of the managed instance. + * @param dnsAliasName The dnsAliasName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String managedInstanceName, String dnsAliasName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (dnsAliasName == null) { + return Mono.error(new IllegalArgumentException("Parameter dnsAliasName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + dnsAliasName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the managed 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 managedInstanceName The name of the managed instance. + * @param dnsAliasName The dnsAliasName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String managedInstanceName, String dnsAliasName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (dnsAliasName == null) { + return Mono.error(new IllegalArgumentException("Parameter dnsAliasName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + dnsAliasName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes the managed 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 managedInstanceName The name of the managed instance. + * @param dnsAliasName The dnsAliasName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String managedInstanceName, String dnsAliasName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, managedInstanceName, dnsAliasName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes the managed 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 managedInstanceName The name of the managed instance. + * @param dnsAliasName The dnsAliasName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String managedInstanceName, String dnsAliasName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, managedInstanceName, dnsAliasName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes the managed 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 managedInstanceName The name of the managed instance. + * @param dnsAliasName The dnsAliasName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, String dnsAliasName) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, dnsAliasName).getSyncPoller(); + } + + /** + * Deletes the managed 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 managedInstanceName The name of the managed instance. + * @param dnsAliasName The dnsAliasName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, String dnsAliasName, Context context) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, dnsAliasName, context).getSyncPoller(); + } + + /** + * Deletes the managed 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 managedInstanceName The name of the managed instance. + * @param dnsAliasName The dnsAliasName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String managedInstanceName, String dnsAliasName) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, dnsAliasName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the managed 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 managedInstanceName The name of the managed instance. + * @param dnsAliasName The dnsAliasName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String managedInstanceName, String dnsAliasName, Context context) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, dnsAliasName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the managed 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 managedInstanceName The name of the managed instance. + * @param dnsAliasName The dnsAliasName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String managedInstanceName, String dnsAliasName) { + deleteAsync(resourceGroupName, managedInstanceName, dnsAliasName).block(); + } + + /** + * Deletes the managed 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 managedInstanceName The name of the managed instance. + * @param dnsAliasName The dnsAliasName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String managedInstanceName, String dnsAliasName, Context context) { + deleteAsync(resourceGroupName, managedInstanceName, dnsAliasName, context).block(); + } + + /** + * Acquires managed server DNS alias from another managed server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param dnsAliasName The dnsAliasName parameter. + * @param parameters A managed server DNS alias acquisition request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed server DNS alias along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> acquireWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String dnsAliasName, + ManagedServerDnsAliasAcquisition parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (dnsAliasName == null) { + return Mono.error(new IllegalArgumentException("Parameter dnsAliasName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .acquire( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + dnsAliasName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Acquires managed server DNS alias from another managed server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param dnsAliasName The dnsAliasName parameter. + * @param parameters A managed server DNS alias acquisition request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed server DNS alias along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> acquireWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String dnsAliasName, + ManagedServerDnsAliasAcquisition parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (dnsAliasName == null) { + return Mono.error(new IllegalArgumentException("Parameter dnsAliasName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .acquire( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + dnsAliasName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Acquires managed server DNS alias from another managed server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param dnsAliasName The dnsAliasName parameter. + * @param parameters A managed server DNS alias acquisition request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a managed server DNS alias. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ManagedServerDnsAliasInner> beginAcquireAsync( + String resourceGroupName, + String managedInstanceName, + String dnsAliasName, + ManagedServerDnsAliasAcquisition parameters) { + Mono>> mono = + acquireWithResponseAsync(resourceGroupName, managedInstanceName, dnsAliasName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedServerDnsAliasInner.class, + ManagedServerDnsAliasInner.class, + this.client.getContext()); + } + + /** + * Acquires managed server DNS alias from another managed server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param dnsAliasName The dnsAliasName parameter. + * @param parameters A managed server DNS alias acquisition request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a managed server DNS alias. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ManagedServerDnsAliasInner> beginAcquireAsync( + String resourceGroupName, + String managedInstanceName, + String dnsAliasName, + ManagedServerDnsAliasAcquisition parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + acquireWithResponseAsync(resourceGroupName, managedInstanceName, dnsAliasName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedServerDnsAliasInner.class, + ManagedServerDnsAliasInner.class, + context); + } + + /** + * Acquires managed server DNS alias from another managed server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param dnsAliasName The dnsAliasName parameter. + * @param parameters A managed server DNS alias acquisition request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a managed server DNS alias. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ManagedServerDnsAliasInner> beginAcquire( + String resourceGroupName, + String managedInstanceName, + String dnsAliasName, + ManagedServerDnsAliasAcquisition parameters) { + return beginAcquireAsync(resourceGroupName, managedInstanceName, dnsAliasName, parameters).getSyncPoller(); + } + + /** + * Acquires managed server DNS alias from another managed server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param dnsAliasName The dnsAliasName parameter. + * @param parameters A managed server DNS alias acquisition request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a managed server DNS alias. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ManagedServerDnsAliasInner> beginAcquire( + String resourceGroupName, + String managedInstanceName, + String dnsAliasName, + ManagedServerDnsAliasAcquisition parameters, + Context context) { + return beginAcquireAsync(resourceGroupName, managedInstanceName, dnsAliasName, parameters, context) + .getSyncPoller(); + } + + /** + * Acquires managed server DNS alias from another managed server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param dnsAliasName The dnsAliasName parameter. + * @param parameters A managed server DNS alias acquisition request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed server DNS alias on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono acquireAsync( + String resourceGroupName, + String managedInstanceName, + String dnsAliasName, + ManagedServerDnsAliasAcquisition parameters) { + return beginAcquireAsync(resourceGroupName, managedInstanceName, dnsAliasName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Acquires managed server DNS alias from another managed server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param dnsAliasName The dnsAliasName parameter. + * @param parameters A managed server DNS alias acquisition request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed server DNS alias on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono acquireAsync( + String resourceGroupName, + String managedInstanceName, + String dnsAliasName, + ManagedServerDnsAliasAcquisition parameters, + Context context) { + return beginAcquireAsync(resourceGroupName, managedInstanceName, dnsAliasName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Acquires managed server DNS alias from another managed server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param dnsAliasName The dnsAliasName parameter. + * @param parameters A managed server DNS alias acquisition request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed server DNS alias. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedServerDnsAliasInner acquire( + String resourceGroupName, + String managedInstanceName, + String dnsAliasName, + ManagedServerDnsAliasAcquisition parameters) { + return acquireAsync(resourceGroupName, managedInstanceName, dnsAliasName, parameters).block(); + } + + /** + * Acquires managed server DNS alias from another managed server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param dnsAliasName The dnsAliasName parameter. + * @param parameters A managed server DNS alias acquisition request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed server DNS alias. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedServerDnsAliasInner acquire( + String resourceGroupName, + String managedInstanceName, + String dnsAliasName, + ManagedServerDnsAliasAcquisition parameters, + Context context) { + return acquireAsync(resourceGroupName, managedInstanceName, dnsAliasName, parameters, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed server DNS aliases along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByManagedInstanceNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByManagedInstanceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed server DNS aliases along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByManagedInstanceNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByManagedInstanceNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedServerDnsAliasesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedServerDnsAliasesImpl.java new file mode 100644 index 0000000000000..645ed4af4606d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedServerDnsAliasesImpl.java @@ -0,0 +1,230 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ManagedServerDnsAliasesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedServerDnsAliasInner; +import com.azure.resourcemanager.sql.generated.models.ManagedServerDnsAlias; +import com.azure.resourcemanager.sql.generated.models.ManagedServerDnsAliasAcquisition; +import com.azure.resourcemanager.sql.generated.models.ManagedServerDnsAliases; + +public final class ManagedServerDnsAliasesImpl implements ManagedServerDnsAliases { + private static final ClientLogger LOGGER = new ClientLogger(ManagedServerDnsAliasesImpl.class); + + private final ManagedServerDnsAliasesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedServerDnsAliasesImpl( + ManagedServerDnsAliasesClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByManagedInstance( + String resourceGroupName, String managedInstanceName) { + PagedIterable inner = + this.serviceClient().listByManagedInstance(resourceGroupName, managedInstanceName); + return Utils.mapPage(inner, inner1 -> new ManagedServerDnsAliasImpl(inner1, this.manager())); + } + + public PagedIterable listByManagedInstance( + String resourceGroupName, String managedInstanceName, Context context) { + PagedIterable inner = + this.serviceClient().listByManagedInstance(resourceGroupName, managedInstanceName, context); + return Utils.mapPage(inner, inner1 -> new ManagedServerDnsAliasImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, String dnsAliasName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, managedInstanceName, dnsAliasName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ManagedServerDnsAliasImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ManagedServerDnsAlias get(String resourceGroupName, String managedInstanceName, String dnsAliasName) { + ManagedServerDnsAliasInner inner = + this.serviceClient().get(resourceGroupName, managedInstanceName, dnsAliasName); + if (inner != null) { + return new ManagedServerDnsAliasImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String managedInstanceName, String dnsAliasName) { + this.serviceClient().delete(resourceGroupName, managedInstanceName, dnsAliasName); + } + + public void delete(String resourceGroupName, String managedInstanceName, String dnsAliasName, Context context) { + this.serviceClient().delete(resourceGroupName, managedInstanceName, dnsAliasName, context); + } + + public ManagedServerDnsAlias acquire( + String resourceGroupName, + String managedInstanceName, + String dnsAliasName, + ManagedServerDnsAliasAcquisition parameters) { + ManagedServerDnsAliasInner inner = + this.serviceClient().acquire(resourceGroupName, managedInstanceName, dnsAliasName, parameters); + if (inner != null) { + return new ManagedServerDnsAliasImpl(inner, this.manager()); + } else { + return null; + } + } + + public ManagedServerDnsAlias acquire( + String resourceGroupName, + String managedInstanceName, + String dnsAliasName, + ManagedServerDnsAliasAcquisition parameters, + Context context) { + ManagedServerDnsAliasInner inner = + this.serviceClient().acquire(resourceGroupName, managedInstanceName, dnsAliasName, parameters, context); + if (inner != null) { + return new ManagedServerDnsAliasImpl(inner, this.manager()); + } else { + return null; + } + } + + public ManagedServerDnsAlias getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String dnsAliasName = Utils.getValueFromIdByName(id, "dnsAliases"); + if (dnsAliasName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'dnsAliases'.", id))); + } + return this.getWithResponse(resourceGroupName, managedInstanceName, dnsAliasName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String dnsAliasName = Utils.getValueFromIdByName(id, "dnsAliases"); + if (dnsAliasName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'dnsAliases'.", id))); + } + return this.getWithResponse(resourceGroupName, managedInstanceName, dnsAliasName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String dnsAliasName = Utils.getValueFromIdByName(id, "dnsAliases"); + if (dnsAliasName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'dnsAliases'.", id))); + } + this.delete(resourceGroupName, managedInstanceName, dnsAliasName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String dnsAliasName = Utils.getValueFromIdByName(id, "dnsAliases"); + if (dnsAliasName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'dnsAliases'.", id))); + } + this.delete(resourceGroupName, managedInstanceName, dnsAliasName, context); + } + + private ManagedServerDnsAliasesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ManagedServerDnsAliasImpl define(String name) { + return new ManagedServerDnsAliasImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedServerSecurityAlertPoliciesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedServerSecurityAlertPoliciesClientImpl.java new file mode 100644 index 0000000000000..a87f4f0ac66a9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedServerSecurityAlertPoliciesClientImpl.java @@ -0,0 +1,936 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ManagedServerSecurityAlertPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedServerSecurityAlertPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ManagedServerSecurityAlertPolicyListResult; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyName; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ManagedServerSecurityAlertPoliciesClient. + */ +public final class ManagedServerSecurityAlertPoliciesClientImpl implements ManagedServerSecurityAlertPoliciesClient { + /** The proxy service used to perform REST calls. */ + private final ManagedServerSecurityAlertPoliciesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ManagedServerSecurityAlertPoliciesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ManagedServerSecurityAlertPoliciesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ManagedServerSecurityAlertPoliciesService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientManagedServerSecurityAlertPolicies to be used by + * the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientM") + public interface ManagedServerSecurityAlertPoliciesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/securityAlertPolicies/{securityAlertPolicyName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("securityAlertPolicyName") SecurityAlertPolicyName securityAlertPolicyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/securityAlertPolicies/{securityAlertPolicyName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("securityAlertPolicyName") SecurityAlertPolicyName securityAlertPolicyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ManagedServerSecurityAlertPolicyInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/securityAlertPolicies") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInstance( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInstanceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 securityAlertPolicyName The name of the security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed server's threat detection policy along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, SecurityAlertPolicyName securityAlertPolicyName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (securityAlertPolicyName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter securityAlertPolicyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + securityAlertPolicyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 securityAlertPolicyName The name of the security alert policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed server's threat detection policy along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + SecurityAlertPolicyName securityAlertPolicyName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (securityAlertPolicyName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter securityAlertPolicyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + securityAlertPolicyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 securityAlertPolicyName The name of the security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed server's threat detection policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String managedInstanceName, SecurityAlertPolicyName securityAlertPolicyName) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, securityAlertPolicyName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 securityAlertPolicyName The name of the security alert policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed server's threat detection policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + SecurityAlertPolicyName securityAlertPolicyName, + Context context) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, securityAlertPolicyName, context).block(); + } + + /** + * 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 securityAlertPolicyName The name of the security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed server's threat detection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedServerSecurityAlertPolicyInner get( + String resourceGroupName, String managedInstanceName, SecurityAlertPolicyName securityAlertPolicyName) { + return getWithResponse(resourceGroupName, managedInstanceName, securityAlertPolicyName, Context.NONE) + .getValue(); + } + + /** + * 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 securityAlertPolicyName The name of the security alert policy. + * @param parameters The managed server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed server security alert policy along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + SecurityAlertPolicyName securityAlertPolicyName, + ManagedServerSecurityAlertPolicyInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (securityAlertPolicyName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter securityAlertPolicyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + securityAlertPolicyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 securityAlertPolicyName The name of the security alert policy. + * @param parameters The managed server security alert policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed server security alert policy along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + SecurityAlertPolicyName securityAlertPolicyName, + ManagedServerSecurityAlertPolicyInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (securityAlertPolicyName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter securityAlertPolicyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + securityAlertPolicyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 securityAlertPolicyName The name of the security alert policy. + * @param parameters The managed server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a managed server security alert policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ManagedServerSecurityAlertPolicyInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + SecurityAlertPolicyName securityAlertPolicyName, + ManagedServerSecurityAlertPolicyInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, managedInstanceName, securityAlertPolicyName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedServerSecurityAlertPolicyInner.class, + ManagedServerSecurityAlertPolicyInner.class, + this.client.getContext()); + } + + /** + * 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 securityAlertPolicyName The name of the security alert policy. + * @param parameters The managed server security alert policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a managed server security alert policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ManagedServerSecurityAlertPolicyInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + SecurityAlertPolicyName securityAlertPolicyName, + ManagedServerSecurityAlertPolicyInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, managedInstanceName, securityAlertPolicyName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ManagedServerSecurityAlertPolicyInner.class, + ManagedServerSecurityAlertPolicyInner.class, + context); + } + + /** + * 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 securityAlertPolicyName The name of the security alert policy. + * @param parameters The managed server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a managed server security alert policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ManagedServerSecurityAlertPolicyInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + SecurityAlertPolicyName securityAlertPolicyName, + ManagedServerSecurityAlertPolicyInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, securityAlertPolicyName, parameters) + .getSyncPoller(); + } + + /** + * 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 securityAlertPolicyName The name of the security alert policy. + * @param parameters The managed server security alert policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a managed server security alert policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ManagedServerSecurityAlertPolicyInner> + beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + SecurityAlertPolicyName securityAlertPolicyName, + ManagedServerSecurityAlertPolicyInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, managedInstanceName, securityAlertPolicyName, parameters, context) + .getSyncPoller(); + } + + /** + * 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 securityAlertPolicyName The name of the security alert policy. + * @param parameters The managed server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed server security alert policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + SecurityAlertPolicyName securityAlertPolicyName, + ManagedServerSecurityAlertPolicyInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, securityAlertPolicyName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 securityAlertPolicyName The name of the security alert policy. + * @param parameters The managed server security alert policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed server security alert policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + SecurityAlertPolicyName securityAlertPolicyName, + ManagedServerSecurityAlertPolicyInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, managedInstanceName, securityAlertPolicyName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 securityAlertPolicyName The name of the security alert policy. + * @param parameters The managed server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedServerSecurityAlertPolicyInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + SecurityAlertPolicyName securityAlertPolicyName, + ManagedServerSecurityAlertPolicyInner parameters) { + return createOrUpdateAsync(resourceGroupName, managedInstanceName, securityAlertPolicyName, parameters).block(); + } + + /** + * 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 securityAlertPolicyName The name of the security alert policy. + * @param parameters The managed server security alert policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ManagedServerSecurityAlertPolicyInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + SecurityAlertPolicyName securityAlertPolicyName, + ManagedServerSecurityAlertPolicyInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, managedInstanceName, securityAlertPolicyName, parameters, context) + .block(); + } + + /** + * Get the managed server's threat detection 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed server's threat detection policies along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the managed server's threat detection 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed server's threat detection policies along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the managed server's threat detection 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed server's threat detection policies as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync( + String resourceGroupName, String managedInstanceName) { + return new PagedFlux<>( + () -> listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName), + nextLink -> listByInstanceNextSinglePageAsync(nextLink)); + } + + /** + * Get the managed server's threat detection 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed server's threat detection policies as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedFlux<>( + () -> listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName, context), + nextLink -> listByInstanceNextSinglePageAsync(nextLink, context)); + } + + /** + * Get the managed server's threat detection 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed server's threat detection policies as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName) { + return new PagedIterable<>(listByInstanceAsync(resourceGroupName, managedInstanceName)); + } + + /** + * Get the managed server's threat detection 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed server's threat detection policies as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedIterable<>(listByInstanceAsync(resourceGroupName, managedInstanceName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the managed Server's security alert policies along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByInstanceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the managed Server's security alert policies along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInstanceNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedServerSecurityAlertPoliciesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedServerSecurityAlertPoliciesImpl.java new file mode 100644 index 0000000000000..a581b7c5b9b90 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedServerSecurityAlertPoliciesImpl.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ManagedServerSecurityAlertPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedServerSecurityAlertPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ManagedServerSecurityAlertPolicies; +import com.azure.resourcemanager.sql.generated.models.ManagedServerSecurityAlertPolicy; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyName; + +public final class ManagedServerSecurityAlertPoliciesImpl implements ManagedServerSecurityAlertPolicies { + private static final ClientLogger LOGGER = new ClientLogger(ManagedServerSecurityAlertPoliciesImpl.class); + + private final ManagedServerSecurityAlertPoliciesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ManagedServerSecurityAlertPoliciesImpl( + ManagedServerSecurityAlertPoliciesClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + SecurityAlertPolicyName securityAlertPolicyName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, managedInstanceName, securityAlertPolicyName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ManagedServerSecurityAlertPolicyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ManagedServerSecurityAlertPolicy get( + String resourceGroupName, String managedInstanceName, SecurityAlertPolicyName securityAlertPolicyName) { + ManagedServerSecurityAlertPolicyInner inner = + this.serviceClient().get(resourceGroupName, managedInstanceName, securityAlertPolicyName); + if (inner != null) { + return new ManagedServerSecurityAlertPolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName) { + PagedIterable inner = + this.serviceClient().listByInstance(resourceGroupName, managedInstanceName); + return Utils.mapPage(inner, inner1 -> new ManagedServerSecurityAlertPolicyImpl(inner1, this.manager())); + } + + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context) { + PagedIterable inner = + this.serviceClient().listByInstance(resourceGroupName, managedInstanceName, context); + return Utils.mapPage(inner, inner1 -> new ManagedServerSecurityAlertPolicyImpl(inner1, this.manager())); + } + + public ManagedServerSecurityAlertPolicy getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String securityAlertPolicyNameLocal = Utils.getValueFromIdByName(id, "securityAlertPolicies"); + if (securityAlertPolicyNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'securityAlertPolicies'.", + id))); + } + SecurityAlertPolicyName securityAlertPolicyName = + SecurityAlertPolicyName.fromString(securityAlertPolicyNameLocal); + return this + .getWithResponse(resourceGroupName, managedInstanceName, securityAlertPolicyName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String securityAlertPolicyNameLocal = Utils.getValueFromIdByName(id, "securityAlertPolicies"); + if (securityAlertPolicyNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'securityAlertPolicies'.", + id))); + } + SecurityAlertPolicyName securityAlertPolicyName = + SecurityAlertPolicyName.fromString(securityAlertPolicyNameLocal); + return this.getWithResponse(resourceGroupName, managedInstanceName, securityAlertPolicyName, context); + } + + private ManagedServerSecurityAlertPoliciesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ManagedServerSecurityAlertPolicyImpl define(SecurityAlertPolicyName name) { + return new ManagedServerSecurityAlertPolicyImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedServerSecurityAlertPolicyImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedServerSecurityAlertPolicyImpl.java new file mode 100644 index 0000000000000..c13aa19263e08 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedServerSecurityAlertPolicyImpl.java @@ -0,0 +1,224 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedServerSecurityAlertPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ManagedServerSecurityAlertPolicy; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyName; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertsPolicyState; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class ManagedServerSecurityAlertPolicyImpl + implements ManagedServerSecurityAlertPolicy, + ManagedServerSecurityAlertPolicy.Definition, + ManagedServerSecurityAlertPolicy.Update { + private ManagedServerSecurityAlertPolicyInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public SecurityAlertsPolicyState state() { + return this.innerModel().state(); + } + + public List disabledAlerts() { + List inner = this.innerModel().disabledAlerts(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List emailAddresses() { + List inner = this.innerModel().emailAddresses(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Boolean emailAccountAdmins() { + return this.innerModel().emailAccountAdmins(); + } + + public String storageEndpoint() { + return this.innerModel().storageEndpoint(); + } + + public String storageAccountAccessKey() { + return this.innerModel().storageAccountAccessKey(); + } + + public Integer retentionDays() { + return this.innerModel().retentionDays(); + } + + public OffsetDateTime creationTime() { + return this.innerModel().creationTime(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ManagedServerSecurityAlertPolicyInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String managedInstanceName; + + private SecurityAlertPolicyName securityAlertPolicyName; + + public ManagedServerSecurityAlertPolicyImpl withExistingManagedInstance( + String resourceGroupName, String managedInstanceName) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + return this; + } + + public ManagedServerSecurityAlertPolicy create() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedServerSecurityAlertPolicies() + .createOrUpdate( + resourceGroupName, managedInstanceName, securityAlertPolicyName, this.innerModel(), Context.NONE); + return this; + } + + public ManagedServerSecurityAlertPolicy create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedServerSecurityAlertPolicies() + .createOrUpdate( + resourceGroupName, managedInstanceName, securityAlertPolicyName, this.innerModel(), context); + return this; + } + + ManagedServerSecurityAlertPolicyImpl( + SecurityAlertPolicyName name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ManagedServerSecurityAlertPolicyInner(); + this.serviceManager = serviceManager; + this.securityAlertPolicyName = name; + } + + public ManagedServerSecurityAlertPolicyImpl update() { + return this; + } + + public ManagedServerSecurityAlertPolicy apply() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedServerSecurityAlertPolicies() + .createOrUpdate( + resourceGroupName, managedInstanceName, securityAlertPolicyName, this.innerModel(), Context.NONE); + return this; + } + + public ManagedServerSecurityAlertPolicy apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedServerSecurityAlertPolicies() + .createOrUpdate( + resourceGroupName, managedInstanceName, securityAlertPolicyName, this.innerModel(), context); + return this; + } + + ManagedServerSecurityAlertPolicyImpl( + ManagedServerSecurityAlertPolicyInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.managedInstanceName = Utils.getValueFromIdByName(innerObject.id(), "managedInstances"); + this.securityAlertPolicyName = + SecurityAlertPolicyName.fromString(Utils.getValueFromIdByName(innerObject.id(), "securityAlertPolicies")); + } + + public ManagedServerSecurityAlertPolicy refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedServerSecurityAlertPolicies() + .getWithResponse(resourceGroupName, managedInstanceName, securityAlertPolicyName, Context.NONE) + .getValue(); + return this; + } + + public ManagedServerSecurityAlertPolicy refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedServerSecurityAlertPolicies() + .getWithResponse(resourceGroupName, managedInstanceName, securityAlertPolicyName, context) + .getValue(); + return this; + } + + public ManagedServerSecurityAlertPolicyImpl withState(SecurityAlertsPolicyState state) { + this.innerModel().withState(state); + return this; + } + + public ManagedServerSecurityAlertPolicyImpl withDisabledAlerts(List disabledAlerts) { + this.innerModel().withDisabledAlerts(disabledAlerts); + return this; + } + + public ManagedServerSecurityAlertPolicyImpl withEmailAddresses(List emailAddresses) { + this.innerModel().withEmailAddresses(emailAddresses); + return this; + } + + public ManagedServerSecurityAlertPolicyImpl withEmailAccountAdmins(Boolean emailAccountAdmins) { + this.innerModel().withEmailAccountAdmins(emailAccountAdmins); + return this; + } + + public ManagedServerSecurityAlertPolicyImpl withStorageEndpoint(String storageEndpoint) { + this.innerModel().withStorageEndpoint(storageEndpoint); + return this; + } + + public ManagedServerSecurityAlertPolicyImpl withStorageAccountAccessKey(String storageAccountAccessKey) { + this.innerModel().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + public ManagedServerSecurityAlertPolicyImpl withRetentionDays(Integer retentionDays) { + this.innerModel().withRetentionDays(retentionDays); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedTransparentDataEncryptionImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedTransparentDataEncryptionImpl.java new file mode 100644 index 0000000000000..e4f0df276388a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ManagedTransparentDataEncryptionImpl.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedTransparentDataEncryptionInner; +import com.azure.resourcemanager.sql.generated.models.ManagedTransparentDataEncryption; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionName; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionState; + +public final class ManagedTransparentDataEncryptionImpl + implements ManagedTransparentDataEncryption, + ManagedTransparentDataEncryption.Definition, + ManagedTransparentDataEncryption.Update { + private ManagedTransparentDataEncryptionInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public TransparentDataEncryptionState state() { + return this.innerModel().state(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ManagedTransparentDataEncryptionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String managedInstanceName; + + private String databaseName; + + private TransparentDataEncryptionName tdeName; + + public ManagedTransparentDataEncryptionImpl withExistingDatabase( + String resourceGroupName, String managedInstanceName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + this.databaseName = databaseName; + return this; + } + + public ManagedTransparentDataEncryption create() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedDatabaseTransparentDataEncryptions() + .createOrUpdateWithResponse( + resourceGroupName, managedInstanceName, databaseName, tdeName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public ManagedTransparentDataEncryption create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedDatabaseTransparentDataEncryptions() + .createOrUpdateWithResponse( + resourceGroupName, managedInstanceName, databaseName, tdeName, this.innerModel(), context) + .getValue(); + return this; + } + + ManagedTransparentDataEncryptionImpl( + TransparentDataEncryptionName name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ManagedTransparentDataEncryptionInner(); + this.serviceManager = serviceManager; + this.tdeName = name; + } + + public ManagedTransparentDataEncryptionImpl update() { + return this; + } + + public ManagedTransparentDataEncryption apply() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedDatabaseTransparentDataEncryptions() + .createOrUpdateWithResponse( + resourceGroupName, managedInstanceName, databaseName, tdeName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public ManagedTransparentDataEncryption apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedDatabaseTransparentDataEncryptions() + .createOrUpdateWithResponse( + resourceGroupName, managedInstanceName, databaseName, tdeName, this.innerModel(), context) + .getValue(); + return this; + } + + ManagedTransparentDataEncryptionImpl( + ManagedTransparentDataEncryptionInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.managedInstanceName = Utils.getValueFromIdByName(innerObject.id(), "managedInstances"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "databases"); + this.tdeName = + TransparentDataEncryptionName + .fromString(Utils.getValueFromIdByName(innerObject.id(), "transparentDataEncryption")); + } + + public ManagedTransparentDataEncryption refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedDatabaseTransparentDataEncryptions() + .getWithResponse(resourceGroupName, managedInstanceName, databaseName, tdeName, Context.NONE) + .getValue(); + return this; + } + + public ManagedTransparentDataEncryption refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedDatabaseTransparentDataEncryptions() + .getWithResponse(resourceGroupName, managedInstanceName, databaseName, tdeName, context) + .getValue(); + return this; + } + + public ManagedTransparentDataEncryptionImpl withState(TransparentDataEncryptionState state) { + this.innerModel().withState(state); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/MetricDefinitionImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/MetricDefinitionImpl.java new file mode 100644 index 0000000000000..3e884accf89d2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/MetricDefinitionImpl.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.MetricDefinitionInner; +import com.azure.resourcemanager.sql.generated.models.MetricAvailability; +import com.azure.resourcemanager.sql.generated.models.MetricDefinition; +import com.azure.resourcemanager.sql.generated.models.MetricName; +import com.azure.resourcemanager.sql.generated.models.PrimaryAggregationType; +import com.azure.resourcemanager.sql.generated.models.UnitDefinitionType; +import java.util.Collections; +import java.util.List; + +public final class MetricDefinitionImpl implements MetricDefinition { + private MetricDefinitionInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + MetricDefinitionImpl( + MetricDefinitionInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public MetricName name() { + return this.innerModel().name(); + } + + public PrimaryAggregationType primaryAggregationType() { + return this.innerModel().primaryAggregationType(); + } + + public String resourceUri() { + return this.innerModel().resourceUri(); + } + + public UnitDefinitionType unit() { + return this.innerModel().unit(); + } + + public List metricAvailabilities() { + List inner = this.innerModel().metricAvailabilities(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public MetricDefinitionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/MetricImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/MetricImpl.java new file mode 100644 index 0000000000000..d4b96290a9b9b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/MetricImpl.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.MetricInner; +import com.azure.resourcemanager.sql.generated.models.Metric; +import com.azure.resourcemanager.sql.generated.models.MetricName; +import com.azure.resourcemanager.sql.generated.models.MetricValue; +import com.azure.resourcemanager.sql.generated.models.UnitType; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class MetricImpl implements Metric { + private MetricInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + MetricImpl(MetricInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public OffsetDateTime startTime() { + return this.innerModel().startTime(); + } + + public OffsetDateTime endTime() { + return this.innerModel().endTime(); + } + + public String timeGrain() { + return this.innerModel().timeGrain(); + } + + public UnitType unit() { + return this.innerModel().unit(); + } + + public MetricName name() { + return this.innerModel().name(); + } + + public List metricValues() { + List inner = this.innerModel().metricValues(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public MetricInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/OperationImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/OperationImpl.java new file mode 100644 index 0000000000000..e06b173a2a7c7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/OperationImpl.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.OperationInner; +import com.azure.resourcemanager.sql.generated.models.Operation; +import com.azure.resourcemanager.sql.generated.models.OperationDisplay; +import com.azure.resourcemanager.sql.generated.models.OperationOrigin; +import java.util.Collections; +import java.util.Map; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + OperationImpl(OperationInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public OperationDisplay display() { + return this.innerModel().display(); + } + + public OperationOrigin origin() { + return this.innerModel().origin(); + } + + public Map properties() { + Map inner = this.innerModel().properties(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public OperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/OperationsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/OperationsClientImpl.java new file mode 100644 index 0000000000000..9569cf9b94d77 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/OperationsClientImpl.java @@ -0,0 +1,273 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.OperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.OperationInner; +import com.azure.resourcemanager.sql.generated.models.OperationListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public final class OperationsClientImpl implements OperationsClient { + /** The proxy service used to perform REST calls. */ + private final OperationsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientO") + public interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Sql/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists all of the available SQL Rest API operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list SQL operations along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all of the available SQL Rest API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list SQL operations along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all of the available SQL Rest API operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list SQL operations as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the available SQL Rest API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list SQL operations as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all of the available SQL Rest API operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list SQL operations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all of the available SQL Rest API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list SQL operations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list SQL operations along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list SQL operations along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/OperationsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..672183343200d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/OperationsImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.OperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.OperationInner; +import com.azure.resourcemanager.sql.generated.models.Operation; +import com.azure.resourcemanager.sql.generated.models.Operations; + +public final class OperationsImpl implements Operations { + private static final ClientLogger LOGGER = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public OperationsImpl( + OperationsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/OutboundFirewallRuleImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/OutboundFirewallRuleImpl.java new file mode 100644 index 0000000000000..88aa81582e071 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/OutboundFirewallRuleImpl.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.OutboundFirewallRuleInner; +import com.azure.resourcemanager.sql.generated.models.OutboundFirewallRule; + +public final class OutboundFirewallRuleImpl + implements OutboundFirewallRule, OutboundFirewallRule.Definition, OutboundFirewallRule.Update { + private OutboundFirewallRuleInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public OutboundFirewallRuleInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String outboundRuleFqdn; + + public OutboundFirewallRuleImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public OutboundFirewallRule create() { + this.innerObject = + serviceManager + .serviceClient() + .getOutboundFirewallRules() + .createOrUpdate(resourceGroupName, serverName, outboundRuleFqdn, this.innerModel(), Context.NONE); + return this; + } + + public OutboundFirewallRule create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getOutboundFirewallRules() + .createOrUpdate(resourceGroupName, serverName, outboundRuleFqdn, this.innerModel(), context); + return this; + } + + OutboundFirewallRuleImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new OutboundFirewallRuleInner(); + this.serviceManager = serviceManager; + this.outboundRuleFqdn = name; + } + + public OutboundFirewallRuleImpl update() { + return this; + } + + public OutboundFirewallRule apply() { + this.innerObject = + serviceManager + .serviceClient() + .getOutboundFirewallRules() + .createOrUpdate(resourceGroupName, serverName, outboundRuleFqdn, this.innerModel(), Context.NONE); + return this; + } + + public OutboundFirewallRule apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getOutboundFirewallRules() + .createOrUpdate(resourceGroupName, serverName, outboundRuleFqdn, this.innerModel(), context); + return this; + } + + OutboundFirewallRuleImpl( + OutboundFirewallRuleInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.outboundRuleFqdn = Utils.getValueFromIdByName(innerObject.id(), "outboundFirewallRules"); + } + + public OutboundFirewallRule refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getOutboundFirewallRules() + .getWithResponse(resourceGroupName, serverName, outboundRuleFqdn, Context.NONE) + .getValue(); + return this; + } + + public OutboundFirewallRule refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getOutboundFirewallRules() + .getWithResponse(resourceGroupName, serverName, outboundRuleFqdn, context) + .getValue(); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/OutboundFirewallRulesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/OutboundFirewallRulesClientImpl.java new file mode 100644 index 0000000000000..18b2b5acd4865 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/OutboundFirewallRulesClientImpl.java @@ -0,0 +1,1159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.OutboundFirewallRulesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.OutboundFirewallRuleInner; +import com.azure.resourcemanager.sql.generated.models.OutboundFirewallRuleListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in OutboundFirewallRulesClient. */ +public final class OutboundFirewallRulesClientImpl implements OutboundFirewallRulesClient { + /** The proxy service used to perform REST calls. */ + private final OutboundFirewallRulesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of OutboundFirewallRulesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OutboundFirewallRulesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create(OutboundFirewallRulesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientOutboundFirewallRules to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientO") + public interface OutboundFirewallRulesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/outboundFirewallRules/{outboundRuleFqdn}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("outboundRuleFqdn") String outboundRuleFqdn, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/outboundFirewallRules/{outboundRuleFqdn}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("outboundRuleFqdn") String outboundRuleFqdn, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") OutboundFirewallRuleInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/outboundFirewallRules/{outboundRuleFqdn}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("outboundRuleFqdn") String outboundRuleFqdn, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/outboundFirewallRules") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets an outbound 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 outboundRuleFqdn The outboundRuleFqdn parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an outbound firewall rule along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String outboundRuleFqdn) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (outboundRuleFqdn == null) { + return Mono + .error(new IllegalArgumentException("Parameter outboundRuleFqdn is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + outboundRuleFqdn, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets an outbound 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 outboundRuleFqdn The outboundRuleFqdn parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an outbound firewall rule along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String outboundRuleFqdn, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (outboundRuleFqdn == null) { + return Mono + .error(new IllegalArgumentException("Parameter outboundRuleFqdn is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + outboundRuleFqdn, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets an outbound 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 outboundRuleFqdn The outboundRuleFqdn parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an outbound firewall rule on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String outboundRuleFqdn) { + return getWithResponseAsync(resourceGroupName, serverName, outboundRuleFqdn) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets an outbound 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 outboundRuleFqdn The outboundRuleFqdn parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an outbound firewall rule along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String outboundRuleFqdn, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, outboundRuleFqdn, context).block(); + } + + /** + * Gets an outbound 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 outboundRuleFqdn The outboundRuleFqdn parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an outbound firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OutboundFirewallRuleInner get(String resourceGroupName, String serverName, String outboundRuleFqdn) { + return getWithResponse(resourceGroupName, serverName, outboundRuleFqdn, Context.NONE).getValue(); + } + + /** + * Create a outbound firewall rule with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param outboundRuleFqdn The outboundRuleFqdn parameter. + * @param parameters An Azure SQL DB Server Outbound Firewall Rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL DB Server Outbound Firewall Rule along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverName, String outboundRuleFqdn, OutboundFirewallRuleInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (outboundRuleFqdn == null) { + return Mono + .error(new IllegalArgumentException("Parameter outboundRuleFqdn is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + outboundRuleFqdn, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a outbound firewall rule with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param outboundRuleFqdn The outboundRuleFqdn parameter. + * @param parameters An Azure SQL DB Server Outbound Firewall Rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL DB Server Outbound Firewall Rule along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String outboundRuleFqdn, + OutboundFirewallRuleInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (outboundRuleFqdn == null) { + return Mono + .error(new IllegalArgumentException("Parameter outboundRuleFqdn is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + outboundRuleFqdn, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Create a outbound firewall rule with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param outboundRuleFqdn The outboundRuleFqdn parameter. + * @param parameters An Azure SQL DB Server Outbound Firewall Rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an Azure SQL DB Server Outbound Firewall Rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, OutboundFirewallRuleInner> beginCreateOrUpdateAsync( + String resourceGroupName, String serverName, String outboundRuleFqdn, OutboundFirewallRuleInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, outboundRuleFqdn, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + OutboundFirewallRuleInner.class, + OutboundFirewallRuleInner.class, + this.client.getContext()); + } + + /** + * Create a outbound firewall rule with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param outboundRuleFqdn The outboundRuleFqdn parameter. + * @param parameters An Azure SQL DB Server Outbound Firewall Rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an Azure SQL DB Server Outbound Firewall Rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, OutboundFirewallRuleInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String outboundRuleFqdn, + OutboundFirewallRuleInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, outboundRuleFqdn, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + OutboundFirewallRuleInner.class, + OutboundFirewallRuleInner.class, + context); + } + + /** + * Create a outbound firewall rule with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param outboundRuleFqdn The outboundRuleFqdn parameter. + * @param parameters An Azure SQL DB Server Outbound Firewall Rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL DB Server Outbound Firewall Rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, OutboundFirewallRuleInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String outboundRuleFqdn, OutboundFirewallRuleInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, outboundRuleFqdn, parameters).getSyncPoller(); + } + + /** + * Create a outbound firewall rule with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param outboundRuleFqdn The outboundRuleFqdn parameter. + * @param parameters An Azure SQL DB Server Outbound Firewall Rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL DB Server Outbound Firewall Rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, OutboundFirewallRuleInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String outboundRuleFqdn, + OutboundFirewallRuleInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, outboundRuleFqdn, parameters, context) + .getSyncPoller(); + } + + /** + * Create a outbound firewall rule with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param outboundRuleFqdn The outboundRuleFqdn parameter. + * @param parameters An Azure SQL DB Server Outbound Firewall Rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL DB Server Outbound Firewall Rule on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serverName, String outboundRuleFqdn, OutboundFirewallRuleInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, outboundRuleFqdn, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a outbound firewall rule with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param outboundRuleFqdn The outboundRuleFqdn parameter. + * @param parameters An Azure SQL DB Server Outbound Firewall Rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL DB Server Outbound Firewall Rule on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String outboundRuleFqdn, + OutboundFirewallRuleInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, outboundRuleFqdn, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a outbound firewall rule with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param outboundRuleFqdn The outboundRuleFqdn parameter. + * @param parameters An Azure SQL DB Server Outbound Firewall Rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL DB Server Outbound Firewall Rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OutboundFirewallRuleInner createOrUpdate( + String resourceGroupName, String serverName, String outboundRuleFqdn, OutboundFirewallRuleInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, outboundRuleFqdn, parameters).block(); + } + + /** + * Create a outbound firewall rule with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param outboundRuleFqdn The outboundRuleFqdn parameter. + * @param parameters An Azure SQL DB Server Outbound Firewall Rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL DB Server Outbound Firewall Rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OutboundFirewallRuleInner createOrUpdate( + String resourceGroupName, + String serverName, + String outboundRuleFqdn, + OutboundFirewallRuleInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, outboundRuleFqdn, parameters, context).block(); + } + + /** + * Deletes a outbound firewall rule with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param outboundRuleFqdn The outboundRuleFqdn parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, String outboundRuleFqdn) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (outboundRuleFqdn == null) { + return Mono + .error(new IllegalArgumentException("Parameter outboundRuleFqdn is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-02-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + outboundRuleFqdn, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a outbound firewall rule with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param outboundRuleFqdn The outboundRuleFqdn parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, String outboundRuleFqdn, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (outboundRuleFqdn == null) { + return Mono + .error(new IllegalArgumentException("Parameter outboundRuleFqdn is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-02-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + outboundRuleFqdn, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes a outbound firewall rule with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param outboundRuleFqdn The outboundRuleFqdn parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String outboundRuleFqdn) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, outboundRuleFqdn); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes a outbound firewall rule with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param outboundRuleFqdn The outboundRuleFqdn parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String outboundRuleFqdn, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, outboundRuleFqdn, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a outbound firewall rule with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param outboundRuleFqdn The outboundRuleFqdn parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String outboundRuleFqdn) { + return beginDeleteAsync(resourceGroupName, serverName, outboundRuleFqdn).getSyncPoller(); + } + + /** + * Deletes a outbound firewall rule with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param outboundRuleFqdn The outboundRuleFqdn parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String outboundRuleFqdn, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, outboundRuleFqdn, context).getSyncPoller(); + } + + /** + * Deletes a outbound firewall rule with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param outboundRuleFqdn The outboundRuleFqdn parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String serverName, String outboundRuleFqdn) { + return beginDeleteAsync(resourceGroupName, serverName, outboundRuleFqdn) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a outbound firewall rule with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param outboundRuleFqdn The outboundRuleFqdn parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String serverName, String outboundRuleFqdn, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, outboundRuleFqdn, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a outbound firewall rule with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param outboundRuleFqdn The outboundRuleFqdn parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, String outboundRuleFqdn) { + deleteAsync(resourceGroupName, serverName, outboundRuleFqdn).block(); + } + + /** + * Deletes a outbound firewall rule with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param outboundRuleFqdn The outboundRuleFqdn parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, String outboundRuleFqdn, Context context) { + deleteAsync(resourceGroupName, serverName, outboundRuleFqdn, context).block(); + } + + /** + * Gets all outbound firewall rules on a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all outbound firewall rules on a server along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets all outbound firewall rules on a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all outbound firewall rules on a server along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets all outbound firewall rules on a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all outbound firewall rules on a server as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Gets all outbound firewall rules on a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all outbound firewall rules on a server as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all outbound firewall rules on a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all outbound firewall rules on a server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * Gets all outbound firewall rules on a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all outbound firewall rules on a server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of outbound rules along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByServerNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of outbound rules along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServerNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/OutboundFirewallRulesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/OutboundFirewallRulesImpl.java new file mode 100644 index 0000000000000..48ff525d8c9e3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/OutboundFirewallRulesImpl.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.OutboundFirewallRulesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.OutboundFirewallRuleInner; +import com.azure.resourcemanager.sql.generated.models.OutboundFirewallRule; +import com.azure.resourcemanager.sql.generated.models.OutboundFirewallRules; + +public final class OutboundFirewallRulesImpl implements OutboundFirewallRules { + private static final ClientLogger LOGGER = new ClientLogger(OutboundFirewallRulesImpl.class); + + private final OutboundFirewallRulesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public OutboundFirewallRulesImpl( + OutboundFirewallRulesClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String outboundRuleFqdn, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, outboundRuleFqdn, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new OutboundFirewallRuleImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public OutboundFirewallRule get(String resourceGroupName, String serverName, String outboundRuleFqdn) { + OutboundFirewallRuleInner inner = this.serviceClient().get(resourceGroupName, serverName, outboundRuleFqdn); + if (inner != null) { + return new OutboundFirewallRuleImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String serverName, String outboundRuleFqdn) { + this.serviceClient().delete(resourceGroupName, serverName, outboundRuleFqdn); + } + + public void delete(String resourceGroupName, String serverName, String outboundRuleFqdn, Context context) { + this.serviceClient().delete(resourceGroupName, serverName, outboundRuleFqdn, context); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new OutboundFirewallRuleImpl(inner1, this.manager())); + } + + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new OutboundFirewallRuleImpl(inner1, this.manager())); + } + + public OutboundFirewallRule getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String outboundRuleFqdn = Utils.getValueFromIdByName(id, "outboundFirewallRules"); + if (outboundRuleFqdn == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'outboundFirewallRules'.", + id))); + } + return this.getWithResponse(resourceGroupName, serverName, outboundRuleFqdn, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String outboundRuleFqdn = Utils.getValueFromIdByName(id, "outboundFirewallRules"); + if (outboundRuleFqdn == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'outboundFirewallRules'.", + id))); + } + return this.getWithResponse(resourceGroupName, serverName, outboundRuleFqdn, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String outboundRuleFqdn = Utils.getValueFromIdByName(id, "outboundFirewallRules"); + if (outboundRuleFqdn == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'outboundFirewallRules'.", + id))); + } + this.delete(resourceGroupName, serverName, outboundRuleFqdn, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String outboundRuleFqdn = Utils.getValueFromIdByName(id, "outboundFirewallRules"); + if (outboundRuleFqdn == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'outboundFirewallRules'.", + id))); + } + this.delete(resourceGroupName, serverName, outboundRuleFqdn, context); + } + + private OutboundFirewallRulesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public OutboundFirewallRuleImpl define(String name) { + return new OutboundFirewallRuleImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/PrivateEndpointConnectionImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/PrivateEndpointConnectionImpl.java new file mode 100644 index 0000000000000..10c6ce8e14b7b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/PrivateEndpointConnectionImpl.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.sql.generated.models.PrivateEndpointConnection; +import com.azure.resourcemanager.sql.generated.models.PrivateEndpointProperty; +import com.azure.resourcemanager.sql.generated.models.PrivateEndpointProvisioningState; +import com.azure.resourcemanager.sql.generated.models.PrivateLinkServiceConnectionStateProperty; + +public final class PrivateEndpointConnectionImpl + implements PrivateEndpointConnection, PrivateEndpointConnection.Definition, PrivateEndpointConnection.Update { + private PrivateEndpointConnectionInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public PrivateEndpointProperty privateEndpoint() { + return this.innerModel().privateEndpoint(); + } + + public PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState() { + return this.innerModel().privateLinkServiceConnectionState(); + } + + public PrivateEndpointProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public PrivateEndpointConnectionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String privateEndpointConnectionName; + + public PrivateEndpointConnectionImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public PrivateEndpointConnection create() { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .createOrUpdate( + resourceGroupName, serverName, privateEndpointConnectionName, this.innerModel(), Context.NONE); + return this; + } + + public PrivateEndpointConnection create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .createOrUpdate( + resourceGroupName, serverName, privateEndpointConnectionName, this.innerModel(), context); + return this; + } + + PrivateEndpointConnectionImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new PrivateEndpointConnectionInner(); + this.serviceManager = serviceManager; + this.privateEndpointConnectionName = name; + } + + public PrivateEndpointConnectionImpl update() { + return this; + } + + public PrivateEndpointConnection apply() { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .createOrUpdate( + resourceGroupName, serverName, privateEndpointConnectionName, this.innerModel(), Context.NONE); + return this; + } + + public PrivateEndpointConnection apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .createOrUpdate( + resourceGroupName, serverName, privateEndpointConnectionName, this.innerModel(), context); + return this; + } + + PrivateEndpointConnectionImpl( + PrivateEndpointConnectionInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.privateEndpointConnectionName = Utils.getValueFromIdByName(innerObject.id(), "privateEndpointConnections"); + } + + public PrivateEndpointConnection refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .getWithResponse(resourceGroupName, serverName, privateEndpointConnectionName, Context.NONE) + .getValue(); + return this; + } + + public PrivateEndpointConnection refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .getWithResponse(resourceGroupName, serverName, privateEndpointConnectionName, context) + .getValue(); + return this; + } + + public PrivateEndpointConnectionImpl withPrivateEndpoint(PrivateEndpointProperty privateEndpoint) { + this.innerModel().withPrivateEndpoint(privateEndpoint); + return this; + } + + public PrivateEndpointConnectionImpl withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState) { + this.innerModel().withPrivateLinkServiceConnectionState(privateLinkServiceConnectionState); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/PrivateEndpointConnectionsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/PrivateEndpointConnectionsClientImpl.java new file mode 100644 index 0000000000000..bdf97121b4afd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/PrivateEndpointConnectionsClientImpl.java @@ -0,0 +1,1196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.sql.generated.models.PrivateEndpointConnectionListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PrivateEndpointConnectionsClient. */ +public final class PrivateEndpointConnectionsClientImpl implements PrivateEndpointConnectionsClient { + /** The proxy service used to perform REST calls. */ + private final PrivateEndpointConnectionsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of PrivateEndpointConnectionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PrivateEndpointConnectionsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + PrivateEndpointConnectionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientPrivateEndpointConnections to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientP") + public interface PrivateEndpointConnectionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") PrivateEndpointConnectionInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/privateEndpointConnections") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String privateEndpointConnectionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + privateEndpointConnectionName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + privateEndpointConnectionName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String privateEndpointConnectionName) { + return getWithResponseAsync(resourceGroupName, serverName, privateEndpointConnectionName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, privateEndpointConnectionName, context).block(); + } + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner get( + String resourceGroupName, String serverName, String privateEndpointConnectionName) { + return getWithResponse(resourceGroupName, serverName, privateEndpointConnectionName, Context.NONE).getValue(); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + privateEndpointConnectionName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + privateEndpointConnectionName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, PrivateEndpointConnectionInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + PrivateEndpointConnectionInner.class, + PrivateEndpointConnectionInner.class, + this.client.getContext()); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, PrivateEndpointConnectionInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, serverName, privateEndpointConnectionName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + PrivateEndpointConnectionInner.class, + PrivateEndpointConnectionInner.class, + context); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, PrivateEndpointConnectionInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters) + .getSyncPoller(); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, PrivateEndpointConnectionInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, serverName, privateEndpointConnectionName, parameters, context) + .getSyncPoller(); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, serverName, privateEndpointConnectionName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner createOrUpdate( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters).block(); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner createOrUpdate( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters, context) + .block(); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, String privateEndpointConnectionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + privateEndpointConnectionName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + privateEndpointConnectionName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String privateEndpointConnectionName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, privateEndpointConnectionName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, privateEndpointConnectionName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String privateEndpointConnectionName) { + return beginDeleteAsync(resourceGroupName, serverName, privateEndpointConnectionName).getSyncPoller(); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, privateEndpointConnectionName, context).getSyncPoller(); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String serverName, String privateEndpointConnectionName) { + return beginDeleteAsync(resourceGroupName, serverName, privateEndpointConnectionName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, privateEndpointConnectionName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, String privateEndpointConnectionName) { + deleteAsync(resourceGroupName, serverName, privateEndpointConnectionName).block(); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context) { + deleteAsync(resourceGroupName, serverName, privateEndpointConnectionName, context).block(); + } + + /** + * Gets all private endpoint connections on a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all private endpoint connections on a server along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets all private endpoint connections on a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all private endpoint connections on a server along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets all private endpoint connections on a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all private endpoint connections on a server as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Gets all private endpoint connections on a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all private endpoint connections on a server as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all private endpoint connections on a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all private endpoint connections on a server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * Gets all private endpoint connections on a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all private endpoint connections on a server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private endpoint connections along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByServerNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private endpoint connections along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServerNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/PrivateEndpointConnectionsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/PrivateEndpointConnectionsImpl.java new file mode 100644 index 0000000000000..e558927ab4cc5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/PrivateEndpointConnectionsImpl.java @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.sql.generated.models.PrivateEndpointConnection; +import com.azure.resourcemanager.sql.generated.models.PrivateEndpointConnections; + +public final class PrivateEndpointConnectionsImpl implements PrivateEndpointConnections { + private static final ClientLogger LOGGER = new ClientLogger(PrivateEndpointConnectionsImpl.class); + + private final PrivateEndpointConnectionsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public PrivateEndpointConnectionsImpl( + PrivateEndpointConnectionsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, privateEndpointConnectionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new PrivateEndpointConnectionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PrivateEndpointConnection get( + String resourceGroupName, String serverName, String privateEndpointConnectionName) { + PrivateEndpointConnectionInner inner = + this.serviceClient().get(resourceGroupName, serverName, privateEndpointConnectionName); + if (inner != null) { + return new PrivateEndpointConnectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String serverName, String privateEndpointConnectionName) { + this.serviceClient().delete(resourceGroupName, serverName, privateEndpointConnectionName); + } + + public void delete( + String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context) { + this.serviceClient().delete(resourceGroupName, serverName, privateEndpointConnectionName, context); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new PrivateEndpointConnectionImpl(inner1, this.manager())); + } + + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new PrivateEndpointConnectionImpl(inner1, this.manager())); + } + + public PrivateEndpointConnection getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String privateEndpointConnectionName = Utils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", + id))); + } + return this + .getWithResponse(resourceGroupName, serverName, privateEndpointConnectionName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String privateEndpointConnectionName = Utils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", + id))); + } + return this.getWithResponse(resourceGroupName, serverName, privateEndpointConnectionName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String privateEndpointConnectionName = Utils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", + id))); + } + this.delete(resourceGroupName, serverName, privateEndpointConnectionName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String privateEndpointConnectionName = Utils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", + id))); + } + this.delete(resourceGroupName, serverName, privateEndpointConnectionName, context); + } + + private PrivateEndpointConnectionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public PrivateEndpointConnectionImpl define(String name) { + return new PrivateEndpointConnectionImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/PrivateLinkResourceImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/PrivateLinkResourceImpl.java new file mode 100644 index 0000000000000..a1ef524652e76 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/PrivateLinkResourceImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.sql.generated.models.PrivateLinkResource; +import com.azure.resourcemanager.sql.generated.models.PrivateLinkResourceProperties; + +public final class PrivateLinkResourceImpl implements PrivateLinkResource { + private PrivateLinkResourceInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + PrivateLinkResourceImpl( + PrivateLinkResourceInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public PrivateLinkResourceProperties properties() { + return this.innerModel().properties(); + } + + public PrivateLinkResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/PrivateLinkResourcesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/PrivateLinkResourcesClientImpl.java new file mode 100644 index 0000000000000..8db9f87b227dc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/PrivateLinkResourcesClientImpl.java @@ -0,0 +1,531 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.PrivateLinkResourcesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.sql.generated.models.PrivateLinkResourceListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PrivateLinkResourcesClient. */ +public final class PrivateLinkResourcesClientImpl implements PrivateLinkResourcesClient { + /** The proxy service used to perform REST calls. */ + private final PrivateLinkResourcesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of PrivateLinkResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PrivateLinkResourcesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create(PrivateLinkResourcesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientPrivateLinkResources to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientP") + public interface PrivateLinkResourcesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/privateLinkResources") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/privateLinkResources/{groupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("groupName") String groupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the private link resources for 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources for SQL server along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the private link resources for 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources for SQL server along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets the private link resources for 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources for SQL server as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Gets the private link resources for 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources for SQL server as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets the private link resources for 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources for SQL server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * Gets the private link resources for 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources for SQL server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } + + /** + * Gets a private link resource for 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 groupName The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private link resource for SQL server along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String groupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (groupName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + groupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a private link resource for 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 groupName The name of the private link resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private link resource for SQL server along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String groupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (groupName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + groupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a private link resource for 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 groupName The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private link resource for SQL server on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serverName, String groupName) { + return getWithResponseAsync(resourceGroupName, serverName, groupName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a private link resource for 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 groupName The name of the private link resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private link resource for SQL server along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String groupName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, groupName, context).block(); + } + + /** + * Gets a private link resource for 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 groupName The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private link resource for SQL server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateLinkResourceInner get(String resourceGroupName, String serverName, String groupName) { + return getWithResponse(resourceGroupName, serverName, groupName, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

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

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private link resources along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServerNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/PrivateLinkResourcesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/PrivateLinkResourcesImpl.java new file mode 100644 index 0000000000000..1e9fdfd8c9ef5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/PrivateLinkResourcesImpl.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.PrivateLinkResourcesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.sql.generated.models.PrivateLinkResource; +import com.azure.resourcemanager.sql.generated.models.PrivateLinkResources; + +public final class PrivateLinkResourcesImpl implements PrivateLinkResources { + private static final ClientLogger LOGGER = new ClientLogger(PrivateLinkResourcesImpl.class); + + private final PrivateLinkResourcesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public PrivateLinkResourcesImpl( + PrivateLinkResourcesClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new PrivateLinkResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new PrivateLinkResourceImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String groupName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, groupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new PrivateLinkResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PrivateLinkResource get(String resourceGroupName, String serverName, String groupName) { + PrivateLinkResourceInner inner = this.serviceClient().get(resourceGroupName, serverName, groupName); + if (inner != null) { + return new PrivateLinkResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + private PrivateLinkResourcesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/QueryStatisticsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/QueryStatisticsImpl.java new file mode 100644 index 0000000000000..a41301ab42df2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/QueryStatisticsImpl.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.QueryStatisticsInner; +import com.azure.resourcemanager.sql.generated.models.QueryMetricInterval; +import com.azure.resourcemanager.sql.generated.models.QueryStatistics; +import java.util.Collections; +import java.util.List; + +public final class QueryStatisticsImpl implements QueryStatistics { + private QueryStatisticsInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + QueryStatisticsImpl( + QueryStatisticsInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String databaseName() { + return this.innerModel().databaseName(); + } + + public String queryId() { + return this.innerModel().queryId(); + } + + public String startTime() { + return this.innerModel().startTime(); + } + + public String endTime() { + return this.innerModel().endTime(); + } + + public List intervals() { + List inner = this.innerModel().intervals(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public QueryStatisticsInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecommendedActionImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecommendedActionImpl.java new file mode 100644 index 0000000000000..7211c07df1192 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecommendedActionImpl.java @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.RecommendedActionInner; +import com.azure.resourcemanager.sql.generated.models.RecommendedAction; +import com.azure.resourcemanager.sql.generated.models.RecommendedActionErrorInfo; +import com.azure.resourcemanager.sql.generated.models.RecommendedActionImpactRecord; +import com.azure.resourcemanager.sql.generated.models.RecommendedActionImplementationInfo; +import com.azure.resourcemanager.sql.generated.models.RecommendedActionInitiatedBy; +import com.azure.resourcemanager.sql.generated.models.RecommendedActionMetricInfo; +import com.azure.resourcemanager.sql.generated.models.RecommendedActionStateInfo; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class RecommendedActionImpl implements RecommendedAction { + private RecommendedActionInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + RecommendedActionImpl( + RecommendedActionInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String kind() { + return this.innerModel().kind(); + } + + public String location() { + return this.innerModel().location(); + } + + public String recommendationReason() { + return this.innerModel().recommendationReason(); + } + + public OffsetDateTime validSince() { + return this.innerModel().validSince(); + } + + public OffsetDateTime lastRefresh() { + return this.innerModel().lastRefresh(); + } + + public RecommendedActionStateInfo state() { + return this.innerModel().state(); + } + + public Boolean isExecutableAction() { + return this.innerModel().isExecutableAction(); + } + + public Boolean isRevertableAction() { + return this.innerModel().isRevertableAction(); + } + + public Boolean isArchivedAction() { + return this.innerModel().isArchivedAction(); + } + + public OffsetDateTime executeActionStartTime() { + return this.innerModel().executeActionStartTime(); + } + + public String executeActionDuration() { + return this.innerModel().executeActionDuration(); + } + + public OffsetDateTime revertActionStartTime() { + return this.innerModel().revertActionStartTime(); + } + + public String revertActionDuration() { + return this.innerModel().revertActionDuration(); + } + + public RecommendedActionInitiatedBy executeActionInitiatedBy() { + return this.innerModel().executeActionInitiatedBy(); + } + + public OffsetDateTime executeActionInitiatedTime() { + return this.innerModel().executeActionInitiatedTime(); + } + + public RecommendedActionInitiatedBy revertActionInitiatedBy() { + return this.innerModel().revertActionInitiatedBy(); + } + + public OffsetDateTime revertActionInitiatedTime() { + return this.innerModel().revertActionInitiatedTime(); + } + + public Integer score() { + return this.innerModel().score(); + } + + public RecommendedActionImplementationInfo implementationDetails() { + return this.innerModel().implementationDetails(); + } + + public RecommendedActionErrorInfo errorDetails() { + return this.innerModel().errorDetails(); + } + + public List estimatedImpact() { + List inner = this.innerModel().estimatedImpact(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List observedImpact() { + List inner = this.innerModel().observedImpact(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List timeSeries() { + List inner = this.innerModel().timeSeries(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List linkedObjects() { + List inner = this.innerModel().linkedObjects(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Map details() { + Map inner = this.innerModel().details(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public RecommendedActionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecommendedSensitivityLabelsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecommendedSensitivityLabelsClientImpl.java new file mode 100644 index 0000000000000..a8e8dffbaf983 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecommendedSensitivityLabelsClientImpl.java @@ -0,0 +1,265 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.RecommendedSensitivityLabelsClient; +import com.azure.resourcemanager.sql.generated.models.RecommendedSensitivityLabelUpdateList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in RecommendedSensitivityLabelsClient. */ +public final class RecommendedSensitivityLabelsClientImpl implements RecommendedSensitivityLabelsClient { + /** The proxy service used to perform REST calls. */ + private final RecommendedSensitivityLabelsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of RecommendedSensitivityLabelsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RecommendedSensitivityLabelsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + RecommendedSensitivityLabelsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientRecommendedSensitivityLabels to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientR") + public interface RecommendedSensitivityLabelsService { + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/recommendedSensitivityLabels") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") RecommendedSensitivityLabelUpdateList parameters, + Context context); + } + + /** + * Update recommended sensitivity labels states of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of recommended sensitivity label update operations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + RecommendedSensitivityLabelUpdateList parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update recommended sensitivity labels states of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of recommended sensitivity label update operations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + RecommendedSensitivityLabelUpdateList parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + context); + } + + /** + * Update recommended sensitivity labels states of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of recommended sensitivity label update operations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String serverName, + String databaseName, + RecommendedSensitivityLabelUpdateList parameters) { + return updateWithResponseAsync(resourceGroupName, serverName, databaseName, parameters) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Update recommended sensitivity labels states of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of recommended sensitivity label update operations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + RecommendedSensitivityLabelUpdateList parameters, + Context context) { + return updateWithResponseAsync(resourceGroupName, serverName, databaseName, parameters, context).block(); + } + + /** + * Update recommended sensitivity labels states of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of recommended sensitivity label update operations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void update( + String resourceGroupName, + String serverName, + String databaseName, + RecommendedSensitivityLabelUpdateList parameters) { + updateWithResponse(resourceGroupName, serverName, databaseName, parameters, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecommendedSensitivityLabelsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecommendedSensitivityLabelsImpl.java new file mode 100644 index 0000000000000..39e6fe1b9f84c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecommendedSensitivityLabelsImpl.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.RecommendedSensitivityLabelsClient; +import com.azure.resourcemanager.sql.generated.models.RecommendedSensitivityLabelUpdateList; +import com.azure.resourcemanager.sql.generated.models.RecommendedSensitivityLabels; + +public final class RecommendedSensitivityLabelsImpl implements RecommendedSensitivityLabels { + private static final ClientLogger LOGGER = new ClientLogger(RecommendedSensitivityLabelsImpl.class); + + private final RecommendedSensitivityLabelsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public RecommendedSensitivityLabelsImpl( + RecommendedSensitivityLabelsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response updateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + RecommendedSensitivityLabelUpdateList parameters, + Context context) { + return this + .serviceClient() + .updateWithResponse(resourceGroupName, serverName, databaseName, parameters, context); + } + + public void update( + String resourceGroupName, + String serverName, + String databaseName, + RecommendedSensitivityLabelUpdateList parameters) { + this.serviceClient().update(resourceGroupName, serverName, databaseName, parameters); + } + + private RecommendedSensitivityLabelsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecoverableDatabaseImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecoverableDatabaseImpl.java new file mode 100644 index 0000000000000..7c4e79f24f588 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecoverableDatabaseImpl.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.RecoverableDatabaseInner; +import com.azure.resourcemanager.sql.generated.models.RecoverableDatabase; +import java.time.OffsetDateTime; + +public final class RecoverableDatabaseImpl implements RecoverableDatabase { + private RecoverableDatabaseInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + RecoverableDatabaseImpl( + RecoverableDatabaseInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String edition() { + return this.innerModel().edition(); + } + + public String serviceLevelObjective() { + return this.innerModel().serviceLevelObjective(); + } + + public String elasticPoolName() { + return this.innerModel().elasticPoolName(); + } + + public OffsetDateTime lastAvailableBackupDate() { + return this.innerModel().lastAvailableBackupDate(); + } + + public RecoverableDatabaseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecoverableDatabasesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecoverableDatabasesClientImpl.java new file mode 100644 index 0000000000000..0ea9b7d2ebf88 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecoverableDatabasesClientImpl.java @@ -0,0 +1,433 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.RecoverableDatabasesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.RecoverableDatabaseInner; +import com.azure.resourcemanager.sql.generated.models.RecoverableDatabaseListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in RecoverableDatabasesClient. */ +public final class RecoverableDatabasesClientImpl implements RecoverableDatabasesClient { + /** The proxy service used to perform REST calls. */ + private final RecoverableDatabasesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of RecoverableDatabasesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RecoverableDatabasesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create(RecoverableDatabasesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientRecoverableDatabases to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientR") + public interface RecoverableDatabasesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/recoverableDatabases/{databaseName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/recoverableDatabases") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a recoverable database, which is a resource representing a database's geo backup along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a recoverable database, which is a resource representing a database's geo backup along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a recoverable database, which is a resource representing a database's geo backup on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serverName, String databaseName) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a recoverable database, which is a resource representing a database's geo backup along with {@link + * Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a recoverable database, which is a resource representing a database's geo backup. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RecoverableDatabaseInner get(String resourceGroupName, String serverName, String databaseName) { + return getWithResponse(resourceGroupName, serverName, databaseName, Context.NONE).getValue(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of recoverable databases along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of recoverable databases along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of recoverable databases as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of recoverable databases as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of recoverable databases as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of recoverable databases as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecoverableDatabasesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecoverableDatabasesImpl.java new file mode 100644 index 0000000000000..565dd658da9bb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecoverableDatabasesImpl.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.RecoverableDatabasesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.RecoverableDatabaseInner; +import com.azure.resourcemanager.sql.generated.models.RecoverableDatabase; +import com.azure.resourcemanager.sql.generated.models.RecoverableDatabases; + +public final class RecoverableDatabasesImpl implements RecoverableDatabases { + private static final ClientLogger LOGGER = new ClientLogger(RecoverableDatabasesImpl.class); + + private final RecoverableDatabasesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public RecoverableDatabasesImpl( + RecoverableDatabasesClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, databaseName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RecoverableDatabaseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public RecoverableDatabase get(String resourceGroupName, String serverName, String databaseName) { + RecoverableDatabaseInner inner = this.serviceClient().get(resourceGroupName, serverName, databaseName); + if (inner != null) { + return new RecoverableDatabaseImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new RecoverableDatabaseImpl(inner1, this.manager())); + } + + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new RecoverableDatabaseImpl(inner1, this.manager())); + } + + private RecoverableDatabasesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecoverableManagedDatabaseImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecoverableManagedDatabaseImpl.java new file mode 100644 index 0000000000000..364d39024cf92 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecoverableManagedDatabaseImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.RecoverableManagedDatabaseInner; +import com.azure.resourcemanager.sql.generated.models.RecoverableManagedDatabase; + +public final class RecoverableManagedDatabaseImpl implements RecoverableManagedDatabase { + private RecoverableManagedDatabaseInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + RecoverableManagedDatabaseImpl( + RecoverableManagedDatabaseInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String lastAvailableBackupDate() { + return this.innerModel().lastAvailableBackupDate(); + } + + public RecoverableManagedDatabaseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecoverableManagedDatabasesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecoverableManagedDatabasesClientImpl.java new file mode 100644 index 0000000000000..12e4d5cbf25f6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecoverableManagedDatabasesClientImpl.java @@ -0,0 +1,543 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.RecoverableManagedDatabasesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.RecoverableManagedDatabaseInner; +import com.azure.resourcemanager.sql.generated.models.RecoverableManagedDatabaseListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in RecoverableManagedDatabasesClient. */ +public final class RecoverableManagedDatabasesClientImpl implements RecoverableManagedDatabasesClient { + /** The proxy service used to perform REST calls. */ + private final RecoverableManagedDatabasesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of RecoverableManagedDatabasesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RecoverableManagedDatabasesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + RecoverableManagedDatabasesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientRecoverableManagedDatabases to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientR") + public interface RecoverableManagedDatabasesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/recoverableDatabases") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInstance( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/recoverableDatabases/{recoverableDatabaseName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("recoverableDatabaseName") String recoverableDatabaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInstanceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of recoverable managed databases along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of recoverable managed databases along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of recoverable managed databases as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync( + String resourceGroupName, String managedInstanceName) { + return new PagedFlux<>( + () -> listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName), + nextLink -> listByInstanceNextSinglePageAsync(nextLink)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of recoverable managed databases as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedFlux<>( + () -> listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName, context), + nextLink -> listByInstanceNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of recoverable managed databases as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName) { + return new PagedIterable<>(listByInstanceAsync(resourceGroupName, managedInstanceName)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of recoverable managed databases as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedIterable<>(listByInstanceAsync(resourceGroupName, managedInstanceName, context)); + } + + /** + * 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 recoverableDatabaseName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a recoverable managed database along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, String recoverableDatabaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (recoverableDatabaseName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter recoverableDatabaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + recoverableDatabaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 recoverableDatabaseName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a recoverable managed database along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, String recoverableDatabaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (recoverableDatabaseName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter recoverableDatabaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + recoverableDatabaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 recoverableDatabaseName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a recoverable managed database on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String managedInstanceName, String recoverableDatabaseName) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, recoverableDatabaseName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 recoverableDatabaseName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a recoverable managed database along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, String recoverableDatabaseName, Context context) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, recoverableDatabaseName, context).block(); + } + + /** + * 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 recoverableDatabaseName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a recoverable managed database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RecoverableManagedDatabaseInner get( + String resourceGroupName, String managedInstanceName, String recoverableDatabaseName) { + return getWithResponse(resourceGroupName, managedInstanceName, recoverableDatabaseName, Context.NONE) + .getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of recoverable managed databases along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByInstanceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of recoverable managed databases along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInstanceNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecoverableManagedDatabasesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecoverableManagedDatabasesImpl.java new file mode 100644 index 0000000000000..6420b78385360 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RecoverableManagedDatabasesImpl.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.RecoverableManagedDatabasesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.RecoverableManagedDatabaseInner; +import com.azure.resourcemanager.sql.generated.models.RecoverableManagedDatabase; +import com.azure.resourcemanager.sql.generated.models.RecoverableManagedDatabases; + +public final class RecoverableManagedDatabasesImpl implements RecoverableManagedDatabases { + private static final ClientLogger LOGGER = new ClientLogger(RecoverableManagedDatabasesImpl.class); + + private final RecoverableManagedDatabasesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public RecoverableManagedDatabasesImpl( + RecoverableManagedDatabasesClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName) { + PagedIterable inner = + this.serviceClient().listByInstance(resourceGroupName, managedInstanceName); + return Utils.mapPage(inner, inner1 -> new RecoverableManagedDatabaseImpl(inner1, this.manager())); + } + + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context) { + PagedIterable inner = + this.serviceClient().listByInstance(resourceGroupName, managedInstanceName, context); + return Utils.mapPage(inner, inner1 -> new RecoverableManagedDatabaseImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, String recoverableDatabaseName, Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, managedInstanceName, recoverableDatabaseName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RecoverableManagedDatabaseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public RecoverableManagedDatabase get( + String resourceGroupName, String managedInstanceName, String recoverableDatabaseName) { + RecoverableManagedDatabaseInner inner = + this.serviceClient().get(resourceGroupName, managedInstanceName, recoverableDatabaseName); + if (inner != null) { + return new RecoverableManagedDatabaseImpl(inner, this.manager()); + } else { + return null; + } + } + + private RecoverableManagedDatabasesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ReplicationLinkImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ReplicationLinkImpl.java new file mode 100644 index 0000000000000..438bc31bba8d6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ReplicationLinkImpl.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.ReplicationLinkInner; +import com.azure.resourcemanager.sql.generated.models.ReplicationLink; +import com.azure.resourcemanager.sql.generated.models.ReplicationLinkType; +import com.azure.resourcemanager.sql.generated.models.ReplicationRole; +import com.azure.resourcemanager.sql.generated.models.ReplicationState; +import java.time.OffsetDateTime; + +public final class ReplicationLinkImpl implements ReplicationLink { + private ReplicationLinkInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + ReplicationLinkImpl( + ReplicationLinkInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String partnerServer() { + return this.innerModel().partnerServer(); + } + + public String partnerDatabase() { + return this.innerModel().partnerDatabase(); + } + + public String partnerLocation() { + return this.innerModel().partnerLocation(); + } + + public ReplicationRole role() { + return this.innerModel().role(); + } + + public ReplicationRole partnerRole() { + return this.innerModel().partnerRole(); + } + + public String replicationMode() { + return this.innerModel().replicationMode(); + } + + public OffsetDateTime startTime() { + return this.innerModel().startTime(); + } + + public Integer percentComplete() { + return this.innerModel().percentComplete(); + } + + public ReplicationState replicationState() { + return this.innerModel().replicationState(); + } + + public Boolean isTerminationAllowed() { + return this.innerModel().isTerminationAllowed(); + } + + public ReplicationLinkType linkType() { + return this.innerModel().linkType(); + } + + public ReplicationLinkInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ReplicationLinksClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ReplicationLinksClientImpl.java new file mode 100644 index 0000000000000..f88dfa5cd96a7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ReplicationLinksClientImpl.java @@ -0,0 +1,1769 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ReplicationLinksClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ReplicationLinkInner; +import com.azure.resourcemanager.sql.generated.models.ReplicationLinkListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ReplicationLinksClient. */ +public final class ReplicationLinksClientImpl implements ReplicationLinksClient { + /** The proxy service used to perform REST calls. */ + private final ReplicationLinksService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ReplicationLinksClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ReplicationLinksClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(ReplicationLinksService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientReplicationLinks to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientR") + public interface ReplicationLinksService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/replicationLinks") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/replicationLinks/{linkId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("linkId") String linkId, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/replicationLinks/{linkId}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("linkId") String linkId, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/failover") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> failover( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("linkId") String linkId, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/replicationLinks/{linkId}/forceFailoverAllowDataLoss") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> failoverAllowDataLoss( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("linkId") String linkId, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/replicationLinks") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabaseNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a list of replication links on database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of replication links on database along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of replication links on database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of replication links on database along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of replication links on database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of replication links on database as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of replication links on database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of replication links on database as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, context), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of replication links on database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of replication links on database as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName)); + } + + /** + * Gets a list of replication links on database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of replication links on database as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName, context)); + } + + /** + * Gets a 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. + * @param linkId The name of the replication link. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a replication link along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String linkId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (linkId == null) { + return Mono.error(new IllegalArgumentException("Parameter linkId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + linkId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a 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. + * @param linkId The name of the replication link. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a replication link along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String linkId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (linkId == null) { + return Mono.error(new IllegalArgumentException("Parameter linkId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + linkId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a 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. + * @param linkId The name of the replication link. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a replication link on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String databaseName, String linkId) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, linkId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a 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. + * @param linkId The name of the replication link. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a replication link along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, String linkId, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, linkId, context).block(); + } + + /** + * Gets a 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. + * @param linkId The name of the replication link. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a replication link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ReplicationLinkInner get(String resourceGroupName, String serverName, String databaseName, String linkId) { + return getWithResponse(resourceGroupName, serverName, databaseName, linkId, Context.NONE).getValue(); + } + + /** + * Deletes the 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. + * @param linkId The linkId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String linkId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (linkId == null) { + return Mono.error(new IllegalArgumentException("Parameter linkId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + linkId, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the 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. + * @param linkId The linkId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String linkId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (linkId == null) { + return Mono.error(new IllegalArgumentException("Parameter linkId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + linkId, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes the 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. + * @param linkId The linkId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String databaseName, String linkId) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, databaseName, linkId); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes the 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. + * @param linkId The linkId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String databaseName, String linkId, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, databaseName, linkId, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes the 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. + * @param linkId The linkId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String databaseName, String linkId) { + return beginDeleteAsync(resourceGroupName, serverName, databaseName, linkId).getSyncPoller(); + } + + /** + * Deletes the 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. + * @param linkId The linkId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String databaseName, String linkId, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, databaseName, linkId, context).getSyncPoller(); + } + + /** + * Deletes the 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. + * @param linkId The linkId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String serverName, String databaseName, String linkId) { + return beginDeleteAsync(resourceGroupName, serverName, databaseName, linkId) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the 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. + * @param linkId The linkId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String serverName, String databaseName, String linkId, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, databaseName, linkId, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the 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. + * @param linkId The linkId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, String databaseName, String linkId) { + deleteAsync(resourceGroupName, serverName, databaseName, linkId).block(); + } + + /** + * Deletes the 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. + * @param linkId The linkId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, String serverName, String databaseName, String linkId, Context context) { + deleteAsync(resourceGroupName, serverName, databaseName, linkId, context).block(); + } + + /** + * 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 databaseName The name of the database. + * @param linkId The name of the replication link. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a replication link along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> failoverWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String linkId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (linkId == null) { + return Mono.error(new IllegalArgumentException("Parameter linkId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .failover( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + linkId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 databaseName The name of the database. + * @param linkId The name of the replication link. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a replication link along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> failoverWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String linkId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (linkId == null) { + return Mono.error(new IllegalArgumentException("Parameter linkId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .failover( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + linkId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 databaseName The name of the database. + * @param linkId The name of the replication link. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a replication link. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ReplicationLinkInner> beginFailoverAsync( + String resourceGroupName, String serverName, String databaseName, String linkId) { + Mono>> mono = + failoverWithResponseAsync(resourceGroupName, serverName, databaseName, linkId); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ReplicationLinkInner.class, + ReplicationLinkInner.class, + this.client.getContext()); + } + + /** + * 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 databaseName The name of the database. + * @param linkId The name of the replication link. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a replication link. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ReplicationLinkInner> beginFailoverAsync( + String resourceGroupName, String serverName, String databaseName, String linkId, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + failoverWithResponseAsync(resourceGroupName, serverName, databaseName, linkId, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ReplicationLinkInner.class, ReplicationLinkInner.class, context); + } + + /** + * 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 databaseName The name of the database. + * @param linkId The name of the replication link. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a replication link. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ReplicationLinkInner> beginFailover( + String resourceGroupName, String serverName, String databaseName, String linkId) { + return beginFailoverAsync(resourceGroupName, serverName, databaseName, linkId).getSyncPoller(); + } + + /** + * 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 databaseName The name of the database. + * @param linkId The name of the replication link. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a replication link. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ReplicationLinkInner> beginFailover( + String resourceGroupName, String serverName, String databaseName, String linkId, Context context) { + return beginFailoverAsync(resourceGroupName, serverName, databaseName, linkId, context).getSyncPoller(); + } + + /** + * 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 databaseName The name of the database. + * @param linkId The name of the replication link. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a replication link on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono failoverAsync( + String resourceGroupName, String serverName, String databaseName, String linkId) { + return beginFailoverAsync(resourceGroupName, serverName, databaseName, linkId) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 databaseName The name of the database. + * @param linkId The name of the replication link. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a replication link on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono failoverAsync( + String resourceGroupName, String serverName, String databaseName, String linkId, Context context) { + return beginFailoverAsync(resourceGroupName, serverName, databaseName, linkId, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 databaseName The name of the database. + * @param linkId The name of the replication link. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a replication link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ReplicationLinkInner failover( + String resourceGroupName, String serverName, String databaseName, String linkId) { + return failoverAsync(resourceGroupName, serverName, databaseName, linkId).block(); + } + + /** + * 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 databaseName The name of the database. + * @param linkId The name of the replication link. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a replication link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ReplicationLinkInner failover( + String resourceGroupName, String serverName, String databaseName, String linkId, Context context) { + return failoverAsync(resourceGroupName, serverName, databaseName, linkId, context).block(); + } + + /** + * Fails over from the current primary server to this server allowing 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. + * @param linkId The name of the replication link. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a replication link along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> failoverAllowDataLossWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String linkId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (linkId == null) { + return Mono.error(new IllegalArgumentException("Parameter linkId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .failoverAllowDataLoss( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + linkId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Fails over from the current primary server to this server allowing 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. + * @param linkId The name of the replication link. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a replication link along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> failoverAllowDataLossWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String linkId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (linkId == null) { + return Mono.error(new IllegalArgumentException("Parameter linkId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .failoverAllowDataLoss( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + linkId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Fails over from the current primary server to this server allowing 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. + * @param linkId The name of the replication link. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a replication link. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ReplicationLinkInner> beginFailoverAllowDataLossAsync( + String resourceGroupName, String serverName, String databaseName, String linkId) { + Mono>> mono = + failoverAllowDataLossWithResponseAsync(resourceGroupName, serverName, databaseName, linkId); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ReplicationLinkInner.class, + ReplicationLinkInner.class, + this.client.getContext()); + } + + /** + * Fails over from the current primary server to this server allowing 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. + * @param linkId The name of the replication link. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a replication link. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ReplicationLinkInner> beginFailoverAllowDataLossAsync( + String resourceGroupName, String serverName, String databaseName, String linkId, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + failoverAllowDataLossWithResponseAsync(resourceGroupName, serverName, databaseName, linkId, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ReplicationLinkInner.class, ReplicationLinkInner.class, context); + } + + /** + * Fails over from the current primary server to this server allowing 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. + * @param linkId The name of the replication link. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a replication link. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ReplicationLinkInner> beginFailoverAllowDataLoss( + String resourceGroupName, String serverName, String databaseName, String linkId) { + return beginFailoverAllowDataLossAsync(resourceGroupName, serverName, databaseName, linkId).getSyncPoller(); + } + + /** + * Fails over from the current primary server to this server allowing 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. + * @param linkId The name of the replication link. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a replication link. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ReplicationLinkInner> beginFailoverAllowDataLoss( + String resourceGroupName, String serverName, String databaseName, String linkId, Context context) { + return beginFailoverAllowDataLossAsync(resourceGroupName, serverName, databaseName, linkId, context) + .getSyncPoller(); + } + + /** + * Fails over from the current primary server to this server allowing 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. + * @param linkId The name of the replication link. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a replication link on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono failoverAllowDataLossAsync( + String resourceGroupName, String serverName, String databaseName, String linkId) { + return beginFailoverAllowDataLossAsync(resourceGroupName, serverName, databaseName, linkId) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Fails over from the current primary server to this server allowing 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. + * @param linkId The name of the replication link. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a replication link on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono failoverAllowDataLossAsync( + String resourceGroupName, String serverName, String databaseName, String linkId, Context context) { + return beginFailoverAllowDataLossAsync(resourceGroupName, serverName, databaseName, linkId, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Fails over from the current primary server to this server allowing 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. + * @param linkId The name of the replication link. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a replication link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ReplicationLinkInner failoverAllowDataLoss( + String resourceGroupName, String serverName, String databaseName, String linkId) { + return failoverAllowDataLossAsync(resourceGroupName, serverName, databaseName, linkId).block(); + } + + /** + * Fails over from the current primary server to this server allowing 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. + * @param linkId The name of the replication link. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a replication link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ReplicationLinkInner failoverAllowDataLoss( + String resourceGroupName, String serverName, String databaseName, String linkId, Context context) { + return failoverAllowDataLossAsync(resourceGroupName, serverName, databaseName, linkId, context).block(); + } + + /** + * Gets a list of 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of replication links along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of replication links along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of replication links as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of replication links as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of replication links as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * Gets a list of 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of replication links as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of replication links along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of replication links along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of replication links along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByServerNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of replication links along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServerNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ReplicationLinksImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ReplicationLinksImpl.java new file mode 100644 index 0000000000000..5558273b7a1ce --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ReplicationLinksImpl.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ReplicationLinksClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ReplicationLinkInner; +import com.azure.resourcemanager.sql.generated.models.ReplicationLink; +import com.azure.resourcemanager.sql.generated.models.ReplicationLinks; + +public final class ReplicationLinksImpl implements ReplicationLinks { + private static final ClientLogger LOGGER = new ClientLogger(ReplicationLinksImpl.class); + + private final ReplicationLinksClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ReplicationLinksImpl( + ReplicationLinksClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName); + return Utils.mapPage(inner, inner1 -> new ReplicationLinkImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName, context); + return Utils.mapPage(inner, inner1 -> new ReplicationLinkImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, String linkId, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, databaseName, linkId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ReplicationLinkImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ReplicationLink get(String resourceGroupName, String serverName, String databaseName, String linkId) { + ReplicationLinkInner inner = this.serviceClient().get(resourceGroupName, serverName, databaseName, linkId); + if (inner != null) { + return new ReplicationLinkImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String serverName, String databaseName, String linkId) { + this.serviceClient().delete(resourceGroupName, serverName, databaseName, linkId); + } + + public void delete( + String resourceGroupName, String serverName, String databaseName, String linkId, Context context) { + this.serviceClient().delete(resourceGroupName, serverName, databaseName, linkId, context); + } + + public ReplicationLink failover(String resourceGroupName, String serverName, String databaseName, String linkId) { + ReplicationLinkInner inner = this.serviceClient().failover(resourceGroupName, serverName, databaseName, linkId); + if (inner != null) { + return new ReplicationLinkImpl(inner, this.manager()); + } else { + return null; + } + } + + public ReplicationLink failover( + String resourceGroupName, String serverName, String databaseName, String linkId, Context context) { + ReplicationLinkInner inner = + this.serviceClient().failover(resourceGroupName, serverName, databaseName, linkId, context); + if (inner != null) { + return new ReplicationLinkImpl(inner, this.manager()); + } else { + return null; + } + } + + public ReplicationLink failoverAllowDataLoss( + String resourceGroupName, String serverName, String databaseName, String linkId) { + ReplicationLinkInner inner = + this.serviceClient().failoverAllowDataLoss(resourceGroupName, serverName, databaseName, linkId); + if (inner != null) { + return new ReplicationLinkImpl(inner, this.manager()); + } else { + return null; + } + } + + public ReplicationLink failoverAllowDataLoss( + String resourceGroupName, String serverName, String databaseName, String linkId, Context context) { + ReplicationLinkInner inner = + this.serviceClient().failoverAllowDataLoss(resourceGroupName, serverName, databaseName, linkId, context); + if (inner != null) { + return new ReplicationLinkImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new ReplicationLinkImpl(inner1, this.manager())); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new ReplicationLinkImpl(inner1, this.manager())); + } + + private ReplicationLinksClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorableDroppedDatabaseImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorableDroppedDatabaseImpl.java new file mode 100644 index 0000000000000..6bebf1ea47eab --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorableDroppedDatabaseImpl.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.RestorableDroppedDatabaseInner; +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.azure.resourcemanager.sql.generated.models.RestorableDroppedDatabase; +import com.azure.resourcemanager.sql.generated.models.Sku; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.Map; + +public final class RestorableDroppedDatabaseImpl implements RestorableDroppedDatabase { + private RestorableDroppedDatabaseInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + RestorableDroppedDatabaseImpl( + RestorableDroppedDatabaseInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public Sku sku() { + return this.innerModel().sku(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String databaseName() { + return this.innerModel().databaseName(); + } + + public Long maxSizeBytes() { + return this.innerModel().maxSizeBytes(); + } + + public OffsetDateTime creationDate() { + return this.innerModel().creationDate(); + } + + public OffsetDateTime deletionDate() { + return this.innerModel().deletionDate(); + } + + public OffsetDateTime earliestRestoreDate() { + return this.innerModel().earliestRestoreDate(); + } + + public BackupStorageRedundancy backupStorageRedundancy() { + return this.innerModel().backupStorageRedundancy(); + } + + public RestorableDroppedDatabaseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorableDroppedDatabasesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorableDroppedDatabasesClientImpl.java new file mode 100644 index 0000000000000..efb470616eee6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorableDroppedDatabasesClientImpl.java @@ -0,0 +1,538 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.RestorableDroppedDatabasesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.RestorableDroppedDatabaseInner; +import com.azure.resourcemanager.sql.generated.models.RestorableDroppedDatabaseListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in RestorableDroppedDatabasesClient. */ +public final class RestorableDroppedDatabasesClientImpl implements RestorableDroppedDatabasesClient { + /** The proxy service used to perform REST calls. */ + private final RestorableDroppedDatabasesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of RestorableDroppedDatabasesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RestorableDroppedDatabasesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + RestorableDroppedDatabasesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientRestorableDroppedDatabases to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientR") + public interface RestorableDroppedDatabasesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/restorableDroppedDatabases") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/restorableDroppedDatabases/{restorableDroppedDatabaseId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("restorableDroppedDatabaseId") String restorableDroppedDatabaseId, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a list of restorable dropped 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of restorable dropped databases along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of restorable dropped 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of restorable dropped databases along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of restorable dropped 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of restorable dropped databases as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of restorable dropped 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of restorable dropped databases as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of restorable dropped 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of restorable dropped databases as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * Gets a list of restorable dropped 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of restorable dropped databases as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } + + /** + * Gets a restorable dropped database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a restorable dropped database along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String restorableDroppedDatabaseId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (restorableDroppedDatabaseId == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter restorableDroppedDatabaseId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + restorableDroppedDatabaseId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a restorable dropped database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a restorable dropped database along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String restorableDroppedDatabaseId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (restorableDroppedDatabaseId == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter restorableDroppedDatabaseId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + restorableDroppedDatabaseId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a restorable dropped database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a restorable dropped database on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String restorableDroppedDatabaseId) { + return getWithResponseAsync(resourceGroupName, serverName, restorableDroppedDatabaseId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a restorable dropped database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a restorable dropped database along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String restorableDroppedDatabaseId, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, restorableDroppedDatabaseId, context).block(); + } + + /** + * Gets a restorable dropped database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a restorable dropped database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RestorableDroppedDatabaseInner get( + String resourceGroupName, String serverName, String restorableDroppedDatabaseId) { + return getWithResponse(resourceGroupName, serverName, restorableDroppedDatabaseId, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of restorable dropped databases along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByServerNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of restorable dropped databases along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServerNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorableDroppedDatabasesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorableDroppedDatabasesImpl.java new file mode 100644 index 0000000000000..5b4b03d5179dc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorableDroppedDatabasesImpl.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.RestorableDroppedDatabasesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.RestorableDroppedDatabaseInner; +import com.azure.resourcemanager.sql.generated.models.RestorableDroppedDatabase; +import com.azure.resourcemanager.sql.generated.models.RestorableDroppedDatabases; + +public final class RestorableDroppedDatabasesImpl implements RestorableDroppedDatabases { + private static final ClientLogger LOGGER = new ClientLogger(RestorableDroppedDatabasesImpl.class); + + private final RestorableDroppedDatabasesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public RestorableDroppedDatabasesImpl( + RestorableDroppedDatabasesClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new RestorableDroppedDatabaseImpl(inner1, this.manager())); + } + + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new RestorableDroppedDatabaseImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String restorableDroppedDatabaseId, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, restorableDroppedDatabaseId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RestorableDroppedDatabaseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public RestorableDroppedDatabase get( + String resourceGroupName, String serverName, String restorableDroppedDatabaseId) { + RestorableDroppedDatabaseInner inner = + this.serviceClient().get(resourceGroupName, serverName, restorableDroppedDatabaseId); + if (inner != null) { + return new RestorableDroppedDatabaseImpl(inner, this.manager()); + } else { + return null; + } + } + + private RestorableDroppedDatabasesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorableDroppedManagedDatabaseImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorableDroppedManagedDatabaseImpl.java new file mode 100644 index 0000000000000..ea715a83cfa87 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorableDroppedManagedDatabaseImpl.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.RestorableDroppedManagedDatabaseInner; +import com.azure.resourcemanager.sql.generated.models.RestorableDroppedManagedDatabase; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.Map; + +public final class RestorableDroppedManagedDatabaseImpl implements RestorableDroppedManagedDatabase { + private RestorableDroppedManagedDatabaseInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + RestorableDroppedManagedDatabaseImpl( + RestorableDroppedManagedDatabaseInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String databaseName() { + return this.innerModel().databaseName(); + } + + public OffsetDateTime creationDate() { + return this.innerModel().creationDate(); + } + + public OffsetDateTime deletionDate() { + return this.innerModel().deletionDate(); + } + + public OffsetDateTime earliestRestoreDate() { + return this.innerModel().earliestRestoreDate(); + } + + public RestorableDroppedManagedDatabaseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorableDroppedManagedDatabasesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorableDroppedManagedDatabasesClientImpl.java new file mode 100644 index 0000000000000..f397606b63c7c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorableDroppedManagedDatabasesClientImpl.java @@ -0,0 +1,553 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.RestorableDroppedManagedDatabasesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.RestorableDroppedManagedDatabaseInner; +import com.azure.resourcemanager.sql.generated.models.RestorableDroppedManagedDatabaseListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in RestorableDroppedManagedDatabasesClient. + */ +public final class RestorableDroppedManagedDatabasesClientImpl implements RestorableDroppedManagedDatabasesClient { + /** The proxy service used to perform REST calls. */ + private final RestorableDroppedManagedDatabasesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of RestorableDroppedManagedDatabasesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RestorableDroppedManagedDatabasesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + RestorableDroppedManagedDatabasesService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientRestorableDroppedManagedDatabases to be used by + * the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientR") + public interface RestorableDroppedManagedDatabasesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/restorableDroppedDatabases") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInstance( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/restorableDroppedDatabases/{restorableDroppedDatabaseId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("restorableDroppedDatabaseId") String restorableDroppedDatabaseId, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInstanceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of restorable dropped managed databases along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of restorable dropped managed databases along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of restorable dropped managed databases as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync( + String resourceGroupName, String managedInstanceName) { + return new PagedFlux<>( + () -> listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName), + nextLink -> listByInstanceNextSinglePageAsync(nextLink)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of restorable dropped managed databases as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedFlux<>( + () -> listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName, context), + nextLink -> listByInstanceNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of restorable dropped managed databases as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName) { + return new PagedIterable<>(listByInstanceAsync(resourceGroupName, managedInstanceName)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of restorable dropped managed databases as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedIterable<>(listByInstanceAsync(resourceGroupName, managedInstanceName, context)); + } + + /** + * 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 restorableDroppedDatabaseId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a restorable dropped managed database along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (restorableDroppedDatabaseId == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter restorableDroppedDatabaseId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + restorableDroppedDatabaseId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 restorableDroppedDatabaseId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a restorable dropped managed database along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (restorableDroppedDatabaseId == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter restorableDroppedDatabaseId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + restorableDroppedDatabaseId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 restorableDroppedDatabaseId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a restorable dropped managed database on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 restorableDroppedDatabaseId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a restorable dropped managed database along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, Context context) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, context) + .block(); + } + + /** + * 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 restorableDroppedDatabaseId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a restorable dropped managed database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RestorableDroppedManagedDatabaseInner get( + String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId) { + return getWithResponse(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, Context.NONE) + .getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of restorable dropped managed databases along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByInstanceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of restorable dropped managed databases along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInstanceNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorableDroppedManagedDatabasesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorableDroppedManagedDatabasesImpl.java new file mode 100644 index 0000000000000..d116f8d0111fc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorableDroppedManagedDatabasesImpl.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.RestorableDroppedManagedDatabasesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.RestorableDroppedManagedDatabaseInner; +import com.azure.resourcemanager.sql.generated.models.RestorableDroppedManagedDatabase; +import com.azure.resourcemanager.sql.generated.models.RestorableDroppedManagedDatabases; + +public final class RestorableDroppedManagedDatabasesImpl implements RestorableDroppedManagedDatabases { + private static final ClientLogger LOGGER = new ClientLogger(RestorableDroppedManagedDatabasesImpl.class); + + private final RestorableDroppedManagedDatabasesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public RestorableDroppedManagedDatabasesImpl( + RestorableDroppedManagedDatabasesClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName) { + PagedIterable inner = + this.serviceClient().listByInstance(resourceGroupName, managedInstanceName); + return Utils.mapPage(inner, inner1 -> new RestorableDroppedManagedDatabaseImpl(inner1, this.manager())); + } + + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context) { + PagedIterable inner = + this.serviceClient().listByInstance(resourceGroupName, managedInstanceName, context); + return Utils.mapPage(inner, inner1 -> new RestorableDroppedManagedDatabaseImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RestorableDroppedManagedDatabaseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public RestorableDroppedManagedDatabase get( + String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId) { + RestorableDroppedManagedDatabaseInner inner = + this.serviceClient().get(resourceGroupName, managedInstanceName, restorableDroppedDatabaseId); + if (inner != null) { + return new RestorableDroppedManagedDatabaseImpl(inner, this.manager()); + } else { + return null; + } + } + + private RestorableDroppedManagedDatabasesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorePointImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorePointImpl.java new file mode 100644 index 0000000000000..d94e2e1a5d67c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorePointImpl.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.RestorePointInner; +import com.azure.resourcemanager.sql.generated.models.RestorePoint; +import com.azure.resourcemanager.sql.generated.models.RestorePointType; +import java.time.OffsetDateTime; + +public final class RestorePointImpl implements RestorePoint { + private RestorePointInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + RestorePointImpl(RestorePointInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public RestorePointType restorePointType() { + return this.innerModel().restorePointType(); + } + + public OffsetDateTime earliestRestoreDate() { + return this.innerModel().earliestRestoreDate(); + } + + public OffsetDateTime restorePointCreationDate() { + return this.innerModel().restorePointCreationDate(); + } + + public String restorePointLabel() { + return this.innerModel().restorePointLabel(); + } + + public RestorePointInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorePointsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorePointsClientImpl.java new file mode 100644 index 0000000000000..655f4d01d5fb7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorePointsClientImpl.java @@ -0,0 +1,1109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.RestorePointsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.RestorePointInner; +import com.azure.resourcemanager.sql.generated.models.CreateDatabaseRestorePointDefinition; +import com.azure.resourcemanager.sql.generated.models.RestorePointListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in RestorePointsClient. */ +public final class RestorePointsClientImpl implements RestorePointsClient { + /** The proxy service used to perform REST calls. */ + private final RestorePointsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of RestorePointsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RestorePointsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(RestorePointsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientRestorePoints to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientR") + public interface RestorePointsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/restorePoints") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/restorePoints") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") CreateDatabaseRestorePointDefinition parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/restorePoints/{restorePointName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("restorePointName") String restorePointName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/restorePoints/{restorePointName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("restorePointName") String restorePointName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabaseNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database restore points along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database restore points along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database restore points as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database restore points as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, context), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database restore points as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database restore points as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName, context)); + } + + /** + * 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 parameters The definition for creating the restore point of this database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database restore points along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + CreateDatabaseRestorePointDefinition parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 parameters The definition for creating the restore point of this database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database restore points along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + CreateDatabaseRestorePointDefinition parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 parameters The definition for creating the restore point of this database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of database restore points. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, RestorePointInner> beginCreateAsync( + String resourceGroupName, + String serverName, + String databaseName, + CreateDatabaseRestorePointDefinition parameters) { + Mono>> mono = + createWithResponseAsync(resourceGroupName, serverName, databaseName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + RestorePointInner.class, + RestorePointInner.class, + this.client.getContext()); + } + + /** + * 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 parameters The definition for creating the restore point of this database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of database restore points. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, RestorePointInner> beginCreateAsync( + String resourceGroupName, + String serverName, + String databaseName, + CreateDatabaseRestorePointDefinition parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createWithResponseAsync(resourceGroupName, serverName, databaseName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), RestorePointInner.class, RestorePointInner.class, context); + } + + /** + * 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 parameters The definition for creating the restore point of this database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of database restore points. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, RestorePointInner> beginCreate( + String resourceGroupName, + String serverName, + String databaseName, + CreateDatabaseRestorePointDefinition parameters) { + return beginCreateAsync(resourceGroupName, serverName, databaseName, parameters).getSyncPoller(); + } + + /** + * 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 parameters The definition for creating the restore point of this database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of database restore points. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, RestorePointInner> beginCreate( + String resourceGroupName, + String serverName, + String databaseName, + CreateDatabaseRestorePointDefinition parameters, + Context context) { + return beginCreateAsync(resourceGroupName, serverName, databaseName, parameters, context).getSyncPoller(); + } + + /** + * 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 parameters The definition for creating the restore point of this database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database restore points on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, + String serverName, + String databaseName, + CreateDatabaseRestorePointDefinition parameters) { + return beginCreateAsync(resourceGroupName, serverName, databaseName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 parameters The definition for creating the restore point of this database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database restore points on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, + String serverName, + String databaseName, + CreateDatabaseRestorePointDefinition parameters, + Context context) { + return beginCreateAsync(resourceGroupName, serverName, databaseName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 parameters The definition for creating the restore point of this database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database restore points. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RestorePointInner create( + String resourceGroupName, + String serverName, + String databaseName, + CreateDatabaseRestorePointDefinition parameters) { + return createAsync(resourceGroupName, serverName, databaseName, parameters).block(); + } + + /** + * 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 parameters The definition for creating the restore point of this database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database restore points. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RestorePointInner create( + String resourceGroupName, + String serverName, + String databaseName, + CreateDatabaseRestorePointDefinition parameters, + Context context) { + return createAsync(resourceGroupName, serverName, databaseName, parameters, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a restore point along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String restorePointName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (restorePointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter restorePointName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + restorePointName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a restore point along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String restorePointName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (restorePointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter restorePointName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + restorePointName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a restore point on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String databaseName, String restorePointName) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, restorePointName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a restore point along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, String restorePointName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, restorePointName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a restore point. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RestorePointInner get( + String resourceGroupName, String serverName, String databaseName, String restorePointName) { + return getWithResponse(resourceGroupName, serverName, databaseName, restorePointName, Context.NONE).getValue(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String restorePointName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (restorePointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter restorePointName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + restorePointName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String restorePointName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (restorePointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter restorePointName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + restorePointName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String serverName, String databaseName, String restorePointName) { + return deleteWithResponseAsync(resourceGroupName, serverName, databaseName, restorePointName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, String serverName, String databaseName, String restorePointName, Context context) { + return deleteWithResponseAsync(resourceGroupName, serverName, databaseName, restorePointName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, String databaseName, String restorePointName) { + deleteWithResponse(resourceGroupName, serverName, databaseName, restorePointName, Context.NONE); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorePointsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorePointsImpl.java new file mode 100644 index 0000000000000..e3e8ea7306919 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/RestorePointsImpl.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.RestorePointsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.RestorePointInner; +import com.azure.resourcemanager.sql.generated.models.CreateDatabaseRestorePointDefinition; +import com.azure.resourcemanager.sql.generated.models.RestorePoint; +import com.azure.resourcemanager.sql.generated.models.RestorePoints; + +public final class RestorePointsImpl implements RestorePoints { + private static final ClientLogger LOGGER = new ClientLogger(RestorePointsImpl.class); + + private final RestorePointsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public RestorePointsImpl( + RestorePointsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName); + return Utils.mapPage(inner, inner1 -> new RestorePointImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName, context); + return Utils.mapPage(inner, inner1 -> new RestorePointImpl(inner1, this.manager())); + } + + public RestorePoint create( + String resourceGroupName, + String serverName, + String databaseName, + CreateDatabaseRestorePointDefinition parameters) { + RestorePointInner inner = this.serviceClient().create(resourceGroupName, serverName, databaseName, parameters); + if (inner != null) { + return new RestorePointImpl(inner, this.manager()); + } else { + return null; + } + } + + public RestorePoint create( + String resourceGroupName, + String serverName, + String databaseName, + CreateDatabaseRestorePointDefinition parameters, + Context context) { + RestorePointInner inner = + this.serviceClient().create(resourceGroupName, serverName, databaseName, parameters, context); + if (inner != null) { + return new RestorePointImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, String restorePointName, Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, serverName, databaseName, restorePointName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RestorePointImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public RestorePoint get(String resourceGroupName, String serverName, String databaseName, String restorePointName) { + RestorePointInner inner = + this.serviceClient().get(resourceGroupName, serverName, databaseName, restorePointName); + if (inner != null) { + return new RestorePointImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse( + String resourceGroupName, String serverName, String databaseName, String restorePointName, Context context) { + return this + .serviceClient() + .deleteWithResponse(resourceGroupName, serverName, databaseName, restorePointName, context); + } + + public void delete(String resourceGroupName, String serverName, String databaseName, String restorePointName) { + this.serviceClient().delete(resourceGroupName, serverName, databaseName, restorePointName); + } + + private RestorePointsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SecurityEventImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SecurityEventImpl.java new file mode 100644 index 0000000000000..0fe155aa34043 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SecurityEventImpl.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.SecurityEventInner; +import com.azure.resourcemanager.sql.generated.models.SecurityEvent; +import com.azure.resourcemanager.sql.generated.models.SecurityEventSqlInjectionAdditionalProperties; +import com.azure.resourcemanager.sql.generated.models.SecurityEventType; +import java.time.OffsetDateTime; + +public final class SecurityEventImpl implements SecurityEvent { + private SecurityEventInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + SecurityEventImpl( + SecurityEventInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public OffsetDateTime eventTime() { + return this.innerModel().eventTime(); + } + + public SecurityEventType securityEventType() { + return this.innerModel().securityEventType(); + } + + public String subscription() { + return this.innerModel().subscription(); + } + + public String server() { + return this.innerModel().server(); + } + + public String database() { + return this.innerModel().database(); + } + + public String clientIp() { + return this.innerModel().clientIp(); + } + + public String applicationName() { + return this.innerModel().applicationName(); + } + + public String principalName() { + return this.innerModel().principalName(); + } + + public SecurityEventSqlInjectionAdditionalProperties securityEventSqlInjectionAdditionalProperties() { + return this.innerModel().securityEventSqlInjectionAdditionalProperties(); + } + + public SecurityEventInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SensitivityLabelImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SensitivityLabelImpl.java new file mode 100644 index 0000000000000..103464c6580ac --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SensitivityLabelImpl.java @@ -0,0 +1,256 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.SensitivityLabelInner; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabel; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelRank; + +public final class SensitivityLabelImpl + implements SensitivityLabel, SensitivityLabel.Definition, SensitivityLabel.Update { + private SensitivityLabelInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String managedBy() { + return this.innerModel().managedBy(); + } + + public String schemaName() { + return this.innerModel().schemaName(); + } + + public String tableName() { + return this.innerModel().tableName(); + } + + public String columnName() { + return this.innerModel().columnName(); + } + + public String labelName() { + return this.innerModel().labelName(); + } + + public String labelId() { + return this.innerModel().labelId(); + } + + public String informationType() { + return this.innerModel().informationType(); + } + + public String informationTypeId() { + return this.innerModel().informationTypeId(); + } + + public Boolean isDisabled() { + return this.innerModel().isDisabled(); + } + + public SensitivityLabelRank rank() { + return this.innerModel().rank(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public SensitivityLabelInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String managedInstanceName; + + private String databaseName; + + private String schemaName; + + private String tableName; + + private String columnName; + + public SensitivityLabelImpl withExistingColumn( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + this.databaseName = databaseName; + this.schemaName = schemaName; + this.tableName = tableName; + this.columnName = columnName; + return this; + } + + public SensitivityLabel create() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedDatabaseSensitivityLabels() + .createOrUpdateWithResponse( + resourceGroupName, + managedInstanceName, + databaseName, + schemaName, + tableName, + columnName, + this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public SensitivityLabel create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedDatabaseSensitivityLabels() + .createOrUpdateWithResponse( + resourceGroupName, + managedInstanceName, + databaseName, + schemaName, + tableName, + columnName, + this.innerModel(), + context) + .getValue(); + return this; + } + + SensitivityLabelImpl(com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new SensitivityLabelInner(); + this.serviceManager = serviceManager; + } + + public SensitivityLabelImpl update() { + return this; + } + + public SensitivityLabel apply() { + this.innerObject = + serviceManager + .serviceClient() + .getManagedDatabaseSensitivityLabels() + .createOrUpdateWithResponse( + resourceGroupName, + managedInstanceName, + databaseName, + schemaName, + tableName, + columnName, + this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public SensitivityLabel apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getManagedDatabaseSensitivityLabels() + .createOrUpdateWithResponse( + resourceGroupName, + managedInstanceName, + databaseName, + schemaName, + tableName, + columnName, + this.innerModel(), + context) + .getValue(); + return this; + } + + SensitivityLabelImpl( + SensitivityLabelInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.managedInstanceName = Utils.getValueFromIdByName(innerObject.id(), "managedInstances"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "databases"); + this.schemaName = Utils.getValueFromIdByName(innerObject.id(), "schemas"); + this.tableName = Utils.getValueFromIdByName(innerObject.id(), "tables"); + this.columnName = Utils.getValueFromIdByName(innerObject.id(), "columns"); + } + + public Response disableRecommendationWithResponse(Context context) { + return serviceManager + .managedDatabaseSensitivityLabels() + .disableRecommendationWithResponse( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, context); + } + + public void disableRecommendation() { + serviceManager + .managedDatabaseSensitivityLabels() + .disableRecommendation( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName); + } + + public Response enableRecommendationWithResponse(Context context) { + return serviceManager + .managedDatabaseSensitivityLabels() + .enableRecommendationWithResponse( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName, context); + } + + public void enableRecommendation() { + serviceManager + .managedDatabaseSensitivityLabels() + .enableRecommendation( + resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName); + } + + public SensitivityLabelImpl withLabelName(String labelName) { + this.innerModel().withLabelName(labelName); + return this; + } + + public SensitivityLabelImpl withLabelId(String labelId) { + this.innerModel().withLabelId(labelId); + return this; + } + + public SensitivityLabelImpl withInformationType(String informationType) { + this.innerModel().withInformationType(informationType); + return this; + } + + public SensitivityLabelImpl withInformationTypeId(String informationTypeId) { + this.innerModel().withInformationTypeId(informationTypeId); + return this; + } + + public SensitivityLabelImpl withRank(SensitivityLabelRank rank) { + this.innerModel().withRank(rank); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SensitivityLabelUpdateImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SensitivityLabelUpdateImpl.java new file mode 100644 index 0000000000000..7474d96fdca01 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SensitivityLabelUpdateImpl.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.SensitivityLabelInner; +import com.azure.resourcemanager.sql.generated.fluent.models.SensitivityLabelUpdateInner; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabel; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelUpdate; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelUpdateKind; + +public final class SensitivityLabelUpdateImpl implements SensitivityLabelUpdate { + private SensitivityLabelUpdateInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + SensitivityLabelUpdateImpl( + SensitivityLabelUpdateInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SensitivityLabelUpdateKind op() { + return this.innerModel().op(); + } + + public String schema() { + return this.innerModel().schema(); + } + + public String table() { + return this.innerModel().table(); + } + + public String column() { + return this.innerModel().column(); + } + + public SensitivityLabel sensitivityLabel() { + SensitivityLabelInner inner = this.innerModel().sensitivityLabel(); + if (inner != null) { + return new SensitivityLabelImpl(inner, this.manager()); + } else { + return null; + } + } + + public SensitivityLabelUpdateInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SensitivityLabelUpdatePropertiesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SensitivityLabelUpdatePropertiesImpl.java new file mode 100644 index 0000000000000..3372999c4a71e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SensitivityLabelUpdatePropertiesImpl.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.SensitivityLabelInner; +import com.azure.resourcemanager.sql.generated.fluent.models.SensitivityLabelUpdatePropertiesInner; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabel; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelUpdateKind; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelUpdateProperties; + +public final class SensitivityLabelUpdatePropertiesImpl implements SensitivityLabelUpdateProperties { + private SensitivityLabelUpdatePropertiesInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + SensitivityLabelUpdatePropertiesImpl( + SensitivityLabelUpdatePropertiesInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public SensitivityLabelUpdateKind op() { + return this.innerModel().op(); + } + + public String schema() { + return this.innerModel().schema(); + } + + public String table() { + return this.innerModel().table(); + } + + public String column() { + return this.innerModel().column(); + } + + public SensitivityLabel sensitivityLabel() { + SensitivityLabelInner inner = this.innerModel().sensitivityLabel(); + if (inner != null) { + return new SensitivityLabelImpl(inner, this.manager()); + } else { + return null; + } + } + + public SensitivityLabelUpdatePropertiesInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SensitivityLabelsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SensitivityLabelsClientImpl.java new file mode 100644 index 0000000000000..48a1d7e9a0e8c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SensitivityLabelsClientImpl.java @@ -0,0 +1,2408 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.SensitivityLabelsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.SensitivityLabelInner; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelListResult; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelSource; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelUpdateList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in SensitivityLabelsClient. */ +public final class SensitivityLabelsClientImpl implements SensitivityLabelsClient { + /** The proxy service used to perform REST calls. */ + private final SensitivityLabelsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of SensitivityLabelsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SensitivityLabelsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(SensitivityLabelsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientSensitivityLabels to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + public interface SensitivityLabelsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/currentSensitivityLabels") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listCurrentByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @QueryParam("$skipToken") String skipToken, + @QueryParam("$count") Boolean count, + @QueryParam("$filter") String filter, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/currentSensitivityLabels") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SensitivityLabelUpdateList parameters, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/recommendedSensitivityLabels") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listRecommendedByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @QueryParam("$skipToken") String skipToken, + @QueryParam("includeDisabledRecommendations") Boolean includeDisabledRecommendations, + @QueryParam("$filter") String filter, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}" + + "/sensitivityLabels/{sensitivityLabelSource}/enable") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> enableRecommendation( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("schemaName") String schemaName, + @PathParam("tableName") String tableName, + @PathParam("columnName") String columnName, + @PathParam("sensitivityLabelSource") String sensitivityLabelSource, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}" + + "/sensitivityLabels/{sensitivityLabelSource}/disable") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> disableRecommendation( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("schemaName") String schemaName, + @PathParam("tableName") String tableName, + @PathParam("columnName") String columnName, + @PathParam("sensitivityLabelSource") String sensitivityLabelSource, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}" + + "/sensitivityLabels/{sensitivityLabelSource}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("schemaName") String schemaName, + @PathParam("tableName") String tableName, + @PathParam("columnName") String columnName, + @PathParam("sensitivityLabelSource") SensitivityLabelSource sensitivityLabelSource, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}" + + "/sensitivityLabels/{sensitivityLabelSource}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("schemaName") String schemaName, + @PathParam("tableName") String tableName, + @PathParam("columnName") String columnName, + @PathParam("sensitivityLabelSource") String sensitivityLabelSource, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SensitivityLabelInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}" + + "/sensitivityLabels/{sensitivityLabelSource}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("schemaName") String schemaName, + @PathParam("tableName") String tableName, + @PathParam("columnName") String columnName, + @PathParam("sensitivityLabelSource") String sensitivityLabelSource, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listCurrentByDatabaseNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listRecommendedByDatabaseNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 skipToken parameter. + * @param count The count parameter. + * @param filter An OData filter expression that filters elements in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity labels of a given database along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listCurrentByDatabaseSinglePageAsync( + String resourceGroupName, + String serverName, + String databaseName, + String skipToken, + Boolean count, + String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listCurrentByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + skipToken, + count, + filter, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 skipToken parameter. + * @param count The count parameter. + * @param filter An OData filter expression that filters elements in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity labels of a given database along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listCurrentByDatabaseSinglePageAsync( + String resourceGroupName, + String serverName, + String databaseName, + String skipToken, + Boolean count, + String filter, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listCurrentByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + skipToken, + count, + filter, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 skipToken parameter. + * @param count The count parameter. + * @param filter An OData filter expression that filters elements in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity labels of a given database as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listCurrentByDatabaseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String skipToken, + Boolean count, + String filter) { + return new PagedFlux<>( + () -> + listCurrentByDatabaseSinglePageAsync( + resourceGroupName, serverName, databaseName, skipToken, count, filter), + nextLink -> listCurrentByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity labels of a given database as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listCurrentByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName) { + final String skipToken = null; + final Boolean count = null; + final String filter = null; + return new PagedFlux<>( + () -> + listCurrentByDatabaseSinglePageAsync( + resourceGroupName, serverName, databaseName, skipToken, count, filter), + nextLink -> listCurrentByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * 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 skipToken parameter. + * @param count The count parameter. + * @param filter An OData filter expression that filters elements in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity labels of a given database as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listCurrentByDatabaseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String skipToken, + Boolean count, + String filter, + Context context) { + return new PagedFlux<>( + () -> + listCurrentByDatabaseSinglePageAsync( + resourceGroupName, serverName, databaseName, skipToken, count, filter, context), + nextLink -> listCurrentByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity labels of a given database as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listCurrentByDatabase( + String resourceGroupName, String serverName, String databaseName) { + final String skipToken = null; + final Boolean count = null; + final String filter = null; + return new PagedIterable<>( + listCurrentByDatabaseAsync(resourceGroupName, serverName, databaseName, skipToken, count, filter)); + } + + /** + * 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 skipToken parameter. + * @param count The count parameter. + * @param filter An OData filter expression that filters elements in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity labels of a given database as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listCurrentByDatabase( + String resourceGroupName, + String serverName, + String databaseName, + String skipToken, + Boolean count, + String filter, + Context context) { + return new PagedIterable<>( + listCurrentByDatabaseAsync(resourceGroupName, serverName, databaseName, skipToken, count, filter, context)); + } + + /** + * Update sensitivity labels of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of sensitivity label update operations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, SensitivityLabelUpdateList parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update sensitivity labels of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of sensitivity label update operations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + SensitivityLabelUpdateList parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + context); + } + + /** + * Update sensitivity labels of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of sensitivity label update operations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String serverName, String databaseName, SensitivityLabelUpdateList parameters) { + return updateWithResponseAsync(resourceGroupName, serverName, databaseName, parameters) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Update sensitivity labels of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of sensitivity label update operations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + SensitivityLabelUpdateList parameters, + Context context) { + return updateWithResponseAsync(resourceGroupName, serverName, databaseName, parameters, context).block(); + } + + /** + * Update sensitivity labels of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of sensitivity label update operations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void update( + String resourceGroupName, String serverName, String databaseName, SensitivityLabelUpdateList parameters) { + updateWithResponse(resourceGroupName, serverName, databaseName, parameters, Context.NONE); + } + + /** + * 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 skipToken parameter. + * @param includeDisabledRecommendations Specifies whether to include disabled recommendations or not. + * @param filter An OData filter expression that filters elements in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity labels of a given database along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listRecommendedByDatabaseSinglePageAsync( + String resourceGroupName, + String serverName, + String databaseName, + String skipToken, + Boolean includeDisabledRecommendations, + String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listRecommendedByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + skipToken, + includeDisabledRecommendations, + filter, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 skipToken parameter. + * @param includeDisabledRecommendations Specifies whether to include disabled recommendations or not. + * @param filter An OData filter expression that filters elements in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity labels of a given database along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listRecommendedByDatabaseSinglePageAsync( + String resourceGroupName, + String serverName, + String databaseName, + String skipToken, + Boolean includeDisabledRecommendations, + String filter, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listRecommendedByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + skipToken, + includeDisabledRecommendations, + filter, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 skipToken parameter. + * @param includeDisabledRecommendations Specifies whether to include disabled recommendations or not. + * @param filter An OData filter expression that filters elements in the collection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity labels of a given database as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listRecommendedByDatabaseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String skipToken, + Boolean includeDisabledRecommendations, + String filter) { + return new PagedFlux<>( + () -> + listRecommendedByDatabaseSinglePageAsync( + resourceGroupName, serverName, databaseName, skipToken, includeDisabledRecommendations, filter), + nextLink -> listRecommendedByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity labels of a given database as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listRecommendedByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName) { + final String skipToken = null; + final Boolean includeDisabledRecommendations = null; + final String filter = null; + return new PagedFlux<>( + () -> + listRecommendedByDatabaseSinglePageAsync( + resourceGroupName, serverName, databaseName, skipToken, includeDisabledRecommendations, filter), + nextLink -> listRecommendedByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * 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 skipToken parameter. + * @param includeDisabledRecommendations Specifies whether to include disabled recommendations or not. + * @param filter An OData filter expression that filters elements in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity labels of a given database as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listRecommendedByDatabaseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String skipToken, + Boolean includeDisabledRecommendations, + String filter, + Context context) { + return new PagedFlux<>( + () -> + listRecommendedByDatabaseSinglePageAsync( + resourceGroupName, + serverName, + databaseName, + skipToken, + includeDisabledRecommendations, + filter, + context), + nextLink -> listRecommendedByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity labels of a given database as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listRecommendedByDatabase( + String resourceGroupName, String serverName, String databaseName) { + final String skipToken = null; + final Boolean includeDisabledRecommendations = null; + final String filter = null; + return new PagedIterable<>( + listRecommendedByDatabaseAsync( + resourceGroupName, serverName, databaseName, skipToken, includeDisabledRecommendations, filter)); + } + + /** + * 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 skipToken parameter. + * @param includeDisabledRecommendations Specifies whether to include disabled recommendations or not. + * @param filter An OData filter expression that filters elements in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity labels of a given database as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listRecommendedByDatabase( + String resourceGroupName, + String serverName, + String databaseName, + String skipToken, + Boolean includeDisabledRecommendations, + String filter, + Context context) { + return new PagedIterable<>( + listRecommendedByDatabaseAsync( + resourceGroupName, + serverName, + databaseName, + skipToken, + includeDisabledRecommendations, + filter, + context)); + } + + /** + * Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> enableRecommendationWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (columnName == null) { + return Mono.error(new IllegalArgumentException("Parameter columnName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String sensitivityLabelSource = "recommended"; + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .enableRecommendation( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + schemaName, + tableName, + columnName, + sensitivityLabelSource, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> enableRecommendationWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (columnName == null) { + return Mono.error(new IllegalArgumentException("Parameter columnName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String sensitivityLabelSource = "recommended"; + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .enableRecommendation( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + schemaName, + tableName, + columnName, + sensitivityLabelSource, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono enableRecommendationAsync( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + return enableRecommendationWithResponseAsync( + resourceGroupName, serverName, databaseName, schemaName, tableName, columnName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response enableRecommendationWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context) { + return enableRecommendationWithResponseAsync( + resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, context) + .block(); + } + + /** + * Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void enableRecommendation( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + enableRecommendationWithResponse( + resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, Context.NONE); + } + + /** + * Disables sensitivity recommendations on a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> disableRecommendationWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (columnName == null) { + return Mono.error(new IllegalArgumentException("Parameter columnName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String sensitivityLabelSource = "recommended"; + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .disableRecommendation( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + schemaName, + tableName, + columnName, + sensitivityLabelSource, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Disables sensitivity recommendations on a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> disableRecommendationWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (columnName == null) { + return Mono.error(new IllegalArgumentException("Parameter columnName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String sensitivityLabelSource = "recommended"; + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .disableRecommendation( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + schemaName, + tableName, + columnName, + sensitivityLabelSource, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Disables sensitivity recommendations on a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono disableRecommendationAsync( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + return disableRecommendationWithResponseAsync( + resourceGroupName, serverName, databaseName, schemaName, tableName, columnName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Disables sensitivity recommendations on a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response disableRecommendationWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context) { + return disableRecommendationWithResponseAsync( + resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, context) + .block(); + } + + /** + * Disables sensitivity recommendations on a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void disableRecommendation( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + disableRecommendationWithResponse( + resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, Context.NONE); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity label of a given column along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelSource sensitivityLabelSource) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (columnName == null) { + return Mono.error(new IllegalArgumentException("Parameter columnName is required and cannot be null.")); + } + if (sensitivityLabelSource == null) { + return Mono + .error( + new IllegalArgumentException("Parameter sensitivityLabelSource is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + schemaName, + tableName, + columnName, + sensitivityLabelSource, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity label of a given column along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelSource sensitivityLabelSource, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (columnName == null) { + return Mono.error(new IllegalArgumentException("Parameter columnName is required and cannot be null.")); + } + if (sensitivityLabelSource == null) { + return Mono + .error( + new IllegalArgumentException("Parameter sensitivityLabelSource is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + schemaName, + tableName, + columnName, + sensitivityLabelSource, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity label of a given column on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelSource sensitivityLabelSource) { + return getWithResponseAsync( + resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, sensitivityLabelSource) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity label of a given column along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelSource sensitivityLabelSource, + Context context) { + return getWithResponseAsync( + resourceGroupName, + serverName, + databaseName, + schemaName, + tableName, + columnName, + sensitivityLabelSource, + context) + .block(); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity label of a given column. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SensitivityLabelInner get( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelSource sensitivityLabelSource) { + return getWithResponse( + resourceGroupName, + serverName, + databaseName, + schemaName, + tableName, + columnName, + sensitivityLabelSource, + Context.NONE) + .getValue(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sensitivity label along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (columnName == null) { + return Mono.error(new IllegalArgumentException("Parameter columnName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String sensitivityLabelSource = "current"; + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + schemaName, + tableName, + columnName, + sensitivityLabelSource, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sensitivity label along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (columnName == null) { + return Mono.error(new IllegalArgumentException("Parameter columnName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String sensitivityLabelSource = "current"; + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + schemaName, + tableName, + columnName, + sensitivityLabelSource, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sensitivity label on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelInner parameters) { + return createOrUpdateWithResponseAsync( + resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sensitivity label along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelInner parameters, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, parameters, context) + .block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sensitivity label. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SensitivityLabelInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelInner parameters) { + return createOrUpdateWithResponse( + resourceGroupName, + serverName, + databaseName, + schemaName, + tableName, + columnName, + parameters, + Context.NONE) + .getValue(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (columnName == null) { + return Mono.error(new IllegalArgumentException("Parameter columnName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String sensitivityLabelSource = "current"; + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + schemaName, + tableName, + columnName, + sensitivityLabelSource, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (schemaName == null) { + return Mono.error(new IllegalArgumentException("Parameter schemaName is required and cannot be null.")); + } + if (tableName == null) { + return Mono.error(new IllegalArgumentException("Parameter tableName is required and cannot be null.")); + } + if (columnName == null) { + return Mono.error(new IllegalArgumentException("Parameter columnName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String sensitivityLabelSource = "current"; + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + schemaName, + tableName, + columnName, + sensitivityLabelSource, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + return deleteWithResponseAsync(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context) { + return deleteWithResponseAsync( + resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, context) + .block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + deleteWithResponse( + resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, Context.NONE); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sensitivity labels along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listCurrentByDatabaseNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listCurrentByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sensitivity labels along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listCurrentByDatabaseNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listCurrentByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sensitivity labels along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listRecommendedByDatabaseNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listRecommendedByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sensitivity labels along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listRecommendedByDatabaseNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listRecommendedByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SensitivityLabelsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SensitivityLabelsImpl.java new file mode 100644 index 0000000000000..546a98cc9b5e6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SensitivityLabelsImpl.java @@ -0,0 +1,292 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.SensitivityLabelsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.SensitivityLabelInner; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabel; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelSource; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelUpdateList; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabels; + +public final class SensitivityLabelsImpl implements SensitivityLabels { + private static final ClientLogger LOGGER = new ClientLogger(SensitivityLabelsImpl.class); + + private final SensitivityLabelsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public SensitivityLabelsImpl( + SensitivityLabelsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listCurrentByDatabase( + String resourceGroupName, String serverName, String databaseName) { + PagedIterable inner = + this.serviceClient().listCurrentByDatabase(resourceGroupName, serverName, databaseName); + return Utils.mapPage(inner, inner1 -> new SensitivityLabelImpl(inner1, this.manager())); + } + + public PagedIterable listCurrentByDatabase( + String resourceGroupName, + String serverName, + String databaseName, + String skipToken, + Boolean count, + String filter, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listCurrentByDatabase(resourceGroupName, serverName, databaseName, skipToken, count, filter, context); + return Utils.mapPage(inner, inner1 -> new SensitivityLabelImpl(inner1, this.manager())); + } + + public Response updateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + SensitivityLabelUpdateList parameters, + Context context) { + return this + .serviceClient() + .updateWithResponse(resourceGroupName, serverName, databaseName, parameters, context); + } + + public void update( + String resourceGroupName, String serverName, String databaseName, SensitivityLabelUpdateList parameters) { + this.serviceClient().update(resourceGroupName, serverName, databaseName, parameters); + } + + public PagedIterable listRecommendedByDatabase( + String resourceGroupName, String serverName, String databaseName) { + PagedIterable inner = + this.serviceClient().listRecommendedByDatabase(resourceGroupName, serverName, databaseName); + return Utils.mapPage(inner, inner1 -> new SensitivityLabelImpl(inner1, this.manager())); + } + + public PagedIterable listRecommendedByDatabase( + String resourceGroupName, + String serverName, + String databaseName, + String skipToken, + Boolean includeDisabledRecommendations, + String filter, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listRecommendedByDatabase( + resourceGroupName, + serverName, + databaseName, + skipToken, + includeDisabledRecommendations, + filter, + context); + return Utils.mapPage(inner, inner1 -> new SensitivityLabelImpl(inner1, this.manager())); + } + + public Response enableRecommendationWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context) { + return this + .serviceClient() + .enableRecommendationWithResponse( + resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, context); + } + + public void enableRecommendation( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + this + .serviceClient() + .enableRecommendation(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName); + } + + public Response disableRecommendationWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context) { + return this + .serviceClient() + .disableRecommendationWithResponse( + resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, context); + } + + public void disableRecommendation( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + this + .serviceClient() + .disableRecommendation(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName); + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelSource sensitivityLabelSource, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse( + resourceGroupName, + serverName, + databaseName, + schemaName, + tableName, + columnName, + sensitivityLabelSource, + context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SensitivityLabelImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SensitivityLabel get( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelSource sensitivityLabelSource) { + SensitivityLabelInner inner = + this + .serviceClient() + .get( + resourceGroupName, + serverName, + databaseName, + schemaName, + tableName, + columnName, + sensitivityLabelSource); + if (inner != null) { + return new SensitivityLabelImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelInner parameters, + Context context) { + Response inner = + this + .serviceClient() + .createOrUpdateWithResponse( + resourceGroupName, + serverName, + databaseName, + schemaName, + tableName, + columnName, + parameters, + context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SensitivityLabelImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SensitivityLabel createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelInner parameters) { + SensitivityLabelInner inner = + this + .serviceClient() + .createOrUpdate( + resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, parameters); + if (inner != null) { + return new SensitivityLabelImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context) { + return this + .serviceClient() + .deleteWithResponse( + resourceGroupName, serverName, databaseName, schemaName, tableName, columnName, context); + } + + public void delete( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName) { + this.serviceClient().delete(resourceGroupName, serverName, databaseName, schemaName, tableName, columnName); + } + + private SensitivityLabelsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAdvancedThreatProtectionImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAdvancedThreatProtectionImpl.java new file mode 100644 index 0000000000000..5ff154c765bdd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAdvancedThreatProtectionImpl.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerAdvancedThreatProtectionInner; +import com.azure.resourcemanager.sql.generated.models.AdvancedThreatProtectionName; +import com.azure.resourcemanager.sql.generated.models.AdvancedThreatProtectionState; +import com.azure.resourcemanager.sql.generated.models.ServerAdvancedThreatProtection; +import java.time.OffsetDateTime; + +public final class ServerAdvancedThreatProtectionImpl + implements ServerAdvancedThreatProtection, + ServerAdvancedThreatProtection.Definition, + ServerAdvancedThreatProtection.Update { + private ServerAdvancedThreatProtectionInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public AdvancedThreatProtectionState state() { + return this.innerModel().state(); + } + + public OffsetDateTime creationTime() { + return this.innerModel().creationTime(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ServerAdvancedThreatProtectionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private AdvancedThreatProtectionName advancedThreatProtectionName; + + public ServerAdvancedThreatProtectionImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public ServerAdvancedThreatProtection create() { + this.innerObject = + serviceManager + .serviceClient() + .getServerAdvancedThreatProtectionSettings() + .createOrUpdate( + resourceGroupName, serverName, advancedThreatProtectionName, this.innerModel(), Context.NONE); + return this; + } + + public ServerAdvancedThreatProtection create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerAdvancedThreatProtectionSettings() + .createOrUpdate( + resourceGroupName, serverName, advancedThreatProtectionName, this.innerModel(), context); + return this; + } + + ServerAdvancedThreatProtectionImpl( + AdvancedThreatProtectionName name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ServerAdvancedThreatProtectionInner(); + this.serviceManager = serviceManager; + this.advancedThreatProtectionName = name; + } + + public ServerAdvancedThreatProtectionImpl update() { + return this; + } + + public ServerAdvancedThreatProtection apply() { + this.innerObject = + serviceManager + .serviceClient() + .getServerAdvancedThreatProtectionSettings() + .createOrUpdate( + resourceGroupName, serverName, advancedThreatProtectionName, this.innerModel(), Context.NONE); + return this; + } + + public ServerAdvancedThreatProtection apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerAdvancedThreatProtectionSettings() + .createOrUpdate( + resourceGroupName, serverName, advancedThreatProtectionName, this.innerModel(), context); + return this; + } + + ServerAdvancedThreatProtectionImpl( + ServerAdvancedThreatProtectionInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.advancedThreatProtectionName = + AdvancedThreatProtectionName + .fromString(Utils.getValueFromIdByName(innerObject.id(), "advancedThreatProtectionSettings")); + } + + public ServerAdvancedThreatProtection refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getServerAdvancedThreatProtectionSettings() + .getWithResponse(resourceGroupName, serverName, advancedThreatProtectionName, Context.NONE) + .getValue(); + return this; + } + + public ServerAdvancedThreatProtection refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerAdvancedThreatProtectionSettings() + .getWithResponse(resourceGroupName, serverName, advancedThreatProtectionName, context) + .getValue(); + return this; + } + + public ServerAdvancedThreatProtectionImpl withState(AdvancedThreatProtectionState state) { + this.innerModel().withState(state); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAdvancedThreatProtectionSettingsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAdvancedThreatProtectionSettingsClientImpl.java new file mode 100644 index 0000000000000..1ae39e79a0d30 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAdvancedThreatProtectionSettingsClientImpl.java @@ -0,0 +1,933 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ServerAdvancedThreatProtectionSettingsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerAdvancedThreatProtectionInner; +import com.azure.resourcemanager.sql.generated.models.AdvancedThreatProtectionName; +import com.azure.resourcemanager.sql.generated.models.LogicalServerAdvancedThreatProtectionListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * ServerAdvancedThreatProtectionSettingsClient. + */ +public final class ServerAdvancedThreatProtectionSettingsClientImpl + implements ServerAdvancedThreatProtectionSettingsClient { + /** The proxy service used to perform REST calls. */ + private final ServerAdvancedThreatProtectionSettingsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ServerAdvancedThreatProtectionSettingsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServerAdvancedThreatProtectionSettingsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ServerAdvancedThreatProtectionSettingsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientServerAdvancedThreatProtectionSettings to be used + * by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + public interface ServerAdvancedThreatProtectionSettingsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/advancedThreatProtectionSettings") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/advancedThreatProtectionSettings/{advancedThreatProtectionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("advancedThreatProtectionName") AdvancedThreatProtectionName advancedThreatProtectionName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/advancedThreatProtectionSettings/{advancedThreatProtectionName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("advancedThreatProtectionName") AdvancedThreatProtectionName advancedThreatProtectionName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ServerAdvancedThreatProtectionInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get a list of the server's Advanced Threat Protection states. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the server's Advanced Threat Protection states along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a list of the server's Advanced Threat Protection states. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the server's Advanced Threat Protection states along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get a list of the server's Advanced Threat Protection states. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the server's Advanced Threat Protection states as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Get a list of the server's Advanced Threat Protection states. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the server's Advanced Threat Protection states as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * Get a list of the server's Advanced Threat Protection states. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the server's Advanced Threat Protection states as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * Get a list of the server's Advanced Threat Protection states. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the server's Advanced Threat Protection states as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } + + /** + * Get a server's Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's Advanced Threat Protection state along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, AdvancedThreatProtectionName advancedThreatProtectionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (advancedThreatProtectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter advancedThreatProtectionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + advancedThreatProtectionName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a server's Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's Advanced Threat Protection state along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + AdvancedThreatProtectionName advancedThreatProtectionName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (advancedThreatProtectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter advancedThreatProtectionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + advancedThreatProtectionName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Get a server's Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's Advanced Threat Protection state on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, AdvancedThreatProtectionName advancedThreatProtectionName) { + return getWithResponseAsync(resourceGroupName, serverName, advancedThreatProtectionName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a server's Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's Advanced Threat Protection state along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + AdvancedThreatProtectionName advancedThreatProtectionName, + Context context) { + return getWithResponseAsync(resourceGroupName, serverName, advancedThreatProtectionName, context).block(); + } + + /** + * Get a server's Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's Advanced Threat Protection state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerAdvancedThreatProtectionInner get( + String resourceGroupName, String serverName, AdvancedThreatProtectionName advancedThreatProtectionName) { + return getWithResponse(resourceGroupName, serverName, advancedThreatProtectionName, Context.NONE).getValue(); + } + + /** + * Creates or updates an Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @param parameters The server Advanced Threat Protection state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server Advanced Threat Protection along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + AdvancedThreatProtectionName advancedThreatProtectionName, + ServerAdvancedThreatProtectionInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (advancedThreatProtectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter advancedThreatProtectionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + advancedThreatProtectionName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates an Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @param parameters The server Advanced Threat Protection state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server Advanced Threat Protection along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + AdvancedThreatProtectionName advancedThreatProtectionName, + ServerAdvancedThreatProtectionInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (advancedThreatProtectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter advancedThreatProtectionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + advancedThreatProtectionName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates an Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @param parameters The server Advanced Threat Protection state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a server Advanced Threat Protection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ServerAdvancedThreatProtectionInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + AdvancedThreatProtectionName advancedThreatProtectionName, + ServerAdvancedThreatProtectionInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, advancedThreatProtectionName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerAdvancedThreatProtectionInner.class, + ServerAdvancedThreatProtectionInner.class, + this.client.getContext()); + } + + /** + * Creates or updates an Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @param parameters The server Advanced Threat Protection state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a server Advanced Threat Protection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ServerAdvancedThreatProtectionInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + AdvancedThreatProtectionName advancedThreatProtectionName, + ServerAdvancedThreatProtectionInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, serverName, advancedThreatProtectionName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerAdvancedThreatProtectionInner.class, + ServerAdvancedThreatProtectionInner.class, + context); + } + + /** + * Creates or updates an Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @param parameters The server Advanced Threat Protection state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a server Advanced Threat Protection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServerAdvancedThreatProtectionInner> + beginCreateOrUpdate( + String resourceGroupName, + String serverName, + AdvancedThreatProtectionName advancedThreatProtectionName, + ServerAdvancedThreatProtectionInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, advancedThreatProtectionName, parameters) + .getSyncPoller(); + } + + /** + * Creates or updates an Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @param parameters The server Advanced Threat Protection state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a server Advanced Threat Protection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServerAdvancedThreatProtectionInner> + beginCreateOrUpdate( + String resourceGroupName, + String serverName, + AdvancedThreatProtectionName advancedThreatProtectionName, + ServerAdvancedThreatProtectionInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, serverName, advancedThreatProtectionName, parameters, context) + .getSyncPoller(); + } + + /** + * Creates or updates an Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @param parameters The server Advanced Threat Protection state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server Advanced Threat Protection on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + AdvancedThreatProtectionName advancedThreatProtectionName, + ServerAdvancedThreatProtectionInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, advancedThreatProtectionName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates an Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @param parameters The server Advanced Threat Protection state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server Advanced Threat Protection on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + AdvancedThreatProtectionName advancedThreatProtectionName, + ServerAdvancedThreatProtectionInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, serverName, advancedThreatProtectionName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates an Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @param parameters The server Advanced Threat Protection state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server Advanced Threat Protection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerAdvancedThreatProtectionInner createOrUpdate( + String resourceGroupName, + String serverName, + AdvancedThreatProtectionName advancedThreatProtectionName, + ServerAdvancedThreatProtectionInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, advancedThreatProtectionName, parameters).block(); + } + + /** + * Creates or updates an Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @param parameters The server Advanced Threat Protection state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server Advanced Threat Protection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerAdvancedThreatProtectionInner createOrUpdate( + String resourceGroupName, + String serverName, + AdvancedThreatProtectionName advancedThreatProtectionName, + ServerAdvancedThreatProtectionInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, advancedThreatProtectionName, parameters, context) + .block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the server's Advanced Threat Protection configurations along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByServerNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the server's Advanced Threat Protection configurations along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServerNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAdvancedThreatProtectionSettingsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAdvancedThreatProtectionSettingsImpl.java new file mode 100644 index 0000000000000..4e65e34faaf50 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAdvancedThreatProtectionSettingsImpl.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ServerAdvancedThreatProtectionSettingsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerAdvancedThreatProtectionInner; +import com.azure.resourcemanager.sql.generated.models.AdvancedThreatProtectionName; +import com.azure.resourcemanager.sql.generated.models.ServerAdvancedThreatProtection; +import com.azure.resourcemanager.sql.generated.models.ServerAdvancedThreatProtectionSettings; + +public final class ServerAdvancedThreatProtectionSettingsImpl implements ServerAdvancedThreatProtectionSettings { + private static final ClientLogger LOGGER = new ClientLogger(ServerAdvancedThreatProtectionSettingsImpl.class); + + private final ServerAdvancedThreatProtectionSettingsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ServerAdvancedThreatProtectionSettingsImpl( + ServerAdvancedThreatProtectionSettingsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new ServerAdvancedThreatProtectionImpl(inner1, this.manager())); + } + + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new ServerAdvancedThreatProtectionImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + AdvancedThreatProtectionName advancedThreatProtectionName, + Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, advancedThreatProtectionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServerAdvancedThreatProtectionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ServerAdvancedThreatProtection get( + String resourceGroupName, String serverName, AdvancedThreatProtectionName advancedThreatProtectionName) { + ServerAdvancedThreatProtectionInner inner = + this.serviceClient().get(resourceGroupName, serverName, advancedThreatProtectionName); + if (inner != null) { + return new ServerAdvancedThreatProtectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public ServerAdvancedThreatProtection getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String advancedThreatProtectionNameLocal = Utils.getValueFromIdByName(id, "advancedThreatProtectionSettings"); + if (advancedThreatProtectionNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment" + + " 'advancedThreatProtectionSettings'.", + id))); + } + AdvancedThreatProtectionName advancedThreatProtectionName = + AdvancedThreatProtectionName.fromString(advancedThreatProtectionNameLocal); + return this + .getWithResponse(resourceGroupName, serverName, advancedThreatProtectionName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String advancedThreatProtectionNameLocal = Utils.getValueFromIdByName(id, "advancedThreatProtectionSettings"); + if (advancedThreatProtectionNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment" + + " 'advancedThreatProtectionSettings'.", + id))); + } + AdvancedThreatProtectionName advancedThreatProtectionName = + AdvancedThreatProtectionName.fromString(advancedThreatProtectionNameLocal); + return this.getWithResponse(resourceGroupName, serverName, advancedThreatProtectionName, context); + } + + private ServerAdvancedThreatProtectionSettingsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ServerAdvancedThreatProtectionImpl define(AdvancedThreatProtectionName name) { + return new ServerAdvancedThreatProtectionImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAdvisorsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAdvisorsClientImpl.java new file mode 100644 index 0000000000000..eb087015f6553 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAdvisorsClientImpl.java @@ -0,0 +1,607 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.ServerAdvisorsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.AdvisorInner; +import java.util.List; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ServerAdvisorsClient. */ +public final class ServerAdvisorsClientImpl implements ServerAdvisorsClient { + /** The proxy service used to perform REST calls. */ + private final ServerAdvisorsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ServerAdvisorsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServerAdvisorsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(ServerAdvisorsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientServerAdvisors to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + public interface ServerAdvisorsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/advisors") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> listByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @QueryParam("$expand") String expand, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/advisors/{advisorName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("advisorName") String advisorName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/advisors/{advisorName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("advisorName") String advisorName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") AdvisorInner parameters, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 expand The child resources to include in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server advisors along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listByServerWithResponseAsync( + String resourceGroupName, String serverName, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + expand, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server advisors along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listByServerWithResponseAsync( + String resourceGroupName, String serverName, String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + expand, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server advisors on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerAsync(String resourceGroupName, String serverName) { + final String expand = null; + return listByServerWithResponseAsync(resourceGroupName, serverName, expand) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server advisors along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response> listByServerWithResponse( + String resourceGroupName, String serverName, String expand, Context context) { + return listByServerWithResponseAsync(resourceGroupName, serverName, expand, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server advisors. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public List listByServer(String resourceGroupName, String serverName) { + final String expand = null; + return listByServerWithResponse(resourceGroupName, serverName, expand, Context.NONE).getValue(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server advisor along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String advisorName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (advisorName == null) { + return Mono.error(new IllegalArgumentException("Parameter advisorName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + advisorName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server advisor along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String advisorName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (advisorName == null) { + return Mono.error(new IllegalArgumentException("Parameter advisorName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + advisorName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server advisor on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serverName, String advisorName) { + return getWithResponseAsync(resourceGroupName, serverName, advisorName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server advisor along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String advisorName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, advisorName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server advisor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AdvisorInner get(String resourceGroupName, String serverName, String advisorName) { + return getWithResponse(resourceGroupName, serverName, advisorName, Context.NONE).getValue(); + } + + /** + * 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 parameters The requested advisor resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database, Server or Elastic Pool Advisor along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String serverName, String advisorName, AdvisorInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (advisorName == null) { + return Mono.error(new IllegalArgumentException("Parameter advisorName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + serverName, + advisorName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 parameters The requested advisor resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database, Server or Elastic Pool Advisor along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String serverName, String advisorName, AdvisorInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (advisorName == null) { + return Mono.error(new IllegalArgumentException("Parameter advisorName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + serverName, + advisorName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 parameters The requested advisor resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database, Server or Elastic Pool Advisor on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String serverName, String advisorName, AdvisorInner parameters) { + return updateWithResponseAsync(resourceGroupName, serverName, advisorName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 parameters The requested advisor resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database, Server or Elastic Pool Advisor along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String serverName, String advisorName, AdvisorInner parameters, Context context) { + return updateWithResponseAsync(resourceGroupName, serverName, advisorName, parameters, context).block(); + } + + /** + * 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 parameters The requested advisor resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database, Server or Elastic Pool Advisor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AdvisorInner update( + String resourceGroupName, String serverName, String advisorName, AdvisorInner parameters) { + return updateWithResponse(resourceGroupName, serverName, advisorName, parameters, Context.NONE).getValue(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAdvisorsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAdvisorsImpl.java new file mode 100644 index 0000000000000..181d1232c7b08 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAdvisorsImpl.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ServerAdvisorsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.AdvisorInner; +import com.azure.resourcemanager.sql.generated.models.Advisor; +import com.azure.resourcemanager.sql.generated.models.ServerAdvisors; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class ServerAdvisorsImpl implements ServerAdvisors { + private static final ClientLogger LOGGER = new ClientLogger(ServerAdvisorsImpl.class); + + private final ServerAdvisorsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ServerAdvisorsImpl( + ServerAdvisorsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response> listByServerWithResponse( + String resourceGroupName, String serverName, String expand, Context context) { + Response> inner = + this.serviceClient().listByServerWithResponse(resourceGroupName, serverName, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + inner + .getValue() + .stream() + .map(inner1 -> new AdvisorImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return null; + } + } + + public List listByServer(String resourceGroupName, String serverName) { + List inner = this.serviceClient().listByServer(resourceGroupName, serverName); + if (inner != null) { + return Collections + .unmodifiableList( + inner.stream().map(inner1 -> new AdvisorImpl(inner1, this.manager())).collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String advisorName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, advisorName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AdvisorImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Advisor get(String resourceGroupName, String serverName, String advisorName) { + AdvisorInner inner = this.serviceClient().get(resourceGroupName, serverName, advisorName); + if (inner != null) { + return new AdvisorImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response updateWithResponse( + String resourceGroupName, String serverName, String advisorName, AdvisorInner parameters, Context context) { + Response inner = + this.serviceClient().updateWithResponse(resourceGroupName, serverName, advisorName, parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AdvisorImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Advisor update(String resourceGroupName, String serverName, String advisorName, AdvisorInner parameters) { + AdvisorInner inner = this.serviceClient().update(resourceGroupName, serverName, advisorName, parameters); + if (inner != null) { + return new AdvisorImpl(inner, this.manager()); + } else { + return null; + } + } + + private ServerAdvisorsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAutomaticTuningImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAutomaticTuningImpl.java new file mode 100644 index 0000000000000..083131a4c0f86 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAutomaticTuningImpl.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.ServerAutomaticTuningInner; +import com.azure.resourcemanager.sql.generated.models.AutomaticTuningServerMode; +import com.azure.resourcemanager.sql.generated.models.AutomaticTuningServerOptions; +import com.azure.resourcemanager.sql.generated.models.ServerAutomaticTuning; +import java.util.Collections; +import java.util.Map; + +public final class ServerAutomaticTuningImpl implements ServerAutomaticTuning { + private ServerAutomaticTuningInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + ServerAutomaticTuningImpl( + ServerAutomaticTuningInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public AutomaticTuningServerMode desiredState() { + return this.innerModel().desiredState(); + } + + public AutomaticTuningServerMode actualState() { + return this.innerModel().actualState(); + } + + public Map options() { + Map inner = this.innerModel().options(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public ServerAutomaticTuningInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAutomaticTuningsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAutomaticTuningsClientImpl.java new file mode 100644 index 0000000000000..21d2ba035e2b7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAutomaticTuningsClientImpl.java @@ -0,0 +1,404 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.ServerAutomaticTuningsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerAutomaticTuningInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ServerAutomaticTuningsClient. */ +public final class ServerAutomaticTuningsClientImpl implements ServerAutomaticTuningsClient { + /** The proxy service used to perform REST calls. */ + private final ServerAutomaticTuningsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ServerAutomaticTuningsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServerAutomaticTuningsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create(ServerAutomaticTuningsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientServerAutomaticTunings to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + public interface ServerAutomaticTuningsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/automaticTuning/current") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/automaticTuning/current") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ServerAutomaticTuningInner parameters, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return server-level Automatic Tuning along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return server-level Automatic Tuning along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return server-level Automatic Tuning on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serverName) { + return getWithResponseAsync(resourceGroupName, serverName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return server-level Automatic Tuning along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return server-level Automatic Tuning. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerAutomaticTuningInner get(String resourceGroupName, String serverName) { + return getWithResponse(resourceGroupName, serverName, Context.NONE).getValue(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return server-level Automatic Tuning along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String serverName, ServerAutomaticTuningInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return server-level Automatic Tuning along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String serverName, ServerAutomaticTuningInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return server-level Automatic Tuning on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String serverName, ServerAutomaticTuningInner parameters) { + return updateWithResponseAsync(resourceGroupName, serverName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return server-level Automatic Tuning along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String serverName, ServerAutomaticTuningInner parameters, Context context) { + return updateWithResponseAsync(resourceGroupName, serverName, parameters, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return server-level Automatic Tuning. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerAutomaticTuningInner update( + String resourceGroupName, String serverName, ServerAutomaticTuningInner parameters) { + return updateWithResponse(resourceGroupName, serverName, parameters, Context.NONE).getValue(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAutomaticTuningsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAutomaticTuningsImpl.java new file mode 100644 index 0000000000000..95f617cabd156 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAutomaticTuningsImpl.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ServerAutomaticTuningsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerAutomaticTuningInner; +import com.azure.resourcemanager.sql.generated.models.ServerAutomaticTuning; +import com.azure.resourcemanager.sql.generated.models.ServerAutomaticTunings; + +public final class ServerAutomaticTuningsImpl implements ServerAutomaticTunings { + private static final ClientLogger LOGGER = new ClientLogger(ServerAutomaticTuningsImpl.class); + + private final ServerAutomaticTuningsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ServerAutomaticTuningsImpl( + ServerAutomaticTuningsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String resourceGroupName, String serverName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServerAutomaticTuningImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ServerAutomaticTuning get(String resourceGroupName, String serverName) { + ServerAutomaticTuningInner inner = this.serviceClient().get(resourceGroupName, serverName); + if (inner != null) { + return new ServerAutomaticTuningImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response updateWithResponse( + String resourceGroupName, String serverName, ServerAutomaticTuningInner parameters, Context context) { + Response inner = + this.serviceClient().updateWithResponse(resourceGroupName, serverName, parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServerAutomaticTuningImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ServerAutomaticTuning update( + String resourceGroupName, String serverName, ServerAutomaticTuningInner parameters) { + ServerAutomaticTuningInner inner = this.serviceClient().update(resourceGroupName, serverName, parameters); + if (inner != null) { + return new ServerAutomaticTuningImpl(inner, this.manager()); + } else { + return null; + } + } + + private ServerAutomaticTuningsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAzureADAdministratorImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAzureADAdministratorImpl.java new file mode 100644 index 0000000000000..0cd33eaf0a8f3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAzureADAdministratorImpl.java @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerAzureADAdministratorInner; +import com.azure.resourcemanager.sql.generated.models.AdministratorName; +import com.azure.resourcemanager.sql.generated.models.AdministratorType; +import com.azure.resourcemanager.sql.generated.models.ServerAzureADAdministrator; +import java.util.UUID; + +public final class ServerAzureADAdministratorImpl + implements ServerAzureADAdministrator, ServerAzureADAdministrator.Definition, ServerAzureADAdministrator.Update { + private ServerAzureADAdministratorInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public AdministratorType administratorType() { + return this.innerModel().administratorType(); + } + + public String login() { + return this.innerModel().login(); + } + + public UUID sid() { + return this.innerModel().sid(); + } + + public UUID tenantId() { + return this.innerModel().tenantId(); + } + + public Boolean azureADOnlyAuthentication() { + return this.innerModel().azureADOnlyAuthentication(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ServerAzureADAdministratorInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private AdministratorName administratorName; + + public ServerAzureADAdministratorImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public ServerAzureADAdministrator create() { + this.innerObject = + serviceManager + .serviceClient() + .getServerAzureADAdministrators() + .createOrUpdate(resourceGroupName, serverName, administratorName, this.innerModel(), Context.NONE); + return this; + } + + public ServerAzureADAdministrator create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerAzureADAdministrators() + .createOrUpdate(resourceGroupName, serverName, administratorName, this.innerModel(), context); + return this; + } + + ServerAzureADAdministratorImpl( + AdministratorName name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ServerAzureADAdministratorInner(); + this.serviceManager = serviceManager; + this.administratorName = name; + } + + public ServerAzureADAdministratorImpl update() { + return this; + } + + public ServerAzureADAdministrator apply() { + this.innerObject = + serviceManager + .serviceClient() + .getServerAzureADAdministrators() + .createOrUpdate(resourceGroupName, serverName, administratorName, this.innerModel(), Context.NONE); + return this; + } + + public ServerAzureADAdministrator apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerAzureADAdministrators() + .createOrUpdate(resourceGroupName, serverName, administratorName, this.innerModel(), context); + return this; + } + + ServerAzureADAdministratorImpl( + ServerAzureADAdministratorInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.administratorName = + AdministratorName.fromString(Utils.getValueFromIdByName(innerObject.id(), "administrators")); + } + + public ServerAzureADAdministrator refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getServerAzureADAdministrators() + .getWithResponse(resourceGroupName, serverName, administratorName, Context.NONE) + .getValue(); + return this; + } + + public ServerAzureADAdministrator refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerAzureADAdministrators() + .getWithResponse(resourceGroupName, serverName, administratorName, context) + .getValue(); + return this; + } + + public ServerAzureADAdministratorImpl withAdministratorType(AdministratorType administratorType) { + this.innerModel().withAdministratorType(administratorType); + return this; + } + + public ServerAzureADAdministratorImpl withLogin(String login) { + this.innerModel().withLogin(login); + return this; + } + + public ServerAzureADAdministratorImpl withSid(UUID sid) { + this.innerModel().withSid(sid); + return this; + } + + public ServerAzureADAdministratorImpl withTenantId(UUID tenantId) { + this.innerModel().withTenantId(tenantId); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAzureADAdministratorsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAzureADAdministratorsClientImpl.java new file mode 100644 index 0000000000000..3e1b6249cd5fb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAzureADAdministratorsClientImpl.java @@ -0,0 +1,1186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ServerAzureADAdministratorsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerAzureADAdministratorInner; +import com.azure.resourcemanager.sql.generated.models.AdministratorListResult; +import com.azure.resourcemanager.sql.generated.models.AdministratorName; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ServerAzureADAdministratorsClient. */ +public final class ServerAzureADAdministratorsClientImpl implements ServerAzureADAdministratorsClient { + /** The proxy service used to perform REST calls. */ + private final ServerAzureADAdministratorsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ServerAzureADAdministratorsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServerAzureADAdministratorsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ServerAzureADAdministratorsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientServerAzureADAdministrators to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + public interface ServerAzureADAdministratorsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/administrators/{administratorName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("administratorName") AdministratorName administratorName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/administrators/{administratorName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("administratorName") AdministratorName administratorName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ServerAzureADAdministratorInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/administrators/{administratorName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("administratorName") AdministratorName administratorName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/administrators") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a Azure 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 administratorName The name of server active directory administrator. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Azure Active Directory administrator along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, AdministratorName administratorName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (administratorName == null) { + return Mono + .error(new IllegalArgumentException("Parameter administratorName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + administratorName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a Azure 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 administratorName The name of server active directory administrator. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Azure Active Directory administrator along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, AdministratorName administratorName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (administratorName == null) { + return Mono + .error(new IllegalArgumentException("Parameter administratorName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + administratorName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a Azure 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 administratorName The name of server active directory administrator. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Azure Active Directory administrator on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, AdministratorName administratorName) { + return getWithResponseAsync(resourceGroupName, serverName, administratorName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a Azure 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 administratorName The name of server active directory administrator. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Azure Active Directory administrator along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, AdministratorName administratorName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, administratorName, context).block(); + } + + /** + * Gets a Azure 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 administratorName The name of server active directory administrator. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Azure Active Directory administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerAzureADAdministratorInner get( + String resourceGroupName, String serverName, AdministratorName administratorName) { + return getWithResponse(resourceGroupName, serverName, administratorName, Context.NONE).getValue(); + } + + /** + * Creates or updates an existing Azure 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 administratorName The name of server active directory administrator. + * @param parameters The requested Azure Active Directory administrator Resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure Active Directory administrator along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + AdministratorName administratorName, + ServerAzureADAdministratorInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (administratorName == null) { + return Mono + .error(new IllegalArgumentException("Parameter administratorName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + administratorName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates an existing Azure 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 administratorName The name of server active directory administrator. + * @param parameters The requested Azure Active Directory administrator Resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure Active Directory administrator along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + AdministratorName administratorName, + ServerAzureADAdministratorInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (administratorName == null) { + return Mono + .error(new IllegalArgumentException("Parameter administratorName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + administratorName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates an existing Azure 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 administratorName The name of server active directory administrator. + * @param parameters The requested Azure Active Directory administrator Resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of azure Active Directory administrator. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ServerAzureADAdministratorInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + AdministratorName administratorName, + ServerAzureADAdministratorInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, administratorName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerAzureADAdministratorInner.class, + ServerAzureADAdministratorInner.class, + this.client.getContext()); + } + + /** + * Creates or updates an existing Azure 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 administratorName The name of server active directory administrator. + * @param parameters The requested Azure Active Directory administrator Resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of azure Active Directory administrator. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ServerAzureADAdministratorInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + AdministratorName administratorName, + ServerAzureADAdministratorInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, administratorName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerAzureADAdministratorInner.class, + ServerAzureADAdministratorInner.class, + context); + } + + /** + * Creates or updates an existing Azure 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 administratorName The name of server active directory administrator. + * @param parameters The requested Azure Active Directory administrator Resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of azure Active Directory administrator. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServerAzureADAdministratorInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + AdministratorName administratorName, + ServerAzureADAdministratorInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, administratorName, parameters).getSyncPoller(); + } + + /** + * Creates or updates an existing Azure 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 administratorName The name of server active directory administrator. + * @param parameters The requested Azure Active Directory administrator Resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of azure Active Directory administrator. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServerAzureADAdministratorInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + AdministratorName administratorName, + ServerAzureADAdministratorInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, administratorName, parameters, context) + .getSyncPoller(); + } + + /** + * Creates or updates an existing Azure 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 administratorName The name of server active directory administrator. + * @param parameters The requested Azure Active Directory administrator Resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure Active Directory administrator on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + AdministratorName administratorName, + ServerAzureADAdministratorInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, administratorName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates an existing Azure 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 administratorName The name of server active directory administrator. + * @param parameters The requested Azure Active Directory administrator Resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure Active Directory administrator on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + AdministratorName administratorName, + ServerAzureADAdministratorInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, administratorName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates an existing Azure 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 administratorName The name of server active directory administrator. + * @param parameters The requested Azure Active Directory administrator Resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure Active Directory administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerAzureADAdministratorInner createOrUpdate( + String resourceGroupName, + String serverName, + AdministratorName administratorName, + ServerAzureADAdministratorInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, administratorName, parameters).block(); + } + + /** + * Creates or updates an existing Azure 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 administratorName The name of server active directory administrator. + * @param parameters The requested Azure Active Directory administrator Resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure Active Directory administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerAzureADAdministratorInner createOrUpdate( + String resourceGroupName, + String serverName, + AdministratorName administratorName, + ServerAzureADAdministratorInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, administratorName, parameters, context).block(); + } + + /** + * Deletes the Azure Active Directory administrator 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 administratorName The name of server active directory administrator. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, AdministratorName administratorName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (administratorName == null) { + return Mono + .error(new IllegalArgumentException("Parameter administratorName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + administratorName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the Azure Active Directory administrator 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 administratorName The name of server active directory administrator. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, AdministratorName administratorName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (administratorName == null) { + return Mono + .error(new IllegalArgumentException("Parameter administratorName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + administratorName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes the Azure Active Directory administrator 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 administratorName The name of server active directory administrator. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, AdministratorName administratorName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, administratorName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes the Azure Active Directory administrator 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 administratorName The name of server active directory administrator. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, AdministratorName administratorName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, administratorName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes the Azure Active Directory administrator 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 administratorName The name of server active directory administrator. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, AdministratorName administratorName) { + return beginDeleteAsync(resourceGroupName, serverName, administratorName).getSyncPoller(); + } + + /** + * Deletes the Azure Active Directory administrator 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 administratorName The name of server active directory administrator. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, AdministratorName administratorName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, administratorName, context).getSyncPoller(); + } + + /** + * Deletes the Azure Active Directory administrator 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 administratorName The name of server active directory administrator. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String serverName, AdministratorName administratorName) { + return beginDeleteAsync(resourceGroupName, serverName, administratorName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the Azure Active Directory administrator 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 administratorName The name of server active directory administrator. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String serverName, AdministratorName administratorName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, administratorName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the Azure Active Directory administrator 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 administratorName The name of server active directory administrator. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, AdministratorName administratorName) { + deleteAsync(resourceGroupName, serverName, administratorName).block(); + } + + /** + * Deletes the Azure Active Directory administrator 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 administratorName The name of server active directory administrator. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, String serverName, AdministratorName administratorName, Context context) { + deleteAsync(resourceGroupName, serverName, administratorName, context).block(); + } + + /** + * Gets a list of Azure Active Directory administrators 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Azure Active Directory administrators in a server along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of Azure Active Directory administrators 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Azure Active Directory administrators in a server along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of Azure Active Directory administrators 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Azure Active Directory administrators in a server as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of Azure Active Directory administrators 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Azure Active Directory administrators in a server as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of Azure Active Directory administrators 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Azure Active Directory administrators in a server as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * Gets a list of Azure Active Directory administrators 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Azure Active Directory administrators in a server as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of active directory administrators along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByServerNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of active directory administrators along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServerNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAzureADAdministratorsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAzureADAdministratorsImpl.java new file mode 100644 index 0000000000000..80d42fb14f0c5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAzureADAdministratorsImpl.java @@ -0,0 +1,203 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ServerAzureADAdministratorsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerAzureADAdministratorInner; +import com.azure.resourcemanager.sql.generated.models.AdministratorName; +import com.azure.resourcemanager.sql.generated.models.ServerAzureADAdministrator; +import com.azure.resourcemanager.sql.generated.models.ServerAzureADAdministrators; + +public final class ServerAzureADAdministratorsImpl implements ServerAzureADAdministrators { + private static final ClientLogger LOGGER = new ClientLogger(ServerAzureADAdministratorsImpl.class); + + private final ServerAzureADAdministratorsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ServerAzureADAdministratorsImpl( + ServerAzureADAdministratorsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String resourceGroupName, String serverName, AdministratorName administratorName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, administratorName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServerAzureADAdministratorImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ServerAzureADAdministrator get( + String resourceGroupName, String serverName, AdministratorName administratorName) { + ServerAzureADAdministratorInner inner = + this.serviceClient().get(resourceGroupName, serverName, administratorName); + if (inner != null) { + return new ServerAzureADAdministratorImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String serverName, AdministratorName administratorName) { + this.serviceClient().delete(resourceGroupName, serverName, administratorName); + } + + public void delete( + String resourceGroupName, String serverName, AdministratorName administratorName, Context context) { + this.serviceClient().delete(resourceGroupName, serverName, administratorName, context); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new ServerAzureADAdministratorImpl(inner1, this.manager())); + } + + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new ServerAzureADAdministratorImpl(inner1, this.manager())); + } + + public ServerAzureADAdministrator getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String administratorNameLocal = Utils.getValueFromIdByName(id, "administrators"); + if (administratorNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'administrators'.", id))); + } + AdministratorName administratorName = AdministratorName.fromString(administratorNameLocal); + return this.getWithResponse(resourceGroupName, serverName, administratorName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String administratorNameLocal = Utils.getValueFromIdByName(id, "administrators"); + if (administratorNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'administrators'.", id))); + } + AdministratorName administratorName = AdministratorName.fromString(administratorNameLocal); + return this.getWithResponse(resourceGroupName, serverName, administratorName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String administratorNameLocal = Utils.getValueFromIdByName(id, "administrators"); + if (administratorNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'administrators'.", id))); + } + AdministratorName administratorName = AdministratorName.fromString(administratorNameLocal); + this.delete(resourceGroupName, serverName, administratorName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String administratorNameLocal = Utils.getValueFromIdByName(id, "administrators"); + if (administratorNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'administrators'.", id))); + } + AdministratorName administratorName = AdministratorName.fromString(administratorNameLocal); + this.delete(resourceGroupName, serverName, administratorName, context); + } + + private ServerAzureADAdministratorsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ServerAzureADAdministratorImpl define(AdministratorName name) { + return new ServerAzureADAdministratorImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAzureADOnlyAuthenticationImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAzureADOnlyAuthenticationImpl.java new file mode 100644 index 0000000000000..bc211c9c9772c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAzureADOnlyAuthenticationImpl.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerAzureADOnlyAuthenticationInner; +import com.azure.resourcemanager.sql.generated.models.AuthenticationName; +import com.azure.resourcemanager.sql.generated.models.ServerAzureADOnlyAuthentication; + +public final class ServerAzureADOnlyAuthenticationImpl + implements ServerAzureADOnlyAuthentication, + ServerAzureADOnlyAuthentication.Definition, + ServerAzureADOnlyAuthentication.Update { + private ServerAzureADOnlyAuthenticationInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public boolean azureADOnlyAuthentication() { + return this.innerModel().azureADOnlyAuthentication(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ServerAzureADOnlyAuthenticationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private AuthenticationName authenticationName; + + public ServerAzureADOnlyAuthenticationImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public ServerAzureADOnlyAuthentication create() { + this.innerObject = + serviceManager + .serviceClient() + .getServerAzureADOnlyAuthentications() + .createOrUpdate(resourceGroupName, serverName, authenticationName, this.innerModel(), Context.NONE); + return this; + } + + public ServerAzureADOnlyAuthentication create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerAzureADOnlyAuthentications() + .createOrUpdate(resourceGroupName, serverName, authenticationName, this.innerModel(), context); + return this; + } + + ServerAzureADOnlyAuthenticationImpl( + AuthenticationName name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ServerAzureADOnlyAuthenticationInner(); + this.serviceManager = serviceManager; + this.authenticationName = name; + } + + public ServerAzureADOnlyAuthenticationImpl update() { + return this; + } + + public ServerAzureADOnlyAuthentication apply() { + this.innerObject = + serviceManager + .serviceClient() + .getServerAzureADOnlyAuthentications() + .createOrUpdate(resourceGroupName, serverName, authenticationName, this.innerModel(), Context.NONE); + return this; + } + + public ServerAzureADOnlyAuthentication apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerAzureADOnlyAuthentications() + .createOrUpdate(resourceGroupName, serverName, authenticationName, this.innerModel(), context); + return this; + } + + ServerAzureADOnlyAuthenticationImpl( + ServerAzureADOnlyAuthenticationInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.authenticationName = + AuthenticationName.fromString(Utils.getValueFromIdByName(innerObject.id(), "azureADOnlyAuthentications")); + } + + public ServerAzureADOnlyAuthentication refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getServerAzureADOnlyAuthentications() + .getWithResponse(resourceGroupName, serverName, authenticationName, Context.NONE) + .getValue(); + return this; + } + + public ServerAzureADOnlyAuthentication refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerAzureADOnlyAuthentications() + .getWithResponse(resourceGroupName, serverName, authenticationName, context) + .getValue(); + return this; + } + + public ServerAzureADOnlyAuthenticationImpl withAzureADOnlyAuthentication(boolean azureADOnlyAuthentication) { + this.innerModel().withAzureADOnlyAuthentication(azureADOnlyAuthentication); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAzureADOnlyAuthenticationsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAzureADOnlyAuthenticationsClientImpl.java new file mode 100644 index 0000000000000..b12a92702e540 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAzureADOnlyAuthenticationsClientImpl.java @@ -0,0 +1,1216 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ServerAzureADOnlyAuthenticationsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerAzureADOnlyAuthenticationInner; +import com.azure.resourcemanager.sql.generated.models.AuthenticationName; +import com.azure.resourcemanager.sql.generated.models.AzureADOnlyAuthListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ServerAzureADOnlyAuthenticationsClient. + */ +public final class ServerAzureADOnlyAuthenticationsClientImpl implements ServerAzureADOnlyAuthenticationsClient { + /** The proxy service used to perform REST calls. */ + private final ServerAzureADOnlyAuthenticationsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ServerAzureADOnlyAuthenticationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServerAzureADOnlyAuthenticationsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ServerAzureADOnlyAuthenticationsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientServerAzureADOnlyAuthentications to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + public interface ServerAzureADOnlyAuthenticationsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/azureADOnlyAuthentications/{authenticationName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("authenticationName") AuthenticationName authenticationName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/azureADOnlyAuthentications/{authenticationName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("authenticationName") AuthenticationName authenticationName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ServerAzureADOnlyAuthenticationInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/azureADOnlyAuthentications/{authenticationName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("authenticationName") AuthenticationName authenticationName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/azureADOnlyAuthentications") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a specific Azure Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific Azure Active Directory only authentication property along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, AuthenticationName authenticationName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (authenticationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter authenticationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + authenticationName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a specific Azure Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific Azure Active Directory only authentication property along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, AuthenticationName authenticationName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (authenticationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter authenticationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + authenticationName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a specific Azure Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific Azure Active Directory only authentication property on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, AuthenticationName authenticationName) { + return getWithResponseAsync(resourceGroupName, serverName, authenticationName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a specific Azure Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific Azure Active Directory only authentication property along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, AuthenticationName authenticationName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, authenticationName, context).block(); + } + + /** + * Gets a specific Azure Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific Azure Active Directory only authentication property. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerAzureADOnlyAuthenticationInner get( + String resourceGroupName, String serverName, AuthenticationName authenticationName) { + return getWithResponse(resourceGroupName, serverName, authenticationName, Context.NONE).getValue(); + } + + /** + * Sets Server Active Directory only authentication property or updates an existing server Active Directory only + * authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @param parameters The required parameters for creating or updating an Active Directory only authentication + * property. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure Active Directory only authentication along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + AuthenticationName authenticationName, + ServerAzureADOnlyAuthenticationInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (authenticationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter authenticationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + authenticationName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Sets Server Active Directory only authentication property or updates an existing server Active Directory only + * authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @param parameters The required parameters for creating or updating an Active Directory only authentication + * property. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure Active Directory only authentication along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + AuthenticationName authenticationName, + ServerAzureADOnlyAuthenticationInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (authenticationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter authenticationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + authenticationName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Sets Server Active Directory only authentication property or updates an existing server Active Directory only + * authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @param parameters The required parameters for creating or updating an Active Directory only authentication + * property. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ServerAzureADOnlyAuthenticationInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + AuthenticationName authenticationName, + ServerAzureADOnlyAuthenticationInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, authenticationName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerAzureADOnlyAuthenticationInner.class, + ServerAzureADOnlyAuthenticationInner.class, + this.client.getContext()); + } + + /** + * Sets Server Active Directory only authentication property or updates an existing server Active Directory only + * authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @param parameters The required parameters for creating or updating an Active Directory only authentication + * property. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ServerAzureADOnlyAuthenticationInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + AuthenticationName authenticationName, + ServerAzureADOnlyAuthenticationInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, authenticationName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerAzureADOnlyAuthenticationInner.class, + ServerAzureADOnlyAuthenticationInner.class, + context); + } + + /** + * Sets Server Active Directory only authentication property or updates an existing server Active Directory only + * authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @param parameters The required parameters for creating or updating an Active Directory only authentication + * property. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServerAzureADOnlyAuthenticationInner> + beginCreateOrUpdate( + String resourceGroupName, + String serverName, + AuthenticationName authenticationName, + ServerAzureADOnlyAuthenticationInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, authenticationName, parameters).getSyncPoller(); + } + + /** + * Sets Server Active Directory only authentication property or updates an existing server Active Directory only + * authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @param parameters The required parameters for creating or updating an Active Directory only authentication + * property. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServerAzureADOnlyAuthenticationInner> + beginCreateOrUpdate( + String resourceGroupName, + String serverName, + AuthenticationName authenticationName, + ServerAzureADOnlyAuthenticationInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, authenticationName, parameters, context) + .getSyncPoller(); + } + + /** + * Sets Server Active Directory only authentication property or updates an existing server Active Directory only + * authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @param parameters The required parameters for creating or updating an Active Directory only authentication + * property. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure Active Directory only authentication on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + AuthenticationName authenticationName, + ServerAzureADOnlyAuthenticationInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, authenticationName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Sets Server Active Directory only authentication property or updates an existing server Active Directory only + * authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @param parameters The required parameters for creating or updating an Active Directory only authentication + * property. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure Active Directory only authentication on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + AuthenticationName authenticationName, + ServerAzureADOnlyAuthenticationInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, authenticationName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Sets Server Active Directory only authentication property or updates an existing server Active Directory only + * authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @param parameters The required parameters for creating or updating an Active Directory only authentication + * property. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerAzureADOnlyAuthenticationInner createOrUpdate( + String resourceGroupName, + String serverName, + AuthenticationName authenticationName, + ServerAzureADOnlyAuthenticationInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, authenticationName, parameters).block(); + } + + /** + * Sets Server Active Directory only authentication property or updates an existing server Active Directory only + * authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @param parameters The required parameters for creating or updating an Active Directory only authentication + * property. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure Active Directory only authentication. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerAzureADOnlyAuthenticationInner createOrUpdate( + String resourceGroupName, + String serverName, + AuthenticationName authenticationName, + ServerAzureADOnlyAuthenticationInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, authenticationName, parameters, context).block(); + } + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, AuthenticationName authenticationName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (authenticationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter authenticationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + authenticationName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, AuthenticationName authenticationName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (authenticationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter authenticationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + authenticationName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, AuthenticationName authenticationName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, authenticationName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, AuthenticationName authenticationName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, authenticationName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, AuthenticationName authenticationName) { + return beginDeleteAsync(resourceGroupName, serverName, authenticationName).getSyncPoller(); + } + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, AuthenticationName authenticationName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, authenticationName, context).getSyncPoller(); + } + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String serverName, AuthenticationName authenticationName) { + return beginDeleteAsync(resourceGroupName, serverName, authenticationName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String serverName, AuthenticationName authenticationName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, authenticationName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, AuthenticationName authenticationName) { + deleteAsync(resourceGroupName, serverName, authenticationName).block(); + } + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, String serverName, AuthenticationName authenticationName, Context context) { + deleteAsync(resourceGroupName, serverName, authenticationName, context).block(); + } + + /** + * Gets a list of server Azure Active Directory only authentications. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server Azure Active Directory only authentications along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of server Azure Active Directory only authentications. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server Azure Active Directory only authentications along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of server Azure Active Directory only authentications. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server Azure Active Directory only authentications as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of server Azure Active Directory only authentications. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server Azure Active Directory only authentications as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of server Azure Active Directory only authentications. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server Azure Active Directory only authentications as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * Gets a list of server Azure Active Directory only authentications. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server Azure Active Directory only authentications as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of active directory only authentications along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByServerNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of active directory only authentications along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServerNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAzureADOnlyAuthenticationsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAzureADOnlyAuthenticationsImpl.java new file mode 100644 index 0000000000000..b2eb94d9df3b6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerAzureADOnlyAuthenticationsImpl.java @@ -0,0 +1,211 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ServerAzureADOnlyAuthenticationsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerAzureADOnlyAuthenticationInner; +import com.azure.resourcemanager.sql.generated.models.AuthenticationName; +import com.azure.resourcemanager.sql.generated.models.ServerAzureADOnlyAuthentication; +import com.azure.resourcemanager.sql.generated.models.ServerAzureADOnlyAuthentications; + +public final class ServerAzureADOnlyAuthenticationsImpl implements ServerAzureADOnlyAuthentications { + private static final ClientLogger LOGGER = new ClientLogger(ServerAzureADOnlyAuthenticationsImpl.class); + + private final ServerAzureADOnlyAuthenticationsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ServerAzureADOnlyAuthenticationsImpl( + ServerAzureADOnlyAuthenticationsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String resourceGroupName, String serverName, AuthenticationName authenticationName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, authenticationName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServerAzureADOnlyAuthenticationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ServerAzureADOnlyAuthentication get( + String resourceGroupName, String serverName, AuthenticationName authenticationName) { + ServerAzureADOnlyAuthenticationInner inner = + this.serviceClient().get(resourceGroupName, serverName, authenticationName); + if (inner != null) { + return new ServerAzureADOnlyAuthenticationImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String serverName, AuthenticationName authenticationName) { + this.serviceClient().delete(resourceGroupName, serverName, authenticationName); + } + + public void delete( + String resourceGroupName, String serverName, AuthenticationName authenticationName, Context context) { + this.serviceClient().delete(resourceGroupName, serverName, authenticationName, context); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new ServerAzureADOnlyAuthenticationImpl(inner1, this.manager())); + } + + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new ServerAzureADOnlyAuthenticationImpl(inner1, this.manager())); + } + + public ServerAzureADOnlyAuthentication getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String authenticationNameLocal = Utils.getValueFromIdByName(id, "azureADOnlyAuthentications"); + if (authenticationNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'azureADOnlyAuthentications'.", + id))); + } + AuthenticationName authenticationName = AuthenticationName.fromString(authenticationNameLocal); + return this.getWithResponse(resourceGroupName, serverName, authenticationName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String authenticationNameLocal = Utils.getValueFromIdByName(id, "azureADOnlyAuthentications"); + if (authenticationNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'azureADOnlyAuthentications'.", + id))); + } + AuthenticationName authenticationName = AuthenticationName.fromString(authenticationNameLocal); + return this.getWithResponse(resourceGroupName, serverName, authenticationName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String authenticationNameLocal = Utils.getValueFromIdByName(id, "azureADOnlyAuthentications"); + if (authenticationNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'azureADOnlyAuthentications'.", + id))); + } + AuthenticationName authenticationName = AuthenticationName.fromString(authenticationNameLocal); + this.delete(resourceGroupName, serverName, authenticationName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String authenticationNameLocal = Utils.getValueFromIdByName(id, "azureADOnlyAuthentications"); + if (authenticationNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'azureADOnlyAuthentications'.", + id))); + } + AuthenticationName authenticationName = AuthenticationName.fromString(authenticationNameLocal); + this.delete(resourceGroupName, serverName, authenticationName, context); + } + + private ServerAzureADOnlyAuthenticationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ServerAzureADOnlyAuthenticationImpl define(AuthenticationName name) { + return new ServerAzureADOnlyAuthenticationImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerBlobAuditingPoliciesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerBlobAuditingPoliciesClientImpl.java new file mode 100644 index 0000000000000..23043233ed1bb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerBlobAuditingPoliciesClientImpl.java @@ -0,0 +1,833 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ServerBlobAuditingPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerBlobAuditingPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ServerBlobAuditingPolicyListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ServerBlobAuditingPoliciesClient. */ +public final class ServerBlobAuditingPoliciesClientImpl implements ServerBlobAuditingPoliciesClient { + /** The proxy service used to perform REST calls. */ + private final ServerBlobAuditingPoliciesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ServerBlobAuditingPoliciesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServerBlobAuditingPoliciesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ServerBlobAuditingPoliciesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientServerBlobAuditingPolicies to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + public interface ServerBlobAuditingPoliciesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/auditingSettings") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/auditingSettings/{blobAuditingPolicyName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("blobAuditingPolicyName") String blobAuditingPolicyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/auditingSettings/{blobAuditingPolicyName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("blobAuditingPolicyName") String blobAuditingPolicyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ServerBlobAuditingPolicyInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists auditing settings of 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server auditing settings along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists auditing settings of 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server auditing settings along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists auditing settings of 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server auditing settings as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Lists auditing settings of 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server auditing settings as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists auditing settings of 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server auditing settings as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * Lists auditing settings of 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server auditing settings as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's blob auditing policy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String blobAuditingPolicyName = "default"; + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + blobAuditingPolicyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's blob auditing policy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String blobAuditingPolicyName = "default"; + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + blobAuditingPolicyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's blob auditing policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serverName) { + return getWithResponseAsync(resourceGroupName, serverName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's blob auditing policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerBlobAuditingPolicyInner get(String resourceGroupName, String serverName) { + return getWithResponse(resourceGroupName, serverName, Context.NONE).getValue(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server blob auditing policy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverName, ServerBlobAuditingPolicyInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String blobAuditingPolicyName = "default"; + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + blobAuditingPolicyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server blob auditing policy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverName, ServerBlobAuditingPolicyInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String blobAuditingPolicyName = "default"; + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + blobAuditingPolicyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ServerBlobAuditingPolicyInner> + beginCreateOrUpdateAsync( + String resourceGroupName, String serverName, ServerBlobAuditingPolicyInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerBlobAuditingPolicyInner.class, + ServerBlobAuditingPolicyInner.class, + this.client.getContext()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ServerBlobAuditingPolicyInner> + beginCreateOrUpdateAsync( + String resourceGroupName, String serverName, ServerBlobAuditingPolicyInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerBlobAuditingPolicyInner.class, + ServerBlobAuditingPolicyInner.class, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServerBlobAuditingPolicyInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, ServerBlobAuditingPolicyInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, parameters).getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServerBlobAuditingPolicyInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, ServerBlobAuditingPolicyInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, parameters, context).getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server blob auditing policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serverName, ServerBlobAuditingPolicyInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server blob auditing policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serverName, ServerBlobAuditingPolicyInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerBlobAuditingPolicyInner createOrUpdate( + String resourceGroupName, String serverName, ServerBlobAuditingPolicyInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, parameters).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server blob auditing policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerBlobAuditingPolicyInner createOrUpdate( + String resourceGroupName, String serverName, ServerBlobAuditingPolicyInner parameters, Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, parameters, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server auditing settings along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByServerNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server auditing settings along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServerNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerBlobAuditingPoliciesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerBlobAuditingPoliciesImpl.java new file mode 100644 index 0000000000000..6f06985048109 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerBlobAuditingPoliciesImpl.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ServerBlobAuditingPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerBlobAuditingPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ServerBlobAuditingPolicies; +import com.azure.resourcemanager.sql.generated.models.ServerBlobAuditingPolicy; + +public final class ServerBlobAuditingPoliciesImpl implements ServerBlobAuditingPolicies { + private static final ClientLogger LOGGER = new ClientLogger(ServerBlobAuditingPoliciesImpl.class); + + private final ServerBlobAuditingPoliciesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ServerBlobAuditingPoliciesImpl( + ServerBlobAuditingPoliciesClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new ServerBlobAuditingPolicyImpl(inner1, this.manager())); + } + + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new ServerBlobAuditingPolicyImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, String serverName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServerBlobAuditingPolicyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ServerBlobAuditingPolicy get(String resourceGroupName, String serverName) { + ServerBlobAuditingPolicyInner inner = this.serviceClient().get(resourceGroupName, serverName); + if (inner != null) { + return new ServerBlobAuditingPolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public ServerBlobAuditingPolicy getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, context); + } + + private ServerBlobAuditingPoliciesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ServerBlobAuditingPolicyImpl define() { + return new ServerBlobAuditingPolicyImpl(this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerBlobAuditingPolicyImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerBlobAuditingPolicyImpl.java new file mode 100644 index 0000000000000..25053a3b6bdae --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerBlobAuditingPolicyImpl.java @@ -0,0 +1,231 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerBlobAuditingPolicyInner; +import com.azure.resourcemanager.sql.generated.models.BlobAuditingPolicyState; +import com.azure.resourcemanager.sql.generated.models.ServerBlobAuditingPolicy; +import java.util.Collections; +import java.util.List; +import java.util.UUID; + +public final class ServerBlobAuditingPolicyImpl + implements ServerBlobAuditingPolicy, ServerBlobAuditingPolicy.Definition, ServerBlobAuditingPolicy.Update { + private ServerBlobAuditingPolicyInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public Boolean isDevopsAuditEnabled() { + return this.innerModel().isDevopsAuditEnabled(); + } + + public Integer retentionDays() { + return this.innerModel().retentionDays(); + } + + public List auditActionsAndGroups() { + List inner = this.innerModel().auditActionsAndGroups(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Boolean isStorageSecondaryKeyInUse() { + return this.innerModel().isStorageSecondaryKeyInUse(); + } + + public Boolean isAzureMonitorTargetEnabled() { + return this.innerModel().isAzureMonitorTargetEnabled(); + } + + public Integer queueDelayMs() { + return this.innerModel().queueDelayMs(); + } + + public Boolean isManagedIdentityInUse() { + return this.innerModel().isManagedIdentityInUse(); + } + + public BlobAuditingPolicyState state() { + return this.innerModel().state(); + } + + public String storageEndpoint() { + return this.innerModel().storageEndpoint(); + } + + public String storageAccountAccessKey() { + return this.innerModel().storageAccountAccessKey(); + } + + public UUID storageAccountSubscriptionId() { + return this.innerModel().storageAccountSubscriptionId(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ServerBlobAuditingPolicyInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + public ServerBlobAuditingPolicyImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public ServerBlobAuditingPolicy create() { + this.innerObject = + serviceManager + .serviceClient() + .getServerBlobAuditingPolicies() + .createOrUpdate(resourceGroupName, serverName, this.innerModel(), Context.NONE); + return this; + } + + public ServerBlobAuditingPolicy create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerBlobAuditingPolicies() + .createOrUpdate(resourceGroupName, serverName, this.innerModel(), context); + return this; + } + + ServerBlobAuditingPolicyImpl(com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ServerBlobAuditingPolicyInner(); + this.serviceManager = serviceManager; + } + + public ServerBlobAuditingPolicyImpl update() { + return this; + } + + public ServerBlobAuditingPolicy apply() { + this.innerObject = + serviceManager + .serviceClient() + .getServerBlobAuditingPolicies() + .createOrUpdate(resourceGroupName, serverName, this.innerModel(), Context.NONE); + return this; + } + + public ServerBlobAuditingPolicy apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerBlobAuditingPolicies() + .createOrUpdate(resourceGroupName, serverName, this.innerModel(), context); + return this; + } + + ServerBlobAuditingPolicyImpl( + ServerBlobAuditingPolicyInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + } + + public ServerBlobAuditingPolicy refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getServerBlobAuditingPolicies() + .getWithResponse(resourceGroupName, serverName, Context.NONE) + .getValue(); + return this; + } + + public ServerBlobAuditingPolicy refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerBlobAuditingPolicies() + .getWithResponse(resourceGroupName, serverName, context) + .getValue(); + return this; + } + + public ServerBlobAuditingPolicyImpl withIsDevopsAuditEnabled(Boolean isDevopsAuditEnabled) { + this.innerModel().withIsDevopsAuditEnabled(isDevopsAuditEnabled); + return this; + } + + public ServerBlobAuditingPolicyImpl withRetentionDays(Integer retentionDays) { + this.innerModel().withRetentionDays(retentionDays); + return this; + } + + public ServerBlobAuditingPolicyImpl withAuditActionsAndGroups(List auditActionsAndGroups) { + this.innerModel().withAuditActionsAndGroups(auditActionsAndGroups); + return this; + } + + public ServerBlobAuditingPolicyImpl withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse) { + this.innerModel().withIsStorageSecondaryKeyInUse(isStorageSecondaryKeyInUse); + return this; + } + + public ServerBlobAuditingPolicyImpl withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled) { + this.innerModel().withIsAzureMonitorTargetEnabled(isAzureMonitorTargetEnabled); + return this; + } + + public ServerBlobAuditingPolicyImpl withQueueDelayMs(Integer queueDelayMs) { + this.innerModel().withQueueDelayMs(queueDelayMs); + return this; + } + + public ServerBlobAuditingPolicyImpl withIsManagedIdentityInUse(Boolean isManagedIdentityInUse) { + this.innerModel().withIsManagedIdentityInUse(isManagedIdentityInUse); + return this; + } + + public ServerBlobAuditingPolicyImpl withState(BlobAuditingPolicyState state) { + this.innerModel().withState(state); + return this; + } + + public ServerBlobAuditingPolicyImpl withStorageEndpoint(String storageEndpoint) { + this.innerModel().withStorageEndpoint(storageEndpoint); + return this; + } + + public ServerBlobAuditingPolicyImpl withStorageAccountAccessKey(String storageAccountAccessKey) { + this.innerModel().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + public ServerBlobAuditingPolicyImpl withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId) { + this.innerModel().withStorageAccountSubscriptionId(storageAccountSubscriptionId); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerCommunicationLinkImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerCommunicationLinkImpl.java new file mode 100644 index 0000000000000..a5c4ab78e2045 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerCommunicationLinkImpl.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerCommunicationLinkInner; +import com.azure.resourcemanager.sql.generated.models.ServerCommunicationLink; + +public final class ServerCommunicationLinkImpl + implements ServerCommunicationLink, ServerCommunicationLink.Definition, ServerCommunicationLink.Update { + private ServerCommunicationLinkInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public String kind() { + return this.innerModel().kind(); + } + + public String state() { + return this.innerModel().state(); + } + + public String partnerServer() { + return this.innerModel().partnerServer(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ServerCommunicationLinkInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String communicationLinkName; + + public ServerCommunicationLinkImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public ServerCommunicationLink create() { + this.innerObject = + serviceManager + .serviceClient() + .getServerCommunicationLinks() + .createOrUpdate(resourceGroupName, serverName, communicationLinkName, this.innerModel(), Context.NONE); + return this; + } + + public ServerCommunicationLink create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerCommunicationLinks() + .createOrUpdate(resourceGroupName, serverName, communicationLinkName, this.innerModel(), context); + return this; + } + + ServerCommunicationLinkImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ServerCommunicationLinkInner(); + this.serviceManager = serviceManager; + this.communicationLinkName = name; + } + + public ServerCommunicationLinkImpl update() { + return this; + } + + public ServerCommunicationLink apply() { + this.innerObject = + serviceManager + .serviceClient() + .getServerCommunicationLinks() + .createOrUpdate(resourceGroupName, serverName, communicationLinkName, this.innerModel(), Context.NONE); + return this; + } + + public ServerCommunicationLink apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerCommunicationLinks() + .createOrUpdate(resourceGroupName, serverName, communicationLinkName, this.innerModel(), context); + return this; + } + + ServerCommunicationLinkImpl( + ServerCommunicationLinkInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.communicationLinkName = Utils.getValueFromIdByName(innerObject.id(), "communicationLinks"); + } + + public ServerCommunicationLink refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getServerCommunicationLinks() + .getWithResponse(resourceGroupName, serverName, communicationLinkName, Context.NONE) + .getValue(); + return this; + } + + public ServerCommunicationLink refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerCommunicationLinks() + .getWithResponse(resourceGroupName, serverName, communicationLinkName, context) + .getValue(); + return this; + } + + public ServerCommunicationLinkImpl withPartnerServer(String partnerServer) { + this.innerModel().withPartnerServer(partnerServer); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerCommunicationLinksClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerCommunicationLinksClientImpl.java new file mode 100644 index 0000000000000..788f8e1baf950 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerCommunicationLinksClientImpl.java @@ -0,0 +1,971 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ServerCommunicationLinksClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerCommunicationLinkInner; +import com.azure.resourcemanager.sql.generated.models.ServerCommunicationLinkListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ServerCommunicationLinksClient. */ +public final class ServerCommunicationLinksClientImpl implements ServerCommunicationLinksClient { + /** The proxy service used to perform REST calls. */ + private final ServerCommunicationLinksService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ServerCommunicationLinksClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServerCommunicationLinksClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create(ServerCommunicationLinksService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientServerCommunicationLinks to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + public interface ServerCommunicationLinksService { + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/communicationLinks/{communicationLinkName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("communicationLinkName") String communicationLinkName, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/communicationLinks/{communicationLinkName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("communicationLinkName") String communicationLinkName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/communicationLinks/{communicationLinkName}") + @ExpectedResponses({201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("communicationLinkName") String communicationLinkName, + @BodyParam("application/json") ServerCommunicationLinkInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/communicationLinks") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String serverName, String communicationLinkName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (communicationLinkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter communicationLinkName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + communicationLinkName, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String serverName, String communicationLinkName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (communicationLinkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter communicationLinkName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + communicationLinkName, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String serverName, String communicationLinkName) { + return deleteWithResponseAsync(resourceGroupName, serverName, communicationLinkName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, String serverName, String communicationLinkName, Context context) { + return deleteWithResponseAsync(resourceGroupName, serverName, communicationLinkName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, String communicationLinkName) { + deleteWithResponse(resourceGroupName, serverName, communicationLinkName, Context.NONE); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return server communication link along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String communicationLinkName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (communicationLinkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter communicationLinkName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + communicationLinkName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return server communication link along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String communicationLinkName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (communicationLinkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter communicationLinkName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + communicationLinkName, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return server communication link on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String communicationLinkName) { + return getWithResponseAsync(resourceGroupName, serverName, communicationLinkName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return server communication link along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String communicationLinkName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, communicationLinkName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return server communication link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerCommunicationLinkInner get(String resourceGroupName, String serverName, String communicationLinkName) { + return getWithResponse(resourceGroupName, serverName, communicationLinkName, Context.NONE).getValue(); + } + + /** + * 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 parameters The required parameters for creating a server communication link. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return server communication link along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String communicationLinkName, + ServerCommunicationLinkInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (communicationLinkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter communicationLinkName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + communicationLinkName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 parameters The required parameters for creating a server communication link. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return server communication link along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String communicationLinkName, + ServerCommunicationLinkInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (communicationLinkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter communicationLinkName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + communicationLinkName, + parameters, + accept, + context); + } + + /** + * 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 parameters The required parameters for creating a server communication link. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of server communication link. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ServerCommunicationLinkInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String communicationLinkName, + ServerCommunicationLinkInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, communicationLinkName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerCommunicationLinkInner.class, + ServerCommunicationLinkInner.class, + this.client.getContext()); + } + + /** + * 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 parameters The required parameters for creating a server communication link. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of server communication link. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ServerCommunicationLinkInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String communicationLinkName, + ServerCommunicationLinkInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, communicationLinkName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerCommunicationLinkInner.class, + ServerCommunicationLinkInner.class, + context); + } + + /** + * 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 parameters The required parameters for creating a server communication link. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of server communication link. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServerCommunicationLinkInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String communicationLinkName, + ServerCommunicationLinkInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, communicationLinkName, parameters) + .getSyncPoller(); + } + + /** + * 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 parameters The required parameters for creating a server communication link. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of server communication link. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServerCommunicationLinkInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String communicationLinkName, + ServerCommunicationLinkInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, communicationLinkName, parameters, context) + .getSyncPoller(); + } + + /** + * 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 parameters The required parameters for creating a server communication link. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return server communication link on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String communicationLinkName, + ServerCommunicationLinkInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, communicationLinkName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 parameters The required parameters for creating a server communication link. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return server communication link on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String communicationLinkName, + ServerCommunicationLinkInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, communicationLinkName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 parameters The required parameters for creating a server communication link. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return server communication link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerCommunicationLinkInner createOrUpdate( + String resourceGroupName, + String serverName, + String communicationLinkName, + ServerCommunicationLinkInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, communicationLinkName, parameters).block(); + } + + /** + * 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 parameters The required parameters for creating a server communication link. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return server communication link. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerCommunicationLinkInner createOrUpdate( + String resourceGroupName, + String serverName, + String communicationLinkName, + ServerCommunicationLinkInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, communicationLinkName, parameters, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server communication links along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server communication links along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server communication links as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server communication links as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server communication links as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server communication links as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerCommunicationLinksImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerCommunicationLinksImpl.java new file mode 100644 index 0000000000000..b850d18f1c409 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerCommunicationLinksImpl.java @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ServerCommunicationLinksClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerCommunicationLinkInner; +import com.azure.resourcemanager.sql.generated.models.ServerCommunicationLink; +import com.azure.resourcemanager.sql.generated.models.ServerCommunicationLinks; + +public final class ServerCommunicationLinksImpl implements ServerCommunicationLinks { + private static final ClientLogger LOGGER = new ClientLogger(ServerCommunicationLinksImpl.class); + + private final ServerCommunicationLinksClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ServerCommunicationLinksImpl( + ServerCommunicationLinksClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response deleteWithResponse( + String resourceGroupName, String serverName, String communicationLinkName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, serverName, communicationLinkName, context); + } + + public void delete(String resourceGroupName, String serverName, String communicationLinkName) { + this.serviceClient().delete(resourceGroupName, serverName, communicationLinkName); + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String communicationLinkName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, communicationLinkName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServerCommunicationLinkImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ServerCommunicationLink get(String resourceGroupName, String serverName, String communicationLinkName) { + ServerCommunicationLinkInner inner = + this.serviceClient().get(resourceGroupName, serverName, communicationLinkName); + if (inner != null) { + return new ServerCommunicationLinkImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new ServerCommunicationLinkImpl(inner1, this.manager())); + } + + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new ServerCommunicationLinkImpl(inner1, this.manager())); + } + + public ServerCommunicationLink getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String communicationLinkName = Utils.getValueFromIdByName(id, "communicationLinks"); + if (communicationLinkName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'communicationLinks'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, communicationLinkName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String communicationLinkName = Utils.getValueFromIdByName(id, "communicationLinks"); + if (communicationLinkName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'communicationLinks'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, communicationLinkName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String communicationLinkName = Utils.getValueFromIdByName(id, "communicationLinks"); + if (communicationLinkName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'communicationLinks'.", id))); + } + this.deleteWithResponse(resourceGroupName, serverName, communicationLinkName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String communicationLinkName = Utils.getValueFromIdByName(id, "communicationLinks"); + if (communicationLinkName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'communicationLinks'.", id))); + } + return this.deleteWithResponse(resourceGroupName, serverName, communicationLinkName, context); + } + + private ServerCommunicationLinksClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ServerCommunicationLinkImpl define(String name) { + return new ServerCommunicationLinkImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerConnectionPoliciesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerConnectionPoliciesClientImpl.java new file mode 100644 index 0000000000000..5c12afe77a735 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerConnectionPoliciesClientImpl.java @@ -0,0 +1,898 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ServerConnectionPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerConnectionPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ConnectionPolicyName; +import com.azure.resourcemanager.sql.generated.models.ServerConnectionPolicyListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ServerConnectionPoliciesClient. */ +public final class ServerConnectionPoliciesClientImpl implements ServerConnectionPoliciesClient { + /** The proxy service used to perform REST calls. */ + private final ServerConnectionPoliciesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ServerConnectionPoliciesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServerConnectionPoliciesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create(ServerConnectionPoliciesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientServerConnectionPolicies to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + public interface ServerConnectionPoliciesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/connectionPolicies/{connectionPolicyName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("connectionPolicyName") ConnectionPolicyName connectionPolicyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/connectionPolicies/{connectionPolicyName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("connectionPolicyName") ConnectionPolicyName connectionPolicyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ServerConnectionPolicyInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/connectionPolicies") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a server 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 connectionPolicyName The name of the connection policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server connection policy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, ConnectionPolicyName connectionPolicyName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (connectionPolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter connectionPolicyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + connectionPolicyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a server 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 connectionPolicyName The name of the connection policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server connection policy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, ConnectionPolicyName connectionPolicyName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (connectionPolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter connectionPolicyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + connectionPolicyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a server 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 connectionPolicyName The name of the connection policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server connection policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, ConnectionPolicyName connectionPolicyName) { + return getWithResponseAsync(resourceGroupName, serverName, connectionPolicyName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a server 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 connectionPolicyName The name of the connection policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server connection policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, ConnectionPolicyName connectionPolicyName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, connectionPolicyName, context).block(); + } + + /** + * Gets a server 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 connectionPolicyName The name of the connection policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server connection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerConnectionPolicyInner get( + String resourceGroupName, String serverName, ConnectionPolicyName connectionPolicyName) { + return getWithResponse(resourceGroupName, serverName, connectionPolicyName, Context.NONE).getValue(); + } + + /** + * Updates a server 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 connectionPolicyName The name of the connection policy. + * @param parameters The required parameters for updating a server connection policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server connection policy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + ConnectionPolicyName connectionPolicyName, + ServerConnectionPolicyInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (connectionPolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter connectionPolicyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + connectionPolicyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates a server 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 connectionPolicyName The name of the connection policy. + * @param parameters The required parameters for updating a server connection policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server connection policy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + ConnectionPolicyName connectionPolicyName, + ServerConnectionPolicyInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (connectionPolicyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter connectionPolicyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + connectionPolicyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Updates a server 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 connectionPolicyName The name of the connection policy. + * @param parameters The required parameters for updating a server connection policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a server connection policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ServerConnectionPolicyInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + ConnectionPolicyName connectionPolicyName, + ServerConnectionPolicyInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, connectionPolicyName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerConnectionPolicyInner.class, + ServerConnectionPolicyInner.class, + this.client.getContext()); + } + + /** + * Updates a server 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 connectionPolicyName The name of the connection policy. + * @param parameters The required parameters for updating a server connection policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a server connection policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ServerConnectionPolicyInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + ConnectionPolicyName connectionPolicyName, + ServerConnectionPolicyInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, connectionPolicyName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerConnectionPolicyInner.class, + ServerConnectionPolicyInner.class, + context); + } + + /** + * Updates a server 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 connectionPolicyName The name of the connection policy. + * @param parameters The required parameters for updating a server connection policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a server connection policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServerConnectionPolicyInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + ConnectionPolicyName connectionPolicyName, + ServerConnectionPolicyInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, connectionPolicyName, parameters) + .getSyncPoller(); + } + + /** + * Updates a server 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 connectionPolicyName The name of the connection policy. + * @param parameters The required parameters for updating a server connection policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a server connection policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServerConnectionPolicyInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + ConnectionPolicyName connectionPolicyName, + ServerConnectionPolicyInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, connectionPolicyName, parameters, context) + .getSyncPoller(); + } + + /** + * Updates a server 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 connectionPolicyName The name of the connection policy. + * @param parameters The required parameters for updating a server connection policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server connection policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + ConnectionPolicyName connectionPolicyName, + ServerConnectionPolicyInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, connectionPolicyName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a server 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 connectionPolicyName The name of the connection policy. + * @param parameters The required parameters for updating a server connection policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server connection policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + ConnectionPolicyName connectionPolicyName, + ServerConnectionPolicyInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, connectionPolicyName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a server 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 connectionPolicyName The name of the connection policy. + * @param parameters The required parameters for updating a server connection policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server connection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerConnectionPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + ConnectionPolicyName connectionPolicyName, + ServerConnectionPolicyInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, connectionPolicyName, parameters).block(); + } + + /** + * Updates a server 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 connectionPolicyName The name of the connection policy. + * @param parameters The required parameters for updating a server connection policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server connection policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerConnectionPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + ConnectionPolicyName connectionPolicyName, + ServerConnectionPolicyInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, connectionPolicyName, parameters, context).block(); + } + + /** + * Lists 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server connection policy objects along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server connection policy objects along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server connection policy objects as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Lists 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server connection policy objects as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server connection policy objects as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * Lists 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server connection policy objects as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server connection policy objects along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByServerNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server connection policy objects along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServerNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerConnectionPoliciesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerConnectionPoliciesImpl.java new file mode 100644 index 0000000000000..f402235e0cdcc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerConnectionPoliciesImpl.java @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ServerConnectionPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerConnectionPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ConnectionPolicyName; +import com.azure.resourcemanager.sql.generated.models.ServerConnectionPolicies; +import com.azure.resourcemanager.sql.generated.models.ServerConnectionPolicy; + +public final class ServerConnectionPoliciesImpl implements ServerConnectionPolicies { + private static final ClientLogger LOGGER = new ClientLogger(ServerConnectionPoliciesImpl.class); + + private final ServerConnectionPoliciesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ServerConnectionPoliciesImpl( + ServerConnectionPoliciesClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String resourceGroupName, String serverName, ConnectionPolicyName connectionPolicyName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, connectionPolicyName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServerConnectionPolicyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ServerConnectionPolicy get( + String resourceGroupName, String serverName, ConnectionPolicyName connectionPolicyName) { + ServerConnectionPolicyInner inner = + this.serviceClient().get(resourceGroupName, serverName, connectionPolicyName); + if (inner != null) { + return new ServerConnectionPolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new ServerConnectionPolicyImpl(inner1, this.manager())); + } + + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new ServerConnectionPolicyImpl(inner1, this.manager())); + } + + public ServerConnectionPolicy getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String connectionPolicyNameLocal = Utils.getValueFromIdByName(id, "connectionPolicies"); + if (connectionPolicyNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'connectionPolicies'.", id))); + } + ConnectionPolicyName connectionPolicyName = ConnectionPolicyName.fromString(connectionPolicyNameLocal); + return this.getWithResponse(resourceGroupName, serverName, connectionPolicyName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String connectionPolicyNameLocal = Utils.getValueFromIdByName(id, "connectionPolicies"); + if (connectionPolicyNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'connectionPolicies'.", id))); + } + ConnectionPolicyName connectionPolicyName = ConnectionPolicyName.fromString(connectionPolicyNameLocal); + return this.getWithResponse(resourceGroupName, serverName, connectionPolicyName, context); + } + + private ServerConnectionPoliciesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ServerConnectionPolicyImpl define(ConnectionPolicyName name) { + return new ServerConnectionPolicyImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerConnectionPolicyImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerConnectionPolicyImpl.java new file mode 100644 index 0000000000000..48f14d1942488 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerConnectionPolicyImpl.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerConnectionPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ConnectionPolicyName; +import com.azure.resourcemanager.sql.generated.models.ServerConnectionPolicy; +import com.azure.resourcemanager.sql.generated.models.ServerConnectionType; + +public final class ServerConnectionPolicyImpl + implements ServerConnectionPolicy, ServerConnectionPolicy.Definition, ServerConnectionPolicy.Update { + private ServerConnectionPolicyInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public String kind() { + return this.innerModel().kind(); + } + + public ServerConnectionType connectionType() { + return this.innerModel().connectionType(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ServerConnectionPolicyInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private ConnectionPolicyName connectionPolicyName; + + public ServerConnectionPolicyImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public ServerConnectionPolicy create() { + this.innerObject = + serviceManager + .serviceClient() + .getServerConnectionPolicies() + .createOrUpdate(resourceGroupName, serverName, connectionPolicyName, this.innerModel(), Context.NONE); + return this; + } + + public ServerConnectionPolicy create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerConnectionPolicies() + .createOrUpdate(resourceGroupName, serverName, connectionPolicyName, this.innerModel(), context); + return this; + } + + ServerConnectionPolicyImpl( + ConnectionPolicyName name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ServerConnectionPolicyInner(); + this.serviceManager = serviceManager; + this.connectionPolicyName = name; + } + + public ServerConnectionPolicyImpl update() { + return this; + } + + public ServerConnectionPolicy apply() { + this.innerObject = + serviceManager + .serviceClient() + .getServerConnectionPolicies() + .createOrUpdate(resourceGroupName, serverName, connectionPolicyName, this.innerModel(), Context.NONE); + return this; + } + + public ServerConnectionPolicy apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerConnectionPolicies() + .createOrUpdate(resourceGroupName, serverName, connectionPolicyName, this.innerModel(), context); + return this; + } + + ServerConnectionPolicyImpl( + ServerConnectionPolicyInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.connectionPolicyName = + ConnectionPolicyName.fromString(Utils.getValueFromIdByName(innerObject.id(), "connectionPolicies")); + } + + public ServerConnectionPolicy refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getServerConnectionPolicies() + .getWithResponse(resourceGroupName, serverName, connectionPolicyName, Context.NONE) + .getValue(); + return this; + } + + public ServerConnectionPolicy refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerConnectionPolicies() + .getWithResponse(resourceGroupName, serverName, connectionPolicyName, context) + .getValue(); + return this; + } + + public ServerConnectionPolicyImpl withConnectionType(ServerConnectionType connectionType) { + this.innerModel().withConnectionType(connectionType); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerDevOpsAuditSettingsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerDevOpsAuditSettingsClientImpl.java new file mode 100644 index 0000000000000..e4e7b7d1fd758 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerDevOpsAuditSettingsClientImpl.java @@ -0,0 +1,920 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ServerDevOpsAuditSettingsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerDevOpsAuditingSettingsInner; +import com.azure.resourcemanager.sql.generated.models.DevOpsAuditingSettingsName; +import com.azure.resourcemanager.sql.generated.models.ServerDevOpsAuditSettingsListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ServerDevOpsAuditSettingsClient. */ +public final class ServerDevOpsAuditSettingsClientImpl implements ServerDevOpsAuditSettingsClient { + /** The proxy service used to perform REST calls. */ + private final ServerDevOpsAuditSettingsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ServerDevOpsAuditSettingsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServerDevOpsAuditSettingsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ServerDevOpsAuditSettingsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientServerDevOpsAuditSettings to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + public interface ServerDevOpsAuditSettingsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/devOpsAuditingSettings") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/devOpsAuditingSettings/{devOpsAuditingSettingsName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("devOpsAuditingSettingsName") DevOpsAuditingSettingsName devOpsAuditingSettingsName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/devOpsAuditingSettings/{devOpsAuditingSettingsName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("devOpsAuditingSettingsName") DevOpsAuditingSettingsName devOpsAuditingSettingsName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ServerDevOpsAuditingSettingsInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists DevOps audit settings of 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server DevOps audit settings along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists DevOps audit settings of 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server DevOps audit settings along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists DevOps audit settings of 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server DevOps audit settings as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Lists DevOps audit settings of 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server DevOps audit settings as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists DevOps audit settings of 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server DevOps audit settings as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * Lists DevOps audit settings of 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server DevOps audit settings as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } + + /** + * Gets a server's DevOps audit settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param devOpsAuditingSettingsName The devOpsAuditingSettingsName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's DevOps audit settings along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, DevOpsAuditingSettingsName devOpsAuditingSettingsName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (devOpsAuditingSettingsName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter devOpsAuditingSettingsName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + devOpsAuditingSettingsName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a server's DevOps audit settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param devOpsAuditingSettingsName The devOpsAuditingSettingsName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's DevOps audit settings along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + DevOpsAuditingSettingsName devOpsAuditingSettingsName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (devOpsAuditingSettingsName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter devOpsAuditingSettingsName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + devOpsAuditingSettingsName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a server's DevOps audit settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param devOpsAuditingSettingsName The devOpsAuditingSettingsName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's DevOps audit settings on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, DevOpsAuditingSettingsName devOpsAuditingSettingsName) { + return getWithResponseAsync(resourceGroupName, serverName, devOpsAuditingSettingsName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a server's DevOps audit settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param devOpsAuditingSettingsName The devOpsAuditingSettingsName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's DevOps audit settings along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + DevOpsAuditingSettingsName devOpsAuditingSettingsName, + Context context) { + return getWithResponseAsync(resourceGroupName, serverName, devOpsAuditingSettingsName, context).block(); + } + + /** + * Gets a server's DevOps audit settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param devOpsAuditingSettingsName The devOpsAuditingSettingsName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's DevOps audit settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerDevOpsAuditingSettingsInner get( + String resourceGroupName, String serverName, DevOpsAuditingSettingsName devOpsAuditingSettingsName) { + return getWithResponse(resourceGroupName, serverName, devOpsAuditingSettingsName, Context.NONE).getValue(); + } + + /** + * Creates or updates a server's DevOps audit settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param devOpsAuditingSettingsName The devOpsAuditingSettingsName parameter. + * @param parameters Properties of DevOps audit settings. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server DevOps auditing settings along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + DevOpsAuditingSettingsName devOpsAuditingSettingsName, + ServerDevOpsAuditingSettingsInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (devOpsAuditingSettingsName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter devOpsAuditingSettingsName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + devOpsAuditingSettingsName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a server's DevOps audit settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param devOpsAuditingSettingsName The devOpsAuditingSettingsName parameter. + * @param parameters Properties of DevOps audit settings. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server DevOps auditing settings along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + DevOpsAuditingSettingsName devOpsAuditingSettingsName, + ServerDevOpsAuditingSettingsInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (devOpsAuditingSettingsName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter devOpsAuditingSettingsName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + devOpsAuditingSettingsName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates a server's DevOps audit settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param devOpsAuditingSettingsName The devOpsAuditingSettingsName parameter. + * @param parameters Properties of DevOps audit settings. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a server DevOps auditing settings. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ServerDevOpsAuditingSettingsInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + DevOpsAuditingSettingsName devOpsAuditingSettingsName, + ServerDevOpsAuditingSettingsInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, devOpsAuditingSettingsName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerDevOpsAuditingSettingsInner.class, + ServerDevOpsAuditingSettingsInner.class, + this.client.getContext()); + } + + /** + * Creates or updates a server's DevOps audit settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param devOpsAuditingSettingsName The devOpsAuditingSettingsName parameter. + * @param parameters Properties of DevOps audit settings. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a server DevOps auditing settings. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ServerDevOpsAuditingSettingsInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + DevOpsAuditingSettingsName devOpsAuditingSettingsName, + ServerDevOpsAuditingSettingsInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, serverName, devOpsAuditingSettingsName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerDevOpsAuditingSettingsInner.class, + ServerDevOpsAuditingSettingsInner.class, + context); + } + + /** + * Creates or updates a server's DevOps audit settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param devOpsAuditingSettingsName The devOpsAuditingSettingsName parameter. + * @param parameters Properties of DevOps audit settings. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a server DevOps auditing settings. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServerDevOpsAuditingSettingsInner> + beginCreateOrUpdate( + String resourceGroupName, + String serverName, + DevOpsAuditingSettingsName devOpsAuditingSettingsName, + ServerDevOpsAuditingSettingsInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, devOpsAuditingSettingsName, parameters) + .getSyncPoller(); + } + + /** + * Creates or updates a server's DevOps audit settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param devOpsAuditingSettingsName The devOpsAuditingSettingsName parameter. + * @param parameters Properties of DevOps audit settings. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a server DevOps auditing settings. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServerDevOpsAuditingSettingsInner> + beginCreateOrUpdate( + String resourceGroupName, + String serverName, + DevOpsAuditingSettingsName devOpsAuditingSettingsName, + ServerDevOpsAuditingSettingsInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, devOpsAuditingSettingsName, parameters, context) + .getSyncPoller(); + } + + /** + * Creates or updates a server's DevOps audit settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param devOpsAuditingSettingsName The devOpsAuditingSettingsName parameter. + * @param parameters Properties of DevOps audit settings. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server DevOps auditing settings on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + DevOpsAuditingSettingsName devOpsAuditingSettingsName, + ServerDevOpsAuditingSettingsInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, devOpsAuditingSettingsName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a server's DevOps audit settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param devOpsAuditingSettingsName The devOpsAuditingSettingsName parameter. + * @param parameters Properties of DevOps audit settings. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server DevOps auditing settings on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + DevOpsAuditingSettingsName devOpsAuditingSettingsName, + ServerDevOpsAuditingSettingsInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, devOpsAuditingSettingsName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a server's DevOps audit settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param devOpsAuditingSettingsName The devOpsAuditingSettingsName parameter. + * @param parameters Properties of DevOps audit settings. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server DevOps auditing settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerDevOpsAuditingSettingsInner createOrUpdate( + String resourceGroupName, + String serverName, + DevOpsAuditingSettingsName devOpsAuditingSettingsName, + ServerDevOpsAuditingSettingsInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, devOpsAuditingSettingsName, parameters).block(); + } + + /** + * Creates or updates a server's DevOps audit settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param devOpsAuditingSettingsName The devOpsAuditingSettingsName parameter. + * @param parameters Properties of DevOps audit settings. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server DevOps auditing settings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerDevOpsAuditingSettingsInner createOrUpdate( + String resourceGroupName, + String serverName, + DevOpsAuditingSettingsName devOpsAuditingSettingsName, + ServerDevOpsAuditingSettingsInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, devOpsAuditingSettingsName, parameters, context) + .block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server DevOps audit settings along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByServerNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server DevOps audit settings along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServerNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerDevOpsAuditSettingsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerDevOpsAuditSettingsImpl.java new file mode 100644 index 0000000000000..40629ce32e5d8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerDevOpsAuditSettingsImpl.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ServerDevOpsAuditSettingsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerDevOpsAuditingSettingsInner; +import com.azure.resourcemanager.sql.generated.models.DevOpsAuditingSettingsName; +import com.azure.resourcemanager.sql.generated.models.ServerDevOpsAuditSettings; +import com.azure.resourcemanager.sql.generated.models.ServerDevOpsAuditingSettings; + +public final class ServerDevOpsAuditSettingsImpl implements ServerDevOpsAuditSettings { + private static final ClientLogger LOGGER = new ClientLogger(ServerDevOpsAuditSettingsImpl.class); + + private final ServerDevOpsAuditSettingsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ServerDevOpsAuditSettingsImpl( + ServerDevOpsAuditSettingsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new ServerDevOpsAuditingSettingsImpl(inner1, this.manager())); + } + + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new ServerDevOpsAuditingSettingsImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + DevOpsAuditingSettingsName devOpsAuditingSettingsName, + Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, devOpsAuditingSettingsName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServerDevOpsAuditingSettingsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ServerDevOpsAuditingSettings get( + String resourceGroupName, String serverName, DevOpsAuditingSettingsName devOpsAuditingSettingsName) { + ServerDevOpsAuditingSettingsInner inner = + this.serviceClient().get(resourceGroupName, serverName, devOpsAuditingSettingsName); + if (inner != null) { + return new ServerDevOpsAuditingSettingsImpl(inner, this.manager()); + } else { + return null; + } + } + + public ServerDevOpsAuditingSettings getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String devOpsAuditingSettingsNameLocal = Utils.getValueFromIdByName(id, "devOpsAuditingSettings"); + if (devOpsAuditingSettingsNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'devOpsAuditingSettings'.", + id))); + } + DevOpsAuditingSettingsName devOpsAuditingSettingsName = + DevOpsAuditingSettingsName.fromString(devOpsAuditingSettingsNameLocal); + return this.getWithResponse(resourceGroupName, serverName, devOpsAuditingSettingsName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String devOpsAuditingSettingsNameLocal = Utils.getValueFromIdByName(id, "devOpsAuditingSettings"); + if (devOpsAuditingSettingsNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'devOpsAuditingSettings'.", + id))); + } + DevOpsAuditingSettingsName devOpsAuditingSettingsName = + DevOpsAuditingSettingsName.fromString(devOpsAuditingSettingsNameLocal); + return this.getWithResponse(resourceGroupName, serverName, devOpsAuditingSettingsName, context); + } + + private ServerDevOpsAuditSettingsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ServerDevOpsAuditingSettingsImpl define(DevOpsAuditingSettingsName name) { + return new ServerDevOpsAuditingSettingsImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerDevOpsAuditingSettingsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerDevOpsAuditingSettingsImpl.java new file mode 100644 index 0000000000000..3af1337c67cec --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerDevOpsAuditingSettingsImpl.java @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerDevOpsAuditingSettingsInner; +import com.azure.resourcemanager.sql.generated.models.BlobAuditingPolicyState; +import com.azure.resourcemanager.sql.generated.models.DevOpsAuditingSettingsName; +import com.azure.resourcemanager.sql.generated.models.ServerDevOpsAuditingSettings; +import java.util.UUID; + +public final class ServerDevOpsAuditingSettingsImpl + implements ServerDevOpsAuditingSettings, + ServerDevOpsAuditingSettings.Definition, + ServerDevOpsAuditingSettings.Update { + private ServerDevOpsAuditingSettingsInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Boolean isAzureMonitorTargetEnabled() { + return this.innerModel().isAzureMonitorTargetEnabled(); + } + + public Boolean isManagedIdentityInUse() { + return this.innerModel().isManagedIdentityInUse(); + } + + public BlobAuditingPolicyState state() { + return this.innerModel().state(); + } + + public String storageEndpoint() { + return this.innerModel().storageEndpoint(); + } + + public String storageAccountAccessKey() { + return this.innerModel().storageAccountAccessKey(); + } + + public UUID storageAccountSubscriptionId() { + return this.innerModel().storageAccountSubscriptionId(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ServerDevOpsAuditingSettingsInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private DevOpsAuditingSettingsName devOpsAuditingSettingsName; + + public ServerDevOpsAuditingSettingsImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public ServerDevOpsAuditingSettings create() { + this.innerObject = + serviceManager + .serviceClient() + .getServerDevOpsAuditSettings() + .createOrUpdate( + resourceGroupName, serverName, devOpsAuditingSettingsName, this.innerModel(), Context.NONE); + return this; + } + + public ServerDevOpsAuditingSettings create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerDevOpsAuditSettings() + .createOrUpdate(resourceGroupName, serverName, devOpsAuditingSettingsName, this.innerModel(), context); + return this; + } + + ServerDevOpsAuditingSettingsImpl( + DevOpsAuditingSettingsName name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ServerDevOpsAuditingSettingsInner(); + this.serviceManager = serviceManager; + this.devOpsAuditingSettingsName = name; + } + + public ServerDevOpsAuditingSettingsImpl update() { + return this; + } + + public ServerDevOpsAuditingSettings apply() { + this.innerObject = + serviceManager + .serviceClient() + .getServerDevOpsAuditSettings() + .createOrUpdate( + resourceGroupName, serverName, devOpsAuditingSettingsName, this.innerModel(), Context.NONE); + return this; + } + + public ServerDevOpsAuditingSettings apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerDevOpsAuditSettings() + .createOrUpdate(resourceGroupName, serverName, devOpsAuditingSettingsName, this.innerModel(), context); + return this; + } + + ServerDevOpsAuditingSettingsImpl( + ServerDevOpsAuditingSettingsInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.devOpsAuditingSettingsName = + DevOpsAuditingSettingsName + .fromString(Utils.getValueFromIdByName(innerObject.id(), "devOpsAuditingSettings")); + } + + public ServerDevOpsAuditingSettings refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getServerDevOpsAuditSettings() + .getWithResponse(resourceGroupName, serverName, devOpsAuditingSettingsName, Context.NONE) + .getValue(); + return this; + } + + public ServerDevOpsAuditingSettings refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerDevOpsAuditSettings() + .getWithResponse(resourceGroupName, serverName, devOpsAuditingSettingsName, context) + .getValue(); + return this; + } + + public ServerDevOpsAuditingSettingsImpl withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled) { + this.innerModel().withIsAzureMonitorTargetEnabled(isAzureMonitorTargetEnabled); + return this; + } + + public ServerDevOpsAuditingSettingsImpl withIsManagedIdentityInUse(Boolean isManagedIdentityInUse) { + this.innerModel().withIsManagedIdentityInUse(isManagedIdentityInUse); + return this; + } + + public ServerDevOpsAuditingSettingsImpl withState(BlobAuditingPolicyState state) { + this.innerModel().withState(state); + return this; + } + + public ServerDevOpsAuditingSettingsImpl withStorageEndpoint(String storageEndpoint) { + this.innerModel().withStorageEndpoint(storageEndpoint); + return this; + } + + public ServerDevOpsAuditingSettingsImpl withStorageAccountAccessKey(String storageAccountAccessKey) { + this.innerModel().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + public ServerDevOpsAuditingSettingsImpl withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId) { + this.innerModel().withStorageAccountSubscriptionId(storageAccountSubscriptionId); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerDnsAliasImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerDnsAliasImpl.java new file mode 100644 index 0000000000000..0b0a405e1da3c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerDnsAliasImpl.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.ServerDnsAliasInner; +import com.azure.resourcemanager.sql.generated.models.ServerDnsAlias; + +public final class ServerDnsAliasImpl implements ServerDnsAlias { + private ServerDnsAliasInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + ServerDnsAliasImpl( + ServerDnsAliasInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String azureDnsRecord() { + return this.innerModel().azureDnsRecord(); + } + + public ServerDnsAliasInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerDnsAliasesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerDnsAliasesClientImpl.java new file mode 100644 index 0000000000000..15fc112ed587c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerDnsAliasesClientImpl.java @@ -0,0 +1,1433 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ServerDnsAliasesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerDnsAliasInner; +import com.azure.resourcemanager.sql.generated.models.ServerDnsAliasAcquisition; +import com.azure.resourcemanager.sql.generated.models.ServerDnsAliasListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ServerDnsAliasesClient. */ +public final class ServerDnsAliasesClientImpl implements ServerDnsAliasesClient { + /** The proxy service used to perform REST calls. */ + private final ServerDnsAliasesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ServerDnsAliasesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServerDnsAliasesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(ServerDnsAliasesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientServerDnsAliases to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + public interface ServerDnsAliasesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/dnsAliases/{dnsAliasName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("dnsAliasName") String dnsAliasName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/dnsAliases/{dnsAliasName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("dnsAliasName") String dnsAliasName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/dnsAliases/{dnsAliasName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("dnsAliasName") String dnsAliasName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/dnsAliases") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/dnsAliases/{dnsAliasName}/acquire") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> acquire( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("dnsAliasName") String dnsAliasName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ServerDnsAliasAcquisition parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server DNS alias along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String dnsAliasName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (dnsAliasName == null) { + return Mono.error(new IllegalArgumentException("Parameter dnsAliasName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + dnsAliasName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server DNS alias along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String dnsAliasName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (dnsAliasName == null) { + return Mono.error(new IllegalArgumentException("Parameter dnsAliasName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + dnsAliasName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server DNS alias on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serverName, String dnsAliasName) { + return getWithResponseAsync(resourceGroupName, serverName, dnsAliasName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server DNS alias along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String dnsAliasName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, dnsAliasName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server DNS alias. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerDnsAliasInner get(String resourceGroupName, String serverName, String dnsAliasName) { + return getWithResponse(resourceGroupName, serverName, dnsAliasName, Context.NONE).getValue(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server DNS alias along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverName, String dnsAliasName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (dnsAliasName == null) { + return Mono.error(new IllegalArgumentException("Parameter dnsAliasName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + dnsAliasName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server DNS alias along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverName, String dnsAliasName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (dnsAliasName == null) { + return Mono.error(new IllegalArgumentException("Parameter dnsAliasName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + dnsAliasName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a server DNS alias. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ServerDnsAliasInner> beginCreateOrUpdateAsync( + String resourceGroupName, String serverName, String dnsAliasName) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, dnsAliasName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerDnsAliasInner.class, + ServerDnsAliasInner.class, + this.client.getContext()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a server DNS alias. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ServerDnsAliasInner> beginCreateOrUpdateAsync( + String resourceGroupName, String serverName, String dnsAliasName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, dnsAliasName, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ServerDnsAliasInner.class, ServerDnsAliasInner.class, context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a server DNS alias. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServerDnsAliasInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String dnsAliasName) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, dnsAliasName).getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a server DNS alias. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServerDnsAliasInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String dnsAliasName, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, dnsAliasName, context).getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server DNS alias on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serverName, String dnsAliasName) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, dnsAliasName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server DNS alias on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serverName, String dnsAliasName, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, dnsAliasName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server DNS alias. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerDnsAliasInner createOrUpdate(String resourceGroupName, String serverName, String dnsAliasName) { + return createOrUpdateAsync(resourceGroupName, serverName, dnsAliasName).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server DNS alias. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerDnsAliasInner createOrUpdate( + String resourceGroupName, String serverName, String dnsAliasName, Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, dnsAliasName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, String dnsAliasName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (dnsAliasName == null) { + return Mono.error(new IllegalArgumentException("Parameter dnsAliasName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + dnsAliasName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, String dnsAliasName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (dnsAliasName == null) { + return Mono.error(new IllegalArgumentException("Parameter dnsAliasName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + dnsAliasName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String dnsAliasName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, serverName, dnsAliasName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String dnsAliasName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, dnsAliasName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String dnsAliasName) { + return beginDeleteAsync(resourceGroupName, serverName, dnsAliasName).getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String dnsAliasName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, dnsAliasName, context).getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String serverName, String dnsAliasName) { + return beginDeleteAsync(resourceGroupName, serverName, dnsAliasName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String serverName, String dnsAliasName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, dnsAliasName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, String dnsAliasName) { + deleteAsync(resourceGroupName, serverName, dnsAliasName).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, String dnsAliasName, Context context) { + deleteAsync(resourceGroupName, serverName, dnsAliasName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server DNS aliases for a server along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server DNS aliases for a server along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server DNS aliases for a server as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server DNS aliases for a server as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server DNS aliases for a server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server DNS aliases for a server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } + + /** + * 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 parameters A server dns alias acquisition request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server DNS alias along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> acquireWithResponseAsync( + String resourceGroupName, String serverName, String dnsAliasName, ServerDnsAliasAcquisition parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (dnsAliasName == null) { + return Mono.error(new IllegalArgumentException("Parameter dnsAliasName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .acquire( + this.client.getEndpoint(), + resourceGroupName, + serverName, + dnsAliasName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 parameters A server dns alias acquisition request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server DNS alias along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> acquireWithResponseAsync( + String resourceGroupName, + String serverName, + String dnsAliasName, + ServerDnsAliasAcquisition parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (dnsAliasName == null) { + return Mono.error(new IllegalArgumentException("Parameter dnsAliasName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .acquire( + this.client.getEndpoint(), + resourceGroupName, + serverName, + dnsAliasName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 parameters A server dns alias acquisition request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a server DNS alias. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ServerDnsAliasInner> beginAcquireAsync( + String resourceGroupName, String serverName, String dnsAliasName, ServerDnsAliasAcquisition parameters) { + Mono>> mono = + acquireWithResponseAsync(resourceGroupName, serverName, dnsAliasName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerDnsAliasInner.class, + ServerDnsAliasInner.class, + this.client.getContext()); + } + + /** + * 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 parameters A server dns alias acquisition request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a server DNS alias. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ServerDnsAliasInner> beginAcquireAsync( + String resourceGroupName, + String serverName, + String dnsAliasName, + ServerDnsAliasAcquisition parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + acquireWithResponseAsync(resourceGroupName, serverName, dnsAliasName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ServerDnsAliasInner.class, ServerDnsAliasInner.class, context); + } + + /** + * 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 parameters A server dns alias acquisition request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a server DNS alias. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServerDnsAliasInner> beginAcquire( + String resourceGroupName, String serverName, String dnsAliasName, ServerDnsAliasAcquisition parameters) { + return beginAcquireAsync(resourceGroupName, serverName, dnsAliasName, parameters).getSyncPoller(); + } + + /** + * 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 parameters A server dns alias acquisition request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a server DNS alias. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServerDnsAliasInner> beginAcquire( + String resourceGroupName, + String serverName, + String dnsAliasName, + ServerDnsAliasAcquisition parameters, + Context context) { + return beginAcquireAsync(resourceGroupName, serverName, dnsAliasName, parameters, context).getSyncPoller(); + } + + /** + * 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 parameters A server dns alias acquisition request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server DNS alias on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono acquireAsync( + String resourceGroupName, String serverName, String dnsAliasName, ServerDnsAliasAcquisition parameters) { + return beginAcquireAsync(resourceGroupName, serverName, dnsAliasName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 parameters A server dns alias acquisition request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server DNS alias on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono acquireAsync( + String resourceGroupName, + String serverName, + String dnsAliasName, + ServerDnsAliasAcquisition parameters, + Context context) { + return beginAcquireAsync(resourceGroupName, serverName, dnsAliasName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 parameters A server dns alias acquisition request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server DNS alias. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerDnsAliasInner acquire( + String resourceGroupName, String serverName, String dnsAliasName, ServerDnsAliasAcquisition parameters) { + return acquireAsync(resourceGroupName, serverName, dnsAliasName, parameters).block(); + } + + /** + * 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 parameters A server dns alias acquisition request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server DNS alias. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerDnsAliasInner acquire( + String resourceGroupName, + String serverName, + String dnsAliasName, + ServerDnsAliasAcquisition parameters, + Context context) { + return acquireAsync(resourceGroupName, serverName, dnsAliasName, parameters, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server DNS aliases along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByServerNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server DNS aliases along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServerNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerDnsAliasesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerDnsAliasesImpl.java new file mode 100644 index 0000000000000..9e03bceffc9ac --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerDnsAliasesImpl.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ServerDnsAliasesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerDnsAliasInner; +import com.azure.resourcemanager.sql.generated.models.ServerDnsAlias; +import com.azure.resourcemanager.sql.generated.models.ServerDnsAliasAcquisition; +import com.azure.resourcemanager.sql.generated.models.ServerDnsAliases; + +public final class ServerDnsAliasesImpl implements ServerDnsAliases { + private static final ClientLogger LOGGER = new ClientLogger(ServerDnsAliasesImpl.class); + + private final ServerDnsAliasesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ServerDnsAliasesImpl( + ServerDnsAliasesClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String dnsAliasName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, dnsAliasName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServerDnsAliasImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ServerDnsAlias get(String resourceGroupName, String serverName, String dnsAliasName) { + ServerDnsAliasInner inner = this.serviceClient().get(resourceGroupName, serverName, dnsAliasName); + if (inner != null) { + return new ServerDnsAliasImpl(inner, this.manager()); + } else { + return null; + } + } + + public ServerDnsAlias createOrUpdate(String resourceGroupName, String serverName, String dnsAliasName) { + ServerDnsAliasInner inner = this.serviceClient().createOrUpdate(resourceGroupName, serverName, dnsAliasName); + if (inner != null) { + return new ServerDnsAliasImpl(inner, this.manager()); + } else { + return null; + } + } + + public ServerDnsAlias createOrUpdate( + String resourceGroupName, String serverName, String dnsAliasName, Context context) { + ServerDnsAliasInner inner = + this.serviceClient().createOrUpdate(resourceGroupName, serverName, dnsAliasName, context); + if (inner != null) { + return new ServerDnsAliasImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String serverName, String dnsAliasName) { + this.serviceClient().delete(resourceGroupName, serverName, dnsAliasName); + } + + public void delete(String resourceGroupName, String serverName, String dnsAliasName, Context context) { + this.serviceClient().delete(resourceGroupName, serverName, dnsAliasName, context); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new ServerDnsAliasImpl(inner1, this.manager())); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new ServerDnsAliasImpl(inner1, this.manager())); + } + + public ServerDnsAlias acquire( + String resourceGroupName, String serverName, String dnsAliasName, ServerDnsAliasAcquisition parameters) { + ServerDnsAliasInner inner = + this.serviceClient().acquire(resourceGroupName, serverName, dnsAliasName, parameters); + if (inner != null) { + return new ServerDnsAliasImpl(inner, this.manager()); + } else { + return null; + } + } + + public ServerDnsAlias acquire( + String resourceGroupName, + String serverName, + String dnsAliasName, + ServerDnsAliasAcquisition parameters, + Context context) { + ServerDnsAliasInner inner = + this.serviceClient().acquire(resourceGroupName, serverName, dnsAliasName, parameters, context); + if (inner != null) { + return new ServerDnsAliasImpl(inner, this.manager()); + } else { + return null; + } + } + + private ServerDnsAliasesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerImpl.java new file mode 100644 index 0000000000000..8e936363431c4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerImpl.java @@ -0,0 +1,361 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerInner; +import com.azure.resourcemanager.sql.generated.models.ImportExportOperationResult; +import com.azure.resourcemanager.sql.generated.models.ImportNewDatabaseDefinition; +import com.azure.resourcemanager.sql.generated.models.ResourceIdentity; +import com.azure.resourcemanager.sql.generated.models.Server; +import com.azure.resourcemanager.sql.generated.models.ServerExternalAdministrator; +import com.azure.resourcemanager.sql.generated.models.ServerNetworkAccessFlag; +import com.azure.resourcemanager.sql.generated.models.ServerPrivateEndpointConnection; +import com.azure.resourcemanager.sql.generated.models.ServerUpdate; +import com.azure.resourcemanager.sql.generated.models.ServerWorkspaceFeature; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +public final class ServerImpl implements Server, Server.Definition, Server.Update { + private ServerInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public ResourceIdentity identity() { + return this.innerModel().identity(); + } + + public String kind() { + return this.innerModel().kind(); + } + + public String administratorLogin() { + return this.innerModel().administratorLogin(); + } + + public String administratorLoginPassword() { + return this.innerModel().administratorLoginPassword(); + } + + public String version() { + return this.innerModel().version(); + } + + public String state() { + return this.innerModel().state(); + } + + public String fullyQualifiedDomainName() { + return this.innerModel().fullyQualifiedDomainName(); + } + + public List privateEndpointConnections() { + List inner = this.innerModel().privateEndpointConnections(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String minimalTlsVersion() { + return this.innerModel().minimalTlsVersion(); + } + + public ServerNetworkAccessFlag publicNetworkAccess() { + return this.innerModel().publicNetworkAccess(); + } + + public ServerWorkspaceFeature workspaceFeature() { + return this.innerModel().workspaceFeature(); + } + + public String primaryUserAssignedIdentityId() { + return this.innerModel().primaryUserAssignedIdentityId(); + } + + public UUID federatedClientId() { + return this.innerModel().federatedClientId(); + } + + public String keyId() { + return this.innerModel().keyId(); + } + + public ServerExternalAdministrator administrators() { + return this.innerModel().administrators(); + } + + public ServerNetworkAccessFlag restrictOutboundNetworkAccess() { + return this.innerModel().restrictOutboundNetworkAccess(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ServerInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private ServerUpdate updateParameters; + + public ServerImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public Server create() { + this.innerObject = + serviceManager + .serviceClient() + .getServers() + .createOrUpdate(resourceGroupName, serverName, this.innerModel(), Context.NONE); + return this; + } + + public Server create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServers() + .createOrUpdate(resourceGroupName, serverName, this.innerModel(), context); + return this; + } + + ServerImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ServerInner(); + this.serviceManager = serviceManager; + this.serverName = name; + } + + public ServerImpl update() { + this.updateParameters = new ServerUpdate(); + return this; + } + + public Server apply() { + this.innerObject = + serviceManager + .serviceClient() + .getServers() + .update(resourceGroupName, serverName, updateParameters, Context.NONE); + return this; + } + + public Server apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServers() + .update(resourceGroupName, serverName, updateParameters, context); + return this; + } + + ServerImpl(ServerInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + } + + public Server refresh() { + String localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getServers() + .getByResourceGroupWithResponse(resourceGroupName, serverName, localExpand, Context.NONE) + .getValue(); + return this; + } + + public Server refresh(Context context) { + String localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getServers() + .getByResourceGroupWithResponse(resourceGroupName, serverName, localExpand, context) + .getValue(); + return this; + } + + public ImportExportOperationResult importDatabase(ImportNewDatabaseDefinition parameters) { + return serviceManager.servers().importDatabase(resourceGroupName, serverName, parameters); + } + + public ImportExportOperationResult importDatabase(ImportNewDatabaseDefinition parameters, Context context) { + return serviceManager.servers().importDatabase(resourceGroupName, serverName, parameters, context); + } + + public ServerImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public ServerImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public ServerImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public ServerImpl withIdentity(ResourceIdentity identity) { + if (isInCreateMode()) { + this.innerModel().withIdentity(identity); + return this; + } else { + this.updateParameters.withIdentity(identity); + return this; + } + } + + public ServerImpl withAdministratorLogin(String administratorLogin) { + this.innerModel().withAdministratorLogin(administratorLogin); + return this; + } + + public ServerImpl withAdministratorLoginPassword(String administratorLoginPassword) { + if (isInCreateMode()) { + this.innerModel().withAdministratorLoginPassword(administratorLoginPassword); + return this; + } else { + this.updateParameters.withAdministratorLoginPassword(administratorLoginPassword); + return this; + } + } + + public ServerImpl withVersion(String version) { + if (isInCreateMode()) { + this.innerModel().withVersion(version); + return this; + } else { + this.updateParameters.withVersion(version); + return this; + } + } + + public ServerImpl withMinimalTlsVersion(String minimalTlsVersion) { + if (isInCreateMode()) { + this.innerModel().withMinimalTlsVersion(minimalTlsVersion); + return this; + } else { + this.updateParameters.withMinimalTlsVersion(minimalTlsVersion); + return this; + } + } + + public ServerImpl withPublicNetworkAccess(ServerNetworkAccessFlag publicNetworkAccess) { + if (isInCreateMode()) { + this.innerModel().withPublicNetworkAccess(publicNetworkAccess); + return this; + } else { + this.updateParameters.withPublicNetworkAccess(publicNetworkAccess); + return this; + } + } + + public ServerImpl withPrimaryUserAssignedIdentityId(String primaryUserAssignedIdentityId) { + if (isInCreateMode()) { + this.innerModel().withPrimaryUserAssignedIdentityId(primaryUserAssignedIdentityId); + return this; + } else { + this.updateParameters.withPrimaryUserAssignedIdentityId(primaryUserAssignedIdentityId); + return this; + } + } + + public ServerImpl withFederatedClientId(UUID federatedClientId) { + if (isInCreateMode()) { + this.innerModel().withFederatedClientId(federatedClientId); + return this; + } else { + this.updateParameters.withFederatedClientId(federatedClientId); + return this; + } + } + + public ServerImpl withKeyId(String keyId) { + if (isInCreateMode()) { + this.innerModel().withKeyId(keyId); + return this; + } else { + this.updateParameters.withKeyId(keyId); + return this; + } + } + + public ServerImpl withAdministrators(ServerExternalAdministrator administrators) { + this.innerModel().withAdministrators(administrators); + return this; + } + + public ServerImpl withRestrictOutboundNetworkAccess(ServerNetworkAccessFlag restrictOutboundNetworkAccess) { + if (isInCreateMode()) { + this.innerModel().withRestrictOutboundNetworkAccess(restrictOutboundNetworkAccess); + return this; + } else { + this.updateParameters.withRestrictOutboundNetworkAccess(restrictOutboundNetworkAccess); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerKeyImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerKeyImpl.java new file mode 100644 index 0000000000000..5c1b6a161d5e1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerKeyImpl.java @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerKeyInner; +import com.azure.resourcemanager.sql.generated.models.ServerKey; +import com.azure.resourcemanager.sql.generated.models.ServerKeyType; +import java.time.OffsetDateTime; + +public final class ServerKeyImpl implements ServerKey, ServerKey.Definition, ServerKey.Update { + private ServerKeyInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String kind() { + return this.innerModel().kind(); + } + + public String location() { + return this.innerModel().location(); + } + + public String subregion() { + return this.innerModel().subregion(); + } + + public ServerKeyType serverKeyType() { + return this.innerModel().serverKeyType(); + } + + public String uri() { + return this.innerModel().uri(); + } + + public String thumbprint() { + return this.innerModel().thumbprint(); + } + + public OffsetDateTime creationDate() { + return this.innerModel().creationDate(); + } + + public Boolean autoRotationEnabled() { + return this.innerModel().autoRotationEnabled(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ServerKeyInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String keyName; + + public ServerKeyImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public ServerKey create() { + this.innerObject = + serviceManager + .serviceClient() + .getServerKeys() + .createOrUpdate(resourceGroupName, serverName, keyName, this.innerModel(), Context.NONE); + return this; + } + + public ServerKey create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerKeys() + .createOrUpdate(resourceGroupName, serverName, keyName, this.innerModel(), context); + return this; + } + + ServerKeyImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ServerKeyInner(); + this.serviceManager = serviceManager; + this.keyName = name; + } + + public ServerKeyImpl update() { + return this; + } + + public ServerKey apply() { + this.innerObject = + serviceManager + .serviceClient() + .getServerKeys() + .createOrUpdate(resourceGroupName, serverName, keyName, this.innerModel(), Context.NONE); + return this; + } + + public ServerKey apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerKeys() + .createOrUpdate(resourceGroupName, serverName, keyName, this.innerModel(), context); + return this; + } + + ServerKeyImpl(ServerKeyInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.keyName = Utils.getValueFromIdByName(innerObject.id(), "keys"); + } + + public ServerKey refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getServerKeys() + .getWithResponse(resourceGroupName, serverName, keyName, Context.NONE) + .getValue(); + return this; + } + + public ServerKey refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerKeys() + .getWithResponse(resourceGroupName, serverName, keyName, context) + .getValue(); + return this; + } + + public ServerKeyImpl withServerKeyType(ServerKeyType serverKeyType) { + this.innerModel().withServerKeyType(serverKeyType); + return this; + } + + public ServerKeyImpl withUri(String uri) { + this.innerModel().withUri(uri); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerKeysClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerKeysClientImpl.java new file mode 100644 index 0000000000000..54964cacffdc1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerKeysClientImpl.java @@ -0,0 +1,1146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ServerKeysClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerKeyInner; +import com.azure.resourcemanager.sql.generated.models.ServerKeyListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ServerKeysClient. */ +public final class ServerKeysClientImpl implements ServerKeysClient { + /** The proxy service used to perform REST calls. */ + private final ServerKeysService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ServerKeysClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServerKeysClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(ServerKeysService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientServerKeys to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + public interface ServerKeysService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/keys") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/keys/{keyName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("keyName") String keyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/keys/{keyName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("keyName") String keyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ServerKeyInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/keys/{keyName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("keyName") String keyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server keys along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server keys along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server keys as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server keys as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server keys as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server keys as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server key along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String keyName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (keyName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + keyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server key along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String keyName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (keyName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + keyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server key on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serverName, String keyName) { + return getWithResponseAsync(resourceGroupName, serverName, keyName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server key along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String keyName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, keyName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerKeyInner get(String resourceGroupName, String serverName, String keyName) { + return getWithResponse(resourceGroupName, serverName, keyName, Context.NONE).getValue(); + } + + /** + * 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/YourKeyVersion, then the server key name should be + * formatted as: YourVaultName_YourKeyName_YourKeyVersion. + * @param parameters The requested server key resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server key along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverName, String keyName, ServerKeyInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (keyName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + keyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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/YourKeyVersion, then the server key name should be + * formatted as: YourVaultName_YourKeyName_YourKeyVersion. + * @param parameters The requested server key resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server key along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverName, String keyName, ServerKeyInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (keyName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + keyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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/YourKeyVersion, then the server key name should be + * formatted as: YourVaultName_YourKeyName_YourKeyVersion. + * @param parameters The requested server key resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a server key. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ServerKeyInner> beginCreateOrUpdateAsync( + String resourceGroupName, String serverName, String keyName, ServerKeyInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, keyName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerKeyInner.class, + ServerKeyInner.class, + this.client.getContext()); + } + + /** + * 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/YourKeyVersion, then the server key name should be + * formatted as: YourVaultName_YourKeyName_YourKeyVersion. + * @param parameters The requested server key resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a server key. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ServerKeyInner> beginCreateOrUpdateAsync( + String resourceGroupName, String serverName, String keyName, ServerKeyInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, keyName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ServerKeyInner.class, ServerKeyInner.class, context); + } + + /** + * 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/YourKeyVersion, then the server key name should be + * formatted as: YourVaultName_YourKeyName_YourKeyVersion. + * @param parameters The requested server key resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a server key. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServerKeyInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String keyName, ServerKeyInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, keyName, parameters).getSyncPoller(); + } + + /** + * 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/YourKeyVersion, then the server key name should be + * formatted as: YourVaultName_YourKeyName_YourKeyVersion. + * @param parameters The requested server key resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a server key. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServerKeyInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String keyName, ServerKeyInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, keyName, parameters, context).getSyncPoller(); + } + + /** + * 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/YourKeyVersion, then the server key name should be + * formatted as: YourVaultName_YourKeyName_YourKeyVersion. + * @param parameters The requested server key resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server key on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serverName, String keyName, ServerKeyInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, keyName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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/YourKeyVersion, then the server key name should be + * formatted as: YourVaultName_YourKeyName_YourKeyVersion. + * @param parameters The requested server key resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server key on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serverName, String keyName, ServerKeyInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, keyName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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/YourKeyVersion, then the server key name should be + * formatted as: YourVaultName_YourKeyName_YourKeyVersion. + * @param parameters The requested server key resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerKeyInner createOrUpdate( + String resourceGroupName, String serverName, String keyName, ServerKeyInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, keyName, parameters).block(); + } + + /** + * 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/YourKeyVersion, then the server key name should be + * formatted as: YourVaultName_YourKeyName_YourKeyVersion. + * @param parameters The requested server key resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerKeyInner createOrUpdate( + String resourceGroupName, String serverName, String keyName, ServerKeyInner parameters, Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, keyName, parameters, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, String keyName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (keyName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + keyName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, String keyName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (keyName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + keyName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String keyName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, serverName, keyName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String keyName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, keyName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String serverName, String keyName) { + return beginDeleteAsync(resourceGroupName, serverName, keyName).getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String keyName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, keyName, context).getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String serverName, String keyName) { + return beginDeleteAsync(resourceGroupName, serverName, keyName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String serverName, String keyName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, keyName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, String keyName) { + deleteAsync(resourceGroupName, serverName, keyName).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, String keyName, Context context) { + deleteAsync(resourceGroupName, serverName, keyName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server keys along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByServerNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server keys along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServerNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerKeysImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerKeysImpl.java new file mode 100644 index 0000000000000..c5a3af8cb9c1a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerKeysImpl.java @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ServerKeysClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerKeyInner; +import com.azure.resourcemanager.sql.generated.models.ServerKey; +import com.azure.resourcemanager.sql.generated.models.ServerKeys; + +public final class ServerKeysImpl implements ServerKeys { + private static final ClientLogger LOGGER = new ClientLogger(ServerKeysImpl.class); + + private final ServerKeysClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ServerKeysImpl( + ServerKeysClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new ServerKeyImpl(inner1, this.manager())); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { + PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new ServerKeyImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String keyName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, keyName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServerKeyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ServerKey get(String resourceGroupName, String serverName, String keyName) { + ServerKeyInner inner = this.serviceClient().get(resourceGroupName, serverName, keyName); + if (inner != null) { + return new ServerKeyImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String serverName, String keyName) { + this.serviceClient().delete(resourceGroupName, serverName, keyName); + } + + public void delete(String resourceGroupName, String serverName, String keyName, Context context) { + this.serviceClient().delete(resourceGroupName, serverName, keyName, context); + } + + public ServerKey getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String keyName = Utils.getValueFromIdByName(id, "keys"); + if (keyName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'keys'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, keyName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String keyName = Utils.getValueFromIdByName(id, "keys"); + if (keyName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'keys'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, keyName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String keyName = Utils.getValueFromIdByName(id, "keys"); + if (keyName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'keys'.", id))); + } + this.delete(resourceGroupName, serverName, keyName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String keyName = Utils.getValueFromIdByName(id, "keys"); + if (keyName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'keys'.", id))); + } + this.delete(resourceGroupName, serverName, keyName, context); + } + + private ServerKeysClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ServerKeyImpl define(String name) { + return new ServerKeyImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerOperationImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerOperationImpl.java new file mode 100644 index 0000000000000..afcbefe115a57 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerOperationImpl.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.ServerOperationInner; +import com.azure.resourcemanager.sql.generated.models.ManagementOperationState; +import com.azure.resourcemanager.sql.generated.models.ServerOperation; +import java.time.OffsetDateTime; + +public final class ServerOperationImpl implements ServerOperation { + private ServerOperationInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + ServerOperationImpl( + ServerOperationInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String operation() { + return this.innerModel().operation(); + } + + public String operationFriendlyName() { + return this.innerModel().operationFriendlyName(); + } + + public Integer percentComplete() { + return this.innerModel().percentComplete(); + } + + public String serverName() { + return this.innerModel().serverName(); + } + + public OffsetDateTime startTime() { + return this.innerModel().startTime(); + } + + public ManagementOperationState state() { + return this.innerModel().state(); + } + + public Integer errorCode() { + return this.innerModel().errorCode(); + } + + public String errorDescription() { + return this.innerModel().errorDescription(); + } + + public Integer errorSeverity() { + return this.innerModel().errorSeverity(); + } + + public Boolean isUserError() { + return this.innerModel().isUserError(); + } + + public OffsetDateTime estimatedCompletionTime() { + return this.innerModel().estimatedCompletionTime(); + } + + public String description() { + return this.innerModel().description(); + } + + public Boolean isCancellable() { + return this.innerModel().isCancellable(); + } + + public ServerOperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerOperationsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerOperationsClientImpl.java new file mode 100644 index 0000000000000..19b4e50ab6ded --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerOperationsClientImpl.java @@ -0,0 +1,350 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.ServerOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerOperationInner; +import com.azure.resourcemanager.sql.generated.models.ServerOperationListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ServerOperationsClient. */ +public final class ServerOperationsClientImpl implements ServerOperationsClient { + /** The proxy service used to perform REST calls. */ + private final ServerOperationsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ServerOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServerOperationsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(ServerOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientServerOperations to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + public interface ServerOperationsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a list of operations performed 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of operations performed on the server along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of operations performed 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of operations performed on the server along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of operations performed 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of operations performed on the server as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of operations performed 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of operations performed on the server as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of operations performed 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of operations performed on the server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * Gets a list of operations performed 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of operations performed on the server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list server operations request along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByServerNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list server operations request along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServerNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerOperationsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerOperationsImpl.java new file mode 100644 index 0000000000000..baa76bb93982f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerOperationsImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ServerOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerOperationInner; +import com.azure.resourcemanager.sql.generated.models.ServerOperation; +import com.azure.resourcemanager.sql.generated.models.ServerOperations; + +public final class ServerOperationsImpl implements ServerOperations { + private static final ClientLogger LOGGER = new ClientLogger(ServerOperationsImpl.class); + + private final ServerOperationsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ServerOperationsImpl( + ServerOperationsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new ServerOperationImpl(inner1, this.manager())); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new ServerOperationImpl(inner1, this.manager())); + } + + private ServerOperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerSecurityAlertPoliciesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerSecurityAlertPoliciesClientImpl.java new file mode 100644 index 0000000000000..0f373b0c64510 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerSecurityAlertPoliciesClientImpl.java @@ -0,0 +1,906 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ServerSecurityAlertPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerSecurityAlertPolicyInner; +import com.azure.resourcemanager.sql.generated.models.LogicalServerSecurityAlertPolicyListResult; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyName; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ServerSecurityAlertPoliciesClient. */ +public final class ServerSecurityAlertPoliciesClientImpl implements ServerSecurityAlertPoliciesClient { + /** The proxy service used to perform REST calls. */ + private final ServerSecurityAlertPoliciesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ServerSecurityAlertPoliciesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServerSecurityAlertPoliciesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ServerSecurityAlertPoliciesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientServerSecurityAlertPolicies to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + public interface ServerSecurityAlertPoliciesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/securityAlertPolicies/{securityAlertPolicyName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("securityAlertPolicyName") SecurityAlertPolicyName securityAlertPolicyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/securityAlertPolicies/{securityAlertPolicyName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("securityAlertPolicyName") SecurityAlertPolicyName securityAlertPolicyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ServerSecurityAlertPolicyInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/securityAlertPolicies") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 securityAlertPolicyName The name of the security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's security alert policy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, SecurityAlertPolicyName securityAlertPolicyName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (securityAlertPolicyName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter securityAlertPolicyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + securityAlertPolicyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 securityAlertPolicyName The name of the security alert policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's security alert policy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, SecurityAlertPolicyName securityAlertPolicyName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (securityAlertPolicyName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter securityAlertPolicyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + securityAlertPolicyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 securityAlertPolicyName The name of the security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's security alert policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, SecurityAlertPolicyName securityAlertPolicyName) { + return getWithResponseAsync(resourceGroupName, serverName, securityAlertPolicyName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 securityAlertPolicyName The name of the security alert policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's security alert policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, SecurityAlertPolicyName securityAlertPolicyName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, securityAlertPolicyName, context).block(); + } + + /** + * 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 securityAlertPolicyName The name of the security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerSecurityAlertPolicyInner get( + String resourceGroupName, String serverName, SecurityAlertPolicyName securityAlertPolicyName) { + return getWithResponse(resourceGroupName, serverName, securityAlertPolicyName, Context.NONE).getValue(); + } + + /** + * 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 securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server security alert policy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (securityAlertPolicyName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter securityAlertPolicyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + securityAlertPolicyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server security alert policy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (securityAlertPolicyName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter securityAlertPolicyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + securityAlertPolicyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a server security alert policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ServerSecurityAlertPolicyInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, securityAlertPolicyName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerSecurityAlertPolicyInner.class, + ServerSecurityAlertPolicyInner.class, + this.client.getContext()); + } + + /** + * 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 securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a server security alert policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ServerSecurityAlertPolicyInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, serverName, securityAlertPolicyName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerSecurityAlertPolicyInner.class, + ServerSecurityAlertPolicyInner.class, + context); + } + + /** + * 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 securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a server security alert policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServerSecurityAlertPolicyInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, securityAlertPolicyName, parameters) + .getSyncPoller(); + } + + /** + * 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 securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a server security alert policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServerSecurityAlertPolicyInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, securityAlertPolicyName, parameters, context) + .getSyncPoller(); + } + + /** + * 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 securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server security alert policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, securityAlertPolicyName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server security alert policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, securityAlertPolicyName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerSecurityAlertPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, securityAlertPolicyName, parameters).block(); + } + + /** + * 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 securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerSecurityAlertPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, securityAlertPolicyName, parameters, context).block(); + } + + /** + * Get the server's threat detection 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the server's threat detection policies along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the server's threat detection 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the server's threat detection policies along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the server's threat detection 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the server's threat detection policies as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Get the server's threat detection 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the server's threat detection policies as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * Get the server's threat detection 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the server's threat detection policies as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * Get the server's threat detection 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the server's threat detection policies as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the server's security alert policies along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByServerNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the server's security alert policies along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServerNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerSecurityAlertPoliciesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerSecurityAlertPoliciesImpl.java new file mode 100644 index 0000000000000..76dd9d1cd5269 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerSecurityAlertPoliciesImpl.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ServerSecurityAlertPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerSecurityAlertPolicyInner; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyName; +import com.azure.resourcemanager.sql.generated.models.ServerSecurityAlertPolicies; +import com.azure.resourcemanager.sql.generated.models.ServerSecurityAlertPolicy; + +public final class ServerSecurityAlertPoliciesImpl implements ServerSecurityAlertPolicies { + private static final ClientLogger LOGGER = new ClientLogger(ServerSecurityAlertPoliciesImpl.class); + + private final ServerSecurityAlertPoliciesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ServerSecurityAlertPoliciesImpl( + ServerSecurityAlertPoliciesClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String resourceGroupName, String serverName, SecurityAlertPolicyName securityAlertPolicyName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, securityAlertPolicyName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServerSecurityAlertPolicyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ServerSecurityAlertPolicy get( + String resourceGroupName, String serverName, SecurityAlertPolicyName securityAlertPolicyName) { + ServerSecurityAlertPolicyInner inner = + this.serviceClient().get(resourceGroupName, serverName, securityAlertPolicyName); + if (inner != null) { + return new ServerSecurityAlertPolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new ServerSecurityAlertPolicyImpl(inner1, this.manager())); + } + + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new ServerSecurityAlertPolicyImpl(inner1, this.manager())); + } + + public ServerSecurityAlertPolicy getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String securityAlertPolicyNameLocal = Utils.getValueFromIdByName(id, "securityAlertPolicies"); + if (securityAlertPolicyNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'securityAlertPolicies'.", + id))); + } + SecurityAlertPolicyName securityAlertPolicyName = + SecurityAlertPolicyName.fromString(securityAlertPolicyNameLocal); + return this.getWithResponse(resourceGroupName, serverName, securityAlertPolicyName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String securityAlertPolicyNameLocal = Utils.getValueFromIdByName(id, "securityAlertPolicies"); + if (securityAlertPolicyNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'securityAlertPolicies'.", + id))); + } + SecurityAlertPolicyName securityAlertPolicyName = + SecurityAlertPolicyName.fromString(securityAlertPolicyNameLocal); + return this.getWithResponse(resourceGroupName, serverName, securityAlertPolicyName, context); + } + + private ServerSecurityAlertPoliciesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ServerSecurityAlertPolicyImpl define(SecurityAlertPolicyName name) { + return new ServerSecurityAlertPolicyImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerSecurityAlertPolicyImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerSecurityAlertPolicyImpl.java new file mode 100644 index 0000000000000..3c084e30f5a69 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerSecurityAlertPolicyImpl.java @@ -0,0 +1,218 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerSecurityAlertPolicyInner; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyName; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertsPolicyState; +import com.azure.resourcemanager.sql.generated.models.ServerSecurityAlertPolicy; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class ServerSecurityAlertPolicyImpl + implements ServerSecurityAlertPolicy, ServerSecurityAlertPolicy.Definition, ServerSecurityAlertPolicy.Update { + private ServerSecurityAlertPolicyInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public SecurityAlertsPolicyState state() { + return this.innerModel().state(); + } + + public List disabledAlerts() { + List inner = this.innerModel().disabledAlerts(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List emailAddresses() { + List inner = this.innerModel().emailAddresses(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Boolean emailAccountAdmins() { + return this.innerModel().emailAccountAdmins(); + } + + public String storageEndpoint() { + return this.innerModel().storageEndpoint(); + } + + public String storageAccountAccessKey() { + return this.innerModel().storageAccountAccessKey(); + } + + public Integer retentionDays() { + return this.innerModel().retentionDays(); + } + + public OffsetDateTime creationTime() { + return this.innerModel().creationTime(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ServerSecurityAlertPolicyInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private SecurityAlertPolicyName securityAlertPolicyName; + + public ServerSecurityAlertPolicyImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public ServerSecurityAlertPolicy create() { + this.innerObject = + serviceManager + .serviceClient() + .getServerSecurityAlertPolicies() + .createOrUpdate( + resourceGroupName, serverName, securityAlertPolicyName, this.innerModel(), Context.NONE); + return this; + } + + public ServerSecurityAlertPolicy create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerSecurityAlertPolicies() + .createOrUpdate(resourceGroupName, serverName, securityAlertPolicyName, this.innerModel(), context); + return this; + } + + ServerSecurityAlertPolicyImpl( + SecurityAlertPolicyName name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ServerSecurityAlertPolicyInner(); + this.serviceManager = serviceManager; + this.securityAlertPolicyName = name; + } + + public ServerSecurityAlertPolicyImpl update() { + return this; + } + + public ServerSecurityAlertPolicy apply() { + this.innerObject = + serviceManager + .serviceClient() + .getServerSecurityAlertPolicies() + .createOrUpdate( + resourceGroupName, serverName, securityAlertPolicyName, this.innerModel(), Context.NONE); + return this; + } + + public ServerSecurityAlertPolicy apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerSecurityAlertPolicies() + .createOrUpdate(resourceGroupName, serverName, securityAlertPolicyName, this.innerModel(), context); + return this; + } + + ServerSecurityAlertPolicyImpl( + ServerSecurityAlertPolicyInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.securityAlertPolicyName = + SecurityAlertPolicyName.fromString(Utils.getValueFromIdByName(innerObject.id(), "securityAlertPolicies")); + } + + public ServerSecurityAlertPolicy refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getServerSecurityAlertPolicies() + .getWithResponse(resourceGroupName, serverName, securityAlertPolicyName, Context.NONE) + .getValue(); + return this; + } + + public ServerSecurityAlertPolicy refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerSecurityAlertPolicies() + .getWithResponse(resourceGroupName, serverName, securityAlertPolicyName, context) + .getValue(); + return this; + } + + public ServerSecurityAlertPolicyImpl withState(SecurityAlertsPolicyState state) { + this.innerModel().withState(state); + return this; + } + + public ServerSecurityAlertPolicyImpl withDisabledAlerts(List disabledAlerts) { + this.innerModel().withDisabledAlerts(disabledAlerts); + return this; + } + + public ServerSecurityAlertPolicyImpl withEmailAddresses(List emailAddresses) { + this.innerModel().withEmailAddresses(emailAddresses); + return this; + } + + public ServerSecurityAlertPolicyImpl withEmailAccountAdmins(Boolean emailAccountAdmins) { + this.innerModel().withEmailAccountAdmins(emailAccountAdmins); + return this; + } + + public ServerSecurityAlertPolicyImpl withStorageEndpoint(String storageEndpoint) { + this.innerModel().withStorageEndpoint(storageEndpoint); + return this; + } + + public ServerSecurityAlertPolicyImpl withStorageAccountAccessKey(String storageAccountAccessKey) { + this.innerModel().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + public ServerSecurityAlertPolicyImpl withRetentionDays(Integer retentionDays) { + this.innerModel().withRetentionDays(retentionDays); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerTrustCertificateImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerTrustCertificateImpl.java new file mode 100644 index 0000000000000..27bc7244b0225 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerTrustCertificateImpl.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerTrustCertificateInner; +import com.azure.resourcemanager.sql.generated.models.ServerTrustCertificate; + +public final class ServerTrustCertificateImpl + implements ServerTrustCertificate, ServerTrustCertificate.Definition, ServerTrustCertificate.Update { + private ServerTrustCertificateInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String publicBlob() { + return this.innerModel().publicBlob(); + } + + public String thumbprint() { + return this.innerModel().thumbprint(); + } + + public String certificateName() { + return this.innerModel().certificateName(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ServerTrustCertificateInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String managedInstanceName; + + private String certificateName; + + public ServerTrustCertificateImpl withExistingManagedInstance( + String resourceGroupName, String managedInstanceName) { + this.resourceGroupName = resourceGroupName; + this.managedInstanceName = managedInstanceName; + return this; + } + + public ServerTrustCertificate create() { + this.innerObject = + serviceManager + .serviceClient() + .getServerTrustCertificates() + .createOrUpdate( + resourceGroupName, managedInstanceName, certificateName, this.innerModel(), Context.NONE); + return this; + } + + public ServerTrustCertificate create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerTrustCertificates() + .createOrUpdate(resourceGroupName, managedInstanceName, certificateName, this.innerModel(), context); + return this; + } + + ServerTrustCertificateImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ServerTrustCertificateInner(); + this.serviceManager = serviceManager; + this.certificateName = name; + } + + public ServerTrustCertificateImpl update() { + return this; + } + + public ServerTrustCertificate apply() { + this.innerObject = + serviceManager + .serviceClient() + .getServerTrustCertificates() + .createOrUpdate( + resourceGroupName, managedInstanceName, certificateName, this.innerModel(), Context.NONE); + return this; + } + + public ServerTrustCertificate apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerTrustCertificates() + .createOrUpdate(resourceGroupName, managedInstanceName, certificateName, this.innerModel(), context); + return this; + } + + ServerTrustCertificateImpl( + ServerTrustCertificateInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.managedInstanceName = Utils.getValueFromIdByName(innerObject.id(), "managedInstances"); + this.certificateName = Utils.getValueFromIdByName(innerObject.id(), "serverTrustCertificates"); + } + + public ServerTrustCertificate refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getServerTrustCertificates() + .getWithResponse(resourceGroupName, managedInstanceName, certificateName, Context.NONE) + .getValue(); + return this; + } + + public ServerTrustCertificate refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerTrustCertificates() + .getWithResponse(resourceGroupName, managedInstanceName, certificateName, context) + .getValue(); + return this; + } + + public ServerTrustCertificateImpl withPublicBlob(String publicBlob) { + this.innerModel().withPublicBlob(publicBlob); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerTrustCertificatesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerTrustCertificatesClientImpl.java new file mode 100644 index 0000000000000..eaebfd579ecb5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerTrustCertificatesClientImpl.java @@ -0,0 +1,1204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ServerTrustCertificatesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerTrustCertificateInner; +import com.azure.resourcemanager.sql.generated.models.ServerTrustCertificatesListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ServerTrustCertificatesClient. */ +public final class ServerTrustCertificatesClientImpl implements ServerTrustCertificatesClient { + /** The proxy service used to perform REST calls. */ + private final ServerTrustCertificatesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ServerTrustCertificatesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServerTrustCertificatesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create(ServerTrustCertificatesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientServerTrustCertificates to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + public interface ServerTrustCertificatesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/serverTrustCertificates") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInstance( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/serverTrustCertificates/{certificateName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("certificateName") String certificateName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/serverTrustCertificates/{certificateName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("certificateName") String certificateName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ServerTrustCertificateInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/serverTrustCertificates/{certificateName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("certificateName") String certificateName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInstanceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a list of server trust certificates that were uploaded from box to the given Sql 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server trust certificates that were uploaded from box to the given Sql Managed Instance along + * with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of server trust certificates that were uploaded from box to the given Sql 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server trust certificates that were uploaded from box to the given Sql Managed Instance along + * with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of server trust certificates that were uploaded from box to the given Sql 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server trust certificates that were uploaded from box to the given Sql Managed Instance as + * paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync( + String resourceGroupName, String managedInstanceName) { + return new PagedFlux<>( + () -> listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName), + nextLink -> listByInstanceNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of server trust certificates that were uploaded from box to the given Sql 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server trust certificates that were uploaded from box to the given Sql Managed Instance as + * paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedFlux<>( + () -> listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName, context), + nextLink -> listByInstanceNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of server trust certificates that were uploaded from box to the given Sql 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server trust certificates that were uploaded from box to the given Sql Managed Instance as + * paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName) { + return new PagedIterable<>(listByInstanceAsync(resourceGroupName, managedInstanceName)); + } + + /** + * Gets a list of server trust certificates that were uploaded from box to the given Sql 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server trust certificates that were uploaded from box to the given Sql Managed Instance as + * paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedIterable<>(listByInstanceAsync(resourceGroupName, managedInstanceName, context)); + } + + /** + * Gets a server trust certificate that was uploaded from box to Sql 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 certificateName Name of of the certificate to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust certificate that was uploaded from box to Sql Managed Instance along with {@link Response} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, String certificateName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (certificateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter certificateName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + certificateName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a server trust certificate that was uploaded from box to Sql 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 certificateName Name of of the certificate to get. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust certificate that was uploaded from box to Sql Managed Instance along with {@link Response} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, String certificateName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (certificateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter certificateName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + certificateName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a server trust certificate that was uploaded from box to Sql 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 certificateName Name of of the certificate to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust certificate that was uploaded from box to Sql Managed Instance on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String managedInstanceName, String certificateName) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, certificateName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a server trust certificate that was uploaded from box to Sql 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 certificateName Name of of the certificate to get. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust certificate that was uploaded from box to Sql Managed Instance along with {@link + * Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, String certificateName, Context context) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, certificateName, context).block(); + } + + /** + * Gets a server trust certificate that was uploaded from box to Sql 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 certificateName Name of of the certificate to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust certificate that was uploaded from box to Sql Managed Instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerTrustCertificateInner get( + String resourceGroupName, String managedInstanceName, String certificateName) { + return getWithResponse(resourceGroupName, managedInstanceName, certificateName, Context.NONE).getValue(); + } + + /** + * Uploads a server trust certificate from box to Sql 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 certificateName Name of of the certificate to upload. + * @param parameters The server trust certificate info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return server trust certificate imported from box to enable connection between box and Sql Managed Instance + * along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String certificateName, + ServerTrustCertificateInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (certificateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter certificateName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + certificateName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Uploads a server trust certificate from box to Sql 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 certificateName Name of of the certificate to upload. + * @param parameters The server trust certificate info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return server trust certificate imported from box to enable connection between box and Sql Managed Instance + * along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String managedInstanceName, + String certificateName, + ServerTrustCertificateInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (certificateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter certificateName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + certificateName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Uploads a server trust certificate from box to Sql 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 certificateName Name of of the certificate to upload. + * @param parameters The server trust certificate info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of server trust certificate imported from box to enable connection + * between box and Sql Managed Instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ServerTrustCertificateInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String certificateName, + ServerTrustCertificateInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, managedInstanceName, certificateName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerTrustCertificateInner.class, + ServerTrustCertificateInner.class, + this.client.getContext()); + } + + /** + * Uploads a server trust certificate from box to Sql 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 certificateName Name of of the certificate to upload. + * @param parameters The server trust certificate info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of server trust certificate imported from box to enable connection + * between box and Sql Managed Instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ServerTrustCertificateInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String certificateName, + ServerTrustCertificateInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, managedInstanceName, certificateName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerTrustCertificateInner.class, + ServerTrustCertificateInner.class, + context); + } + + /** + * Uploads a server trust certificate from box to Sql 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 certificateName Name of of the certificate to upload. + * @param parameters The server trust certificate info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of server trust certificate imported from box to enable connection + * between box and Sql Managed Instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServerTrustCertificateInner> beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String certificateName, + ServerTrustCertificateInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, certificateName, parameters) + .getSyncPoller(); + } + + /** + * Uploads a server trust certificate from box to Sql 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 certificateName Name of of the certificate to upload. + * @param parameters The server trust certificate info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of server trust certificate imported from box to enable connection + * between box and Sql Managed Instance. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServerTrustCertificateInner> beginCreateOrUpdate( + String resourceGroupName, + String managedInstanceName, + String certificateName, + ServerTrustCertificateInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, certificateName, parameters, context) + .getSyncPoller(); + } + + /** + * Uploads a server trust certificate from box to Sql 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 certificateName Name of of the certificate to upload. + * @param parameters The server trust certificate info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return server trust certificate imported from box to enable connection between box and Sql Managed Instance on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String certificateName, + ServerTrustCertificateInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, certificateName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Uploads a server trust certificate from box to Sql 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 certificateName Name of of the certificate to upload. + * @param parameters The server trust certificate info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return server trust certificate imported from box to enable connection between box and Sql Managed Instance on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String managedInstanceName, + String certificateName, + ServerTrustCertificateInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, managedInstanceName, certificateName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Uploads a server trust certificate from box to Sql 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 certificateName Name of of the certificate to upload. + * @param parameters The server trust certificate info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return server trust certificate imported from box to enable connection between box and Sql Managed Instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerTrustCertificateInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String certificateName, + ServerTrustCertificateInner parameters) { + return createOrUpdateAsync(resourceGroupName, managedInstanceName, certificateName, parameters).block(); + } + + /** + * Uploads a server trust certificate from box to Sql 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 certificateName Name of of the certificate to upload. + * @param parameters The server trust certificate info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return server trust certificate imported from box to enable connection between box and Sql Managed Instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerTrustCertificateInner createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String certificateName, + ServerTrustCertificateInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, managedInstanceName, certificateName, parameters, context) + .block(); + } + + /** + * Deletes a server trust certificate that was uploaded from box to Sql 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 certificateName Name of of the certificate to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String managedInstanceName, String certificateName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (certificateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter certificateName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + certificateName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a server trust certificate that was uploaded from box to Sql 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 certificateName Name of of the certificate to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String managedInstanceName, String certificateName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (certificateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter certificateName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-11-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + certificateName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes a server trust certificate that was uploaded from box to Sql 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 certificateName Name of of the certificate to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String managedInstanceName, String certificateName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, managedInstanceName, certificateName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes a server trust certificate that was uploaded from box to Sql 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 certificateName Name of of the certificate to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String managedInstanceName, String certificateName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, managedInstanceName, certificateName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a server trust certificate that was uploaded from box to Sql 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 certificateName Name of of the certificate to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, String certificateName) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, certificateName).getSyncPoller(); + } + + /** + * Deletes a server trust certificate that was uploaded from box to Sql 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 certificateName Name of of the certificate to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String managedInstanceName, String certificateName, Context context) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, certificateName, context).getSyncPoller(); + } + + /** + * Deletes a server trust certificate that was uploaded from box to Sql 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 certificateName Name of of the certificate to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String managedInstanceName, String certificateName) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, certificateName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a server trust certificate that was uploaded from box to Sql 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 certificateName Name of of the certificate to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String managedInstanceName, String certificateName, Context context) { + return beginDeleteAsync(resourceGroupName, managedInstanceName, certificateName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a server trust certificate that was uploaded from box to Sql 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 certificateName Name of of the certificate to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String managedInstanceName, String certificateName) { + deleteAsync(resourceGroupName, managedInstanceName, certificateName).block(); + } + + /** + * Deletes a server trust certificate that was uploaded from box to Sql 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 certificateName Name of of the certificate to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String managedInstanceName, String certificateName, Context context) { + deleteAsync(resourceGroupName, managedInstanceName, certificateName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server trust certificates in instance along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByInstanceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server trust certificates in instance along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInstanceNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerTrustCertificatesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerTrustCertificatesImpl.java new file mode 100644 index 0000000000000..7fc331aa6ec3b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerTrustCertificatesImpl.java @@ -0,0 +1,211 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ServerTrustCertificatesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerTrustCertificateInner; +import com.azure.resourcemanager.sql.generated.models.ServerTrustCertificate; +import com.azure.resourcemanager.sql.generated.models.ServerTrustCertificates; + +public final class ServerTrustCertificatesImpl implements ServerTrustCertificates { + private static final ClientLogger LOGGER = new ClientLogger(ServerTrustCertificatesImpl.class); + + private final ServerTrustCertificatesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ServerTrustCertificatesImpl( + ServerTrustCertificatesClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByInstance(String resourceGroupName, String managedInstanceName) { + PagedIterable inner = + this.serviceClient().listByInstance(resourceGroupName, managedInstanceName); + return Utils.mapPage(inner, inner1 -> new ServerTrustCertificateImpl(inner1, this.manager())); + } + + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context) { + PagedIterable inner = + this.serviceClient().listByInstance(resourceGroupName, managedInstanceName, context); + return Utils.mapPage(inner, inner1 -> new ServerTrustCertificateImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, String certificateName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, managedInstanceName, certificateName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServerTrustCertificateImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ServerTrustCertificate get(String resourceGroupName, String managedInstanceName, String certificateName) { + ServerTrustCertificateInner inner = + this.serviceClient().get(resourceGroupName, managedInstanceName, certificateName); + if (inner != null) { + return new ServerTrustCertificateImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String managedInstanceName, String certificateName) { + this.serviceClient().delete(resourceGroupName, managedInstanceName, certificateName); + } + + public void delete(String resourceGroupName, String managedInstanceName, String certificateName, Context context) { + this.serviceClient().delete(resourceGroupName, managedInstanceName, certificateName, context); + } + + public ServerTrustCertificate getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String certificateName = Utils.getValueFromIdByName(id, "serverTrustCertificates"); + if (certificateName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'serverTrustCertificates'.", + id))); + } + return this.getWithResponse(resourceGroupName, managedInstanceName, certificateName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String certificateName = Utils.getValueFromIdByName(id, "serverTrustCertificates"); + if (certificateName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'serverTrustCertificates'.", + id))); + } + return this.getWithResponse(resourceGroupName, managedInstanceName, certificateName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String certificateName = Utils.getValueFromIdByName(id, "serverTrustCertificates"); + if (certificateName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'serverTrustCertificates'.", + id))); + } + this.delete(resourceGroupName, managedInstanceName, certificateName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String managedInstanceName = Utils.getValueFromIdByName(id, "managedInstances"); + if (managedInstanceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'managedInstances'.", id))); + } + String certificateName = Utils.getValueFromIdByName(id, "serverTrustCertificates"); + if (certificateName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'serverTrustCertificates'.", + id))); + } + this.delete(resourceGroupName, managedInstanceName, certificateName, context); + } + + private ServerTrustCertificatesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ServerTrustCertificateImpl define(String name) { + return new ServerTrustCertificateImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerTrustGroupImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerTrustGroupImpl.java new file mode 100644 index 0000000000000..31850fc9196d0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerTrustGroupImpl.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerTrustGroupInner; +import com.azure.resourcemanager.sql.generated.models.ServerInfo; +import com.azure.resourcemanager.sql.generated.models.ServerTrustGroup; +import com.azure.resourcemanager.sql.generated.models.ServerTrustGroupPropertiesTrustScopesItem; +import java.util.Collections; +import java.util.List; + +public final class ServerTrustGroupImpl + implements ServerTrustGroup, ServerTrustGroup.Definition, ServerTrustGroup.Update { + private ServerTrustGroupInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public List groupMembers() { + List inner = this.innerModel().groupMembers(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List trustScopes() { + List inner = this.innerModel().trustScopes(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ServerTrustGroupInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String locationName; + + private String serverTrustGroupName; + + public ServerTrustGroupImpl withExistingLocation(String resourceGroupName, String locationName) { + this.resourceGroupName = resourceGroupName; + this.locationName = locationName; + return this; + } + + public ServerTrustGroup create() { + this.innerObject = + serviceManager + .serviceClient() + .getServerTrustGroups() + .createOrUpdate(resourceGroupName, locationName, serverTrustGroupName, this.innerModel(), Context.NONE); + return this; + } + + public ServerTrustGroup create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerTrustGroups() + .createOrUpdate(resourceGroupName, locationName, serverTrustGroupName, this.innerModel(), context); + return this; + } + + ServerTrustGroupImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ServerTrustGroupInner(); + this.serviceManager = serviceManager; + this.serverTrustGroupName = name; + } + + public ServerTrustGroupImpl update() { + return this; + } + + public ServerTrustGroup apply() { + this.innerObject = + serviceManager + .serviceClient() + .getServerTrustGroups() + .createOrUpdate(resourceGroupName, locationName, serverTrustGroupName, this.innerModel(), Context.NONE); + return this; + } + + public ServerTrustGroup apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerTrustGroups() + .createOrUpdate(resourceGroupName, locationName, serverTrustGroupName, this.innerModel(), context); + return this; + } + + ServerTrustGroupImpl( + ServerTrustGroupInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.locationName = Utils.getValueFromIdByName(innerObject.id(), "locations"); + this.serverTrustGroupName = Utils.getValueFromIdByName(innerObject.id(), "serverTrustGroups"); + } + + public ServerTrustGroup refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getServerTrustGroups() + .getWithResponse(resourceGroupName, locationName, serverTrustGroupName, Context.NONE) + .getValue(); + return this; + } + + public ServerTrustGroup refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerTrustGroups() + .getWithResponse(resourceGroupName, locationName, serverTrustGroupName, context) + .getValue(); + return this; + } + + public ServerTrustGroupImpl withGroupMembers(List groupMembers) { + this.innerModel().withGroupMembers(groupMembers); + return this; + } + + public ServerTrustGroupImpl withTrustScopes(List trustScopes) { + this.innerModel().withTrustScopes(trustScopes); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerTrustGroupsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerTrustGroupsClientImpl.java new file mode 100644 index 0000000000000..48efd95529c7b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerTrustGroupsClientImpl.java @@ -0,0 +1,1442 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ServerTrustGroupsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerTrustGroupInner; +import com.azure.resourcemanager.sql.generated.models.ServerTrustGroupListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ServerTrustGroupsClient. */ +public final class ServerTrustGroupsClientImpl implements ServerTrustGroupsClient { + /** The proxy service used to perform REST calls. */ + private final ServerTrustGroupsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ServerTrustGroupsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServerTrustGroupsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(ServerTrustGroupsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientServerTrustGroups to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + public interface ServerTrustGroupsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations" + + "/{locationName}/serverTrustGroups/{serverTrustGroupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("locationName") String locationName, + @PathParam("serverTrustGroupName") String serverTrustGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations" + + "/{locationName}/serverTrustGroups/{serverTrustGroupName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("locationName") String locationName, + @PathParam("serverTrustGroupName") String serverTrustGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ServerTrustGroupInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations" + + "/{locationName}/serverTrustGroups/{serverTrustGroupName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("locationName") String locationName, + @PathParam("serverTrustGroupName") String serverTrustGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations" + + "/{locationName}/serverTrustGroups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByLocation( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("locationName") String locationName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/serverTrustGroups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInstance( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByLocationNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInstanceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a server trust 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 serverTrustGroupName The name of the server trust group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String locationName, String serverTrustGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (serverTrustGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serverTrustGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + locationName, + serverTrustGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a server trust 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 serverTrustGroupName The name of the server trust group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String locationName, String serverTrustGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (serverTrustGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serverTrustGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + locationName, + serverTrustGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a server trust 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 serverTrustGroupName The name of the server trust group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String locationName, String serverTrustGroupName) { + return getWithResponseAsync(resourceGroupName, locationName, serverTrustGroupName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a server trust 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 serverTrustGroupName The name of the server trust group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String locationName, String serverTrustGroupName, Context context) { + return getWithResponseAsync(resourceGroupName, locationName, serverTrustGroupName, context).block(); + } + + /** + * Gets a server trust 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 serverTrustGroupName The name of the server trust group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerTrustGroupInner get(String resourceGroupName, String locationName, String serverTrustGroupName) { + return getWithResponse(resourceGroupName, locationName, serverTrustGroupName, Context.NONE).getValue(); + } + + /** + * Creates or updates a server trust 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 serverTrustGroupName The name of the server trust group. + * @param parameters The server trust group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String locationName, String serverTrustGroupName, ServerTrustGroupInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (serverTrustGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serverTrustGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + locationName, + serverTrustGroupName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a server trust 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 serverTrustGroupName The name of the server trust group. + * @param parameters The server trust group parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String locationName, + String serverTrustGroupName, + ServerTrustGroupInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (serverTrustGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serverTrustGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + locationName, + serverTrustGroupName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates a server trust 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 serverTrustGroupName The name of the server trust group. + * @param parameters The server trust group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a server trust group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ServerTrustGroupInner> beginCreateOrUpdateAsync( + String resourceGroupName, String locationName, String serverTrustGroupName, ServerTrustGroupInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, locationName, serverTrustGroupName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerTrustGroupInner.class, + ServerTrustGroupInner.class, + this.client.getContext()); + } + + /** + * Creates or updates a server trust 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 serverTrustGroupName The name of the server trust group. + * @param parameters The server trust group parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a server trust group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ServerTrustGroupInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String locationName, + String serverTrustGroupName, + ServerTrustGroupInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, locationName, serverTrustGroupName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ServerTrustGroupInner.class, ServerTrustGroupInner.class, context); + } + + /** + * Creates or updates a server trust 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 serverTrustGroupName The name of the server trust group. + * @param parameters The server trust group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a server trust group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServerTrustGroupInner> beginCreateOrUpdate( + String resourceGroupName, String locationName, String serverTrustGroupName, ServerTrustGroupInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, locationName, serverTrustGroupName, parameters) + .getSyncPoller(); + } + + /** + * Creates or updates a server trust 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 serverTrustGroupName The name of the server trust group. + * @param parameters The server trust group parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a server trust group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServerTrustGroupInner> beginCreateOrUpdate( + String resourceGroupName, + String locationName, + String serverTrustGroupName, + ServerTrustGroupInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, locationName, serverTrustGroupName, parameters, context) + .getSyncPoller(); + } + + /** + * Creates or updates a server trust 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 serverTrustGroupName The name of the server trust group. + * @param parameters The server trust group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String locationName, String serverTrustGroupName, ServerTrustGroupInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, locationName, serverTrustGroupName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a server trust 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 serverTrustGroupName The name of the server trust group. + * @param parameters The server trust group parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String locationName, + String serverTrustGroupName, + ServerTrustGroupInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, locationName, serverTrustGroupName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a server trust 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 serverTrustGroupName The name of the server trust group. + * @param parameters The server trust group parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerTrustGroupInner createOrUpdate( + String resourceGroupName, String locationName, String serverTrustGroupName, ServerTrustGroupInner parameters) { + return createOrUpdateAsync(resourceGroupName, locationName, serverTrustGroupName, parameters).block(); + } + + /** + * Creates or updates a server trust 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 serverTrustGroupName The name of the server trust group. + * @param parameters The server trust group parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerTrustGroupInner createOrUpdate( + String resourceGroupName, + String locationName, + String serverTrustGroupName, + ServerTrustGroupInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, locationName, serverTrustGroupName, parameters, context).block(); + } + + /** + * Deletes a server trust 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 serverTrustGroupName The name of the server trust group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String locationName, String serverTrustGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (serverTrustGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serverTrustGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + locationName, + serverTrustGroupName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a server trust 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 serverTrustGroupName The name of the server trust group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String locationName, String serverTrustGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (serverTrustGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serverTrustGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + locationName, + serverTrustGroupName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes a server trust 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 serverTrustGroupName The name of the server trust group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String locationName, String serverTrustGroupName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, locationName, serverTrustGroupName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes a server trust 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 serverTrustGroupName The name of the server trust group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String locationName, String serverTrustGroupName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, locationName, serverTrustGroupName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a server trust 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 serverTrustGroupName The name of the server trust group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String locationName, String serverTrustGroupName) { + return beginDeleteAsync(resourceGroupName, locationName, serverTrustGroupName).getSyncPoller(); + } + + /** + * Deletes a server trust 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 serverTrustGroupName The name of the server trust group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String locationName, String serverTrustGroupName, Context context) { + return beginDeleteAsync(resourceGroupName, locationName, serverTrustGroupName, context).getSyncPoller(); + } + + /** + * Deletes a server trust 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 serverTrustGroupName The name of the server trust group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String locationName, String serverTrustGroupName) { + return beginDeleteAsync(resourceGroupName, locationName, serverTrustGroupName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a server trust 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 serverTrustGroupName The name of the server trust group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String locationName, String serverTrustGroupName, Context context) { + return beginDeleteAsync(resourceGroupName, locationName, serverTrustGroupName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a server trust 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 serverTrustGroupName The name of the server trust group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String locationName, String serverTrustGroupName) { + deleteAsync(resourceGroupName, locationName, serverTrustGroupName).block(); + } + + /** + * Deletes a server trust 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 serverTrustGroupName The name of the server trust group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String locationName, String serverTrustGroupName, Context context) { + deleteAsync(resourceGroupName, locationName, serverTrustGroupName, context).block(); + } + + /** + * Lists a server trust 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server trust groups along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationSinglePageAsync( + String resourceGroupName, String locationName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByLocation( + this.client.getEndpoint(), + resourceGroupName, + locationName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists a server trust 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server trust groups along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationSinglePageAsync( + String resourceGroupName, String locationName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByLocation( + this.client.getEndpoint(), + resourceGroupName, + locationName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists a server trust 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server trust groups as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByLocationAsync(String resourceGroupName, String locationName) { + return new PagedFlux<>( + () -> listByLocationSinglePageAsync(resourceGroupName, locationName), + nextLink -> listByLocationNextSinglePageAsync(nextLink)); + } + + /** + * Lists a server trust 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server trust groups as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByLocationAsync( + String resourceGroupName, String locationName, Context context) { + return new PagedFlux<>( + () -> listByLocationSinglePageAsync(resourceGroupName, locationName, context), + nextLink -> listByLocationNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists a server trust 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server trust groups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByLocation(String resourceGroupName, String locationName) { + return new PagedIterable<>(listByLocationAsync(resourceGroupName, locationName)); + } + + /** + * Lists a server trust 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server trust groups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByLocation( + String resourceGroupName, String locationName, Context context) { + return new PagedIterable<>(listByLocationAsync(resourceGroupName, locationName, context)); + } + + /** + * Gets a server trust groups by instance 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust groups by instance name along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a server trust groups by instance 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust groups by instance name along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceSinglePageAsync( + String resourceGroupName, String managedInstanceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInstance( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a server trust groups by instance 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust groups by instance name as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync(String resourceGroupName, String managedInstanceName) { + return new PagedFlux<>( + () -> listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName), + nextLink -> listByInstanceNextSinglePageAsync(nextLink)); + } + + /** + * Gets a server trust groups by instance 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust groups by instance name as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstanceAsync( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedFlux<>( + () -> listByInstanceSinglePageAsync(resourceGroupName, managedInstanceName, context), + nextLink -> listByInstanceNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a server trust groups by instance 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust groups by instance name as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstance(String resourceGroupName, String managedInstanceName) { + return new PagedIterable<>(listByInstanceAsync(resourceGroupName, managedInstanceName)); + } + + /** + * Gets a server trust groups by instance 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust groups by instance name as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context) { + return new PagedIterable<>(listByInstanceAsync(resourceGroupName, managedInstanceName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server trust groups along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByLocationNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server trust groups along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByLocationNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server trust groups along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByInstanceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server trust groups along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstanceNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInstanceNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerTrustGroupsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerTrustGroupsImpl.java new file mode 100644 index 0000000000000..3a444c22fffad --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerTrustGroupsImpl.java @@ -0,0 +1,211 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ServerTrustGroupsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerTrustGroupInner; +import com.azure.resourcemanager.sql.generated.models.ServerTrustGroup; +import com.azure.resourcemanager.sql.generated.models.ServerTrustGroups; + +public final class ServerTrustGroupsImpl implements ServerTrustGroups { + private static final ClientLogger LOGGER = new ClientLogger(ServerTrustGroupsImpl.class); + + private final ServerTrustGroupsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ServerTrustGroupsImpl( + ServerTrustGroupsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String resourceGroupName, String locationName, String serverTrustGroupName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, locationName, serverTrustGroupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServerTrustGroupImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ServerTrustGroup get(String resourceGroupName, String locationName, String serverTrustGroupName) { + ServerTrustGroupInner inner = this.serviceClient().get(resourceGroupName, locationName, serverTrustGroupName); + if (inner != null) { + return new ServerTrustGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String locationName, String serverTrustGroupName) { + this.serviceClient().delete(resourceGroupName, locationName, serverTrustGroupName); + } + + public void delete(String resourceGroupName, String locationName, String serverTrustGroupName, Context context) { + this.serviceClient().delete(resourceGroupName, locationName, serverTrustGroupName, context); + } + + public PagedIterable listByLocation(String resourceGroupName, String locationName) { + PagedIterable inner = + this.serviceClient().listByLocation(resourceGroupName, locationName); + return Utils.mapPage(inner, inner1 -> new ServerTrustGroupImpl(inner1, this.manager())); + } + + public PagedIterable listByLocation( + String resourceGroupName, String locationName, Context context) { + PagedIterable inner = + this.serviceClient().listByLocation(resourceGroupName, locationName, context); + return Utils.mapPage(inner, inner1 -> new ServerTrustGroupImpl(inner1, this.manager())); + } + + public PagedIterable listByInstance(String resourceGroupName, String managedInstanceName) { + PagedIterable inner = + this.serviceClient().listByInstance(resourceGroupName, managedInstanceName); + return Utils.mapPage(inner, inner1 -> new ServerTrustGroupImpl(inner1, this.manager())); + } + + public PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context) { + PagedIterable inner = + this.serviceClient().listByInstance(resourceGroupName, managedInstanceName, context); + return Utils.mapPage(inner, inner1 -> new ServerTrustGroupImpl(inner1, this.manager())); + } + + public ServerTrustGroup getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String locationName = Utils.getValueFromIdByName(id, "locations"); + if (locationName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'locations'.", id))); + } + String serverTrustGroupName = Utils.getValueFromIdByName(id, "serverTrustGroups"); + if (serverTrustGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'serverTrustGroups'.", id))); + } + return this.getWithResponse(resourceGroupName, locationName, serverTrustGroupName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String locationName = Utils.getValueFromIdByName(id, "locations"); + if (locationName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'locations'.", id))); + } + String serverTrustGroupName = Utils.getValueFromIdByName(id, "serverTrustGroups"); + if (serverTrustGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'serverTrustGroups'.", id))); + } + return this.getWithResponse(resourceGroupName, locationName, serverTrustGroupName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String locationName = Utils.getValueFromIdByName(id, "locations"); + if (locationName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'locations'.", id))); + } + String serverTrustGroupName = Utils.getValueFromIdByName(id, "serverTrustGroups"); + if (serverTrustGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'serverTrustGroups'.", id))); + } + this.delete(resourceGroupName, locationName, serverTrustGroupName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String locationName = Utils.getValueFromIdByName(id, "locations"); + if (locationName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'locations'.", id))); + } + String serverTrustGroupName = Utils.getValueFromIdByName(id, "serverTrustGroups"); + if (serverTrustGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'serverTrustGroups'.", id))); + } + this.delete(resourceGroupName, locationName, serverTrustGroupName, context); + } + + private ServerTrustGroupsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ServerTrustGroupImpl define(String name) { + return new ServerTrustGroupImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerUsageImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerUsageImpl.java new file mode 100644 index 0000000000000..7f3b07096d836 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerUsageImpl.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.ServerUsageInner; +import com.azure.resourcemanager.sql.generated.models.ServerUsage; +import java.time.OffsetDateTime; + +public final class ServerUsageImpl implements ServerUsage { + private ServerUsageInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + ServerUsageImpl(ServerUsageInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public String resourceName() { + return this.innerModel().resourceName(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public Double currentValue() { + return this.innerModel().currentValue(); + } + + public Double limit() { + return this.innerModel().limit(); + } + + public String unit() { + return this.innerModel().unit(); + } + + public OffsetDateTime nextResetTime() { + return this.innerModel().nextResetTime(); + } + + public ServerUsageInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerUsagesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerUsagesClientImpl.java new file mode 100644 index 0000000000000..b35f92c21ef63 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerUsagesClientImpl.java @@ -0,0 +1,251 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.ServerUsagesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerUsageInner; +import com.azure.resourcemanager.sql.generated.models.ServerUsageListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ServerUsagesClient. */ +public final class ServerUsagesClientImpl implements ServerUsagesClient { + /** The proxy service used to perform REST calls. */ + private final ServerUsagesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ServerUsagesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServerUsagesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(ServerUsagesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientServerUsages to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + public interface ServerUsagesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/usages") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a list server metrics request along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a list server metrics request along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a list server metrics request as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a list server metrics request as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a list server metrics request as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a list server metrics request as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerUsagesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerUsagesImpl.java new file mode 100644 index 0000000000000..adbbbd6e2edcb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerUsagesImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ServerUsagesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerUsageInner; +import com.azure.resourcemanager.sql.generated.models.ServerUsage; +import com.azure.resourcemanager.sql.generated.models.ServerUsages; + +public final class ServerUsagesImpl implements ServerUsages { + private static final ClientLogger LOGGER = new ClientLogger(ServerUsagesImpl.class); + + private final ServerUsagesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ServerUsagesImpl( + ServerUsagesClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new ServerUsageImpl(inner1, this.manager())); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new ServerUsageImpl(inner1, this.manager())); + } + + private ServerUsagesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerVulnerabilityAssessmentImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerVulnerabilityAssessmentImpl.java new file mode 100644 index 0000000000000..ea1a5e40abaa2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerVulnerabilityAssessmentImpl.java @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerVulnerabilityAssessmentInner; +import com.azure.resourcemanager.sql.generated.models.ServerVulnerabilityAssessment; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentRecurringScansProperties; + +public final class ServerVulnerabilityAssessmentImpl + implements ServerVulnerabilityAssessment, + ServerVulnerabilityAssessment.Definition, + ServerVulnerabilityAssessment.Update { + private ServerVulnerabilityAssessmentInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String storageContainerPath() { + return this.innerModel().storageContainerPath(); + } + + public String storageContainerSasKey() { + return this.innerModel().storageContainerSasKey(); + } + + public String storageAccountAccessKey() { + return this.innerModel().storageAccountAccessKey(); + } + + public VulnerabilityAssessmentRecurringScansProperties recurringScans() { + return this.innerModel().recurringScans(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ServerVulnerabilityAssessmentInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private VulnerabilityAssessmentName vulnerabilityAssessmentName; + + public ServerVulnerabilityAssessmentImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public ServerVulnerabilityAssessment create() { + this.innerObject = + serviceManager + .serviceClient() + .getServerVulnerabilityAssessments() + .createOrUpdateWithResponse( + resourceGroupName, serverName, vulnerabilityAssessmentName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public ServerVulnerabilityAssessment create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerVulnerabilityAssessments() + .createOrUpdateWithResponse( + resourceGroupName, serverName, vulnerabilityAssessmentName, this.innerModel(), context) + .getValue(); + return this; + } + + ServerVulnerabilityAssessmentImpl( + VulnerabilityAssessmentName name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new ServerVulnerabilityAssessmentInner(); + this.serviceManager = serviceManager; + this.vulnerabilityAssessmentName = name; + } + + public ServerVulnerabilityAssessmentImpl update() { + return this; + } + + public ServerVulnerabilityAssessment apply() { + this.innerObject = + serviceManager + .serviceClient() + .getServerVulnerabilityAssessments() + .createOrUpdateWithResponse( + resourceGroupName, serverName, vulnerabilityAssessmentName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public ServerVulnerabilityAssessment apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerVulnerabilityAssessments() + .createOrUpdateWithResponse( + resourceGroupName, serverName, vulnerabilityAssessmentName, this.innerModel(), context) + .getValue(); + return this; + } + + ServerVulnerabilityAssessmentImpl( + ServerVulnerabilityAssessmentInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.vulnerabilityAssessmentName = + VulnerabilityAssessmentName + .fromString(Utils.getValueFromIdByName(innerObject.id(), "vulnerabilityAssessments")); + } + + public ServerVulnerabilityAssessment refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getServerVulnerabilityAssessments() + .getWithResponse(resourceGroupName, serverName, vulnerabilityAssessmentName, Context.NONE) + .getValue(); + return this; + } + + public ServerVulnerabilityAssessment refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerVulnerabilityAssessments() + .getWithResponse(resourceGroupName, serverName, vulnerabilityAssessmentName, context) + .getValue(); + return this; + } + + public ServerVulnerabilityAssessmentImpl withStorageContainerPath(String storageContainerPath) { + this.innerModel().withStorageContainerPath(storageContainerPath); + return this; + } + + public ServerVulnerabilityAssessmentImpl withStorageContainerSasKey(String storageContainerSasKey) { + this.innerModel().withStorageContainerSasKey(storageContainerSasKey); + return this; + } + + public ServerVulnerabilityAssessmentImpl withStorageAccountAccessKey(String storageAccountAccessKey) { + this.innerModel().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + public ServerVulnerabilityAssessmentImpl withRecurringScans( + VulnerabilityAssessmentRecurringScansProperties recurringScans) { + this.innerModel().withRecurringScans(recurringScans); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerVulnerabilityAssessmentsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerVulnerabilityAssessmentsClientImpl.java new file mode 100644 index 0000000000000..361f35677da78 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerVulnerabilityAssessmentsClientImpl.java @@ -0,0 +1,974 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.ServerVulnerabilityAssessmentsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerVulnerabilityAssessmentInner; +import com.azure.resourcemanager.sql.generated.models.ServerVulnerabilityAssessmentListResult; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ServerVulnerabilityAssessmentsClient. */ +public final class ServerVulnerabilityAssessmentsClientImpl implements ServerVulnerabilityAssessmentsClient { + /** The proxy service used to perform REST calls. */ + private final ServerVulnerabilityAssessmentsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ServerVulnerabilityAssessmentsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServerVulnerabilityAssessmentsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ServerVulnerabilityAssessmentsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientServerVulnerabilityAssessments to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + public interface ServerVulnerabilityAssessmentsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ServerVulnerabilityAssessmentInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/vulnerabilityAssessments") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the server's vulnerability assessment along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, VulnerabilityAssessmentName vulnerabilityAssessmentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the server's vulnerability assessment along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the server's vulnerability assessment on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, VulnerabilityAssessmentName vulnerabilityAssessmentName) { + return getWithResponseAsync(resourceGroupName, serverName, vulnerabilityAssessmentName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the server's vulnerability assessment along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + return getWithResponseAsync(resourceGroupName, serverName, vulnerabilityAssessmentName, context).block(); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the server's vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerVulnerabilityAssessmentInner get( + String resourceGroupName, String serverName, VulnerabilityAssessmentName vulnerabilityAssessmentName) { + return getWithResponse(resourceGroupName, serverName, vulnerabilityAssessmentName, Context.NONE).getValue(); + } + + /** + * Creates or updates the server's vulnerability assessment. Learn more about setting SQL vulnerability assessment + * with managed identity - + * https://docs.microsoft.com/azure/azure-sql/database/sql-database-vulnerability-assessment-storage. + * + * @param resourceGroupName The name of the resource group that 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server vulnerability assessment along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + ServerVulnerabilityAssessmentInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates the server's vulnerability assessment. Learn more about setting SQL vulnerability assessment + * with managed identity - + * https://docs.microsoft.com/azure/azure-sql/database/sql-database-vulnerability-assessment-storage. + * + * @param resourceGroupName The name of the resource group that 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server vulnerability assessment along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + ServerVulnerabilityAssessmentInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates the server's vulnerability assessment. Learn more about setting SQL vulnerability assessment + * with managed identity - + * https://docs.microsoft.com/azure/azure-sql/database/sql-database-vulnerability-assessment-storage. + * + * @param resourceGroupName The name of the resource group that 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server vulnerability assessment on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + ServerVulnerabilityAssessmentInner parameters) { + return createOrUpdateWithResponseAsync(resourceGroupName, serverName, vulnerabilityAssessmentName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or updates the server's vulnerability assessment. Learn more about setting SQL vulnerability assessment + * with managed identity - + * https://docs.microsoft.com/azure/azure-sql/database/sql-database-vulnerability-assessment-storage. + * + * @param resourceGroupName The name of the resource group that 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server vulnerability assessment along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + ServerVulnerabilityAssessmentInner parameters, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, serverName, vulnerabilityAssessmentName, parameters, context) + .block(); + } + + /** + * Creates or updates the server's vulnerability assessment. Learn more about setting SQL vulnerability assessment + * with managed identity - + * https://docs.microsoft.com/azure/azure-sql/database/sql-database-vulnerability-assessment-storage. + * + * @param resourceGroupName The name of the resource group that 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server vulnerability assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerVulnerabilityAssessmentInner createOrUpdate( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + ServerVulnerabilityAssessmentInner parameters) { + return createOrUpdateWithResponse( + resourceGroupName, serverName, vulnerabilityAssessmentName, parameters, Context.NONE) + .getValue(); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String serverName, VulnerabilityAssessmentName vulnerabilityAssessmentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String serverName, VulnerabilityAssessmentName vulnerabilityAssessmentName) { + return deleteWithResponseAsync(resourceGroupName, serverName, vulnerabilityAssessmentName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + return deleteWithResponseAsync(resourceGroupName, serverName, vulnerabilityAssessmentName, context).block(); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, String serverName, VulnerabilityAssessmentName vulnerabilityAssessmentName) { + deleteWithResponse(resourceGroupName, serverName, vulnerabilityAssessmentName, Context.NONE); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the server's vulnerability assessments along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the server's vulnerability assessments along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the server's vulnerability assessments as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the server's vulnerability assessments as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the server's vulnerability assessments as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the server's vulnerability assessments as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the server's vulnerability assessments along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByServerNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the server's vulnerability assessments along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServerNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerVulnerabilityAssessmentsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerVulnerabilityAssessmentsImpl.java new file mode 100644 index 0000000000000..ff06bb8d050e8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServerVulnerabilityAssessmentsImpl.java @@ -0,0 +1,226 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ServerVulnerabilityAssessmentsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerVulnerabilityAssessmentInner; +import com.azure.resourcemanager.sql.generated.models.ServerVulnerabilityAssessment; +import com.azure.resourcemanager.sql.generated.models.ServerVulnerabilityAssessments; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +public final class ServerVulnerabilityAssessmentsImpl implements ServerVulnerabilityAssessments { + private static final ClientLogger LOGGER = new ClientLogger(ServerVulnerabilityAssessmentsImpl.class); + + private final ServerVulnerabilityAssessmentsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ServerVulnerabilityAssessmentsImpl( + ServerVulnerabilityAssessmentsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, vulnerabilityAssessmentName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServerVulnerabilityAssessmentImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ServerVulnerabilityAssessment get( + String resourceGroupName, String serverName, VulnerabilityAssessmentName vulnerabilityAssessmentName) { + ServerVulnerabilityAssessmentInner inner = + this.serviceClient().get(resourceGroupName, serverName, vulnerabilityAssessmentName); + if (inner != null) { + return new ServerVulnerabilityAssessmentImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + return this + .serviceClient() + .deleteWithResponse(resourceGroupName, serverName, vulnerabilityAssessmentName, context); + } + + public void delete( + String resourceGroupName, String serverName, VulnerabilityAssessmentName vulnerabilityAssessmentName) { + this.serviceClient().delete(resourceGroupName, serverName, vulnerabilityAssessmentName); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new ServerVulnerabilityAssessmentImpl(inner1, this.manager())); + } + + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new ServerVulnerabilityAssessmentImpl(inner1, this.manager())); + } + + public ServerVulnerabilityAssessment getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String vulnerabilityAssessmentNameLocal = Utils.getValueFromIdByName(id, "vulnerabilityAssessments"); + if (vulnerabilityAssessmentNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'vulnerabilityAssessments'.", + id))); + } + VulnerabilityAssessmentName vulnerabilityAssessmentName = + VulnerabilityAssessmentName.fromString(vulnerabilityAssessmentNameLocal); + return this + .getWithResponse(resourceGroupName, serverName, vulnerabilityAssessmentName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String vulnerabilityAssessmentNameLocal = Utils.getValueFromIdByName(id, "vulnerabilityAssessments"); + if (vulnerabilityAssessmentNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'vulnerabilityAssessments'.", + id))); + } + VulnerabilityAssessmentName vulnerabilityAssessmentName = + VulnerabilityAssessmentName.fromString(vulnerabilityAssessmentNameLocal); + return this.getWithResponse(resourceGroupName, serverName, vulnerabilityAssessmentName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String vulnerabilityAssessmentNameLocal = Utils.getValueFromIdByName(id, "vulnerabilityAssessments"); + if (vulnerabilityAssessmentNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'vulnerabilityAssessments'.", + id))); + } + VulnerabilityAssessmentName vulnerabilityAssessmentName = + VulnerabilityAssessmentName.fromString(vulnerabilityAssessmentNameLocal); + this.deleteWithResponse(resourceGroupName, serverName, vulnerabilityAssessmentName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String vulnerabilityAssessmentNameLocal = Utils.getValueFromIdByName(id, "vulnerabilityAssessments"); + if (vulnerabilityAssessmentNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'vulnerabilityAssessments'.", + id))); + } + VulnerabilityAssessmentName vulnerabilityAssessmentName = + VulnerabilityAssessmentName.fromString(vulnerabilityAssessmentNameLocal); + return this.deleteWithResponse(resourceGroupName, serverName, vulnerabilityAssessmentName, context); + } + + private ServerVulnerabilityAssessmentsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ServerVulnerabilityAssessmentImpl define(VulnerabilityAssessmentName name) { + return new ServerVulnerabilityAssessmentImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServersClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServersClientImpl.java new file mode 100644 index 0000000000000..437606be4c651 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServersClientImpl.java @@ -0,0 +1,2068 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.ServersClient; +import com.azure.resourcemanager.sql.generated.fluent.models.CheckNameAvailabilityResponseInner; +import com.azure.resourcemanager.sql.generated.fluent.models.ImportExportOperationResultInner; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerInner; +import com.azure.resourcemanager.sql.generated.models.CheckNameAvailabilityRequest; +import com.azure.resourcemanager.sql.generated.models.ImportNewDatabaseDefinition; +import com.azure.resourcemanager.sql.generated.models.ServerListResult; +import com.azure.resourcemanager.sql.generated.models.ServerUpdate; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ServersClient. */ +public final class ServersClientImpl implements ServersClient { + /** The proxy service used to perform REST calls. */ + private final ServersService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ServersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServersClientImpl(SqlManagementClientImpl client) { + this.service = RestProxy.create(ServersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientServers to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + public interface ServersService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("$expand") String expand, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @QueryParam("$expand") String expand, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ServerInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ServerUpdate parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/servers") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("$expand") String expand, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/import") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> importDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ImportNewDatabaseDefinition parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/checkNameAvailability") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> checkNameAvailability( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") CheckNameAvailabilityRequest parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 expand The child resources to include in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of servers in a resource groups along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + expand, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of servers in a resource groups along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + expand, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 expand The child resources to include in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of servers in a resource groups as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, String expand) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, expand), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of servers in a resource groups as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + final String expand = null; + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, expand), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * 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 expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of servers in a resource groups as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, String expand, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, expand, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of servers in a resource groups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + final String expand = null; + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, expand)); + } + + /** + * 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 expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of servers in a resource groups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, String expand, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, expand, context)); + } + + /** + * 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 expand The child resources to include in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String serverName, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + serverName, + expand, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String serverName, String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + serverName, + expand, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String serverName) { + final String expand = null; + return getByResourceGroupWithResponseAsync(resourceGroupName, serverName, expand) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String serverName, String expand, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, serverName, expand, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerInner getByResourceGroup(String resourceGroupName, String serverName) { + final String expand = null; + return getByResourceGroupWithResponse(resourceGroupName, serverName, expand, Context.NONE).getValue(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database server along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverName, ServerInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database server along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverName, ServerInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ServerInner> beginCreateOrUpdateAsync( + String resourceGroupName, String serverName, ServerInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ServerInner.class, ServerInner.class, this.client.getContext()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ServerInner> beginCreateOrUpdateAsync( + String resourceGroupName, String serverName, ServerInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ServerInner.class, ServerInner.class, context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServerInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, ServerInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, parameters).getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServerInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, ServerInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, parameters, context).getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database server on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String serverName, ServerInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database server on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serverName, ServerInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerInner createOrUpdate(String resourceGroupName, String serverName, ServerInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, parameters).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerInner createOrUpdate( + String resourceGroupName, String serverName, ServerInner parameters, Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, parameters, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-02-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-02-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String serverName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, serverName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, serverName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String serverName) { + return beginDeleteAsync(resourceGroupName, serverName).getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, context).getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String serverName) { + return beginDeleteAsync(resourceGroupName, serverName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String serverName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName) { + deleteAsync(resourceGroupName, serverName).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, Context context) { + deleteAsync(resourceGroupName, serverName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database server along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String serverName, ServerUpdate parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database server along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String serverName, ServerUpdate parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ServerInner> beginUpdateAsync( + String resourceGroupName, String serverName, ServerUpdate parameters) { + Mono>> mono = updateWithResponseAsync(resourceGroupName, serverName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ServerInner.class, ServerInner.class, this.client.getContext()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ServerInner> beginUpdateAsync( + String resourceGroupName, String serverName, ServerUpdate parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, serverName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ServerInner.class, ServerInner.class, context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServerInner> beginUpdate( + String resourceGroupName, String serverName, ServerUpdate parameters) { + return beginUpdateAsync(resourceGroupName, serverName, parameters).getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ServerInner> beginUpdate( + String resourceGroupName, String serverName, ServerUpdate parameters, Context context) { + return beginUpdateAsync(resourceGroupName, serverName, parameters, context).getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database server on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String serverName, ServerUpdate parameters) { + return beginUpdateAsync(resourceGroupName, serverName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database server on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String serverName, ServerUpdate parameters, Context context) { + return beginUpdateAsync(resourceGroupName, serverName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerInner update(String resourceGroupName, String serverName, ServerUpdate parameters) { + return updateAsync(resourceGroupName, serverName, parameters).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerInner update(String resourceGroupName, String serverName, ServerUpdate parameters, Context context) { + return updateAsync(resourceGroupName, serverName, parameters, context).block(); + } + + /** + * Gets a list of all servers in the subscription. + * + * @param expand The child resources to include in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all servers in the subscription along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + expand, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of all servers in the subscription. + * + * @param expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all servers in the subscription along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), expand, this.client.getSubscriptionId(), apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of all servers in the subscription. + * + * @param expand The child resources to include in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all servers in the subscription as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String expand) { + return new PagedFlux<>(() -> listSinglePageAsync(expand), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of all servers in the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all servers in the subscription as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final String expand = null; + return new PagedFlux<>(() -> listSinglePageAsync(expand), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of all servers in the subscription. + * + * @param expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all servers in the subscription as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String expand, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(expand, context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of all servers in the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all servers in the subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final String expand = null; + return new PagedIterable<>(listAsync(expand)); + } + + /** + * Gets a list of all servers in the subscription. + * + * @param expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all servers in the subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String expand, Context context) { + return new PagedIterable<>(listAsync(expand, context)); + } + + /** + * 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 database import request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> importDatabaseWithResponseAsync( + String resourceGroupName, String serverName, ImportNewDatabaseDefinition parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .importDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 database import request parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> importDatabaseWithResponseAsync( + String resourceGroupName, String serverName, ImportNewDatabaseDefinition parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .importDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 database import request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ImportExportOperationResultInner> + beginImportDatabaseAsync(String resourceGroupName, String serverName, ImportNewDatabaseDefinition parameters) { + Mono>> mono = + importDatabaseWithResponseAsync(resourceGroupName, serverName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ImportExportOperationResultInner.class, + ImportExportOperationResultInner.class, + this.client.getContext()); + } + + /** + * 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 database import request parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ImportExportOperationResultInner> + beginImportDatabaseAsync( + String resourceGroupName, String serverName, ImportNewDatabaseDefinition parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + importDatabaseWithResponseAsync(resourceGroupName, serverName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ImportExportOperationResultInner.class, + ImportExportOperationResultInner.class, + context); + } + + /** + * 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 database import request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ImportExportOperationResultInner> + beginImportDatabase(String resourceGroupName, String serverName, ImportNewDatabaseDefinition parameters) { + return beginImportDatabaseAsync(resourceGroupName, serverName, parameters).getSyncPoller(); + } + + /** + * 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 database import request parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ImportExportOperationResultInner> + beginImportDatabase( + String resourceGroupName, String serverName, ImportNewDatabaseDefinition parameters, Context context) { + return beginImportDatabaseAsync(resourceGroupName, serverName, parameters, context).getSyncPoller(); + } + + /** + * 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 database import request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono importDatabaseAsync( + String resourceGroupName, String serverName, ImportNewDatabaseDefinition parameters) { + return beginImportDatabaseAsync(resourceGroupName, serverName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 database import request parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono importDatabaseAsync( + String resourceGroupName, String serverName, ImportNewDatabaseDefinition parameters, Context context) { + return beginImportDatabaseAsync(resourceGroupName, serverName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 database import request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ImportExportOperationResultInner importDatabase( + String resourceGroupName, String serverName, ImportNewDatabaseDefinition parameters) { + return importDatabaseAsync(resourceGroupName, serverName, parameters).block(); + } + + /** + * 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 database import request parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ImportExportOperationResultInner importDatabase( + String resourceGroupName, String serverName, ImportNewDatabaseDefinition parameters, Context context) { + return importDatabaseAsync(resourceGroupName, serverName, parameters, context).block(); + } + + /** + * Determines whether a resource can be created with the specified name. + * + * @param parameters The name availability request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a name availability check along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkNameAvailabilityWithResponseAsync( + CheckNameAvailabilityRequest parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .checkNameAvailability( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Determines whether a resource can be created with the specified name. + * + * @param parameters The name availability request parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a name availability check along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkNameAvailabilityWithResponseAsync( + CheckNameAvailabilityRequest parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .checkNameAvailability( + this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, parameters, accept, context); + } + + /** + * Determines whether a resource can be created with the specified name. + * + * @param parameters The name availability request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a name availability check on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono checkNameAvailabilityAsync( + CheckNameAvailabilityRequest parameters) { + return checkNameAvailabilityWithResponseAsync(parameters).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Determines whether a resource can be created with the specified name. + * + * @param parameters The name availability request parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a name availability check along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response checkNameAvailabilityWithResponse( + CheckNameAvailabilityRequest parameters, Context context) { + return checkNameAvailabilityWithResponseAsync(parameters, context).block(); + } + + /** + * Determines whether a resource can be created with the specified name. + * + * @param parameters The name availability request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a name availability check. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CheckNameAvailabilityResponseInner checkNameAvailability(CheckNameAvailabilityRequest parameters) { + return checkNameAvailabilityWithResponse(parameters, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of servers along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of servers along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of servers along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of servers along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServersImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServersImpl.java new file mode 100644 index 0000000000000..72cc6e1476537 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServersImpl.java @@ -0,0 +1,221 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ServersClient; +import com.azure.resourcemanager.sql.generated.fluent.models.CheckNameAvailabilityResponseInner; +import com.azure.resourcemanager.sql.generated.fluent.models.ImportExportOperationResultInner; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerInner; +import com.azure.resourcemanager.sql.generated.models.CheckNameAvailabilityRequest; +import com.azure.resourcemanager.sql.generated.models.CheckNameAvailabilityResponse; +import com.azure.resourcemanager.sql.generated.models.ImportExportOperationResult; +import com.azure.resourcemanager.sql.generated.models.ImportNewDatabaseDefinition; +import com.azure.resourcemanager.sql.generated.models.Server; +import com.azure.resourcemanager.sql.generated.models.Servers; + +public final class ServersImpl implements Servers { + private static final ClientLogger LOGGER = new ClientLogger(ServersImpl.class); + + private final ServersClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ServersImpl(ServersClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new ServerImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, String expand, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, expand, context); + return Utils.mapPage(inner, inner1 -> new ServerImpl(inner1, this.manager())); + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String serverName, String expand, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, serverName, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServerImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Server getByResourceGroup(String resourceGroupName, String serverName) { + ServerInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, serverName); + if (inner != null) { + return new ServerImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String serverName) { + this.serviceClient().delete(resourceGroupName, serverName); + } + + public void delete(String resourceGroupName, String serverName, Context context) { + this.serviceClient().delete(resourceGroupName, serverName, context); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new ServerImpl(inner1, this.manager())); + } + + public PagedIterable list(String expand, Context context) { + PagedIterable inner = this.serviceClient().list(expand, context); + return Utils.mapPage(inner, inner1 -> new ServerImpl(inner1, this.manager())); + } + + public ImportExportOperationResult importDatabase( + String resourceGroupName, String serverName, ImportNewDatabaseDefinition parameters) { + ImportExportOperationResultInner inner = + this.serviceClient().importDatabase(resourceGroupName, serverName, parameters); + if (inner != null) { + return new ImportExportOperationResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public ImportExportOperationResult importDatabase( + String resourceGroupName, String serverName, ImportNewDatabaseDefinition parameters, Context context) { + ImportExportOperationResultInner inner = + this.serviceClient().importDatabase(resourceGroupName, serverName, parameters, context); + if (inner != null) { + return new ImportExportOperationResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response checkNameAvailabilityWithResponse( + CheckNameAvailabilityRequest parameters, Context context) { + Response inner = + this.serviceClient().checkNameAvailabilityWithResponse(parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CheckNameAvailabilityResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CheckNameAvailabilityResponse checkNameAvailability(CheckNameAvailabilityRequest parameters) { + CheckNameAvailabilityResponseInner inner = this.serviceClient().checkNameAvailability(parameters); + if (inner != null) { + return new CheckNameAvailabilityResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Server getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String localExpand = null; + return this.getByResourceGroupWithResponse(resourceGroupName, serverName, localExpand, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, String expand, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, serverName, expand, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + this.delete(resourceGroupName, serverName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + this.delete(resourceGroupName, serverName, context); + } + + private ServersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public ServerImpl define(String name) { + return new ServerImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServiceObjectiveImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServiceObjectiveImpl.java new file mode 100644 index 0000000000000..5ca565d8aff44 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServiceObjectiveImpl.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.ServiceObjectiveInner; +import com.azure.resourcemanager.sql.generated.models.ServiceObjective; + +public final class ServiceObjectiveImpl implements ServiceObjective { + private ServiceObjectiveInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + ServiceObjectiveImpl( + ServiceObjectiveInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String serviceObjectiveName() { + return this.innerModel().serviceObjectiveName(); + } + + public Boolean isDefault() { + return this.innerModel().isDefault(); + } + + public Boolean isSystem() { + return this.innerModel().isSystem(); + } + + public String description() { + return this.innerModel().description(); + } + + public Boolean enabled() { + return this.innerModel().enabled(); + } + + public ServiceObjectiveInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServiceObjectivesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServiceObjectivesClientImpl.java new file mode 100644 index 0000000000000..77128a3828741 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServiceObjectivesClientImpl.java @@ -0,0 +1,435 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.ServiceObjectivesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServiceObjectiveInner; +import com.azure.resourcemanager.sql.generated.models.ServiceObjectiveListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ServiceObjectivesClient. */ +public final class ServiceObjectivesClientImpl implements ServiceObjectivesClient { + /** The proxy service used to perform REST calls. */ + private final ServiceObjectivesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of ServiceObjectivesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServiceObjectivesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(ServiceObjectivesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientServiceObjectives to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + public interface ServiceObjectivesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/serviceObjectives/{serviceObjectiveName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("serviceObjectiveName") String serviceObjectiveName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/serviceObjectives") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database service objective along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String serviceObjectiveName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (serviceObjectiveName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serviceObjectiveName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + serviceObjectiveName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database service objective along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String serviceObjectiveName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (serviceObjectiveName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serviceObjectiveName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + serviceObjectiveName, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database service objective on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String serviceObjectiveName) { + return getWithResponseAsync(resourceGroupName, serverName, serviceObjectiveName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database service objective along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String serviceObjectiveName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, serviceObjectiveName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database service objective. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServiceObjectiveInner get(String resourceGroupName, String serverName, String serviceObjectiveName) { + return getWithResponse(resourceGroupName, serverName, serviceObjectiveName, Context.NONE).getValue(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a get database service objectives request along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a get database service objectives request along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2014-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a get database service objectives request as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a get database service objectives request as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a get database service objectives request as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a get database service objectives request as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServiceObjectivesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServiceObjectivesImpl.java new file mode 100644 index 0000000000000..4033cdc85c4cf --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/ServiceObjectivesImpl.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.ServiceObjectivesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.ServiceObjectiveInner; +import com.azure.resourcemanager.sql.generated.models.ServiceObjective; +import com.azure.resourcemanager.sql.generated.models.ServiceObjectives; + +public final class ServiceObjectivesImpl implements ServiceObjectives { + private static final ClientLogger LOGGER = new ClientLogger(ServiceObjectivesImpl.class); + + private final ServiceObjectivesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public ServiceObjectivesImpl( + ServiceObjectivesClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String serviceObjectiveName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, serviceObjectiveName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServiceObjectiveImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ServiceObjective get(String resourceGroupName, String serverName, String serviceObjectiveName) { + ServiceObjectiveInner inner = this.serviceClient().get(resourceGroupName, serverName, serviceObjectiveName); + if (inner != null) { + return new ServiceObjectiveImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new ServiceObjectiveImpl(inner1, this.manager())); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new ServiceObjectiveImpl(inner1, this.manager())); + } + + private ServiceObjectivesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlAgentConfigurationImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlAgentConfigurationImpl.java new file mode 100644 index 0000000000000..d7ebecd5209e9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlAgentConfigurationImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.SqlAgentConfigurationInner; +import com.azure.resourcemanager.sql.generated.models.SqlAgentConfiguration; +import com.azure.resourcemanager.sql.generated.models.SqlAgentConfigurationPropertiesState; + +public final class SqlAgentConfigurationImpl implements SqlAgentConfiguration { + private SqlAgentConfigurationInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + SqlAgentConfigurationImpl( + SqlAgentConfigurationInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SqlAgentConfigurationPropertiesState state() { + return this.innerModel().state(); + } + + public SqlAgentConfigurationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlAgentsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlAgentsClientImpl.java new file mode 100644 index 0000000000000..5d86fd6360ae1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlAgentsClientImpl.java @@ -0,0 +1,412 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.SqlAgentsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.SqlAgentConfigurationInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in SqlAgentsClient. */ +public final class SqlAgentsClientImpl implements SqlAgentsClient { + /** The proxy service used to perform REST calls. */ + private final SqlAgentsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of SqlAgentsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SqlAgentsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(SqlAgentsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientSqlAgents to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + public interface SqlAgentsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/sqlAgent/current") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/managedInstances/{managedInstanceName}/sqlAgent/current") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("managedInstanceName") String managedInstanceName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SqlAgentConfigurationInner parameters, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets current instance sql agent 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 managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return current instance sql agent configuration along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets current instance sql agent 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 managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return current instance sql agent configuration along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String managedInstanceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets current instance sql agent 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 managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return current instance sql agent configuration on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String managedInstanceName) { + return getWithResponseAsync(resourceGroupName, managedInstanceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets current instance sql agent 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 managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return current instance sql agent configuration along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, Context context) { + return getWithResponseAsync(resourceGroupName, managedInstanceName, context).block(); + } + + /** + * Gets current instance sql agent 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 managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return current instance sql agent configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlAgentConfigurationInner get(String resourceGroupName, String managedInstanceName) { + return getWithResponse(resourceGroupName, managedInstanceName, Context.NONE).getValue(); + } + + /** + * Puts new sql agent configuration to 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 A recoverable managed database resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a recoverable managed database resource along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String managedInstanceName, SqlAgentConfigurationInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Puts new sql agent configuration to 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 A recoverable managed database resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a recoverable managed database resource along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String managedInstanceName, SqlAgentConfigurationInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (managedInstanceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + managedInstanceName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Puts new sql agent configuration to 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 A recoverable managed database resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a recoverable managed database resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String managedInstanceName, SqlAgentConfigurationInner parameters) { + return createOrUpdateWithResponseAsync(resourceGroupName, managedInstanceName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Puts new sql agent configuration to 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 A recoverable managed database resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a recoverable managed database resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, String managedInstanceName, SqlAgentConfigurationInner parameters, Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, managedInstanceName, parameters, context).block(); + } + + /** + * Puts new sql agent configuration to 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 A recoverable managed database resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a recoverable managed database resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlAgentConfigurationInner createOrUpdate( + String resourceGroupName, String managedInstanceName, SqlAgentConfigurationInner parameters) { + return createOrUpdateWithResponse(resourceGroupName, managedInstanceName, parameters, Context.NONE).getValue(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlAgentsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlAgentsImpl.java new file mode 100644 index 0000000000000..69227af26b24b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlAgentsImpl.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.SqlAgentsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.SqlAgentConfigurationInner; +import com.azure.resourcemanager.sql.generated.models.SqlAgentConfiguration; +import com.azure.resourcemanager.sql.generated.models.SqlAgents; + +public final class SqlAgentsImpl implements SqlAgents { + private static final ClientLogger LOGGER = new ClientLogger(SqlAgentsImpl.class); + + private final SqlAgentsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public SqlAgentsImpl( + SqlAgentsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String resourceGroupName, String managedInstanceName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, managedInstanceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SqlAgentConfigurationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SqlAgentConfiguration get(String resourceGroupName, String managedInstanceName) { + SqlAgentConfigurationInner inner = this.serviceClient().get(resourceGroupName, managedInstanceName); + if (inner != null) { + return new SqlAgentConfigurationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response createOrUpdateWithResponse( + String resourceGroupName, String managedInstanceName, SqlAgentConfigurationInner parameters, Context context) { + Response inner = + this + .serviceClient() + .createOrUpdateWithResponse(resourceGroupName, managedInstanceName, parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SqlAgentConfigurationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SqlAgentConfiguration createOrUpdate( + String resourceGroupName, String managedInstanceName, SqlAgentConfigurationInner parameters) { + SqlAgentConfigurationInner inner = + this.serviceClient().createOrUpdate(resourceGroupName, managedInstanceName, parameters); + if (inner != null) { + return new SqlAgentConfigurationImpl(inner, this.manager()); + } else { + return null; + } + } + + private SqlAgentsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlManagementClientBuilder.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlManagementClientBuilder.java new file mode 100644 index 0000000000000..d3e21a4448f67 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlManagementClientBuilder.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** A builder for creating a new instance of the SqlManagementClientImpl type. */ +@ServiceClientBuilder(serviceClients = {SqlManagementClientImpl.class}) +public final class SqlManagementClientBuilder { + /* + * The subscription ID that identifies an Azure subscription. + */ + private String subscriptionId; + + /** + * Sets The subscription ID that identifies an Azure subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the SqlManagementClientBuilder. + */ + public SqlManagementClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the SqlManagementClientBuilder. + */ + public SqlManagementClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the SqlManagementClientBuilder. + */ + public SqlManagementClientBuilder environment(AzureEnvironment environment) { + this.environment = environment; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the SqlManagementClientBuilder. + */ + public SqlManagementClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The default poll interval for long-running operation + */ + private Duration defaultPollInterval; + + /** + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. + * @return the SqlManagementClientBuilder. + */ + public SqlManagementClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + return this; + } + + /* + * The serializer to serialize an object into a string + */ + private SerializerAdapter serializerAdapter; + + /** + * Sets The serializer to serialize an object into a string. + * + * @param serializerAdapter the serializerAdapter value. + * @return the SqlManagementClientBuilder. + */ + public SqlManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of SqlManagementClientImpl with the provided parameters. + * + * @return an instance of SqlManagementClientImpl. + */ + public SqlManagementClientImpl buildClient() { + String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; + AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; + HttpPipeline localPipeline = + (pipeline != null) + ? pipeline + : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + Duration localDefaultPollInterval = + (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); + SerializerAdapter localSerializerAdapter = + (serializerAdapter != null) + ? serializerAdapter + : SerializerFactory.createDefaultManagementSerializerAdapter(); + SqlManagementClientImpl client = + new SqlManagementClientImpl( + localPipeline, + localSerializerAdapter, + localDefaultPollInterval, + localEnvironment, + subscriptionId, + localEndpoint); + return client; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlManagementClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlManagementClientImpl.java new file mode 100644 index 0000000000000..b7ee4659bbdf7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlManagementClientImpl.java @@ -0,0 +1,2314 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.sql.generated.fluent.BackupShortTermRetentionPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.CapabilitiesClient; +import com.azure.resourcemanager.sql.generated.fluent.DataMaskingPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.DataMaskingRulesClient; +import com.azure.resourcemanager.sql.generated.fluent.DataWarehouseUserActivitiesOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseAdvancedThreatProtectionSettingsClient; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseAdvisorsClient; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseAutomaticTuningsClient; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseBlobAuditingPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseColumnsClient; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseExtensionsOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseRecommendedActionsClient; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseSchemasClient; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseSecurityAlertPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseSqlVulnerabilityAssessmentBaselinesClient; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseSqlVulnerabilityAssessmentExecuteScansClient; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseSqlVulnerabilityAssessmentRuleBaselinesClient; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseSqlVulnerabilityAssessmentScanResultsClient; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseSqlVulnerabilityAssessmentScansClient; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseSqlVulnerabilityAssessmentsSettingsClient; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseTablesClient; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseUsagesClient; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseVulnerabilityAssessmentRuleBaselinesClient; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseVulnerabilityAssessmentScansClient; +import com.azure.resourcemanager.sql.generated.fluent.DatabaseVulnerabilityAssessmentsClient; +import com.azure.resourcemanager.sql.generated.fluent.DatabasesClient; +import com.azure.resourcemanager.sql.generated.fluent.DeletedServersClient; +import com.azure.resourcemanager.sql.generated.fluent.DistributedAvailabilityGroupsClient; +import com.azure.resourcemanager.sql.generated.fluent.ElasticPoolActivitiesClient; +import com.azure.resourcemanager.sql.generated.fluent.ElasticPoolDatabaseActivitiesClient; +import com.azure.resourcemanager.sql.generated.fluent.ElasticPoolOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.ElasticPoolsClient; +import com.azure.resourcemanager.sql.generated.fluent.EncryptionProtectorsClient; +import com.azure.resourcemanager.sql.generated.fluent.EndpointCertificatesClient; +import com.azure.resourcemanager.sql.generated.fluent.ExtendedDatabaseBlobAuditingPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.ExtendedServerBlobAuditingPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.FailoverGroupsClient; +import com.azure.resourcemanager.sql.generated.fluent.FirewallRulesClient; +import com.azure.resourcemanager.sql.generated.fluent.GeoBackupPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.IPv6FirewallRulesClient; +import com.azure.resourcemanager.sql.generated.fluent.InstanceFailoverGroupsClient; +import com.azure.resourcemanager.sql.generated.fluent.InstancePoolsClient; +import com.azure.resourcemanager.sql.generated.fluent.JobAgentsClient; +import com.azure.resourcemanager.sql.generated.fluent.JobCredentialsClient; +import com.azure.resourcemanager.sql.generated.fluent.JobExecutionsClient; +import com.azure.resourcemanager.sql.generated.fluent.JobStepExecutionsClient; +import com.azure.resourcemanager.sql.generated.fluent.JobStepsClient; +import com.azure.resourcemanager.sql.generated.fluent.JobTargetExecutionsClient; +import com.azure.resourcemanager.sql.generated.fluent.JobTargetGroupsClient; +import com.azure.resourcemanager.sql.generated.fluent.JobVersionsClient; +import com.azure.resourcemanager.sql.generated.fluent.JobsClient; +import com.azure.resourcemanager.sql.generated.fluent.LedgerDigestUploadsOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.LongTermRetentionBackupsClient; +import com.azure.resourcemanager.sql.generated.fluent.LongTermRetentionManagedInstanceBackupsClient; +import com.azure.resourcemanager.sql.generated.fluent.LongTermRetentionPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.MaintenanceWindowOptionsOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.MaintenanceWindowsOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedBackupShortTermRetentionPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseAdvancedThreatProtectionSettingsClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseColumnsClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseMoveOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseQueriesClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseRecommendedSensitivityLabelsClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseRestoreDetailsClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseSchemasClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseSecurityAlertPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseSecurityEventsClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseSensitivityLabelsClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseTablesClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseTransparentDataEncryptionsClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseVulnerabilityAssessmentScansClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabaseVulnerabilityAssessmentsClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedDatabasesClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedInstanceAdministratorsClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedInstanceAdvancedThreatProtectionSettingsClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedInstanceAzureADOnlyAuthenticationsClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedInstanceDtcsClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedInstanceEncryptionProtectorsClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedInstanceKeysClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedInstanceLongTermRetentionPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedInstanceOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedInstancePrivateEndpointConnectionsClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedInstancePrivateLinkResourcesClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedInstanceTdeCertificatesClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedInstanceVulnerabilityAssessmentsClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedInstancesClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedServerDnsAliasesClient; +import com.azure.resourcemanager.sql.generated.fluent.ManagedServerSecurityAlertPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.OperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.OutboundFirewallRulesClient; +import com.azure.resourcemanager.sql.generated.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.sql.generated.fluent.PrivateLinkResourcesClient; +import com.azure.resourcemanager.sql.generated.fluent.RecommendedSensitivityLabelsClient; +import com.azure.resourcemanager.sql.generated.fluent.RecoverableDatabasesClient; +import com.azure.resourcemanager.sql.generated.fluent.RecoverableManagedDatabasesClient; +import com.azure.resourcemanager.sql.generated.fluent.ReplicationLinksClient; +import com.azure.resourcemanager.sql.generated.fluent.RestorableDroppedDatabasesClient; +import com.azure.resourcemanager.sql.generated.fluent.RestorableDroppedManagedDatabasesClient; +import com.azure.resourcemanager.sql.generated.fluent.RestorePointsClient; +import com.azure.resourcemanager.sql.generated.fluent.SensitivityLabelsClient; +import com.azure.resourcemanager.sql.generated.fluent.ServerAdvancedThreatProtectionSettingsClient; +import com.azure.resourcemanager.sql.generated.fluent.ServerAdvisorsClient; +import com.azure.resourcemanager.sql.generated.fluent.ServerAutomaticTuningsClient; +import com.azure.resourcemanager.sql.generated.fluent.ServerAzureADAdministratorsClient; +import com.azure.resourcemanager.sql.generated.fluent.ServerAzureADOnlyAuthenticationsClient; +import com.azure.resourcemanager.sql.generated.fluent.ServerBlobAuditingPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.ServerCommunicationLinksClient; +import com.azure.resourcemanager.sql.generated.fluent.ServerConnectionPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.ServerDevOpsAuditSettingsClient; +import com.azure.resourcemanager.sql.generated.fluent.ServerDnsAliasesClient; +import com.azure.resourcemanager.sql.generated.fluent.ServerKeysClient; +import com.azure.resourcemanager.sql.generated.fluent.ServerOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.ServerSecurityAlertPoliciesClient; +import com.azure.resourcemanager.sql.generated.fluent.ServerTrustCertificatesClient; +import com.azure.resourcemanager.sql.generated.fluent.ServerTrustGroupsClient; +import com.azure.resourcemanager.sql.generated.fluent.ServerUsagesClient; +import com.azure.resourcemanager.sql.generated.fluent.ServerVulnerabilityAssessmentsClient; +import com.azure.resourcemanager.sql.generated.fluent.ServersClient; +import com.azure.resourcemanager.sql.generated.fluent.ServiceObjectivesClient; +import com.azure.resourcemanager.sql.generated.fluent.SqlAgentsClient; +import com.azure.resourcemanager.sql.generated.fluent.SqlManagementClient; +import com.azure.resourcemanager.sql.generated.fluent.SqlVulnerabilityAssessmentBaselinesClient; +import com.azure.resourcemanager.sql.generated.fluent.SqlVulnerabilityAssessmentBaselinesOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.SqlVulnerabilityAssessmentExecuteScansClient; +import com.azure.resourcemanager.sql.generated.fluent.SqlVulnerabilityAssessmentRuleBaselinesClient; +import com.azure.resourcemanager.sql.generated.fluent.SqlVulnerabilityAssessmentRuleBaselinesOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.SqlVulnerabilityAssessmentScanResultOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.SqlVulnerabilityAssessmentScansClient; +import com.azure.resourcemanager.sql.generated.fluent.SqlVulnerabilityAssessmentsClient; +import com.azure.resourcemanager.sql.generated.fluent.SqlVulnerabilityAssessmentsSettingsClient; +import com.azure.resourcemanager.sql.generated.fluent.SubscriptionUsagesClient; +import com.azure.resourcemanager.sql.generated.fluent.SynapseLinkWorkspacesClient; +import com.azure.resourcemanager.sql.generated.fluent.SyncAgentsClient; +import com.azure.resourcemanager.sql.generated.fluent.SyncGroupsClient; +import com.azure.resourcemanager.sql.generated.fluent.SyncMembersClient; +import com.azure.resourcemanager.sql.generated.fluent.TdeCertificatesClient; +import com.azure.resourcemanager.sql.generated.fluent.TimeZonesClient; +import com.azure.resourcemanager.sql.generated.fluent.TransparentDataEncryptionsClient; +import com.azure.resourcemanager.sql.generated.fluent.UsagesClient; +import com.azure.resourcemanager.sql.generated.fluent.VirtualClustersClient; +import com.azure.resourcemanager.sql.generated.fluent.VirtualNetworkRulesClient; +import com.azure.resourcemanager.sql.generated.fluent.WorkloadClassifiersClient; +import com.azure.resourcemanager.sql.generated.fluent.WorkloadGroupsClient; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the SqlManagementClientImpl type. */ +@ServiceClient(builder = SqlManagementClientBuilder.class) +public final class SqlManagementClientImpl implements SqlManagementClient { + /** The subscription ID that identifies an Azure subscription. */ + private final String subscriptionId; + + /** + * Gets The subscription ID that identifies an Azure subscription. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** server parameter. */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** The HTTP pipeline to send requests through. */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** The serializer to serialize an object into a string. */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** The default poll interval for long-running operation. */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** The RecoverableDatabasesClient object to access its operations. */ + private final RecoverableDatabasesClient recoverableDatabases; + + /** + * Gets the RecoverableDatabasesClient object to access its operations. + * + * @return the RecoverableDatabasesClient object. + */ + public RecoverableDatabasesClient getRecoverableDatabases() { + return this.recoverableDatabases; + } + + /** The DataMaskingPoliciesClient object to access its operations. */ + private final DataMaskingPoliciesClient dataMaskingPolicies; + + /** + * Gets the DataMaskingPoliciesClient object to access its operations. + * + * @return the DataMaskingPoliciesClient object. + */ + public DataMaskingPoliciesClient getDataMaskingPolicies() { + return this.dataMaskingPolicies; + } + + /** The DataMaskingRulesClient object to access its operations. */ + private final DataMaskingRulesClient dataMaskingRules; + + /** + * Gets the DataMaskingRulesClient object to access its operations. + * + * @return the DataMaskingRulesClient object. + */ + public DataMaskingRulesClient getDataMaskingRules() { + return this.dataMaskingRules; + } + + /** The GeoBackupPoliciesClient object to access its operations. */ + private final GeoBackupPoliciesClient geoBackupPolicies; + + /** + * Gets the GeoBackupPoliciesClient object to access its operations. + * + * @return the GeoBackupPoliciesClient object. + */ + public GeoBackupPoliciesClient getGeoBackupPolicies() { + return this.geoBackupPolicies; + } + + /** The DatabasesClient object to access its operations. */ + private final DatabasesClient databases; + + /** + * Gets the DatabasesClient object to access its operations. + * + * @return the DatabasesClient object. + */ + public DatabasesClient getDatabases() { + return this.databases; + } + + /** The ElasticPoolsClient object to access its operations. */ + private final ElasticPoolsClient elasticPools; + + /** + * Gets the ElasticPoolsClient object to access its operations. + * + * @return the ElasticPoolsClient object. + */ + public ElasticPoolsClient getElasticPools() { + return this.elasticPools; + } + + /** The ServerCommunicationLinksClient object to access its operations. */ + private final ServerCommunicationLinksClient serverCommunicationLinks; + + /** + * Gets the ServerCommunicationLinksClient object to access its operations. + * + * @return the ServerCommunicationLinksClient object. + */ + public ServerCommunicationLinksClient getServerCommunicationLinks() { + return this.serverCommunicationLinks; + } + + /** The ServiceObjectivesClient object to access its operations. */ + private final ServiceObjectivesClient serviceObjectives; + + /** + * Gets the ServiceObjectivesClient object to access its operations. + * + * @return the ServiceObjectivesClient object. + */ + public ServiceObjectivesClient getServiceObjectives() { + return this.serviceObjectives; + } + + /** The ElasticPoolActivitiesClient object to access its operations. */ + private final ElasticPoolActivitiesClient elasticPoolActivities; + + /** + * Gets the ElasticPoolActivitiesClient object to access its operations. + * + * @return the ElasticPoolActivitiesClient object. + */ + public ElasticPoolActivitiesClient getElasticPoolActivities() { + return this.elasticPoolActivities; + } + + /** The ElasticPoolDatabaseActivitiesClient object to access its operations. */ + private final ElasticPoolDatabaseActivitiesClient elasticPoolDatabaseActivities; + + /** + * Gets the ElasticPoolDatabaseActivitiesClient object to access its operations. + * + * @return the ElasticPoolDatabaseActivitiesClient object. + */ + public ElasticPoolDatabaseActivitiesClient getElasticPoolDatabaseActivities() { + return this.elasticPoolDatabaseActivities; + } + + /** The ServerUsagesClient object to access its operations. */ + private final ServerUsagesClient serverUsages; + + /** + * Gets the ServerUsagesClient object to access its operations. + * + * @return the ServerUsagesClient object. + */ + public ServerUsagesClient getServerUsages() { + return this.serverUsages; + } + + /** The DatabaseAdvisorsClient object to access its operations. */ + private final DatabaseAdvisorsClient databaseAdvisors; + + /** + * Gets the DatabaseAdvisorsClient object to access its operations. + * + * @return the DatabaseAdvisorsClient object. + */ + public DatabaseAdvisorsClient getDatabaseAdvisors() { + return this.databaseAdvisors; + } + + /** The DatabaseAutomaticTuningsClient object to access its operations. */ + private final DatabaseAutomaticTuningsClient databaseAutomaticTunings; + + /** + * Gets the DatabaseAutomaticTuningsClient object to access its operations. + * + * @return the DatabaseAutomaticTuningsClient object. + */ + public DatabaseAutomaticTuningsClient getDatabaseAutomaticTunings() { + return this.databaseAutomaticTunings; + } + + /** The DatabaseColumnsClient object to access its operations. */ + private final DatabaseColumnsClient databaseColumns; + + /** + * Gets the DatabaseColumnsClient object to access its operations. + * + * @return the DatabaseColumnsClient object. + */ + public DatabaseColumnsClient getDatabaseColumns() { + return this.databaseColumns; + } + + /** The DatabaseRecommendedActionsClient object to access its operations. */ + private final DatabaseRecommendedActionsClient databaseRecommendedActions; + + /** + * Gets the DatabaseRecommendedActionsClient object to access its operations. + * + * @return the DatabaseRecommendedActionsClient object. + */ + public DatabaseRecommendedActionsClient getDatabaseRecommendedActions() { + return this.databaseRecommendedActions; + } + + /** The DatabaseSchemasClient object to access its operations. */ + private final DatabaseSchemasClient databaseSchemas; + + /** + * Gets the DatabaseSchemasClient object to access its operations. + * + * @return the DatabaseSchemasClient object. + */ + public DatabaseSchemasClient getDatabaseSchemas() { + return this.databaseSchemas; + } + + /** The DatabaseSecurityAlertPoliciesClient object to access its operations. */ + private final DatabaseSecurityAlertPoliciesClient databaseSecurityAlertPolicies; + + /** + * Gets the DatabaseSecurityAlertPoliciesClient object to access its operations. + * + * @return the DatabaseSecurityAlertPoliciesClient object. + */ + public DatabaseSecurityAlertPoliciesClient getDatabaseSecurityAlertPolicies() { + return this.databaseSecurityAlertPolicies; + } + + /** The DatabaseTablesClient object to access its operations. */ + private final DatabaseTablesClient databaseTables; + + /** + * Gets the DatabaseTablesClient object to access its operations. + * + * @return the DatabaseTablesClient object. + */ + public DatabaseTablesClient getDatabaseTables() { + return this.databaseTables; + } + + /** The DatabaseVulnerabilityAssessmentRuleBaselinesClient object to access its operations. */ + private final DatabaseVulnerabilityAssessmentRuleBaselinesClient databaseVulnerabilityAssessmentRuleBaselines; + + /** + * Gets the DatabaseVulnerabilityAssessmentRuleBaselinesClient object to access its operations. + * + * @return the DatabaseVulnerabilityAssessmentRuleBaselinesClient object. + */ + public DatabaseVulnerabilityAssessmentRuleBaselinesClient getDatabaseVulnerabilityAssessmentRuleBaselines() { + return this.databaseVulnerabilityAssessmentRuleBaselines; + } + + /** The DatabaseVulnerabilityAssessmentsClient object to access its operations. */ + private final DatabaseVulnerabilityAssessmentsClient databaseVulnerabilityAssessments; + + /** + * Gets the DatabaseVulnerabilityAssessmentsClient object to access its operations. + * + * @return the DatabaseVulnerabilityAssessmentsClient object. + */ + public DatabaseVulnerabilityAssessmentsClient getDatabaseVulnerabilityAssessments() { + return this.databaseVulnerabilityAssessments; + } + + /** The DatabaseVulnerabilityAssessmentScansClient object to access its operations. */ + private final DatabaseVulnerabilityAssessmentScansClient databaseVulnerabilityAssessmentScans; + + /** + * Gets the DatabaseVulnerabilityAssessmentScansClient object to access its operations. + * + * @return the DatabaseVulnerabilityAssessmentScansClient object. + */ + public DatabaseVulnerabilityAssessmentScansClient getDatabaseVulnerabilityAssessmentScans() { + return this.databaseVulnerabilityAssessmentScans; + } + + /** The DataWarehouseUserActivitiesOperationsClient object to access its operations. */ + private final DataWarehouseUserActivitiesOperationsClient dataWarehouseUserActivitiesOperations; + + /** + * Gets the DataWarehouseUserActivitiesOperationsClient object to access its operations. + * + * @return the DataWarehouseUserActivitiesOperationsClient object. + */ + public DataWarehouseUserActivitiesOperationsClient getDataWarehouseUserActivitiesOperations() { + return this.dataWarehouseUserActivitiesOperations; + } + + /** The DeletedServersClient object to access its operations. */ + private final DeletedServersClient deletedServers; + + /** + * Gets the DeletedServersClient object to access its operations. + * + * @return the DeletedServersClient object. + */ + public DeletedServersClient getDeletedServers() { + return this.deletedServers; + } + + /** The ElasticPoolOperationsClient object to access its operations. */ + private final ElasticPoolOperationsClient elasticPoolOperations; + + /** + * Gets the ElasticPoolOperationsClient object to access its operations. + * + * @return the ElasticPoolOperationsClient object. + */ + public ElasticPoolOperationsClient getElasticPoolOperations() { + return this.elasticPoolOperations; + } + + /** The EncryptionProtectorsClient object to access its operations. */ + private final EncryptionProtectorsClient encryptionProtectors; + + /** + * Gets the EncryptionProtectorsClient object to access its operations. + * + * @return the EncryptionProtectorsClient object. + */ + public EncryptionProtectorsClient getEncryptionProtectors() { + return this.encryptionProtectors; + } + + /** The FailoverGroupsClient object to access its operations. */ + private final FailoverGroupsClient failoverGroups; + + /** + * Gets the FailoverGroupsClient object to access its operations. + * + * @return the FailoverGroupsClient object. + */ + public FailoverGroupsClient getFailoverGroups() { + return this.failoverGroups; + } + + /** The FirewallRulesClient object to access its operations. */ + private final FirewallRulesClient firewallRules; + + /** + * Gets the FirewallRulesClient object to access its operations. + * + * @return the FirewallRulesClient object. + */ + public FirewallRulesClient getFirewallRules() { + return this.firewallRules; + } + + /** The InstanceFailoverGroupsClient object to access its operations. */ + private final InstanceFailoverGroupsClient instanceFailoverGroups; + + /** + * Gets the InstanceFailoverGroupsClient object to access its operations. + * + * @return the InstanceFailoverGroupsClient object. + */ + public InstanceFailoverGroupsClient getInstanceFailoverGroups() { + return this.instanceFailoverGroups; + } + + /** The InstancePoolsClient object to access its operations. */ + private final InstancePoolsClient instancePools; + + /** + * Gets the InstancePoolsClient object to access its operations. + * + * @return the InstancePoolsClient object. + */ + public InstancePoolsClient getInstancePools() { + return this.instancePools; + } + + /** The JobAgentsClient object to access its operations. */ + private final JobAgentsClient jobAgents; + + /** + * Gets the JobAgentsClient object to access its operations. + * + * @return the JobAgentsClient object. + */ + public JobAgentsClient getJobAgents() { + return this.jobAgents; + } + + /** The JobCredentialsClient object to access its operations. */ + private final JobCredentialsClient jobCredentials; + + /** + * Gets the JobCredentialsClient object to access its operations. + * + * @return the JobCredentialsClient object. + */ + public JobCredentialsClient getJobCredentials() { + return this.jobCredentials; + } + + /** The JobExecutionsClient object to access its operations. */ + private final JobExecutionsClient jobExecutions; + + /** + * Gets the JobExecutionsClient object to access its operations. + * + * @return the JobExecutionsClient object. + */ + public JobExecutionsClient getJobExecutions() { + return this.jobExecutions; + } + + /** The JobsClient object to access its operations. */ + private final JobsClient jobs; + + /** + * Gets the JobsClient object to access its operations. + * + * @return the JobsClient object. + */ + public JobsClient getJobs() { + return this.jobs; + } + + /** The JobStepExecutionsClient object to access its operations. */ + private final JobStepExecutionsClient jobStepExecutions; + + /** + * Gets the JobStepExecutionsClient object to access its operations. + * + * @return the JobStepExecutionsClient object. + */ + public JobStepExecutionsClient getJobStepExecutions() { + return this.jobStepExecutions; + } + + /** The JobStepsClient object to access its operations. */ + private final JobStepsClient jobSteps; + + /** + * Gets the JobStepsClient object to access its operations. + * + * @return the JobStepsClient object. + */ + public JobStepsClient getJobSteps() { + return this.jobSteps; + } + + /** The JobTargetExecutionsClient object to access its operations. */ + private final JobTargetExecutionsClient jobTargetExecutions; + + /** + * Gets the JobTargetExecutionsClient object to access its operations. + * + * @return the JobTargetExecutionsClient object. + */ + public JobTargetExecutionsClient getJobTargetExecutions() { + return this.jobTargetExecutions; + } + + /** The JobTargetGroupsClient object to access its operations. */ + private final JobTargetGroupsClient jobTargetGroups; + + /** + * Gets the JobTargetGroupsClient object to access its operations. + * + * @return the JobTargetGroupsClient object. + */ + public JobTargetGroupsClient getJobTargetGroups() { + return this.jobTargetGroups; + } + + /** The JobVersionsClient object to access its operations. */ + private final JobVersionsClient jobVersions; + + /** + * Gets the JobVersionsClient object to access its operations. + * + * @return the JobVersionsClient object. + */ + public JobVersionsClient getJobVersions() { + return this.jobVersions; + } + + /** The CapabilitiesClient object to access its operations. */ + private final CapabilitiesClient capabilities; + + /** + * Gets the CapabilitiesClient object to access its operations. + * + * @return the CapabilitiesClient object. + */ + public CapabilitiesClient getCapabilities() { + return this.capabilities; + } + + /** The LongTermRetentionPoliciesClient object to access its operations. */ + private final LongTermRetentionPoliciesClient longTermRetentionPolicies; + + /** + * Gets the LongTermRetentionPoliciesClient object to access its operations. + * + * @return the LongTermRetentionPoliciesClient object. + */ + public LongTermRetentionPoliciesClient getLongTermRetentionPolicies() { + return this.longTermRetentionPolicies; + } + + /** The MaintenanceWindowOptionsOperationsClient object to access its operations. */ + private final MaintenanceWindowOptionsOperationsClient maintenanceWindowOptionsOperations; + + /** + * Gets the MaintenanceWindowOptionsOperationsClient object to access its operations. + * + * @return the MaintenanceWindowOptionsOperationsClient object. + */ + public MaintenanceWindowOptionsOperationsClient getMaintenanceWindowOptionsOperations() { + return this.maintenanceWindowOptionsOperations; + } + + /** The MaintenanceWindowsOperationsClient object to access its operations. */ + private final MaintenanceWindowsOperationsClient maintenanceWindowsOperations; + + /** + * Gets the MaintenanceWindowsOperationsClient object to access its operations. + * + * @return the MaintenanceWindowsOperationsClient object. + */ + public MaintenanceWindowsOperationsClient getMaintenanceWindowsOperations() { + return this.maintenanceWindowsOperations; + } + + /** The ManagedBackupShortTermRetentionPoliciesClient object to access its operations. */ + private final ManagedBackupShortTermRetentionPoliciesClient managedBackupShortTermRetentionPolicies; + + /** + * Gets the ManagedBackupShortTermRetentionPoliciesClient object to access its operations. + * + * @return the ManagedBackupShortTermRetentionPoliciesClient object. + */ + public ManagedBackupShortTermRetentionPoliciesClient getManagedBackupShortTermRetentionPolicies() { + return this.managedBackupShortTermRetentionPolicies; + } + + /** The ManagedDatabaseColumnsClient object to access its operations. */ + private final ManagedDatabaseColumnsClient managedDatabaseColumns; + + /** + * Gets the ManagedDatabaseColumnsClient object to access its operations. + * + * @return the ManagedDatabaseColumnsClient object. + */ + public ManagedDatabaseColumnsClient getManagedDatabaseColumns() { + return this.managedDatabaseColumns; + } + + /** The ManagedDatabaseQueriesClient object to access its operations. */ + private final ManagedDatabaseQueriesClient managedDatabaseQueries; + + /** + * Gets the ManagedDatabaseQueriesClient object to access its operations. + * + * @return the ManagedDatabaseQueriesClient object. + */ + public ManagedDatabaseQueriesClient getManagedDatabaseQueries() { + return this.managedDatabaseQueries; + } + + /** The ManagedDatabaseSchemasClient object to access its operations. */ + private final ManagedDatabaseSchemasClient managedDatabaseSchemas; + + /** + * Gets the ManagedDatabaseSchemasClient object to access its operations. + * + * @return the ManagedDatabaseSchemasClient object. + */ + public ManagedDatabaseSchemasClient getManagedDatabaseSchemas() { + return this.managedDatabaseSchemas; + } + + /** The ManagedDatabaseSecurityAlertPoliciesClient object to access its operations. */ + private final ManagedDatabaseSecurityAlertPoliciesClient managedDatabaseSecurityAlertPolicies; + + /** + * Gets the ManagedDatabaseSecurityAlertPoliciesClient object to access its operations. + * + * @return the ManagedDatabaseSecurityAlertPoliciesClient object. + */ + public ManagedDatabaseSecurityAlertPoliciesClient getManagedDatabaseSecurityAlertPolicies() { + return this.managedDatabaseSecurityAlertPolicies; + } + + /** The ManagedDatabaseSecurityEventsClient object to access its operations. */ + private final ManagedDatabaseSecurityEventsClient managedDatabaseSecurityEvents; + + /** + * Gets the ManagedDatabaseSecurityEventsClient object to access its operations. + * + * @return the ManagedDatabaseSecurityEventsClient object. + */ + public ManagedDatabaseSecurityEventsClient getManagedDatabaseSecurityEvents() { + return this.managedDatabaseSecurityEvents; + } + + /** The ManagedDatabaseTablesClient object to access its operations. */ + private final ManagedDatabaseTablesClient managedDatabaseTables; + + /** + * Gets the ManagedDatabaseTablesClient object to access its operations. + * + * @return the ManagedDatabaseTablesClient object. + */ + public ManagedDatabaseTablesClient getManagedDatabaseTables() { + return this.managedDatabaseTables; + } + + /** The ManagedDatabaseTransparentDataEncryptionsClient object to access its operations. */ + private final ManagedDatabaseTransparentDataEncryptionsClient managedDatabaseTransparentDataEncryptions; + + /** + * Gets the ManagedDatabaseTransparentDataEncryptionsClient object to access its operations. + * + * @return the ManagedDatabaseTransparentDataEncryptionsClient object. + */ + public ManagedDatabaseTransparentDataEncryptionsClient getManagedDatabaseTransparentDataEncryptions() { + return this.managedDatabaseTransparentDataEncryptions; + } + + /** The ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient object to access its operations. */ + private final ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient + managedDatabaseVulnerabilityAssessmentRuleBaselines; + + /** + * Gets the ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient object to access its operations. + * + * @return the ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient object. + */ + public ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient + getManagedDatabaseVulnerabilityAssessmentRuleBaselines() { + return this.managedDatabaseVulnerabilityAssessmentRuleBaselines; + } + + /** The ManagedDatabaseVulnerabilityAssessmentsClient object to access its operations. */ + private final ManagedDatabaseVulnerabilityAssessmentsClient managedDatabaseVulnerabilityAssessments; + + /** + * Gets the ManagedDatabaseVulnerabilityAssessmentsClient object to access its operations. + * + * @return the ManagedDatabaseVulnerabilityAssessmentsClient object. + */ + public ManagedDatabaseVulnerabilityAssessmentsClient getManagedDatabaseVulnerabilityAssessments() { + return this.managedDatabaseVulnerabilityAssessments; + } + + /** The ManagedDatabaseVulnerabilityAssessmentScansClient object to access its operations. */ + private final ManagedDatabaseVulnerabilityAssessmentScansClient managedDatabaseVulnerabilityAssessmentScans; + + /** + * Gets the ManagedDatabaseVulnerabilityAssessmentScansClient object to access its operations. + * + * @return the ManagedDatabaseVulnerabilityAssessmentScansClient object. + */ + public ManagedDatabaseVulnerabilityAssessmentScansClient getManagedDatabaseVulnerabilityAssessmentScans() { + return this.managedDatabaseVulnerabilityAssessmentScans; + } + + /** The ManagedInstanceAdministratorsClient object to access its operations. */ + private final ManagedInstanceAdministratorsClient managedInstanceAdministrators; + + /** + * Gets the ManagedInstanceAdministratorsClient object to access its operations. + * + * @return the ManagedInstanceAdministratorsClient object. + */ + public ManagedInstanceAdministratorsClient getManagedInstanceAdministrators() { + return this.managedInstanceAdministrators; + } + + /** The ManagedInstanceAzureADOnlyAuthenticationsClient object to access its operations. */ + private final ManagedInstanceAzureADOnlyAuthenticationsClient managedInstanceAzureADOnlyAuthentications; + + /** + * Gets the ManagedInstanceAzureADOnlyAuthenticationsClient object to access its operations. + * + * @return the ManagedInstanceAzureADOnlyAuthenticationsClient object. + */ + public ManagedInstanceAzureADOnlyAuthenticationsClient getManagedInstanceAzureADOnlyAuthentications() { + return this.managedInstanceAzureADOnlyAuthentications; + } + + /** The ManagedInstanceEncryptionProtectorsClient object to access its operations. */ + private final ManagedInstanceEncryptionProtectorsClient managedInstanceEncryptionProtectors; + + /** + * Gets the ManagedInstanceEncryptionProtectorsClient object to access its operations. + * + * @return the ManagedInstanceEncryptionProtectorsClient object. + */ + public ManagedInstanceEncryptionProtectorsClient getManagedInstanceEncryptionProtectors() { + return this.managedInstanceEncryptionProtectors; + } + + /** The ManagedInstanceKeysClient object to access its operations. */ + private final ManagedInstanceKeysClient managedInstanceKeys; + + /** + * Gets the ManagedInstanceKeysClient object to access its operations. + * + * @return the ManagedInstanceKeysClient object. + */ + public ManagedInstanceKeysClient getManagedInstanceKeys() { + return this.managedInstanceKeys; + } + + /** The ManagedInstanceLongTermRetentionPoliciesClient object to access its operations. */ + private final ManagedInstanceLongTermRetentionPoliciesClient managedInstanceLongTermRetentionPolicies; + + /** + * Gets the ManagedInstanceLongTermRetentionPoliciesClient object to access its operations. + * + * @return the ManagedInstanceLongTermRetentionPoliciesClient object. + */ + public ManagedInstanceLongTermRetentionPoliciesClient getManagedInstanceLongTermRetentionPolicies() { + return this.managedInstanceLongTermRetentionPolicies; + } + + /** The ManagedInstanceOperationsClient object to access its operations. */ + private final ManagedInstanceOperationsClient managedInstanceOperations; + + /** + * Gets the ManagedInstanceOperationsClient object to access its operations. + * + * @return the ManagedInstanceOperationsClient object. + */ + public ManagedInstanceOperationsClient getManagedInstanceOperations() { + return this.managedInstanceOperations; + } + + /** The ManagedInstancePrivateEndpointConnectionsClient object to access its operations. */ + private final ManagedInstancePrivateEndpointConnectionsClient managedInstancePrivateEndpointConnections; + + /** + * Gets the ManagedInstancePrivateEndpointConnectionsClient object to access its operations. + * + * @return the ManagedInstancePrivateEndpointConnectionsClient object. + */ + public ManagedInstancePrivateEndpointConnectionsClient getManagedInstancePrivateEndpointConnections() { + return this.managedInstancePrivateEndpointConnections; + } + + /** The ManagedInstancePrivateLinkResourcesClient object to access its operations. */ + private final ManagedInstancePrivateLinkResourcesClient managedInstancePrivateLinkResources; + + /** + * Gets the ManagedInstancePrivateLinkResourcesClient object to access its operations. + * + * @return the ManagedInstancePrivateLinkResourcesClient object. + */ + public ManagedInstancePrivateLinkResourcesClient getManagedInstancePrivateLinkResources() { + return this.managedInstancePrivateLinkResources; + } + + /** The ManagedInstanceTdeCertificatesClient object to access its operations. */ + private final ManagedInstanceTdeCertificatesClient managedInstanceTdeCertificates; + + /** + * Gets the ManagedInstanceTdeCertificatesClient object to access its operations. + * + * @return the ManagedInstanceTdeCertificatesClient object. + */ + public ManagedInstanceTdeCertificatesClient getManagedInstanceTdeCertificates() { + return this.managedInstanceTdeCertificates; + } + + /** The ManagedInstanceVulnerabilityAssessmentsClient object to access its operations. */ + private final ManagedInstanceVulnerabilityAssessmentsClient managedInstanceVulnerabilityAssessments; + + /** + * Gets the ManagedInstanceVulnerabilityAssessmentsClient object to access its operations. + * + * @return the ManagedInstanceVulnerabilityAssessmentsClient object. + */ + public ManagedInstanceVulnerabilityAssessmentsClient getManagedInstanceVulnerabilityAssessments() { + return this.managedInstanceVulnerabilityAssessments; + } + + /** The ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient object to access its operations. */ + private final ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient + managedRestorableDroppedDatabaseBackupShortTermRetentionPolicies; + + /** + * Gets the ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient object to access its operations. + * + * @return the ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient object. + */ + public ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient + getManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies() { + return this.managedRestorableDroppedDatabaseBackupShortTermRetentionPolicies; + } + + /** The ManagedServerSecurityAlertPoliciesClient object to access its operations. */ + private final ManagedServerSecurityAlertPoliciesClient managedServerSecurityAlertPolicies; + + /** + * Gets the ManagedServerSecurityAlertPoliciesClient object to access its operations. + * + * @return the ManagedServerSecurityAlertPoliciesClient object. + */ + public ManagedServerSecurityAlertPoliciesClient getManagedServerSecurityAlertPolicies() { + return this.managedServerSecurityAlertPolicies; + } + + /** The OperationsClient object to access its operations. */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** The PrivateEndpointConnectionsClient object to access its operations. */ + private final PrivateEndpointConnectionsClient privateEndpointConnections; + + /** + * Gets the PrivateEndpointConnectionsClient object to access its operations. + * + * @return the PrivateEndpointConnectionsClient object. + */ + public PrivateEndpointConnectionsClient getPrivateEndpointConnections() { + return this.privateEndpointConnections; + } + + /** The PrivateLinkResourcesClient object to access its operations. */ + private final PrivateLinkResourcesClient privateLinkResources; + + /** + * Gets the PrivateLinkResourcesClient object to access its operations. + * + * @return the PrivateLinkResourcesClient object. + */ + public PrivateLinkResourcesClient getPrivateLinkResources() { + return this.privateLinkResources; + } + + /** The RecoverableManagedDatabasesClient object to access its operations. */ + private final RecoverableManagedDatabasesClient recoverableManagedDatabases; + + /** + * Gets the RecoverableManagedDatabasesClient object to access its operations. + * + * @return the RecoverableManagedDatabasesClient object. + */ + public RecoverableManagedDatabasesClient getRecoverableManagedDatabases() { + return this.recoverableManagedDatabases; + } + + /** The RestorePointsClient object to access its operations. */ + private final RestorePointsClient restorePoints; + + /** + * Gets the RestorePointsClient object to access its operations. + * + * @return the RestorePointsClient object. + */ + public RestorePointsClient getRestorePoints() { + return this.restorePoints; + } + + /** The ServerAdvisorsClient object to access its operations. */ + private final ServerAdvisorsClient serverAdvisors; + + /** + * Gets the ServerAdvisorsClient object to access its operations. + * + * @return the ServerAdvisorsClient object. + */ + public ServerAdvisorsClient getServerAdvisors() { + return this.serverAdvisors; + } + + /** The ServerAutomaticTuningsClient object to access its operations. */ + private final ServerAutomaticTuningsClient serverAutomaticTunings; + + /** + * Gets the ServerAutomaticTuningsClient object to access its operations. + * + * @return the ServerAutomaticTuningsClient object. + */ + public ServerAutomaticTuningsClient getServerAutomaticTunings() { + return this.serverAutomaticTunings; + } + + /** The ServerAzureADAdministratorsClient object to access its operations. */ + private final ServerAzureADAdministratorsClient serverAzureADAdministrators; + + /** + * Gets the ServerAzureADAdministratorsClient object to access its operations. + * + * @return the ServerAzureADAdministratorsClient object. + */ + public ServerAzureADAdministratorsClient getServerAzureADAdministrators() { + return this.serverAzureADAdministrators; + } + + /** The ServerAzureADOnlyAuthenticationsClient object to access its operations. */ + private final ServerAzureADOnlyAuthenticationsClient serverAzureADOnlyAuthentications; + + /** + * Gets the ServerAzureADOnlyAuthenticationsClient object to access its operations. + * + * @return the ServerAzureADOnlyAuthenticationsClient object. + */ + public ServerAzureADOnlyAuthenticationsClient getServerAzureADOnlyAuthentications() { + return this.serverAzureADOnlyAuthentications; + } + + /** The ServerDevOpsAuditSettingsClient object to access its operations. */ + private final ServerDevOpsAuditSettingsClient serverDevOpsAuditSettings; + + /** + * Gets the ServerDevOpsAuditSettingsClient object to access its operations. + * + * @return the ServerDevOpsAuditSettingsClient object. + */ + public ServerDevOpsAuditSettingsClient getServerDevOpsAuditSettings() { + return this.serverDevOpsAuditSettings; + } + + /** The ServerDnsAliasesClient object to access its operations. */ + private final ServerDnsAliasesClient serverDnsAliases; + + /** + * Gets the ServerDnsAliasesClient object to access its operations. + * + * @return the ServerDnsAliasesClient object. + */ + public ServerDnsAliasesClient getServerDnsAliases() { + return this.serverDnsAliases; + } + + /** The ServerKeysClient object to access its operations. */ + private final ServerKeysClient serverKeys; + + /** + * Gets the ServerKeysClient object to access its operations. + * + * @return the ServerKeysClient object. + */ + public ServerKeysClient getServerKeys() { + return this.serverKeys; + } + + /** The ServerOperationsClient object to access its operations. */ + private final ServerOperationsClient serverOperations; + + /** + * Gets the ServerOperationsClient object to access its operations. + * + * @return the ServerOperationsClient object. + */ + public ServerOperationsClient getServerOperations() { + return this.serverOperations; + } + + /** The ServerSecurityAlertPoliciesClient object to access its operations. */ + private final ServerSecurityAlertPoliciesClient serverSecurityAlertPolicies; + + /** + * Gets the ServerSecurityAlertPoliciesClient object to access its operations. + * + * @return the ServerSecurityAlertPoliciesClient object. + */ + public ServerSecurityAlertPoliciesClient getServerSecurityAlertPolicies() { + return this.serverSecurityAlertPolicies; + } + + /** The ServerTrustGroupsClient object to access its operations. */ + private final ServerTrustGroupsClient serverTrustGroups; + + /** + * Gets the ServerTrustGroupsClient object to access its operations. + * + * @return the ServerTrustGroupsClient object. + */ + public ServerTrustGroupsClient getServerTrustGroups() { + return this.serverTrustGroups; + } + + /** The ServerVulnerabilityAssessmentsClient object to access its operations. */ + private final ServerVulnerabilityAssessmentsClient serverVulnerabilityAssessments; + + /** + * Gets the ServerVulnerabilityAssessmentsClient object to access its operations. + * + * @return the ServerVulnerabilityAssessmentsClient object. + */ + public ServerVulnerabilityAssessmentsClient getServerVulnerabilityAssessments() { + return this.serverVulnerabilityAssessments; + } + + /** The SqlAgentsClient object to access its operations. */ + private final SqlAgentsClient sqlAgents; + + /** + * Gets the SqlAgentsClient object to access its operations. + * + * @return the SqlAgentsClient object. + */ + public SqlAgentsClient getSqlAgents() { + return this.sqlAgents; + } + + /** The SubscriptionUsagesClient object to access its operations. */ + private final SubscriptionUsagesClient subscriptionUsages; + + /** + * Gets the SubscriptionUsagesClient object to access its operations. + * + * @return the SubscriptionUsagesClient object. + */ + public SubscriptionUsagesClient getSubscriptionUsages() { + return this.subscriptionUsages; + } + + /** The SyncAgentsClient object to access its operations. */ + private final SyncAgentsClient syncAgents; + + /** + * Gets the SyncAgentsClient object to access its operations. + * + * @return the SyncAgentsClient object. + */ + public SyncAgentsClient getSyncAgents() { + return this.syncAgents; + } + + /** The SyncGroupsClient object to access its operations. */ + private final SyncGroupsClient syncGroups; + + /** + * Gets the SyncGroupsClient object to access its operations. + * + * @return the SyncGroupsClient object. + */ + public SyncGroupsClient getSyncGroups() { + return this.syncGroups; + } + + /** The SyncMembersClient object to access its operations. */ + private final SyncMembersClient syncMembers; + + /** + * Gets the SyncMembersClient object to access its operations. + * + * @return the SyncMembersClient object. + */ + public SyncMembersClient getSyncMembers() { + return this.syncMembers; + } + + /** The TdeCertificatesClient object to access its operations. */ + private final TdeCertificatesClient tdeCertificates; + + /** + * Gets the TdeCertificatesClient object to access its operations. + * + * @return the TdeCertificatesClient object. + */ + public TdeCertificatesClient getTdeCertificates() { + return this.tdeCertificates; + } + + /** The TimeZonesClient object to access its operations. */ + private final TimeZonesClient timeZones; + + /** + * Gets the TimeZonesClient object to access its operations. + * + * @return the TimeZonesClient object. + */ + public TimeZonesClient getTimeZones() { + return this.timeZones; + } + + /** The VirtualNetworkRulesClient object to access its operations. */ + private final VirtualNetworkRulesClient virtualNetworkRules; + + /** + * Gets the VirtualNetworkRulesClient object to access its operations. + * + * @return the VirtualNetworkRulesClient object. + */ + public VirtualNetworkRulesClient getVirtualNetworkRules() { + return this.virtualNetworkRules; + } + + /** The WorkloadClassifiersClient object to access its operations. */ + private final WorkloadClassifiersClient workloadClassifiers; + + /** + * Gets the WorkloadClassifiersClient object to access its operations. + * + * @return the WorkloadClassifiersClient object. + */ + public WorkloadClassifiersClient getWorkloadClassifiers() { + return this.workloadClassifiers; + } + + /** The WorkloadGroupsClient object to access its operations. */ + private final WorkloadGroupsClient workloadGroups; + + /** + * Gets the WorkloadGroupsClient object to access its operations. + * + * @return the WorkloadGroupsClient object. + */ + public WorkloadGroupsClient getWorkloadGroups() { + return this.workloadGroups; + } + + /** The TransparentDataEncryptionsClient object to access its operations. */ + private final TransparentDataEncryptionsClient transparentDataEncryptions; + + /** + * Gets the TransparentDataEncryptionsClient object to access its operations. + * + * @return the TransparentDataEncryptionsClient object. + */ + public TransparentDataEncryptionsClient getTransparentDataEncryptions() { + return this.transparentDataEncryptions; + } + + /** The BackupShortTermRetentionPoliciesClient object to access its operations. */ + private final BackupShortTermRetentionPoliciesClient backupShortTermRetentionPolicies; + + /** + * Gets the BackupShortTermRetentionPoliciesClient object to access its operations. + * + * @return the BackupShortTermRetentionPoliciesClient object. + */ + public BackupShortTermRetentionPoliciesClient getBackupShortTermRetentionPolicies() { + return this.backupShortTermRetentionPolicies; + } + + /** The DatabaseExtensionsOperationsClient object to access its operations. */ + private final DatabaseExtensionsOperationsClient databaseExtensionsOperations; + + /** + * Gets the DatabaseExtensionsOperationsClient object to access its operations. + * + * @return the DatabaseExtensionsOperationsClient object. + */ + public DatabaseExtensionsOperationsClient getDatabaseExtensionsOperations() { + return this.databaseExtensionsOperations; + } + + /** The DatabaseOperationsClient object to access its operations. */ + private final DatabaseOperationsClient databaseOperations; + + /** + * Gets the DatabaseOperationsClient object to access its operations. + * + * @return the DatabaseOperationsClient object. + */ + public DatabaseOperationsClient getDatabaseOperations() { + return this.databaseOperations; + } + + /** The DatabaseUsagesClient object to access its operations. */ + private final DatabaseUsagesClient databaseUsages; + + /** + * Gets the DatabaseUsagesClient object to access its operations. + * + * @return the DatabaseUsagesClient object. + */ + public DatabaseUsagesClient getDatabaseUsages() { + return this.databaseUsages; + } + + /** The LedgerDigestUploadsOperationsClient object to access its operations. */ + private final LedgerDigestUploadsOperationsClient ledgerDigestUploadsOperations; + + /** + * Gets the LedgerDigestUploadsOperationsClient object to access its operations. + * + * @return the LedgerDigestUploadsOperationsClient object. + */ + public LedgerDigestUploadsOperationsClient getLedgerDigestUploadsOperations() { + return this.ledgerDigestUploadsOperations; + } + + /** The OutboundFirewallRulesClient object to access its operations. */ + private final OutboundFirewallRulesClient outboundFirewallRules; + + /** + * Gets the OutboundFirewallRulesClient object to access its operations. + * + * @return the OutboundFirewallRulesClient object. + */ + public OutboundFirewallRulesClient getOutboundFirewallRules() { + return this.outboundFirewallRules; + } + + /** The ServersClient object to access its operations. */ + private final ServersClient servers; + + /** + * Gets the ServersClient object to access its operations. + * + * @return the ServersClient object. + */ + public ServersClient getServers() { + return this.servers; + } + + /** The UsagesClient object to access its operations. */ + private final UsagesClient usages; + + /** + * Gets the UsagesClient object to access its operations. + * + * @return the UsagesClient object. + */ + public UsagesClient getUsages() { + return this.usages; + } + + /** The LongTermRetentionBackupsClient object to access its operations. */ + private final LongTermRetentionBackupsClient longTermRetentionBackups; + + /** + * Gets the LongTermRetentionBackupsClient object to access its operations. + * + * @return the LongTermRetentionBackupsClient object. + */ + public LongTermRetentionBackupsClient getLongTermRetentionBackups() { + return this.longTermRetentionBackups; + } + + /** The LongTermRetentionManagedInstanceBackupsClient object to access its operations. */ + private final LongTermRetentionManagedInstanceBackupsClient longTermRetentionManagedInstanceBackups; + + /** + * Gets the LongTermRetentionManagedInstanceBackupsClient object to access its operations. + * + * @return the LongTermRetentionManagedInstanceBackupsClient object. + */ + public LongTermRetentionManagedInstanceBackupsClient getLongTermRetentionManagedInstanceBackups() { + return this.longTermRetentionManagedInstanceBackups; + } + + /** The ManagedInstancesClient object to access its operations. */ + private final ManagedInstancesClient managedInstances; + + /** + * Gets the ManagedInstancesClient object to access its operations. + * + * @return the ManagedInstancesClient object. + */ + public ManagedInstancesClient getManagedInstances() { + return this.managedInstances; + } + + /** The RestorableDroppedDatabasesClient object to access its operations. */ + private final RestorableDroppedDatabasesClient restorableDroppedDatabases; + + /** + * Gets the RestorableDroppedDatabasesClient object to access its operations. + * + * @return the RestorableDroppedDatabasesClient object. + */ + public RestorableDroppedDatabasesClient getRestorableDroppedDatabases() { + return this.restorableDroppedDatabases; + } + + /** The RestorableDroppedManagedDatabasesClient object to access its operations. */ + private final RestorableDroppedManagedDatabasesClient restorableDroppedManagedDatabases; + + /** + * Gets the RestorableDroppedManagedDatabasesClient object to access its operations. + * + * @return the RestorableDroppedManagedDatabasesClient object. + */ + public RestorableDroppedManagedDatabasesClient getRestorableDroppedManagedDatabases() { + return this.restorableDroppedManagedDatabases; + } + + /** The ServerConnectionPoliciesClient object to access its operations. */ + private final ServerConnectionPoliciesClient serverConnectionPolicies; + + /** + * Gets the ServerConnectionPoliciesClient object to access its operations. + * + * @return the ServerConnectionPoliciesClient object. + */ + public ServerConnectionPoliciesClient getServerConnectionPolicies() { + return this.serverConnectionPolicies; + } + + /** The DistributedAvailabilityGroupsClient object to access its operations. */ + private final DistributedAvailabilityGroupsClient distributedAvailabilityGroups; + + /** + * Gets the DistributedAvailabilityGroupsClient object to access its operations. + * + * @return the DistributedAvailabilityGroupsClient object. + */ + public DistributedAvailabilityGroupsClient getDistributedAvailabilityGroups() { + return this.distributedAvailabilityGroups; + } + + /** The ServerTrustCertificatesClient object to access its operations. */ + private final ServerTrustCertificatesClient serverTrustCertificates; + + /** + * Gets the ServerTrustCertificatesClient object to access its operations. + * + * @return the ServerTrustCertificatesClient object. + */ + public ServerTrustCertificatesClient getServerTrustCertificates() { + return this.serverTrustCertificates; + } + + /** The IPv6FirewallRulesClient object to access its operations. */ + private final IPv6FirewallRulesClient iPv6FirewallRules; + + /** + * Gets the IPv6FirewallRulesClient object to access its operations. + * + * @return the IPv6FirewallRulesClient object. + */ + public IPv6FirewallRulesClient getIPv6FirewallRules() { + return this.iPv6FirewallRules; + } + + /** The EndpointCertificatesClient object to access its operations. */ + private final EndpointCertificatesClient endpointCertificates; + + /** + * Gets the EndpointCertificatesClient object to access its operations. + * + * @return the EndpointCertificatesClient object. + */ + public EndpointCertificatesClient getEndpointCertificates() { + return this.endpointCertificates; + } + + /** The ManagedDatabaseSensitivityLabelsClient object to access its operations. */ + private final ManagedDatabaseSensitivityLabelsClient managedDatabaseSensitivityLabels; + + /** + * Gets the ManagedDatabaseSensitivityLabelsClient object to access its operations. + * + * @return the ManagedDatabaseSensitivityLabelsClient object. + */ + public ManagedDatabaseSensitivityLabelsClient getManagedDatabaseSensitivityLabels() { + return this.managedDatabaseSensitivityLabels; + } + + /** The ManagedDatabaseRecommendedSensitivityLabelsClient object to access its operations. */ + private final ManagedDatabaseRecommendedSensitivityLabelsClient managedDatabaseRecommendedSensitivityLabels; + + /** + * Gets the ManagedDatabaseRecommendedSensitivityLabelsClient object to access its operations. + * + * @return the ManagedDatabaseRecommendedSensitivityLabelsClient object. + */ + public ManagedDatabaseRecommendedSensitivityLabelsClient getManagedDatabaseRecommendedSensitivityLabels() { + return this.managedDatabaseRecommendedSensitivityLabels; + } + + /** The SensitivityLabelsClient object to access its operations. */ + private final SensitivityLabelsClient sensitivityLabels; + + /** + * Gets the SensitivityLabelsClient object to access its operations. + * + * @return the SensitivityLabelsClient object. + */ + public SensitivityLabelsClient getSensitivityLabels() { + return this.sensitivityLabels; + } + + /** The RecommendedSensitivityLabelsClient object to access its operations. */ + private final RecommendedSensitivityLabelsClient recommendedSensitivityLabels; + + /** + * Gets the RecommendedSensitivityLabelsClient object to access its operations. + * + * @return the RecommendedSensitivityLabelsClient object. + */ + public RecommendedSensitivityLabelsClient getRecommendedSensitivityLabels() { + return this.recommendedSensitivityLabels; + } + + /** The ServerBlobAuditingPoliciesClient object to access its operations. */ + private final ServerBlobAuditingPoliciesClient serverBlobAuditingPolicies; + + /** + * Gets the ServerBlobAuditingPoliciesClient object to access its operations. + * + * @return the ServerBlobAuditingPoliciesClient object. + */ + public ServerBlobAuditingPoliciesClient getServerBlobAuditingPolicies() { + return this.serverBlobAuditingPolicies; + } + + /** The DatabaseBlobAuditingPoliciesClient object to access its operations. */ + private final DatabaseBlobAuditingPoliciesClient databaseBlobAuditingPolicies; + + /** + * Gets the DatabaseBlobAuditingPoliciesClient object to access its operations. + * + * @return the DatabaseBlobAuditingPoliciesClient object. + */ + public DatabaseBlobAuditingPoliciesClient getDatabaseBlobAuditingPolicies() { + return this.databaseBlobAuditingPolicies; + } + + /** The ExtendedDatabaseBlobAuditingPoliciesClient object to access its operations. */ + private final ExtendedDatabaseBlobAuditingPoliciesClient extendedDatabaseBlobAuditingPolicies; + + /** + * Gets the ExtendedDatabaseBlobAuditingPoliciesClient object to access its operations. + * + * @return the ExtendedDatabaseBlobAuditingPoliciesClient object. + */ + public ExtendedDatabaseBlobAuditingPoliciesClient getExtendedDatabaseBlobAuditingPolicies() { + return this.extendedDatabaseBlobAuditingPolicies; + } + + /** The ExtendedServerBlobAuditingPoliciesClient object to access its operations. */ + private final ExtendedServerBlobAuditingPoliciesClient extendedServerBlobAuditingPolicies; + + /** + * Gets the ExtendedServerBlobAuditingPoliciesClient object to access its operations. + * + * @return the ExtendedServerBlobAuditingPoliciesClient object. + */ + public ExtendedServerBlobAuditingPoliciesClient getExtendedServerBlobAuditingPolicies() { + return this.extendedServerBlobAuditingPolicies; + } + + /** The DatabaseAdvancedThreatProtectionSettingsClient object to access its operations. */ + private final DatabaseAdvancedThreatProtectionSettingsClient databaseAdvancedThreatProtectionSettings; + + /** + * Gets the DatabaseAdvancedThreatProtectionSettingsClient object to access its operations. + * + * @return the DatabaseAdvancedThreatProtectionSettingsClient object. + */ + public DatabaseAdvancedThreatProtectionSettingsClient getDatabaseAdvancedThreatProtectionSettings() { + return this.databaseAdvancedThreatProtectionSettings; + } + + /** The ServerAdvancedThreatProtectionSettingsClient object to access its operations. */ + private final ServerAdvancedThreatProtectionSettingsClient serverAdvancedThreatProtectionSettings; + + /** + * Gets the ServerAdvancedThreatProtectionSettingsClient object to access its operations. + * + * @return the ServerAdvancedThreatProtectionSettingsClient object. + */ + public ServerAdvancedThreatProtectionSettingsClient getServerAdvancedThreatProtectionSettings() { + return this.serverAdvancedThreatProtectionSettings; + } + + /** The ManagedServerDnsAliasesClient object to access its operations. */ + private final ManagedServerDnsAliasesClient managedServerDnsAliases; + + /** + * Gets the ManagedServerDnsAliasesClient object to access its operations. + * + * @return the ManagedServerDnsAliasesClient object. + */ + public ManagedServerDnsAliasesClient getManagedServerDnsAliases() { + return this.managedServerDnsAliases; + } + + /** The DatabaseSqlVulnerabilityAssessmentBaselinesClient object to access its operations. */ + private final DatabaseSqlVulnerabilityAssessmentBaselinesClient databaseSqlVulnerabilityAssessmentBaselines; + + /** + * Gets the DatabaseSqlVulnerabilityAssessmentBaselinesClient object to access its operations. + * + * @return the DatabaseSqlVulnerabilityAssessmentBaselinesClient object. + */ + public DatabaseSqlVulnerabilityAssessmentBaselinesClient getDatabaseSqlVulnerabilityAssessmentBaselines() { + return this.databaseSqlVulnerabilityAssessmentBaselines; + } + + /** The DatabaseSqlVulnerabilityAssessmentExecuteScansClient object to access its operations. */ + private final DatabaseSqlVulnerabilityAssessmentExecuteScansClient databaseSqlVulnerabilityAssessmentExecuteScans; + + /** + * Gets the DatabaseSqlVulnerabilityAssessmentExecuteScansClient object to access its operations. + * + * @return the DatabaseSqlVulnerabilityAssessmentExecuteScansClient object. + */ + public DatabaseSqlVulnerabilityAssessmentExecuteScansClient getDatabaseSqlVulnerabilityAssessmentExecuteScans() { + return this.databaseSqlVulnerabilityAssessmentExecuteScans; + } + + /** The DatabaseSqlVulnerabilityAssessmentRuleBaselinesClient object to access its operations. */ + private final DatabaseSqlVulnerabilityAssessmentRuleBaselinesClient databaseSqlVulnerabilityAssessmentRuleBaselines; + + /** + * Gets the DatabaseSqlVulnerabilityAssessmentRuleBaselinesClient object to access its operations. + * + * @return the DatabaseSqlVulnerabilityAssessmentRuleBaselinesClient object. + */ + public DatabaseSqlVulnerabilityAssessmentRuleBaselinesClient getDatabaseSqlVulnerabilityAssessmentRuleBaselines() { + return this.databaseSqlVulnerabilityAssessmentRuleBaselines; + } + + /** The DatabaseSqlVulnerabilityAssessmentScanResultsClient object to access its operations. */ + private final DatabaseSqlVulnerabilityAssessmentScanResultsClient databaseSqlVulnerabilityAssessmentScanResults; + + /** + * Gets the DatabaseSqlVulnerabilityAssessmentScanResultsClient object to access its operations. + * + * @return the DatabaseSqlVulnerabilityAssessmentScanResultsClient object. + */ + public DatabaseSqlVulnerabilityAssessmentScanResultsClient getDatabaseSqlVulnerabilityAssessmentScanResults() { + return this.databaseSqlVulnerabilityAssessmentScanResults; + } + + /** The DatabaseSqlVulnerabilityAssessmentScansClient object to access its operations. */ + private final DatabaseSqlVulnerabilityAssessmentScansClient databaseSqlVulnerabilityAssessmentScans; + + /** + * Gets the DatabaseSqlVulnerabilityAssessmentScansClient object to access its operations. + * + * @return the DatabaseSqlVulnerabilityAssessmentScansClient object. + */ + public DatabaseSqlVulnerabilityAssessmentScansClient getDatabaseSqlVulnerabilityAssessmentScans() { + return this.databaseSqlVulnerabilityAssessmentScans; + } + + /** The DatabaseSqlVulnerabilityAssessmentsSettingsClient object to access its operations. */ + private final DatabaseSqlVulnerabilityAssessmentsSettingsClient databaseSqlVulnerabilityAssessmentsSettings; + + /** + * Gets the DatabaseSqlVulnerabilityAssessmentsSettingsClient object to access its operations. + * + * @return the DatabaseSqlVulnerabilityAssessmentsSettingsClient object. + */ + public DatabaseSqlVulnerabilityAssessmentsSettingsClient getDatabaseSqlVulnerabilityAssessmentsSettings() { + return this.databaseSqlVulnerabilityAssessmentsSettings; + } + + /** The ManagedDatabaseAdvancedThreatProtectionSettingsClient object to access its operations. */ + private final ManagedDatabaseAdvancedThreatProtectionSettingsClient managedDatabaseAdvancedThreatProtectionSettings; + + /** + * Gets the ManagedDatabaseAdvancedThreatProtectionSettingsClient object to access its operations. + * + * @return the ManagedDatabaseAdvancedThreatProtectionSettingsClient object. + */ + public ManagedDatabaseAdvancedThreatProtectionSettingsClient getManagedDatabaseAdvancedThreatProtectionSettings() { + return this.managedDatabaseAdvancedThreatProtectionSettings; + } + + /** The ManagedDatabaseRestoreDetailsClient object to access its operations. */ + private final ManagedDatabaseRestoreDetailsClient managedDatabaseRestoreDetails; + + /** + * Gets the ManagedDatabaseRestoreDetailsClient object to access its operations. + * + * @return the ManagedDatabaseRestoreDetailsClient object. + */ + public ManagedDatabaseRestoreDetailsClient getManagedDatabaseRestoreDetails() { + return this.managedDatabaseRestoreDetails; + } + + /** The ManagedDatabasesClient object to access its operations. */ + private final ManagedDatabasesClient managedDatabases; + + /** + * Gets the ManagedDatabasesClient object to access its operations. + * + * @return the ManagedDatabasesClient object. + */ + public ManagedDatabasesClient getManagedDatabases() { + return this.managedDatabases; + } + + /** The ManagedInstanceAdvancedThreatProtectionSettingsClient object to access its operations. */ + private final ManagedInstanceAdvancedThreatProtectionSettingsClient managedInstanceAdvancedThreatProtectionSettings; + + /** + * Gets the ManagedInstanceAdvancedThreatProtectionSettingsClient object to access its operations. + * + * @return the ManagedInstanceAdvancedThreatProtectionSettingsClient object. + */ + public ManagedInstanceAdvancedThreatProtectionSettingsClient getManagedInstanceAdvancedThreatProtectionSettings() { + return this.managedInstanceAdvancedThreatProtectionSettings; + } + + /** The ReplicationLinksClient object to access its operations. */ + private final ReplicationLinksClient replicationLinks; + + /** + * Gets the ReplicationLinksClient object to access its operations. + * + * @return the ReplicationLinksClient object. + */ + public ReplicationLinksClient getReplicationLinks() { + return this.replicationLinks; + } + + /** The SqlVulnerabilityAssessmentBaselinesClient object to access its operations. */ + private final SqlVulnerabilityAssessmentBaselinesClient sqlVulnerabilityAssessmentBaselines; + + /** + * Gets the SqlVulnerabilityAssessmentBaselinesClient object to access its operations. + * + * @return the SqlVulnerabilityAssessmentBaselinesClient object. + */ + public SqlVulnerabilityAssessmentBaselinesClient getSqlVulnerabilityAssessmentBaselines() { + return this.sqlVulnerabilityAssessmentBaselines; + } + + /** The SqlVulnerabilityAssessmentBaselinesOperationsClient object to access its operations. */ + private final SqlVulnerabilityAssessmentBaselinesOperationsClient sqlVulnerabilityAssessmentBaselinesOperations; + + /** + * Gets the SqlVulnerabilityAssessmentBaselinesOperationsClient object to access its operations. + * + * @return the SqlVulnerabilityAssessmentBaselinesOperationsClient object. + */ + public SqlVulnerabilityAssessmentBaselinesOperationsClient getSqlVulnerabilityAssessmentBaselinesOperations() { + return this.sqlVulnerabilityAssessmentBaselinesOperations; + } + + /** The SqlVulnerabilityAssessmentExecuteScansClient object to access its operations. */ + private final SqlVulnerabilityAssessmentExecuteScansClient sqlVulnerabilityAssessmentExecuteScans; + + /** + * Gets the SqlVulnerabilityAssessmentExecuteScansClient object to access its operations. + * + * @return the SqlVulnerabilityAssessmentExecuteScansClient object. + */ + public SqlVulnerabilityAssessmentExecuteScansClient getSqlVulnerabilityAssessmentExecuteScans() { + return this.sqlVulnerabilityAssessmentExecuteScans; + } + + /** The SqlVulnerabilityAssessmentRuleBaselinesClient object to access its operations. */ + private final SqlVulnerabilityAssessmentRuleBaselinesClient sqlVulnerabilityAssessmentRuleBaselines; + + /** + * Gets the SqlVulnerabilityAssessmentRuleBaselinesClient object to access its operations. + * + * @return the SqlVulnerabilityAssessmentRuleBaselinesClient object. + */ + public SqlVulnerabilityAssessmentRuleBaselinesClient getSqlVulnerabilityAssessmentRuleBaselines() { + return this.sqlVulnerabilityAssessmentRuleBaselines; + } + + /** The SqlVulnerabilityAssessmentRuleBaselinesOperationsClient object to access its operations. */ + private final SqlVulnerabilityAssessmentRuleBaselinesOperationsClient + sqlVulnerabilityAssessmentRuleBaselinesOperations; + + /** + * Gets the SqlVulnerabilityAssessmentRuleBaselinesOperationsClient object to access its operations. + * + * @return the SqlVulnerabilityAssessmentRuleBaselinesOperationsClient object. + */ + public SqlVulnerabilityAssessmentRuleBaselinesOperationsClient + getSqlVulnerabilityAssessmentRuleBaselinesOperations() { + return this.sqlVulnerabilityAssessmentRuleBaselinesOperations; + } + + /** The SqlVulnerabilityAssessmentScanResultOperationsClient object to access its operations. */ + private final SqlVulnerabilityAssessmentScanResultOperationsClient sqlVulnerabilityAssessmentScanResultOperations; + + /** + * Gets the SqlVulnerabilityAssessmentScanResultOperationsClient object to access its operations. + * + * @return the SqlVulnerabilityAssessmentScanResultOperationsClient object. + */ + public SqlVulnerabilityAssessmentScanResultOperationsClient getSqlVulnerabilityAssessmentScanResultOperations() { + return this.sqlVulnerabilityAssessmentScanResultOperations; + } + + /** The SqlVulnerabilityAssessmentScansClient object to access its operations. */ + private final SqlVulnerabilityAssessmentScansClient sqlVulnerabilityAssessmentScans; + + /** + * Gets the SqlVulnerabilityAssessmentScansClient object to access its operations. + * + * @return the SqlVulnerabilityAssessmentScansClient object. + */ + public SqlVulnerabilityAssessmentScansClient getSqlVulnerabilityAssessmentScans() { + return this.sqlVulnerabilityAssessmentScans; + } + + /** The SqlVulnerabilityAssessmentsSettingsClient object to access its operations. */ + private final SqlVulnerabilityAssessmentsSettingsClient sqlVulnerabilityAssessmentsSettings; + + /** + * Gets the SqlVulnerabilityAssessmentsSettingsClient object to access its operations. + * + * @return the SqlVulnerabilityAssessmentsSettingsClient object. + */ + public SqlVulnerabilityAssessmentsSettingsClient getSqlVulnerabilityAssessmentsSettings() { + return this.sqlVulnerabilityAssessmentsSettings; + } + + /** The SqlVulnerabilityAssessmentsClient object to access its operations. */ + private final SqlVulnerabilityAssessmentsClient sqlVulnerabilityAssessments; + + /** + * Gets the SqlVulnerabilityAssessmentsClient object to access its operations. + * + * @return the SqlVulnerabilityAssessmentsClient object. + */ + public SqlVulnerabilityAssessmentsClient getSqlVulnerabilityAssessments() { + return this.sqlVulnerabilityAssessments; + } + + /** The ManagedDatabaseMoveOperationsClient object to access its operations. */ + private final ManagedDatabaseMoveOperationsClient managedDatabaseMoveOperations; + + /** + * Gets the ManagedDatabaseMoveOperationsClient object to access its operations. + * + * @return the ManagedDatabaseMoveOperationsClient object. + */ + public ManagedDatabaseMoveOperationsClient getManagedDatabaseMoveOperations() { + return this.managedDatabaseMoveOperations; + } + + /** The ManagedInstanceDtcsClient object to access its operations. */ + private final ManagedInstanceDtcsClient managedInstanceDtcs; + + /** + * Gets the ManagedInstanceDtcsClient object to access its operations. + * + * @return the ManagedInstanceDtcsClient object. + */ + public ManagedInstanceDtcsClient getManagedInstanceDtcs() { + return this.managedInstanceDtcs; + } + + /** The SynapseLinkWorkspacesClient object to access its operations. */ + private final SynapseLinkWorkspacesClient synapseLinkWorkspaces; + + /** + * Gets the SynapseLinkWorkspacesClient object to access its operations. + * + * @return the SynapseLinkWorkspacesClient object. + */ + public SynapseLinkWorkspacesClient getSynapseLinkWorkspaces() { + return this.synapseLinkWorkspaces; + } + + /** The VirtualClustersClient object to access its operations. */ + private final VirtualClustersClient virtualClusters; + + /** + * Gets the VirtualClustersClient object to access its operations. + * + * @return the VirtualClustersClient object. + */ + public VirtualClustersClient getVirtualClusters() { + return this.virtualClusters; + } + + /** + * Initializes an instance of SqlManagementClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param subscriptionId The subscription ID that identifies an Azure subscription. + * @param endpoint server parameter. + */ + SqlManagementClientImpl( + HttpPipeline httpPipeline, + SerializerAdapter serializerAdapter, + Duration defaultPollInterval, + AzureEnvironment environment, + String subscriptionId, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.recoverableDatabases = new RecoverableDatabasesClientImpl(this); + this.dataMaskingPolicies = new DataMaskingPoliciesClientImpl(this); + this.dataMaskingRules = new DataMaskingRulesClientImpl(this); + this.geoBackupPolicies = new GeoBackupPoliciesClientImpl(this); + this.databases = new DatabasesClientImpl(this); + this.elasticPools = new ElasticPoolsClientImpl(this); + this.serverCommunicationLinks = new ServerCommunicationLinksClientImpl(this); + this.serviceObjectives = new ServiceObjectivesClientImpl(this); + this.elasticPoolActivities = new ElasticPoolActivitiesClientImpl(this); + this.elasticPoolDatabaseActivities = new ElasticPoolDatabaseActivitiesClientImpl(this); + this.serverUsages = new ServerUsagesClientImpl(this); + this.databaseAdvisors = new DatabaseAdvisorsClientImpl(this); + this.databaseAutomaticTunings = new DatabaseAutomaticTuningsClientImpl(this); + this.databaseColumns = new DatabaseColumnsClientImpl(this); + this.databaseRecommendedActions = new DatabaseRecommendedActionsClientImpl(this); + this.databaseSchemas = new DatabaseSchemasClientImpl(this); + this.databaseSecurityAlertPolicies = new DatabaseSecurityAlertPoliciesClientImpl(this); + this.databaseTables = new DatabaseTablesClientImpl(this); + this.databaseVulnerabilityAssessmentRuleBaselines = + new DatabaseVulnerabilityAssessmentRuleBaselinesClientImpl(this); + this.databaseVulnerabilityAssessments = new DatabaseVulnerabilityAssessmentsClientImpl(this); + this.databaseVulnerabilityAssessmentScans = new DatabaseVulnerabilityAssessmentScansClientImpl(this); + this.dataWarehouseUserActivitiesOperations = new DataWarehouseUserActivitiesOperationsClientImpl(this); + this.deletedServers = new DeletedServersClientImpl(this); + this.elasticPoolOperations = new ElasticPoolOperationsClientImpl(this); + this.encryptionProtectors = new EncryptionProtectorsClientImpl(this); + this.failoverGroups = new FailoverGroupsClientImpl(this); + this.firewallRules = new FirewallRulesClientImpl(this); + this.instanceFailoverGroups = new InstanceFailoverGroupsClientImpl(this); + this.instancePools = new InstancePoolsClientImpl(this); + this.jobAgents = new JobAgentsClientImpl(this); + this.jobCredentials = new JobCredentialsClientImpl(this); + this.jobExecutions = new JobExecutionsClientImpl(this); + this.jobs = new JobsClientImpl(this); + this.jobStepExecutions = new JobStepExecutionsClientImpl(this); + this.jobSteps = new JobStepsClientImpl(this); + this.jobTargetExecutions = new JobTargetExecutionsClientImpl(this); + this.jobTargetGroups = new JobTargetGroupsClientImpl(this); + this.jobVersions = new JobVersionsClientImpl(this); + this.capabilities = new CapabilitiesClientImpl(this); + this.longTermRetentionPolicies = new LongTermRetentionPoliciesClientImpl(this); + this.maintenanceWindowOptionsOperations = new MaintenanceWindowOptionsOperationsClientImpl(this); + this.maintenanceWindowsOperations = new MaintenanceWindowsOperationsClientImpl(this); + this.managedBackupShortTermRetentionPolicies = new ManagedBackupShortTermRetentionPoliciesClientImpl(this); + this.managedDatabaseColumns = new ManagedDatabaseColumnsClientImpl(this); + this.managedDatabaseQueries = new ManagedDatabaseQueriesClientImpl(this); + this.managedDatabaseSchemas = new ManagedDatabaseSchemasClientImpl(this); + this.managedDatabaseSecurityAlertPolicies = new ManagedDatabaseSecurityAlertPoliciesClientImpl(this); + this.managedDatabaseSecurityEvents = new ManagedDatabaseSecurityEventsClientImpl(this); + this.managedDatabaseTables = new ManagedDatabaseTablesClientImpl(this); + this.managedDatabaseTransparentDataEncryptions = new ManagedDatabaseTransparentDataEncryptionsClientImpl(this); + this.managedDatabaseVulnerabilityAssessmentRuleBaselines = + new ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClientImpl(this); + this.managedDatabaseVulnerabilityAssessments = new ManagedDatabaseVulnerabilityAssessmentsClientImpl(this); + this.managedDatabaseVulnerabilityAssessmentScans = + new ManagedDatabaseVulnerabilityAssessmentScansClientImpl(this); + this.managedInstanceAdministrators = new ManagedInstanceAdministratorsClientImpl(this); + this.managedInstanceAzureADOnlyAuthentications = new ManagedInstanceAzureADOnlyAuthenticationsClientImpl(this); + this.managedInstanceEncryptionProtectors = new ManagedInstanceEncryptionProtectorsClientImpl(this); + this.managedInstanceKeys = new ManagedInstanceKeysClientImpl(this); + this.managedInstanceLongTermRetentionPolicies = new ManagedInstanceLongTermRetentionPoliciesClientImpl(this); + this.managedInstanceOperations = new ManagedInstanceOperationsClientImpl(this); + this.managedInstancePrivateEndpointConnections = new ManagedInstancePrivateEndpointConnectionsClientImpl(this); + this.managedInstancePrivateLinkResources = new ManagedInstancePrivateLinkResourcesClientImpl(this); + this.managedInstanceTdeCertificates = new ManagedInstanceTdeCertificatesClientImpl(this); + this.managedInstanceVulnerabilityAssessments = new ManagedInstanceVulnerabilityAssessmentsClientImpl(this); + this.managedRestorableDroppedDatabaseBackupShortTermRetentionPolicies = + new ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClientImpl(this); + this.managedServerSecurityAlertPolicies = new ManagedServerSecurityAlertPoliciesClientImpl(this); + this.operations = new OperationsClientImpl(this); + this.privateEndpointConnections = new PrivateEndpointConnectionsClientImpl(this); + this.privateLinkResources = new PrivateLinkResourcesClientImpl(this); + this.recoverableManagedDatabases = new RecoverableManagedDatabasesClientImpl(this); + this.restorePoints = new RestorePointsClientImpl(this); + this.serverAdvisors = new ServerAdvisorsClientImpl(this); + this.serverAutomaticTunings = new ServerAutomaticTuningsClientImpl(this); + this.serverAzureADAdministrators = new ServerAzureADAdministratorsClientImpl(this); + this.serverAzureADOnlyAuthentications = new ServerAzureADOnlyAuthenticationsClientImpl(this); + this.serverDevOpsAuditSettings = new ServerDevOpsAuditSettingsClientImpl(this); + this.serverDnsAliases = new ServerDnsAliasesClientImpl(this); + this.serverKeys = new ServerKeysClientImpl(this); + this.serverOperations = new ServerOperationsClientImpl(this); + this.serverSecurityAlertPolicies = new ServerSecurityAlertPoliciesClientImpl(this); + this.serverTrustGroups = new ServerTrustGroupsClientImpl(this); + this.serverVulnerabilityAssessments = new ServerVulnerabilityAssessmentsClientImpl(this); + this.sqlAgents = new SqlAgentsClientImpl(this); + this.subscriptionUsages = new SubscriptionUsagesClientImpl(this); + this.syncAgents = new SyncAgentsClientImpl(this); + this.syncGroups = new SyncGroupsClientImpl(this); + this.syncMembers = new SyncMembersClientImpl(this); + this.tdeCertificates = new TdeCertificatesClientImpl(this); + this.timeZones = new TimeZonesClientImpl(this); + this.virtualNetworkRules = new VirtualNetworkRulesClientImpl(this); + this.workloadClassifiers = new WorkloadClassifiersClientImpl(this); + this.workloadGroups = new WorkloadGroupsClientImpl(this); + this.transparentDataEncryptions = new TransparentDataEncryptionsClientImpl(this); + this.backupShortTermRetentionPolicies = new BackupShortTermRetentionPoliciesClientImpl(this); + this.databaseExtensionsOperations = new DatabaseExtensionsOperationsClientImpl(this); + this.databaseOperations = new DatabaseOperationsClientImpl(this); + this.databaseUsages = new DatabaseUsagesClientImpl(this); + this.ledgerDigestUploadsOperations = new LedgerDigestUploadsOperationsClientImpl(this); + this.outboundFirewallRules = new OutboundFirewallRulesClientImpl(this); + this.servers = new ServersClientImpl(this); + this.usages = new UsagesClientImpl(this); + this.longTermRetentionBackups = new LongTermRetentionBackupsClientImpl(this); + this.longTermRetentionManagedInstanceBackups = new LongTermRetentionManagedInstanceBackupsClientImpl(this); + this.managedInstances = new ManagedInstancesClientImpl(this); + this.restorableDroppedDatabases = new RestorableDroppedDatabasesClientImpl(this); + this.restorableDroppedManagedDatabases = new RestorableDroppedManagedDatabasesClientImpl(this); + this.serverConnectionPolicies = new ServerConnectionPoliciesClientImpl(this); + this.distributedAvailabilityGroups = new DistributedAvailabilityGroupsClientImpl(this); + this.serverTrustCertificates = new ServerTrustCertificatesClientImpl(this); + this.iPv6FirewallRules = new IPv6FirewallRulesClientImpl(this); + this.endpointCertificates = new EndpointCertificatesClientImpl(this); + this.managedDatabaseSensitivityLabels = new ManagedDatabaseSensitivityLabelsClientImpl(this); + this.managedDatabaseRecommendedSensitivityLabels = + new ManagedDatabaseRecommendedSensitivityLabelsClientImpl(this); + this.sensitivityLabels = new SensitivityLabelsClientImpl(this); + this.recommendedSensitivityLabels = new RecommendedSensitivityLabelsClientImpl(this); + this.serverBlobAuditingPolicies = new ServerBlobAuditingPoliciesClientImpl(this); + this.databaseBlobAuditingPolicies = new DatabaseBlobAuditingPoliciesClientImpl(this); + this.extendedDatabaseBlobAuditingPolicies = new ExtendedDatabaseBlobAuditingPoliciesClientImpl(this); + this.extendedServerBlobAuditingPolicies = new ExtendedServerBlobAuditingPoliciesClientImpl(this); + this.databaseAdvancedThreatProtectionSettings = new DatabaseAdvancedThreatProtectionSettingsClientImpl(this); + this.serverAdvancedThreatProtectionSettings = new ServerAdvancedThreatProtectionSettingsClientImpl(this); + this.managedServerDnsAliases = new ManagedServerDnsAliasesClientImpl(this); + this.databaseSqlVulnerabilityAssessmentBaselines = + new DatabaseSqlVulnerabilityAssessmentBaselinesClientImpl(this); + this.databaseSqlVulnerabilityAssessmentExecuteScans = + new DatabaseSqlVulnerabilityAssessmentExecuteScansClientImpl(this); + this.databaseSqlVulnerabilityAssessmentRuleBaselines = + new DatabaseSqlVulnerabilityAssessmentRuleBaselinesClientImpl(this); + this.databaseSqlVulnerabilityAssessmentScanResults = + new DatabaseSqlVulnerabilityAssessmentScanResultsClientImpl(this); + this.databaseSqlVulnerabilityAssessmentScans = new DatabaseSqlVulnerabilityAssessmentScansClientImpl(this); + this.databaseSqlVulnerabilityAssessmentsSettings = + new DatabaseSqlVulnerabilityAssessmentsSettingsClientImpl(this); + this.managedDatabaseAdvancedThreatProtectionSettings = + new ManagedDatabaseAdvancedThreatProtectionSettingsClientImpl(this); + this.managedDatabaseRestoreDetails = new ManagedDatabaseRestoreDetailsClientImpl(this); + this.managedDatabases = new ManagedDatabasesClientImpl(this); + this.managedInstanceAdvancedThreatProtectionSettings = + new ManagedInstanceAdvancedThreatProtectionSettingsClientImpl(this); + this.replicationLinks = new ReplicationLinksClientImpl(this); + this.sqlVulnerabilityAssessmentBaselines = new SqlVulnerabilityAssessmentBaselinesClientImpl(this); + this.sqlVulnerabilityAssessmentBaselinesOperations = + new SqlVulnerabilityAssessmentBaselinesOperationsClientImpl(this); + this.sqlVulnerabilityAssessmentExecuteScans = new SqlVulnerabilityAssessmentExecuteScansClientImpl(this); + this.sqlVulnerabilityAssessmentRuleBaselines = new SqlVulnerabilityAssessmentRuleBaselinesClientImpl(this); + this.sqlVulnerabilityAssessmentRuleBaselinesOperations = + new SqlVulnerabilityAssessmentRuleBaselinesOperationsClientImpl(this); + this.sqlVulnerabilityAssessmentScanResultOperations = + new SqlVulnerabilityAssessmentScanResultOperationsClientImpl(this); + this.sqlVulnerabilityAssessmentScans = new SqlVulnerabilityAssessmentScansClientImpl(this); + this.sqlVulnerabilityAssessmentsSettings = new SqlVulnerabilityAssessmentsSettingsClientImpl(this); + this.sqlVulnerabilityAssessments = new SqlVulnerabilityAssessmentsClientImpl(this); + this.managedDatabaseMoveOperations = new ManagedDatabaseMoveOperationsClientImpl(this); + this.managedInstanceDtcs = new ManagedInstanceDtcsClientImpl(this); + this.synapseLinkWorkspaces = new SynapseLinkWorkspacesClientImpl(this); + this.virtualClusters = new VirtualClustersClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + return CoreUtils.mergeContexts(this.getContext(), context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult( + Mono>> activationResponse, + HttpPipeline httpPipeline, + Type pollResultType, + Type finalResultType, + Context context) { + return PollerFactory + .create( + serializerAdapter, + httpPipeline, + pollResultType, + finalResultType, + defaultPollInterval, + activationResponse, + context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = + new HttpResponseImpl( + lroError.getResponseStatusCode(), lroError.getResponseHeaders(), lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = + this + .getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + LOGGER.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(s); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SqlManagementClientImpl.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentBaselinesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentBaselinesClientImpl.java new file mode 100644 index 0000000000000..db63b90ad4556 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentBaselinesClientImpl.java @@ -0,0 +1,637 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.SqlVulnerabilityAssessmentBaselinesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseSqlVulnerabilityAssessmentBaselineSetInner; +import com.azure.resourcemanager.sql.generated.models.BaselineName; +import com.azure.resourcemanager.sql.generated.models.DatabaseSqlVulnerabilityAssessmentBaselineSetListResult; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in SqlVulnerabilityAssessmentBaselinesClient. + */ +public final class SqlVulnerabilityAssessmentBaselinesClientImpl implements SqlVulnerabilityAssessmentBaselinesClient { + /** The proxy service used to perform REST calls. */ + private final SqlVulnerabilityAssessmentBaselinesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of SqlVulnerabilityAssessmentBaselinesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SqlVulnerabilityAssessmentBaselinesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + SqlVulnerabilityAssessmentBaselinesService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientSqlVulnerabilityAssessmentBaselines to be used by + * the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + public interface SqlVulnerabilityAssessmentBaselinesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/baselines") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySqlVulnerabilityAssessment( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @QueryParam("systemDatabaseName") String systemDatabaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/baselines/{baselineName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("baselineName") BaselineName baselineName, + @QueryParam("systemDatabaseName") String systemDatabaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySqlVulnerabilityAssessmentNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's sql vulnerability assessment rule baselines along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listBySqlVulnerabilityAssessmentSinglePageAsync( + String resourceGroupName, String serverName, VulnerabilityAssessmentName vulnerabilityAssessmentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String systemDatabaseName = "master"; + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listBySqlVulnerabilityAssessment( + this.client.getEndpoint(), + resourceGroupName, + serverName, + vulnerabilityAssessmentName, + systemDatabaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's sql vulnerability assessment rule baselines along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listBySqlVulnerabilityAssessmentSinglePageAsync( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String systemDatabaseName = "master"; + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySqlVulnerabilityAssessment( + this.client.getEndpoint(), + resourceGroupName, + serverName, + vulnerabilityAssessmentName, + systemDatabaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's sql vulnerability assessment rule baselines as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySqlVulnerabilityAssessmentAsync( + String resourceGroupName, String serverName, VulnerabilityAssessmentName vulnerabilityAssessmentName) { + return new PagedFlux<>( + () -> + listBySqlVulnerabilityAssessmentSinglePageAsync( + resourceGroupName, serverName, vulnerabilityAssessmentName), + nextLink -> listBySqlVulnerabilityAssessmentNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's sql vulnerability assessment rule baselines as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySqlVulnerabilityAssessmentAsync( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + return new PagedFlux<>( + () -> + listBySqlVulnerabilityAssessmentSinglePageAsync( + resourceGroupName, serverName, vulnerabilityAssessmentName, context), + nextLink -> listBySqlVulnerabilityAssessmentNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's sql vulnerability assessment rule baselines as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySqlVulnerabilityAssessment( + String resourceGroupName, String serverName, VulnerabilityAssessmentName vulnerabilityAssessmentName) { + return new PagedIterable<>( + listBySqlVulnerabilityAssessmentAsync(resourceGroupName, serverName, vulnerabilityAssessmentName)); + } + + /** + * Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's sql vulnerability assessment rule baselines as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySqlVulnerabilityAssessment( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + return new PagedIterable<>( + listBySqlVulnerabilityAssessmentAsync(resourceGroupName, serverName, vulnerabilityAssessmentName, context)); + } + + /** + * Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's sql vulnerability assessment rule baselines along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (baselineName == null) { + return Mono.error(new IllegalArgumentException("Parameter baselineName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String systemDatabaseName = "master"; + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + vulnerabilityAssessmentName, + baselineName, + systemDatabaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's sql vulnerability assessment rule baselines along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (baselineName == null) { + return Mono.error(new IllegalArgumentException("Parameter baselineName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String systemDatabaseName = "master"; + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + vulnerabilityAssessmentName, + baselineName, + systemDatabaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's sql vulnerability assessment rule baselines on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName) { + return getWithResponseAsync(resourceGroupName, serverName, vulnerabilityAssessmentName, baselineName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's sql vulnerability assessment rule baselines along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + Context context) { + return getWithResponseAsync(resourceGroupName, serverName, vulnerabilityAssessmentName, baselineName, context) + .block(); + } + + /** + * Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's sql vulnerability assessment rule baselines. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseSqlVulnerabilityAssessmentBaselineSetInner get( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName) { + return getWithResponse(resourceGroupName, serverName, vulnerabilityAssessmentName, baselineName, Context.NONE) + .getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Vulnerability Assessments baseline set along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listBySqlVulnerabilityAssessmentNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service.listBySqlVulnerabilityAssessmentNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Vulnerability Assessments baseline set along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listBySqlVulnerabilityAssessmentNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySqlVulnerabilityAssessmentNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentBaselinesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentBaselinesImpl.java new file mode 100644 index 0000000000000..602bce472d2f0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentBaselinesImpl.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.SqlVulnerabilityAssessmentBaselinesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseSqlVulnerabilityAssessmentBaselineSetInner; +import com.azure.resourcemanager.sql.generated.models.BaselineName; +import com.azure.resourcemanager.sql.generated.models.DatabaseSqlVulnerabilityAssessmentBaselineSet; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentBaselines; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +public final class SqlVulnerabilityAssessmentBaselinesImpl implements SqlVulnerabilityAssessmentBaselines { + private static final ClientLogger LOGGER = new ClientLogger(SqlVulnerabilityAssessmentBaselinesImpl.class); + + private final SqlVulnerabilityAssessmentBaselinesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public SqlVulnerabilityAssessmentBaselinesImpl( + SqlVulnerabilityAssessmentBaselinesClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listBySqlVulnerabilityAssessment( + String resourceGroupName, String serverName, VulnerabilityAssessmentName vulnerabilityAssessmentName) { + PagedIterable inner = + this + .serviceClient() + .listBySqlVulnerabilityAssessment(resourceGroupName, serverName, vulnerabilityAssessmentName); + return Utils + .mapPage(inner, inner1 -> new DatabaseSqlVulnerabilityAssessmentBaselineSetImpl(inner1, this.manager())); + } + + public PagedIterable listBySqlVulnerabilityAssessment( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listBySqlVulnerabilityAssessment(resourceGroupName, serverName, vulnerabilityAssessmentName, context); + return Utils + .mapPage(inner, inner1 -> new DatabaseSqlVulnerabilityAssessmentBaselineSetImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, serverName, vulnerabilityAssessmentName, baselineName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatabaseSqlVulnerabilityAssessmentBaselineSetImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DatabaseSqlVulnerabilityAssessmentBaselineSet get( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName) { + DatabaseSqlVulnerabilityAssessmentBaselineSetInner inner = + this.serviceClient().get(resourceGroupName, serverName, vulnerabilityAssessmentName, baselineName); + if (inner != null) { + return new DatabaseSqlVulnerabilityAssessmentBaselineSetImpl(inner, this.manager()); + } else { + return null; + } + } + + private SqlVulnerabilityAssessmentBaselinesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentBaselinesOperationsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentBaselinesOperationsClientImpl.java new file mode 100644 index 0000000000000..a04e792fb7bad --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentBaselinesOperationsClientImpl.java @@ -0,0 +1,318 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.SqlVulnerabilityAssessmentBaselinesOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseSqlVulnerabilityAssessmentBaselineSetInner; +import com.azure.resourcemanager.sql.generated.models.BaselineName; +import com.azure.resourcemanager.sql.generated.models.DatabaseSqlVulnerabilityAssessmentRuleBaselineListInput; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * SqlVulnerabilityAssessmentBaselinesOperationsClient. + */ +public final class SqlVulnerabilityAssessmentBaselinesOperationsClientImpl + implements SqlVulnerabilityAssessmentBaselinesOperationsClient { + /** The proxy service used to perform REST calls. */ + private final SqlVulnerabilityAssessmentBaselinesOperationsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of SqlVulnerabilityAssessmentBaselinesOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SqlVulnerabilityAssessmentBaselinesOperationsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + SqlVulnerabilityAssessmentBaselinesOperationsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientSqlVulnerabilityAssessmentBaselinesOperations to + * be used by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + public interface SqlVulnerabilityAssessmentBaselinesOperationsService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/baselines/{baselineName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("baselineName") BaselineName baselineName, + @QueryParam("systemDatabaseName") String systemDatabaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DatabaseSqlVulnerabilityAssessmentRuleBaselineListInput parameters, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Add a database's vulnerability assessment rule baseline 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 serverName The name of the server. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param parameters The requested rule baseline resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database sql vulnerability assessment baseline set along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + DatabaseSqlVulnerabilityAssessmentRuleBaselineListInput parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (baselineName == null) { + return Mono.error(new IllegalArgumentException("Parameter baselineName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String systemDatabaseName = "master"; + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + vulnerabilityAssessmentName, + baselineName, + systemDatabaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Add a database's vulnerability assessment rule baseline 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 serverName The name of the server. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param parameters The requested rule baseline resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database sql vulnerability assessment baseline set along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + DatabaseSqlVulnerabilityAssessmentRuleBaselineListInput parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (baselineName == null) { + return Mono.error(new IllegalArgumentException("Parameter baselineName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String systemDatabaseName = "master"; + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + vulnerabilityAssessmentName, + baselineName, + systemDatabaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Add a database's vulnerability assessment rule baseline 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 serverName The name of the server. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param parameters The requested rule baseline resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database sql vulnerability assessment baseline set on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + DatabaseSqlVulnerabilityAssessmentRuleBaselineListInput parameters) { + return createOrUpdateWithResponseAsync( + resourceGroupName, serverName, vulnerabilityAssessmentName, baselineName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Add a database's vulnerability assessment rule baseline 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 serverName The name of the server. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param parameters The requested rule baseline resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database sql vulnerability assessment baseline set along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + DatabaseSqlVulnerabilityAssessmentRuleBaselineListInput parameters, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, serverName, vulnerabilityAssessmentName, baselineName, parameters, context) + .block(); + } + + /** + * Add a database's vulnerability assessment rule baseline 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 serverName The name of the server. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param parameters The requested rule baseline resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database sql vulnerability assessment baseline set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseSqlVulnerabilityAssessmentBaselineSetInner createOrUpdate( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + DatabaseSqlVulnerabilityAssessmentRuleBaselineListInput parameters) { + return createOrUpdateWithResponse( + resourceGroupName, serverName, vulnerabilityAssessmentName, baselineName, parameters, Context.NONE) + .getValue(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentBaselinesOperationsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentBaselinesOperationsImpl.java new file mode 100644 index 0000000000000..e313e10e63c31 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentBaselinesOperationsImpl.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.SqlVulnerabilityAssessmentBaselinesOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseSqlVulnerabilityAssessmentBaselineSetInner; +import com.azure.resourcemanager.sql.generated.models.BaselineName; +import com.azure.resourcemanager.sql.generated.models.DatabaseSqlVulnerabilityAssessmentBaselineSet; +import com.azure.resourcemanager.sql.generated.models.DatabaseSqlVulnerabilityAssessmentRuleBaselineListInput; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentBaselinesOperations; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +public final class SqlVulnerabilityAssessmentBaselinesOperationsImpl + implements SqlVulnerabilityAssessmentBaselinesOperations { + private static final ClientLogger LOGGER = + new ClientLogger(SqlVulnerabilityAssessmentBaselinesOperationsImpl.class); + + private final SqlVulnerabilityAssessmentBaselinesOperationsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public SqlVulnerabilityAssessmentBaselinesOperationsImpl( + SqlVulnerabilityAssessmentBaselinesOperationsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + DatabaseSqlVulnerabilityAssessmentRuleBaselineListInput parameters, + Context context) { + Response inner = + this + .serviceClient() + .createOrUpdateWithResponse( + resourceGroupName, serverName, vulnerabilityAssessmentName, baselineName, parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatabaseSqlVulnerabilityAssessmentBaselineSetImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DatabaseSqlVulnerabilityAssessmentBaselineSet createOrUpdate( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + DatabaseSqlVulnerabilityAssessmentRuleBaselineListInput parameters) { + DatabaseSqlVulnerabilityAssessmentBaselineSetInner inner = + this + .serviceClient() + .createOrUpdate(resourceGroupName, serverName, vulnerabilityAssessmentName, baselineName, parameters); + if (inner != null) { + return new DatabaseSqlVulnerabilityAssessmentBaselineSetImpl(inner, this.manager()); + } else { + return null; + } + } + + private SqlVulnerabilityAssessmentBaselinesOperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentExecuteScansClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentExecuteScansClientImpl.java new file mode 100644 index 0000000000000..338fd3fb292e8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentExecuteScansClientImpl.java @@ -0,0 +1,371 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.SqlVulnerabilityAssessmentExecuteScansClient; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * SqlVulnerabilityAssessmentExecuteScansClient. + */ +public final class SqlVulnerabilityAssessmentExecuteScansClientImpl + implements SqlVulnerabilityAssessmentExecuteScansClient { + /** The proxy service used to perform REST calls. */ + private final SqlVulnerabilityAssessmentExecuteScansService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of SqlVulnerabilityAssessmentExecuteScansClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SqlVulnerabilityAssessmentExecuteScansClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + SqlVulnerabilityAssessmentExecuteScansService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientSqlVulnerabilityAssessmentExecuteScans to be used + * by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + public interface SqlVulnerabilityAssessmentExecuteScansService { + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/initiateScan") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> execute( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @QueryParam("systemDatabaseName") String systemDatabaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> executeWithResponseAsync( + String resourceGroupName, String serverName, VulnerabilityAssessmentName vulnerabilityAssessmentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String systemDatabaseName = "master"; + final String apiVersion = "2022-02-01-preview"; + return FluxUtil + .withContext( + context -> + service + .execute( + this.client.getEndpoint(), + resourceGroupName, + serverName, + vulnerabilityAssessmentName, + systemDatabaseName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> executeWithResponseAsync( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String systemDatabaseName = "master"; + final String apiVersion = "2022-02-01-preview"; + context = this.client.mergeContext(context); + return service + .execute( + this.client.getEndpoint(), + resourceGroupName, + serverName, + vulnerabilityAssessmentName, + systemDatabaseName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginExecuteAsync( + String resourceGroupName, String serverName, VulnerabilityAssessmentName vulnerabilityAssessmentName) { + Mono>> mono = + executeWithResponseAsync(resourceGroupName, serverName, vulnerabilityAssessmentName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginExecuteAsync( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + executeWithResponseAsync(resourceGroupName, serverName, vulnerabilityAssessmentName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginExecute( + String resourceGroupName, String serverName, VulnerabilityAssessmentName vulnerabilityAssessmentName) { + return beginExecuteAsync(resourceGroupName, serverName, vulnerabilityAssessmentName).getSyncPoller(); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginExecute( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + return beginExecuteAsync(resourceGroupName, serverName, vulnerabilityAssessmentName, context).getSyncPoller(); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono executeAsync( + String resourceGroupName, String serverName, VulnerabilityAssessmentName vulnerabilityAssessmentName) { + return beginExecuteAsync(resourceGroupName, serverName, vulnerabilityAssessmentName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono executeAsync( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + return beginExecuteAsync(resourceGroupName, serverName, vulnerabilityAssessmentName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void execute( + String resourceGroupName, String serverName, VulnerabilityAssessmentName vulnerabilityAssessmentName) { + executeAsync(resourceGroupName, serverName, vulnerabilityAssessmentName).block(); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void execute( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + executeAsync(resourceGroupName, serverName, vulnerabilityAssessmentName, context).block(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentExecuteScansImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentExecuteScansImpl.java new file mode 100644 index 0000000000000..413b5e03aa9c7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentExecuteScansImpl.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.SqlVulnerabilityAssessmentExecuteScansClient; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentExecuteScans; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +public final class SqlVulnerabilityAssessmentExecuteScansImpl implements SqlVulnerabilityAssessmentExecuteScans { + private static final ClientLogger LOGGER = new ClientLogger(SqlVulnerabilityAssessmentExecuteScansImpl.class); + + private final SqlVulnerabilityAssessmentExecuteScansClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public SqlVulnerabilityAssessmentExecuteScansImpl( + SqlVulnerabilityAssessmentExecuteScansClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void execute( + String resourceGroupName, String serverName, VulnerabilityAssessmentName vulnerabilityAssessmentName) { + this.serviceClient().execute(resourceGroupName, serverName, vulnerabilityAssessmentName); + } + + public void execute( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + this.serviceClient().execute(resourceGroupName, serverName, vulnerabilityAssessmentName, context); + } + + private SqlVulnerabilityAssessmentExecuteScansClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentImpl.java new file mode 100644 index 0000000000000..ed08648ffebb7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentImpl.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.SqlVulnerabilityAssessmentInner; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessment; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentState; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +public final class SqlVulnerabilityAssessmentImpl + implements SqlVulnerabilityAssessment, SqlVulnerabilityAssessment.Definition, SqlVulnerabilityAssessment.Update { + private SqlVulnerabilityAssessmentInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public SqlVulnerabilityAssessmentState state() { + return this.innerModel().state(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public SqlVulnerabilityAssessmentInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private VulnerabilityAssessmentName vulnerabilityAssessmentName; + + public SqlVulnerabilityAssessmentImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public SqlVulnerabilityAssessment create() { + this.innerObject = + serviceManager + .serviceClient() + .getSqlVulnerabilityAssessmentsSettings() + .createOrUpdateWithResponse( + resourceGroupName, serverName, vulnerabilityAssessmentName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public SqlVulnerabilityAssessment create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSqlVulnerabilityAssessmentsSettings() + .createOrUpdateWithResponse( + resourceGroupName, serverName, vulnerabilityAssessmentName, this.innerModel(), context) + .getValue(); + return this; + } + + SqlVulnerabilityAssessmentImpl( + VulnerabilityAssessmentName name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new SqlVulnerabilityAssessmentInner(); + this.serviceManager = serviceManager; + this.vulnerabilityAssessmentName = name; + } + + public SqlVulnerabilityAssessmentImpl update() { + return this; + } + + public SqlVulnerabilityAssessment apply() { + this.innerObject = + serviceManager + .serviceClient() + .getSqlVulnerabilityAssessmentsSettings() + .createOrUpdateWithResponse( + resourceGroupName, serverName, vulnerabilityAssessmentName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public SqlVulnerabilityAssessment apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSqlVulnerabilityAssessmentsSettings() + .createOrUpdateWithResponse( + resourceGroupName, serverName, vulnerabilityAssessmentName, this.innerModel(), context) + .getValue(); + return this; + } + + SqlVulnerabilityAssessmentImpl( + SqlVulnerabilityAssessmentInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.vulnerabilityAssessmentName = + VulnerabilityAssessmentName + .fromString(Utils.getValueFromIdByName(innerObject.id(), "sqlVulnerabilityAssessments")); + } + + public SqlVulnerabilityAssessment refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getSqlVulnerabilityAssessmentsSettings() + .getWithResponse(resourceGroupName, serverName, vulnerabilityAssessmentName, Context.NONE) + .getValue(); + return this; + } + + public SqlVulnerabilityAssessment refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSqlVulnerabilityAssessmentsSettings() + .getWithResponse(resourceGroupName, serverName, vulnerabilityAssessmentName, context) + .getValue(); + return this; + } + + public SqlVulnerabilityAssessmentImpl withState(SqlVulnerabilityAssessmentState state) { + this.innerModel().withState(state); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentRuleBaselinesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentRuleBaselinesClientImpl.java new file mode 100644 index 0000000000000..99f28c52302e9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentRuleBaselinesClientImpl.java @@ -0,0 +1,964 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.SqlVulnerabilityAssessmentRuleBaselinesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseSqlVulnerabilityAssessmentRuleBaselineInner; +import com.azure.resourcemanager.sql.generated.models.BaselineName; +import com.azure.resourcemanager.sql.generated.models.DatabaseSqlVulnerabilityAssessmentRuleBaselineInput; +import com.azure.resourcemanager.sql.generated.models.DatabaseSqlVulnerabilityAssessmentRuleBaselineListResult; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * SqlVulnerabilityAssessmentRuleBaselinesClient. + */ +public final class SqlVulnerabilityAssessmentRuleBaselinesClientImpl + implements SqlVulnerabilityAssessmentRuleBaselinesClient { + /** The proxy service used to perform REST calls. */ + private final SqlVulnerabilityAssessmentRuleBaselinesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of SqlVulnerabilityAssessmentRuleBaselinesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SqlVulnerabilityAssessmentRuleBaselinesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + SqlVulnerabilityAssessmentRuleBaselinesService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientSqlVulnerabilityAssessmentRuleBaselines to be used + * by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + public interface SqlVulnerabilityAssessmentRuleBaselinesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/baselines/{baselineName}" + + "/rules") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByBaseline( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("baselineName") BaselineName baselineName, + @QueryParam("systemDatabaseName") String systemDatabaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/baselines/{baselineName}" + + "/rules/{ruleId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("baselineName") BaselineName baselineName, + @PathParam("ruleId") String ruleId, + @QueryParam("systemDatabaseName") String systemDatabaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/baselines/{baselineName}" + + "/rules/{ruleId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("baselineName") BaselineName baselineName, + @PathParam("ruleId") String ruleId, + @QueryParam("systemDatabaseName") String systemDatabaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DatabaseSqlVulnerabilityAssessmentRuleBaselineInput parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByBaselineNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a system database's sql 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a system database's sql vulnerability assessment rule baseline along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBaselineSinglePageAsync( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (baselineName == null) { + return Mono.error(new IllegalArgumentException("Parameter baselineName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String systemDatabaseName = "master"; + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByBaseline( + this.client.getEndpoint(), + resourceGroupName, + serverName, + vulnerabilityAssessmentName, + baselineName, + systemDatabaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a system database's sql 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a system database's sql vulnerability assessment rule baseline along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBaselineSinglePageAsync( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (baselineName == null) { + return Mono.error(new IllegalArgumentException("Parameter baselineName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String systemDatabaseName = "master"; + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByBaseline( + this.client.getEndpoint(), + resourceGroupName, + serverName, + vulnerabilityAssessmentName, + baselineName, + systemDatabaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a system database's sql 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a system database's sql vulnerability assessment rule baseline as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBaselineAsync( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName) { + return new PagedFlux<>( + () -> + listByBaselineSinglePageAsync(resourceGroupName, serverName, vulnerabilityAssessmentName, baselineName), + nextLink -> listByBaselineNextSinglePageAsync(nextLink)); + } + + /** + * Gets a system database's sql 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a system database's sql vulnerability assessment rule baseline as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBaselineAsync( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + Context context) { + return new PagedFlux<>( + () -> + listByBaselineSinglePageAsync( + resourceGroupName, serverName, vulnerabilityAssessmentName, baselineName, context), + nextLink -> listByBaselineNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a system database's sql 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a system database's sql vulnerability assessment rule baseline as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBaseline( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName) { + return new PagedIterable<>( + listByBaselineAsync(resourceGroupName, serverName, vulnerabilityAssessmentName, baselineName)); + } + + /** + * Gets a system database's sql 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a system database's sql vulnerability assessment rule baseline as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBaseline( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + Context context) { + return new PagedIterable<>( + listByBaselineAsync(resourceGroupName, serverName, vulnerabilityAssessmentName, baselineName, context)); + } + + /** + * Gets a system database's sql 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param ruleId The vulnerability assessment rule ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a system database's sql vulnerability assessment rule baseline along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (baselineName == null) { + return Mono.error(new IllegalArgumentException("Parameter baselineName is required and cannot be null.")); + } + if (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String systemDatabaseName = "master"; + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + vulnerabilityAssessmentName, + baselineName, + ruleId, + systemDatabaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a system database's sql 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param ruleId The vulnerability assessment rule ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a system database's sql vulnerability assessment rule baseline along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (baselineName == null) { + return Mono.error(new IllegalArgumentException("Parameter baselineName is required and cannot be null.")); + } + if (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String systemDatabaseName = "master"; + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + vulnerabilityAssessmentName, + baselineName, + ruleId, + systemDatabaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a system database's sql 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param ruleId The vulnerability assessment rule ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a system database's sql vulnerability assessment rule baseline on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId) { + return getWithResponseAsync(resourceGroupName, serverName, vulnerabilityAssessmentName, baselineName, ruleId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a system database's sql 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param ruleId The vulnerability assessment rule ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a system database's sql vulnerability assessment rule baseline along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId, + Context context) { + return getWithResponseAsync( + resourceGroupName, serverName, vulnerabilityAssessmentName, baselineName, ruleId, context) + .block(); + } + + /** + * Gets a system database's sql 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param ruleId The vulnerability assessment rule ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a system database's sql vulnerability assessment rule baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseSqlVulnerabilityAssessmentRuleBaselineInner get( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId) { + return getWithResponse( + resourceGroupName, serverName, vulnerabilityAssessmentName, baselineName, ruleId, Context.NONE) + .getValue(); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param ruleId The vulnerability assessment rule ID. + * @param parameters The requested rule baseline resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database sql vulnerability assessment rule baseline along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId, + DatabaseSqlVulnerabilityAssessmentRuleBaselineInput parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (baselineName == null) { + return Mono.error(new IllegalArgumentException("Parameter baselineName is required and cannot be null.")); + } + if (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String systemDatabaseName = "master"; + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + vulnerabilityAssessmentName, + baselineName, + ruleId, + systemDatabaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param ruleId The vulnerability assessment rule ID. + * @param parameters The requested rule baseline resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database sql vulnerability assessment rule baseline along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId, + DatabaseSqlVulnerabilityAssessmentRuleBaselineInput parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (baselineName == null) { + return Mono.error(new IllegalArgumentException("Parameter baselineName is required and cannot be null.")); + } + if (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String systemDatabaseName = "master"; + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + vulnerabilityAssessmentName, + baselineName, + ruleId, + systemDatabaseName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param ruleId The vulnerability assessment rule ID. + * @param parameters The requested rule baseline resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database sql vulnerability assessment rule baseline on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId, + DatabaseSqlVulnerabilityAssessmentRuleBaselineInput parameters) { + return createOrUpdateWithResponseAsync( + resourceGroupName, serverName, vulnerabilityAssessmentName, baselineName, ruleId, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param ruleId The vulnerability assessment rule ID. + * @param parameters The requested rule baseline resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database sql vulnerability assessment rule baseline along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId, + DatabaseSqlVulnerabilityAssessmentRuleBaselineInput parameters, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, serverName, vulnerabilityAssessmentName, baselineName, ruleId, parameters, context) + .block(); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param ruleId The vulnerability assessment rule ID. + * @param parameters The requested rule baseline resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database sql vulnerability assessment rule baseline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseSqlVulnerabilityAssessmentRuleBaselineInner createOrUpdate( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId, + DatabaseSqlVulnerabilityAssessmentRuleBaselineInput parameters) { + return createOrUpdateWithResponse( + resourceGroupName, + serverName, + vulnerabilityAssessmentName, + baselineName, + ruleId, + parameters, + Context.NONE) + .getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Vulnerability Assessments rule baseline along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBaselineNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByBaselineNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Vulnerability Assessments rule baseline along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBaselineNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByBaselineNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentRuleBaselinesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentRuleBaselinesImpl.java new file mode 100644 index 0000000000000..1be82052670f7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentRuleBaselinesImpl.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.SqlVulnerabilityAssessmentRuleBaselinesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseSqlVulnerabilityAssessmentRuleBaselineInner; +import com.azure.resourcemanager.sql.generated.models.BaselineName; +import com.azure.resourcemanager.sql.generated.models.DatabaseSqlVulnerabilityAssessmentRuleBaseline; +import com.azure.resourcemanager.sql.generated.models.DatabaseSqlVulnerabilityAssessmentRuleBaselineInput; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentRuleBaselines; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +public final class SqlVulnerabilityAssessmentRuleBaselinesImpl implements SqlVulnerabilityAssessmentRuleBaselines { + private static final ClientLogger LOGGER = new ClientLogger(SqlVulnerabilityAssessmentRuleBaselinesImpl.class); + + private final SqlVulnerabilityAssessmentRuleBaselinesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public SqlVulnerabilityAssessmentRuleBaselinesImpl( + SqlVulnerabilityAssessmentRuleBaselinesClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByBaseline( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName) { + PagedIterable inner = + this + .serviceClient() + .listByBaseline(resourceGroupName, serverName, vulnerabilityAssessmentName, baselineName); + return Utils + .mapPage(inner, inner1 -> new DatabaseSqlVulnerabilityAssessmentRuleBaselineImpl(inner1, this.manager())); + } + + public PagedIterable listByBaseline( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByBaseline(resourceGroupName, serverName, vulnerabilityAssessmentName, baselineName, context); + return Utils + .mapPage(inner, inner1 -> new DatabaseSqlVulnerabilityAssessmentRuleBaselineImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse( + resourceGroupName, serverName, vulnerabilityAssessmentName, baselineName, ruleId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatabaseSqlVulnerabilityAssessmentRuleBaselineImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DatabaseSqlVulnerabilityAssessmentRuleBaseline get( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId) { + DatabaseSqlVulnerabilityAssessmentRuleBaselineInner inner = + this.serviceClient().get(resourceGroupName, serverName, vulnerabilityAssessmentName, baselineName, ruleId); + if (inner != null) { + return new DatabaseSqlVulnerabilityAssessmentRuleBaselineImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId, + DatabaseSqlVulnerabilityAssessmentRuleBaselineInput parameters, + Context context) { + Response inner = + this + .serviceClient() + .createOrUpdateWithResponse( + resourceGroupName, + serverName, + vulnerabilityAssessmentName, + baselineName, + ruleId, + parameters, + context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatabaseSqlVulnerabilityAssessmentRuleBaselineImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DatabaseSqlVulnerabilityAssessmentRuleBaseline createOrUpdate( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId, + DatabaseSqlVulnerabilityAssessmentRuleBaselineInput parameters) { + DatabaseSqlVulnerabilityAssessmentRuleBaselineInner inner = + this + .serviceClient() + .createOrUpdate( + resourceGroupName, serverName, vulnerabilityAssessmentName, baselineName, ruleId, parameters); + if (inner != null) { + return new DatabaseSqlVulnerabilityAssessmentRuleBaselineImpl(inner, this.manager()); + } else { + return null; + } + } + + private SqlVulnerabilityAssessmentRuleBaselinesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentRuleBaselinesOperationsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentRuleBaselinesOperationsClientImpl.java new file mode 100644 index 0000000000000..5ced85a4c7a21 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentRuleBaselinesOperationsClientImpl.java @@ -0,0 +1,301 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.SqlVulnerabilityAssessmentRuleBaselinesOperationsClient; +import com.azure.resourcemanager.sql.generated.models.BaselineName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * SqlVulnerabilityAssessmentRuleBaselinesOperationsClient. + */ +public final class SqlVulnerabilityAssessmentRuleBaselinesOperationsClientImpl + implements SqlVulnerabilityAssessmentRuleBaselinesOperationsClient { + /** The proxy service used to perform REST calls. */ + private final SqlVulnerabilityAssessmentRuleBaselinesOperationsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of SqlVulnerabilityAssessmentRuleBaselinesOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SqlVulnerabilityAssessmentRuleBaselinesOperationsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + SqlVulnerabilityAssessmentRuleBaselinesOperationsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientSqlVulnerabilityAssessmentRuleBaselinesOperations + * to be used by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + public interface SqlVulnerabilityAssessmentRuleBaselinesOperationsService { + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/baselines/{baselineName}" + + "/rules/{ruleId}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("baselineName") BaselineName baselineName, + @PathParam("ruleId") String ruleId, + @QueryParam("systemDatabaseName") String systemDatabaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param ruleId The vulnerability assessment rule ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (baselineName == null) { + return Mono.error(new IllegalArgumentException("Parameter baselineName is required and cannot be null.")); + } + if (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String systemDatabaseName = "master"; + final String apiVersion = "2022-02-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + vulnerabilityAssessmentName, + baselineName, + ruleId, + systemDatabaseName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param ruleId The vulnerability assessment rule ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (baselineName == null) { + return Mono.error(new IllegalArgumentException("Parameter baselineName is required and cannot be null.")); + } + if (ruleId == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String systemDatabaseName = "master"; + final String apiVersion = "2022-02-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + vulnerabilityAssessmentName, + baselineName, + ruleId, + systemDatabaseName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param ruleId The vulnerability assessment rule ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId) { + return deleteWithResponseAsync(resourceGroupName, serverName, vulnerabilityAssessmentName, baselineName, ruleId) + .flatMap(ignored -> Mono.empty()); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param ruleId The vulnerability assessment rule ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId, + Context context) { + return deleteWithResponseAsync( + resourceGroupName, serverName, vulnerabilityAssessmentName, baselineName, ruleId, context) + .block(); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param ruleId The vulnerability assessment rule ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId) { + deleteWithResponse( + resourceGroupName, serverName, vulnerabilityAssessmentName, baselineName, ruleId, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentRuleBaselinesOperationsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentRuleBaselinesOperationsImpl.java new file mode 100644 index 0000000000000..b409970d64975 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentRuleBaselinesOperationsImpl.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.SqlVulnerabilityAssessmentRuleBaselinesOperationsClient; +import com.azure.resourcemanager.sql.generated.models.BaselineName; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentRuleBaselinesOperations; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +public final class SqlVulnerabilityAssessmentRuleBaselinesOperationsImpl + implements SqlVulnerabilityAssessmentRuleBaselinesOperations { + private static final ClientLogger LOGGER = + new ClientLogger(SqlVulnerabilityAssessmentRuleBaselinesOperationsImpl.class); + + private final SqlVulnerabilityAssessmentRuleBaselinesOperationsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public SqlVulnerabilityAssessmentRuleBaselinesOperationsImpl( + SqlVulnerabilityAssessmentRuleBaselinesOperationsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response deleteWithResponse( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId, + Context context) { + return this + .serviceClient() + .deleteWithResponse( + resourceGroupName, serverName, vulnerabilityAssessmentName, baselineName, ruleId, context); + } + + public void delete( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId) { + this.serviceClient().delete(resourceGroupName, serverName, vulnerabilityAssessmentName, baselineName, ruleId); + } + + private SqlVulnerabilityAssessmentRuleBaselinesOperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentScanRecordImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentScanRecordImpl.java new file mode 100644 index 0000000000000..df9b77abda2a8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentScanRecordImpl.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.sql.generated.fluent.models.SqlVulnerabilityAssessmentScanRecordInner; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentScanError; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentScanRecord; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentScanState; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentScanTriggerType; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class SqlVulnerabilityAssessmentScanRecordImpl implements SqlVulnerabilityAssessmentScanRecord { + private SqlVulnerabilityAssessmentScanRecordInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + SqlVulnerabilityAssessmentScanRecordImpl( + SqlVulnerabilityAssessmentScanRecordInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String scanId() { + return this.innerModel().scanId(); + } + + public VulnerabilityAssessmentScanTriggerType triggerType() { + return this.innerModel().triggerType(); + } + + public VulnerabilityAssessmentScanState state() { + return this.innerModel().state(); + } + + public OffsetDateTime startTime() { + return this.innerModel().startTime(); + } + + public OffsetDateTime endTime() { + return this.innerModel().endTime(); + } + + public List errors() { + List inner = this.innerModel().errors(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String server() { + return this.innerModel().server(); + } + + public String database() { + return this.innerModel().database(); + } + + public String sqlVersion() { + return this.innerModel().sqlVersion(); + } + + public Integer highSeverityFailedRulesCount() { + return this.innerModel().highSeverityFailedRulesCount(); + } + + public Integer mediumSeverityFailedRulesCount() { + return this.innerModel().mediumSeverityFailedRulesCount(); + } + + public Integer lowSeverityFailedRulesCount() { + return this.innerModel().lowSeverityFailedRulesCount(); + } + + public Integer totalPassedRulesCount() { + return this.innerModel().totalPassedRulesCount(); + } + + public Integer totalFailedRulesCount() { + return this.innerModel().totalFailedRulesCount(); + } + + public Integer totalRulesCount() { + return this.innerModel().totalRulesCount(); + } + + public Boolean isBaselineApplied() { + return this.innerModel().isBaselineApplied(); + } + + public SqlVulnerabilityAssessmentScanRecordInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentScanResultOperationsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentScanResultOperationsClientImpl.java new file mode 100644 index 0000000000000..7f7caa11b1166 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentScanResultOperationsClientImpl.java @@ -0,0 +1,674 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.SqlVulnerabilityAssessmentScanResultOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.SqlVulnerabilityAssessmentScanResultsInner; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentScanListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * SqlVulnerabilityAssessmentScanResultOperationsClient. + */ +public final class SqlVulnerabilityAssessmentScanResultOperationsClientImpl + implements SqlVulnerabilityAssessmentScanResultOperationsClient { + /** The proxy service used to perform REST calls. */ + private final SqlVulnerabilityAssessmentScanResultOperationsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of SqlVulnerabilityAssessmentScanResultOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SqlVulnerabilityAssessmentScanResultOperationsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + SqlVulnerabilityAssessmentScanResultOperationsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientSqlVulnerabilityAssessmentScanResultOperations to + * be used by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + public interface SqlVulnerabilityAssessmentScanResultOperationsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/scanResults") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByScan( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("vulnerabilityAssessmentName") SqlVulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("scanId") String scanId, + @QueryParam("systemDatabaseName") String systemDatabaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/scanResults" + + "/{scanResultId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("vulnerabilityAssessmentName") SqlVulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("scanId") String scanId, + @PathParam("scanResultId") String scanResultId, + @QueryParam("systemDatabaseName") String systemDatabaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByScanNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @param scanId The scan id of the SQL Vulnerability Assessment scan to retrieve result from. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a vulnerability assessment scan record of a database along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByScanSinglePageAsync( + String resourceGroupName, + String serverName, + SqlVulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (scanId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String systemDatabaseName = "master"; + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByScan( + this.client.getEndpoint(), + resourceGroupName, + serverName, + vulnerabilityAssessmentName, + scanId, + systemDatabaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @param scanId The scan id of the SQL Vulnerability Assessment scan to retrieve result from. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a vulnerability assessment scan record of a database along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByScanSinglePageAsync( + String resourceGroupName, + String serverName, + SqlVulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (scanId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String systemDatabaseName = "master"; + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByScan( + this.client.getEndpoint(), + resourceGroupName, + serverName, + vulnerabilityAssessmentName, + scanId, + systemDatabaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @param scanId The scan id of the SQL Vulnerability Assessment scan to retrieve result from. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a vulnerability assessment scan record of a database as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByScanAsync( + String resourceGroupName, + String serverName, + SqlVulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + return new PagedFlux<>( + () -> listByScanSinglePageAsync(resourceGroupName, serverName, vulnerabilityAssessmentName, scanId), + nextLink -> listByScanNextSinglePageAsync(nextLink)); + } + + /** + * 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 vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @param scanId The scan id of the SQL Vulnerability Assessment scan to retrieve result from. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a vulnerability assessment scan record of a database as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByScanAsync( + String resourceGroupName, + String serverName, + SqlVulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context) { + return new PagedFlux<>( + () -> + listByScanSinglePageAsync(resourceGroupName, serverName, vulnerabilityAssessmentName, scanId, context), + nextLink -> listByScanNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @param scanId The scan id of the SQL Vulnerability Assessment scan to retrieve result from. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a vulnerability assessment scan record of a database as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByScan( + String resourceGroupName, + String serverName, + SqlVulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + return new PagedIterable<>(listByScanAsync(resourceGroupName, serverName, vulnerabilityAssessmentName, 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 serverName The name of the server. + * @param vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @param scanId The scan id of the SQL Vulnerability Assessment scan to retrieve result from. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a vulnerability assessment scan record of a database as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByScan( + String resourceGroupName, + String serverName, + SqlVulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context) { + return new PagedIterable<>( + listByScanAsync(resourceGroupName, serverName, vulnerabilityAssessmentName, scanId, context)); + } + + /** + * 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 vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @param scanId The scan id of the SQL Vulnerability Assessment scan to retrieve result from. + * @param scanResultId The scan result id of the specific result to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a vulnerability assessment scan record of a database along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + SqlVulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + String scanResultId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (scanId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + if (scanResultId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanResultId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String systemDatabaseName = "master"; + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + vulnerabilityAssessmentName, + scanId, + scanResultId, + systemDatabaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @param scanId The scan id of the SQL Vulnerability Assessment scan to retrieve result from. + * @param scanResultId The scan result id of the specific result to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a vulnerability assessment scan record of a database along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + SqlVulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + String scanResultId, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (scanId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + if (scanResultId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanResultId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String systemDatabaseName = "master"; + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + vulnerabilityAssessmentName, + scanId, + scanResultId, + systemDatabaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @param scanId The scan id of the SQL Vulnerability Assessment scan to retrieve result from. + * @param scanResultId The scan result id of the specific result to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a vulnerability assessment scan record of a database on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String serverName, + SqlVulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + String scanResultId) { + return getWithResponseAsync(resourceGroupName, serverName, vulnerabilityAssessmentName, scanId, scanResultId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @param scanId The scan id of the SQL Vulnerability Assessment scan to retrieve result from. + * @param scanResultId The scan result id of the specific result to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a vulnerability assessment scan record of a database along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + SqlVulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + String scanResultId, + Context context) { + return getWithResponseAsync( + resourceGroupName, serverName, vulnerabilityAssessmentName, scanId, scanResultId, context) + .block(); + } + + /** + * 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 vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @param scanId The scan id of the SQL Vulnerability Assessment scan to retrieve result from. + * @param scanResultId The scan result id of the specific result to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a vulnerability assessment scan record of a database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlVulnerabilityAssessmentScanResultsInner get( + String resourceGroupName, + String serverName, + SqlVulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + String scanResultId) { + return getWithResponse( + resourceGroupName, serverName, vulnerabilityAssessmentName, scanId, scanResultId, Context.NONE) + .getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan results along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByScanNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByScanNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan results along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByScanNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByScanNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentScanResultOperationsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentScanResultOperationsImpl.java new file mode 100644 index 0000000000000..48bee165cf8cf --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentScanResultOperationsImpl.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.SqlVulnerabilityAssessmentScanResultOperationsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.SqlVulnerabilityAssessmentScanResultsInner; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentScanResultOperations; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentScanResults; + +public final class SqlVulnerabilityAssessmentScanResultOperationsImpl + implements SqlVulnerabilityAssessmentScanResultOperations { + private static final ClientLogger LOGGER = + new ClientLogger(SqlVulnerabilityAssessmentScanResultOperationsImpl.class); + + private final SqlVulnerabilityAssessmentScanResultOperationsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public SqlVulnerabilityAssessmentScanResultOperationsImpl( + SqlVulnerabilityAssessmentScanResultOperationsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByScan( + String resourceGroupName, + String serverName, + SqlVulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + PagedIterable inner = + this.serviceClient().listByScan(resourceGroupName, serverName, vulnerabilityAssessmentName, scanId); + return Utils.mapPage(inner, inner1 -> new SqlVulnerabilityAssessmentScanResultsImpl(inner1, this.manager())); + } + + public PagedIterable listByScan( + String resourceGroupName, + String serverName, + SqlVulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByScan(resourceGroupName, serverName, vulnerabilityAssessmentName, scanId, context); + return Utils.mapPage(inner, inner1 -> new SqlVulnerabilityAssessmentScanResultsImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + SqlVulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + String scanResultId, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse( + resourceGroupName, serverName, vulnerabilityAssessmentName, scanId, scanResultId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SqlVulnerabilityAssessmentScanResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SqlVulnerabilityAssessmentScanResults get( + String resourceGroupName, + String serverName, + SqlVulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + String scanResultId) { + SqlVulnerabilityAssessmentScanResultsInner inner = + this.serviceClient().get(resourceGroupName, serverName, vulnerabilityAssessmentName, scanId, scanResultId); + if (inner != null) { + return new SqlVulnerabilityAssessmentScanResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + private SqlVulnerabilityAssessmentScanResultOperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentScanResultsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentScanResultsImpl.java new file mode 100644 index 0000000000000..ad8a97a299683 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentScanResultsImpl.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.sql.generated.fluent.models.SqlVulnerabilityAssessmentScanResultsInner; +import com.azure.resourcemanager.sql.generated.models.BaselineAdjustedResult; +import com.azure.resourcemanager.sql.generated.models.Remediation; +import com.azure.resourcemanager.sql.generated.models.RuleStatus; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentScanResults; +import com.azure.resourcemanager.sql.generated.models.VaRule; +import java.util.Collections; +import java.util.List; + +public final class SqlVulnerabilityAssessmentScanResultsImpl implements SqlVulnerabilityAssessmentScanResults { + private SqlVulnerabilityAssessmentScanResultsInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + SqlVulnerabilityAssessmentScanResultsImpl( + SqlVulnerabilityAssessmentScanResultsInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String ruleId() { + return this.innerModel().ruleId(); + } + + public RuleStatus status() { + return this.innerModel().status(); + } + + public String errorMessage() { + return this.innerModel().errorMessage(); + } + + public Boolean isTrimmed() { + return this.innerModel().isTrimmed(); + } + + public List> queryResults() { + List> inner = this.innerModel().queryResults(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Remediation remediation() { + return this.innerModel().remediation(); + } + + public BaselineAdjustedResult baselineAdjustedResult() { + return this.innerModel().baselineAdjustedResult(); + } + + public VaRule ruleMetadata() { + return this.innerModel().ruleMetadata(); + } + + public SqlVulnerabilityAssessmentScanResultsInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentScansClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentScansClientImpl.java new file mode 100644 index 0000000000000..8e9cac1733cfe --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentScansClientImpl.java @@ -0,0 +1,630 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.SqlVulnerabilityAssessmentScansClient; +import com.azure.resourcemanager.sql.generated.fluent.models.SqlVulnerabilityAssessmentScanRecordInner; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentScanRecordListResult; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in SqlVulnerabilityAssessmentScansClient. */ +public final class SqlVulnerabilityAssessmentScansClientImpl implements SqlVulnerabilityAssessmentScansClient { + /** The proxy service used to perform REST calls. */ + private final SqlVulnerabilityAssessmentScansService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of SqlVulnerabilityAssessmentScansClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SqlVulnerabilityAssessmentScansClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + SqlVulnerabilityAssessmentScansService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientSqlVulnerabilityAssessmentScans to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + public interface SqlVulnerabilityAssessmentScansService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/scans") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySqlVulnerabilityAssessments( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @QueryParam("systemDatabaseName") String systemDatabaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("scanId") String scanId, + @QueryParam("systemDatabaseName") String systemDatabaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySqlVulnerabilityAssessmentsNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan records along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listBySqlVulnerabilityAssessmentsSinglePageAsync( + String resourceGroupName, String serverName, VulnerabilityAssessmentName vulnerabilityAssessmentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String systemDatabaseName = "master"; + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listBySqlVulnerabilityAssessments( + this.client.getEndpoint(), + resourceGroupName, + serverName, + vulnerabilityAssessmentName, + systemDatabaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan records along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listBySqlVulnerabilityAssessmentsSinglePageAsync( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String systemDatabaseName = "master"; + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySqlVulnerabilityAssessments( + this.client.getEndpoint(), + resourceGroupName, + serverName, + vulnerabilityAssessmentName, + systemDatabaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan records as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySqlVulnerabilityAssessmentsAsync( + String resourceGroupName, String serverName, VulnerabilityAssessmentName vulnerabilityAssessmentName) { + return new PagedFlux<>( + () -> + listBySqlVulnerabilityAssessmentsSinglePageAsync( + resourceGroupName, serverName, vulnerabilityAssessmentName), + nextLink -> listBySqlVulnerabilityAssessmentsNextSinglePageAsync(nextLink)); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan records as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySqlVulnerabilityAssessmentsAsync( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + return new PagedFlux<>( + () -> + listBySqlVulnerabilityAssessmentsSinglePageAsync( + resourceGroupName, serverName, vulnerabilityAssessmentName, context), + nextLink -> listBySqlVulnerabilityAssessmentsNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan records as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySqlVulnerabilityAssessments( + String resourceGroupName, String serverName, VulnerabilityAssessmentName vulnerabilityAssessmentName) { + return new PagedIterable<>( + listBySqlVulnerabilityAssessmentsAsync(resourceGroupName, serverName, vulnerabilityAssessmentName)); + } + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan records as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySqlVulnerabilityAssessments( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + return new PagedIterable<>( + listBySqlVulnerabilityAssessmentsAsync( + resourceGroupName, serverName, vulnerabilityAssessmentName, context)); + } + + /** + * Get a system database vulnerability assessment scan record. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The scanId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a system database vulnerability assessment scan record along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (scanId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String systemDatabaseName = "master"; + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + vulnerabilityAssessmentName, + scanId, + systemDatabaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a system database vulnerability assessment scan record. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The scanId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a system database vulnerability assessment scan record along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (scanId == null) { + return Mono.error(new IllegalArgumentException("Parameter scanId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String systemDatabaseName = "master"; + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + vulnerabilityAssessmentName, + scanId, + systemDatabaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Get a system database vulnerability assessment scan record. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The scanId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a system database vulnerability assessment scan record on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + return getWithResponseAsync(resourceGroupName, serverName, vulnerabilityAssessmentName, scanId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a system database vulnerability assessment scan record. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The scanId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a system database vulnerability assessment scan record along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context) { + return getWithResponseAsync(resourceGroupName, serverName, vulnerabilityAssessmentName, scanId, context) + .block(); + } + + /** + * Get a system database vulnerability assessment scan record. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The scanId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a system database vulnerability assessment scan record. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlVulnerabilityAssessmentScanRecordInner get( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + return getWithResponse(resourceGroupName, serverName, vulnerabilityAssessmentName, scanId, Context.NONE) + .getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan records along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listBySqlVulnerabilityAssessmentsNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service.listBySqlVulnerabilityAssessmentsNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan records along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listBySqlVulnerabilityAssessmentsNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySqlVulnerabilityAssessmentsNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentScansImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentScansImpl.java new file mode 100644 index 0000000000000..07638cc37aded --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentScansImpl.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.SqlVulnerabilityAssessmentScansClient; +import com.azure.resourcemanager.sql.generated.fluent.models.SqlVulnerabilityAssessmentScanRecordInner; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentScanRecord; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentScans; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +public final class SqlVulnerabilityAssessmentScansImpl implements SqlVulnerabilityAssessmentScans { + private static final ClientLogger LOGGER = new ClientLogger(SqlVulnerabilityAssessmentScansImpl.class); + + private final SqlVulnerabilityAssessmentScansClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public SqlVulnerabilityAssessmentScansImpl( + SqlVulnerabilityAssessmentScansClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listBySqlVulnerabilityAssessments( + String resourceGroupName, String serverName, VulnerabilityAssessmentName vulnerabilityAssessmentName) { + PagedIterable inner = + this + .serviceClient() + .listBySqlVulnerabilityAssessments(resourceGroupName, serverName, vulnerabilityAssessmentName); + return Utils.mapPage(inner, inner1 -> new SqlVulnerabilityAssessmentScanRecordImpl(inner1, this.manager())); + } + + public PagedIterable listBySqlVulnerabilityAssessments( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listBySqlVulnerabilityAssessments(resourceGroupName, serverName, vulnerabilityAssessmentName, context); + return Utils.mapPage(inner, inner1 -> new SqlVulnerabilityAssessmentScanRecordImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, serverName, vulnerabilityAssessmentName, scanId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SqlVulnerabilityAssessmentScanRecordImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SqlVulnerabilityAssessmentScanRecord get( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId) { + SqlVulnerabilityAssessmentScanRecordInner inner = + this.serviceClient().get(resourceGroupName, serverName, vulnerabilityAssessmentName, scanId); + if (inner != null) { + return new SqlVulnerabilityAssessmentScanRecordImpl(inner, this.manager()); + } else { + return null; + } + } + + private SqlVulnerabilityAssessmentScansClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentsClientImpl.java new file mode 100644 index 0000000000000..b3bfb64cc0c45 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentsClientImpl.java @@ -0,0 +1,241 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.SqlVulnerabilityAssessmentsClient; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in SqlVulnerabilityAssessmentsClient. */ +public final class SqlVulnerabilityAssessmentsClientImpl implements SqlVulnerabilityAssessmentsClient { + /** The proxy service used to perform REST calls. */ + private final SqlVulnerabilityAssessmentsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of SqlVulnerabilityAssessmentsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SqlVulnerabilityAssessmentsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + SqlVulnerabilityAssessmentsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientSqlVulnerabilityAssessments to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + public interface SqlVulnerabilityAssessmentsService { + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + } + + /** + * Removes SQL 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 vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String serverName, VulnerabilityAssessmentName vulnerabilityAssessmentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Removes SQL 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 vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Removes SQL 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 vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String serverName, VulnerabilityAssessmentName vulnerabilityAssessmentName) { + return deleteWithResponseAsync(resourceGroupName, serverName, vulnerabilityAssessmentName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Removes SQL 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 vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + return deleteWithResponseAsync(resourceGroupName, serverName, vulnerabilityAssessmentName, context).block(); + } + + /** + * Removes SQL 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 vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, String serverName, VulnerabilityAssessmentName vulnerabilityAssessmentName) { + deleteWithResponse(resourceGroupName, serverName, vulnerabilityAssessmentName, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentsImpl.java new file mode 100644 index 0000000000000..9905f5a61a11c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentsImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.SqlVulnerabilityAssessmentsClient; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessments; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +public final class SqlVulnerabilityAssessmentsImpl implements SqlVulnerabilityAssessments { + private static final ClientLogger LOGGER = new ClientLogger(SqlVulnerabilityAssessmentsImpl.class); + + private final SqlVulnerabilityAssessmentsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public SqlVulnerabilityAssessmentsImpl( + SqlVulnerabilityAssessmentsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response deleteWithResponse( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context) { + return this + .serviceClient() + .deleteWithResponse(resourceGroupName, serverName, vulnerabilityAssessmentName, context); + } + + public void delete( + String resourceGroupName, String serverName, VulnerabilityAssessmentName vulnerabilityAssessmentName) { + this.serviceClient().delete(resourceGroupName, serverName, vulnerabilityAssessmentName); + } + + private SqlVulnerabilityAssessmentsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentsSettingsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentsSettingsClientImpl.java new file mode 100644 index 0000000000000..63cf8c6e647c9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentsSettingsClientImpl.java @@ -0,0 +1,784 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.SqlVulnerabilityAssessmentsSettingsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.SqlVulnerabilityAssessmentInner; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentListResult; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentNameAutoGenerated; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in SqlVulnerabilityAssessmentsSettingsClient. + */ +public final class SqlVulnerabilityAssessmentsSettingsClientImpl implements SqlVulnerabilityAssessmentsSettingsClient { + /** The proxy service used to perform REST calls. */ + private final SqlVulnerabilityAssessmentsSettingsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of SqlVulnerabilityAssessmentsSettingsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SqlVulnerabilityAssessmentsSettingsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + SqlVulnerabilityAssessmentsSettingsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientSqlVulnerabilityAssessmentsSettings to be used by + * the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + public interface SqlVulnerabilityAssessmentsSettingsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/sqlVulnerabilityAssessments") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("vulnerabilityAssessmentName") + SqlVulnerabilityAssessmentNameAutoGenerated vulnerabilityAssessmentName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/sqlVulnerabilityAssessments/{vulnerabilityAssessmentName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("vulnerabilityAssessmentName") VulnerabilityAssessmentName vulnerabilityAssessmentName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SqlVulnerabilityAssessmentInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists SQL 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Vulnerability Assessments along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists SQL 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Vulnerability Assessments along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists SQL 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Vulnerability Assessments as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Lists SQL 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Vulnerability Assessments as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists SQL 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Vulnerability Assessments as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * Lists SQL 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Vulnerability Assessments as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } + + /** + * Gets SQL Vulnerability Assessment policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return sQL Vulnerability Assessment policy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + SqlVulnerabilityAssessmentNameAutoGenerated vulnerabilityAssessmentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets SQL Vulnerability Assessment policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return sQL Vulnerability Assessment policy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + SqlVulnerabilityAssessmentNameAutoGenerated vulnerabilityAssessmentName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets SQL Vulnerability Assessment policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return sQL Vulnerability Assessment policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String serverName, + SqlVulnerabilityAssessmentNameAutoGenerated vulnerabilityAssessmentName) { + return getWithResponseAsync(resourceGroupName, serverName, vulnerabilityAssessmentName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets SQL Vulnerability Assessment policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return sQL Vulnerability Assessment policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + SqlVulnerabilityAssessmentNameAutoGenerated vulnerabilityAssessmentName, + Context context) { + return getWithResponseAsync(resourceGroupName, serverName, vulnerabilityAssessmentName, context).block(); + } + + /** + * Gets SQL Vulnerability Assessment policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return sQL Vulnerability Assessment policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlVulnerabilityAssessmentInner get( + String resourceGroupName, + String serverName, + SqlVulnerabilityAssessmentNameAutoGenerated vulnerabilityAssessmentName) { + return getWithResponse(resourceGroupName, serverName, vulnerabilityAssessmentName, Context.NONE).getValue(); + } + + /** + * Creates or updates SQL Vulnerability Assessment policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @param parameters The requested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL Vulnerability Assessment along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + SqlVulnerabilityAssessmentInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates SQL Vulnerability Assessment policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @param parameters The requested resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL Vulnerability Assessment along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + SqlVulnerabilityAssessmentInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (vulnerabilityAssessmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter vulnerabilityAssessmentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2022-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + vulnerabilityAssessmentName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates SQL Vulnerability Assessment policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @param parameters The requested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL Vulnerability Assessment on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + SqlVulnerabilityAssessmentInner parameters) { + return createOrUpdateWithResponseAsync(resourceGroupName, serverName, vulnerabilityAssessmentName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or updates SQL Vulnerability Assessment policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @param parameters The requested resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL Vulnerability Assessment along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + SqlVulnerabilityAssessmentInner parameters, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, serverName, vulnerabilityAssessmentName, parameters, context) + .block(); + } + + /** + * Creates or updates SQL Vulnerability Assessment policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @param parameters The requested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a SQL Vulnerability Assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SqlVulnerabilityAssessmentInner createOrUpdate( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + SqlVulnerabilityAssessmentInner parameters) { + return createOrUpdateWithResponse( + resourceGroupName, serverName, vulnerabilityAssessmentName, parameters, Context.NONE) + .getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Vulnerability Assessments along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByServerNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Vulnerability Assessments along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServerNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentsSettingsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentsSettingsImpl.java new file mode 100644 index 0000000000000..76744454a75a3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SqlVulnerabilityAssessmentsSettingsImpl.java @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.SqlVulnerabilityAssessmentsSettingsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.SqlVulnerabilityAssessmentInner; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessment; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentNameAutoGenerated; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentsSettings; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +public final class SqlVulnerabilityAssessmentsSettingsImpl implements SqlVulnerabilityAssessmentsSettings { + private static final ClientLogger LOGGER = new ClientLogger(SqlVulnerabilityAssessmentsSettingsImpl.class); + + private final SqlVulnerabilityAssessmentsSettingsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public SqlVulnerabilityAssessmentsSettingsImpl( + SqlVulnerabilityAssessmentsSettingsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new SqlVulnerabilityAssessmentImpl(inner1, this.manager())); + } + + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new SqlVulnerabilityAssessmentImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + SqlVulnerabilityAssessmentNameAutoGenerated vulnerabilityAssessmentName, + Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, vulnerabilityAssessmentName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SqlVulnerabilityAssessmentImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SqlVulnerabilityAssessment get( + String resourceGroupName, + String serverName, + SqlVulnerabilityAssessmentNameAutoGenerated vulnerabilityAssessmentName) { + SqlVulnerabilityAssessmentInner inner = + this.serviceClient().get(resourceGroupName, serverName, vulnerabilityAssessmentName); + if (inner != null) { + return new SqlVulnerabilityAssessmentImpl(inner, this.manager()); + } else { + return null; + } + } + + public SqlVulnerabilityAssessment getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String vulnerabilityAssessmentNameLocal = Utils.getValueFromIdByName(id, "sqlVulnerabilityAssessments"); + if (vulnerabilityAssessmentNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment" + + " 'sqlVulnerabilityAssessments'.", + id))); + } + SqlVulnerabilityAssessmentNameAutoGenerated vulnerabilityAssessmentName = + SqlVulnerabilityAssessmentNameAutoGenerated.fromString(vulnerabilityAssessmentNameLocal); + return this + .getWithResponse(resourceGroupName, serverName, vulnerabilityAssessmentName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String vulnerabilityAssessmentNameLocal = Utils.getValueFromIdByName(id, "sqlVulnerabilityAssessments"); + if (vulnerabilityAssessmentNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment" + + " 'sqlVulnerabilityAssessments'.", + id))); + } + SqlVulnerabilityAssessmentNameAutoGenerated vulnerabilityAssessmentName = + SqlVulnerabilityAssessmentNameAutoGenerated.fromString(vulnerabilityAssessmentNameLocal); + return this.getWithResponse(resourceGroupName, serverName, vulnerabilityAssessmentName, context); + } + + private SqlVulnerabilityAssessmentsSettingsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public SqlVulnerabilityAssessmentImpl define(VulnerabilityAssessmentName name) { + return new SqlVulnerabilityAssessmentImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SubscriptionUsageImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SubscriptionUsageImpl.java new file mode 100644 index 0000000000000..9022849b9150d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SubscriptionUsageImpl.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.SubscriptionUsageInner; +import com.azure.resourcemanager.sql.generated.models.SubscriptionUsage; + +public final class SubscriptionUsageImpl implements SubscriptionUsage { + private SubscriptionUsageInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + SubscriptionUsageImpl( + SubscriptionUsageInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public Double currentValue() { + return this.innerModel().currentValue(); + } + + public Double limit() { + return this.innerModel().limit(); + } + + public String unit() { + return this.innerModel().unit(); + } + + public SubscriptionUsageInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SubscriptionUsagesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SubscriptionUsagesClientImpl.java new file mode 100644 index 0000000000000..d454e15e3863c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SubscriptionUsagesClientImpl.java @@ -0,0 +1,468 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.SubscriptionUsagesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.SubscriptionUsageInner; +import com.azure.resourcemanager.sql.generated.models.SubscriptionUsageListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in SubscriptionUsagesClient. */ +public final class SubscriptionUsagesClientImpl implements SubscriptionUsagesClient { + /** The proxy service used to perform REST calls. */ + private final SubscriptionUsagesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of SubscriptionUsagesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SubscriptionUsagesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(SubscriptionUsagesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientSubscriptionUsages to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + public interface SubscriptionUsagesService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/usages") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByLocation( + @HostParam("$host") String endpoint, + @PathParam("locationName") String locationName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/usages/{usageName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("locationName") String locationName, + @PathParam("usageName") String usageName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByLocationNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all subscription usage metrics in a given location along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationSinglePageAsync(String locationName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByLocation( + this.client.getEndpoint(), + locationName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets all subscription usage metrics in a given location. + * + * @param locationName The name of the region where the resource is located. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all subscription usage metrics in a given location along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationSinglePageAsync( + String locationName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByLocation( + this.client.getEndpoint(), locationName, this.client.getSubscriptionId(), apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all subscription usage metrics in a given location as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByLocationAsync(String locationName) { + return new PagedFlux<>( + () -> listByLocationSinglePageAsync(locationName), nextLink -> listByLocationNextSinglePageAsync(nextLink)); + } + + /** + * Gets all subscription usage metrics in a given location. + * + * @param locationName The name of the region where the resource is located. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all subscription usage metrics in a given location as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByLocationAsync(String locationName, Context context) { + return new PagedFlux<>( + () -> listByLocationSinglePageAsync(locationName, context), + nextLink -> listByLocationNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all subscription usage metrics in a given location as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByLocation(String locationName) { + return new PagedIterable<>(listByLocationAsync(locationName)); + } + + /** + * Gets all subscription usage metrics in a given location. + * + * @param locationName The name of the region where the resource is located. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all subscription usage metrics in a given location as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByLocation(String locationName, Context context) { + return new PagedIterable<>(listByLocationAsync(locationName, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a subscription usage metric along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String locationName, String usageName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (usageName == null) { + return Mono.error(new IllegalArgumentException("Parameter usageName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + locationName, + usageName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a subscription usage metric along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String locationName, String usageName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (usageName == null) { + return Mono.error(new IllegalArgumentException("Parameter usageName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + locationName, + usageName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a subscription usage metric on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String locationName, String usageName) { + return getWithResponseAsync(locationName, usageName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a subscription usage metric along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String locationName, String usageName, Context context) { + return getWithResponseAsync(locationName, usageName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a subscription usage metric. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SubscriptionUsageInner get(String locationName, String usageName) { + return getWithResponse(locationName, usageName, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of subscription usage metrics in a location along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByLocationNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of subscription usage metrics in a location along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByLocationNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SubscriptionUsagesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SubscriptionUsagesImpl.java new file mode 100644 index 0000000000000..7b76d46b465fe --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SubscriptionUsagesImpl.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.SubscriptionUsagesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.SubscriptionUsageInner; +import com.azure.resourcemanager.sql.generated.models.SubscriptionUsage; +import com.azure.resourcemanager.sql.generated.models.SubscriptionUsages; + +public final class SubscriptionUsagesImpl implements SubscriptionUsages { + private static final ClientLogger LOGGER = new ClientLogger(SubscriptionUsagesImpl.class); + + private final SubscriptionUsagesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public SubscriptionUsagesImpl( + SubscriptionUsagesClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByLocation(String locationName) { + PagedIterable inner = this.serviceClient().listByLocation(locationName); + return Utils.mapPage(inner, inner1 -> new SubscriptionUsageImpl(inner1, this.manager())); + } + + public PagedIterable listByLocation(String locationName, Context context) { + PagedIterable inner = this.serviceClient().listByLocation(locationName, context); + return Utils.mapPage(inner, inner1 -> new SubscriptionUsageImpl(inner1, this.manager())); + } + + public Response getWithResponse(String locationName, String usageName, Context context) { + Response inner = this.serviceClient().getWithResponse(locationName, usageName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SubscriptionUsageImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SubscriptionUsage get(String locationName, String usageName) { + SubscriptionUsageInner inner = this.serviceClient().get(locationName, usageName); + if (inner != null) { + return new SubscriptionUsageImpl(inner, this.manager()); + } else { + return null; + } + } + + private SubscriptionUsagesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SynapseLinkWorkspaceImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SynapseLinkWorkspaceImpl.java new file mode 100644 index 0000000000000..0df3bbbf10f6d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SynapseLinkWorkspaceImpl.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.SynapseLinkWorkspaceInner; +import com.azure.resourcemanager.sql.generated.models.SynapseLinkWorkspace; +import com.azure.resourcemanager.sql.generated.models.SynapseLinkWorkspaceInfoProperties; +import java.util.Collections; +import java.util.List; + +public final class SynapseLinkWorkspaceImpl implements SynapseLinkWorkspace { + private SynapseLinkWorkspaceInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + SynapseLinkWorkspaceImpl( + SynapseLinkWorkspaceInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public List workspaces() { + List inner = this.innerModel().workspaces(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public SynapseLinkWorkspaceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SynapseLinkWorkspacesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SynapseLinkWorkspacesClientImpl.java new file mode 100644 index 0000000000000..3f6821b1229ff --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SynapseLinkWorkspacesClientImpl.java @@ -0,0 +1,368 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.SynapseLinkWorkspacesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.SynapseLinkWorkspaceInner; +import com.azure.resourcemanager.sql.generated.models.SynapseLinkWorkspaceListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in SynapseLinkWorkspacesClient. */ +public final class SynapseLinkWorkspacesClientImpl implements SynapseLinkWorkspacesClient { + /** The proxy service used to perform REST calls. */ + private final SynapseLinkWorkspacesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of SynapseLinkWorkspacesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SynapseLinkWorkspacesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create(SynapseLinkWorkspacesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientSynapseLinkWorkspaces to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + public interface SynapseLinkWorkspacesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/linkWorkspaces") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabaseNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets all synapselink workspaces for 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all synapselink workspaces for a database along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets all synapselink workspaces for 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all synapselink workspaces for a database along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets all synapselink workspaces for 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all synapselink workspaces for a database as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Gets all synapselink workspaces for 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all synapselink workspaces for a database as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, context), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all synapselink workspaces for 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all synapselink workspaces for a database as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName)); + } + + /** + * Gets all synapselink workspaces for 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all synapselink workspaces for a database as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of synapselink workspaces along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of synapselink workspaces along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SynapseLinkWorkspacesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SynapseLinkWorkspacesImpl.java new file mode 100644 index 0000000000000..2df4753267a6a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SynapseLinkWorkspacesImpl.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.SynapseLinkWorkspacesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.SynapseLinkWorkspaceInner; +import com.azure.resourcemanager.sql.generated.models.SynapseLinkWorkspace; +import com.azure.resourcemanager.sql.generated.models.SynapseLinkWorkspaces; + +public final class SynapseLinkWorkspacesImpl implements SynapseLinkWorkspaces { + private static final ClientLogger LOGGER = new ClientLogger(SynapseLinkWorkspacesImpl.class); + + private final SynapseLinkWorkspacesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public SynapseLinkWorkspacesImpl( + SynapseLinkWorkspacesClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName); + return Utils.mapPage(inner, inner1 -> new SynapseLinkWorkspaceImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName, context); + return Utils.mapPage(inner, inner1 -> new SynapseLinkWorkspaceImpl(inner1, this.manager())); + } + + private SynapseLinkWorkspacesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncAgentImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncAgentImpl.java new file mode 100644 index 0000000000000..2aa2f6004b9dc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncAgentImpl.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncAgentInner; +import com.azure.resourcemanager.sql.generated.models.SyncAgent; +import com.azure.resourcemanager.sql.generated.models.SyncAgentKeyProperties; +import com.azure.resourcemanager.sql.generated.models.SyncAgentState; +import java.time.OffsetDateTime; + +public final class SyncAgentImpl implements SyncAgent, SyncAgent.Definition, SyncAgent.Update { + private SyncAgentInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String namePropertiesName() { + return this.innerModel().namePropertiesName(); + } + + public String syncDatabaseId() { + return this.innerModel().syncDatabaseId(); + } + + public OffsetDateTime lastAliveTime() { + return this.innerModel().lastAliveTime(); + } + + public SyncAgentState state() { + return this.innerModel().state(); + } + + public Boolean isUpToDate() { + return this.innerModel().isUpToDate(); + } + + public OffsetDateTime expiryTime() { + return this.innerModel().expiryTime(); + } + + public String version() { + return this.innerModel().version(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public SyncAgentInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String syncAgentName; + + public SyncAgentImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public SyncAgent create() { + this.innerObject = + serviceManager + .serviceClient() + .getSyncAgents() + .createOrUpdate(resourceGroupName, serverName, syncAgentName, this.innerModel(), Context.NONE); + return this; + } + + public SyncAgent create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSyncAgents() + .createOrUpdate(resourceGroupName, serverName, syncAgentName, this.innerModel(), context); + return this; + } + + SyncAgentImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new SyncAgentInner(); + this.serviceManager = serviceManager; + this.syncAgentName = name; + } + + public SyncAgentImpl update() { + return this; + } + + public SyncAgent apply() { + this.innerObject = + serviceManager + .serviceClient() + .getSyncAgents() + .createOrUpdate(resourceGroupName, serverName, syncAgentName, this.innerModel(), Context.NONE); + return this; + } + + public SyncAgent apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSyncAgents() + .createOrUpdate(resourceGroupName, serverName, syncAgentName, this.innerModel(), context); + return this; + } + + SyncAgentImpl(SyncAgentInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.syncAgentName = Utils.getValueFromIdByName(innerObject.id(), "syncAgents"); + } + + public SyncAgent refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getSyncAgents() + .getWithResponse(resourceGroupName, serverName, syncAgentName, Context.NONE) + .getValue(); + return this; + } + + public SyncAgent refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSyncAgents() + .getWithResponse(resourceGroupName, serverName, syncAgentName, context) + .getValue(); + return this; + } + + public Response generateKeyWithResponse(Context context) { + return serviceManager + .syncAgents() + .generateKeyWithResponse(resourceGroupName, serverName, syncAgentName, context); + } + + public SyncAgentKeyProperties generateKey() { + return serviceManager.syncAgents().generateKey(resourceGroupName, serverName, syncAgentName); + } + + public SyncAgentImpl withSyncDatabaseId(String syncDatabaseId) { + this.innerModel().withSyncDatabaseId(syncDatabaseId); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncAgentKeyPropertiesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncAgentKeyPropertiesImpl.java new file mode 100644 index 0000000000000..ff12b28701750 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncAgentKeyPropertiesImpl.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.SyncAgentKeyPropertiesInner; +import com.azure.resourcemanager.sql.generated.models.SyncAgentKeyProperties; + +public final class SyncAgentKeyPropertiesImpl implements SyncAgentKeyProperties { + private SyncAgentKeyPropertiesInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + SyncAgentKeyPropertiesImpl( + SyncAgentKeyPropertiesInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String syncAgentKey() { + return this.innerModel().syncAgentKey(); + } + + public SyncAgentKeyPropertiesInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncAgentLinkedDatabaseImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncAgentLinkedDatabaseImpl.java new file mode 100644 index 0000000000000..6256d1a98f8b2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncAgentLinkedDatabaseImpl.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.SyncAgentLinkedDatabaseInner; +import com.azure.resourcemanager.sql.generated.models.SyncAgentLinkedDatabase; +import com.azure.resourcemanager.sql.generated.models.SyncMemberDbType; + +public final class SyncAgentLinkedDatabaseImpl implements SyncAgentLinkedDatabase { + private SyncAgentLinkedDatabaseInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + SyncAgentLinkedDatabaseImpl( + SyncAgentLinkedDatabaseInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SyncMemberDbType databaseType() { + return this.innerModel().databaseType(); + } + + public String databaseId() { + return this.innerModel().databaseId(); + } + + public String description() { + return this.innerModel().description(); + } + + public String serverName() { + return this.innerModel().serverName(); + } + + public String databaseName() { + return this.innerModel().databaseName(); + } + + public String username() { + return this.innerModel().username(); + } + + public SyncAgentLinkedDatabaseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncAgentsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncAgentsClientImpl.java new file mode 100644 index 0000000000000..d2eb043d94f90 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncAgentsClientImpl.java @@ -0,0 +1,1612 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.SyncAgentsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncAgentInner; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncAgentKeyPropertiesInner; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncAgentLinkedDatabaseInner; +import com.azure.resourcemanager.sql.generated.models.SyncAgentLinkedDatabaseListResult; +import com.azure.resourcemanager.sql.generated.models.SyncAgentListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in SyncAgentsClient. */ +public final class SyncAgentsClientImpl implements SyncAgentsClient { + /** The proxy service used to perform REST calls. */ + private final SyncAgentsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of SyncAgentsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SyncAgentsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(SyncAgentsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientSyncAgents to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + public interface SyncAgentsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/syncAgents/{syncAgentName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("syncAgentName") String syncAgentName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/syncAgents/{syncAgentName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("syncAgentName") String syncAgentName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SyncAgentInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/syncAgents/{syncAgentName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("syncAgentName") String syncAgentName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/syncAgents") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/syncAgents/{syncAgentName}/generateKey") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> generateKey( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("syncAgentName") String syncAgentName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/syncAgents/{syncAgentName}/linkedDatabases") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listLinkedDatabases( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("syncAgentName") String syncAgentName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listLinkedDatabasesNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sync agent along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String syncAgentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (syncAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncAgentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + syncAgentName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sync agent along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String syncAgentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (syncAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncAgentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + syncAgentName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sync agent on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serverName, String syncAgentName) { + return getWithResponseAsync(resourceGroupName, serverName, syncAgentName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sync agent along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String syncAgentName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, syncAgentName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sync agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncAgentInner get(String resourceGroupName, String serverName, String syncAgentName) { + return getWithResponse(resourceGroupName, serverName, syncAgentName, Context.NONE).getValue(); + } + + /** + * 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 parameters The requested sync agent resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync agent along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverName, String syncAgentName, SyncAgentInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (syncAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncAgentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + syncAgentName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 parameters The requested sync agent resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync agent along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverName, String syncAgentName, SyncAgentInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (syncAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncAgentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + syncAgentName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 parameters The requested sync agent resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an Azure SQL Database sync agent. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SyncAgentInner> beginCreateOrUpdateAsync( + String resourceGroupName, String serverName, String syncAgentName, SyncAgentInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, syncAgentName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + SyncAgentInner.class, + SyncAgentInner.class, + this.client.getContext()); + } + + /** + * 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 parameters The requested sync agent resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an Azure SQL Database sync agent. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SyncAgentInner> beginCreateOrUpdateAsync( + String resourceGroupName, String serverName, String syncAgentName, SyncAgentInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, syncAgentName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), SyncAgentInner.class, SyncAgentInner.class, context); + } + + /** + * 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 parameters The requested sync agent resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL Database sync agent. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SyncAgentInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String syncAgentName, SyncAgentInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, syncAgentName, parameters).getSyncPoller(); + } + + /** + * 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 parameters The requested sync agent resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL Database sync agent. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SyncAgentInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String syncAgentName, SyncAgentInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, syncAgentName, parameters, context) + .getSyncPoller(); + } + + /** + * 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 parameters The requested sync agent resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync agent on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serverName, String syncAgentName, SyncAgentInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, syncAgentName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 parameters The requested sync agent resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync agent on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serverName, String syncAgentName, SyncAgentInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, syncAgentName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 parameters The requested sync agent resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncAgentInner createOrUpdate( + String resourceGroupName, String serverName, String syncAgentName, SyncAgentInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, syncAgentName, parameters).block(); + } + + /** + * 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 parameters The requested sync agent resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncAgentInner createOrUpdate( + String resourceGroupName, String serverName, String syncAgentName, SyncAgentInner parameters, Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, syncAgentName, parameters, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, String syncAgentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (syncAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncAgentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + syncAgentName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, String syncAgentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (syncAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncAgentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + syncAgentName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String syncAgentName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, serverName, syncAgentName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String syncAgentName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, syncAgentName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String syncAgentName) { + return beginDeleteAsync(resourceGroupName, serverName, syncAgentName).getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String syncAgentName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, syncAgentName, context).getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String serverName, String syncAgentName) { + return beginDeleteAsync(resourceGroupName, serverName, syncAgentName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String serverName, String syncAgentName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, syncAgentName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, String syncAgentName) { + deleteAsync(resourceGroupName, serverName, syncAgentName).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, String syncAgentName, Context context) { + deleteAsync(resourceGroupName, serverName, syncAgentName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync agents along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync agents along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync agents as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync agents as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync agents as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync agents as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of an Azure SQL Database sync agent key along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> generateKeyWithResponseAsync( + String resourceGroupName, String serverName, String syncAgentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (syncAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncAgentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .generateKey( + this.client.getEndpoint(), + resourceGroupName, + serverName, + syncAgentName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of an Azure SQL Database sync agent key along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> generateKeyWithResponseAsync( + String resourceGroupName, String serverName, String syncAgentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (syncAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncAgentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .generateKey( + this.client.getEndpoint(), + resourceGroupName, + serverName, + syncAgentName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of an Azure SQL Database sync agent key on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono generateKeyAsync( + String resourceGroupName, String serverName, String syncAgentName) { + return generateKeyWithResponseAsync(resourceGroupName, serverName, syncAgentName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of an Azure SQL Database sync agent key along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response generateKeyWithResponse( + String resourceGroupName, String serverName, String syncAgentName, Context context) { + return generateKeyWithResponseAsync(resourceGroupName, serverName, syncAgentName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of an Azure SQL Database sync agent key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncAgentKeyPropertiesInner generateKey(String resourceGroupName, String serverName, String syncAgentName) { + return generateKeyWithResponse(resourceGroupName, serverName, syncAgentName, Context.NONE).getValue(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync agent linked databases along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listLinkedDatabasesSinglePageAsync( + String resourceGroupName, String serverName, String syncAgentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (syncAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncAgentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listLinkedDatabases( + this.client.getEndpoint(), + resourceGroupName, + serverName, + syncAgentName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync agent linked databases along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listLinkedDatabasesSinglePageAsync( + String resourceGroupName, String serverName, String syncAgentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (syncAgentName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncAgentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listLinkedDatabases( + this.client.getEndpoint(), + resourceGroupName, + serverName, + syncAgentName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync agent linked databases as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listLinkedDatabasesAsync( + String resourceGroupName, String serverName, String syncAgentName) { + return new PagedFlux<>( + () -> listLinkedDatabasesSinglePageAsync(resourceGroupName, serverName, syncAgentName), + nextLink -> listLinkedDatabasesNextSinglePageAsync(nextLink)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync agent linked databases as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listLinkedDatabasesAsync( + String resourceGroupName, String serverName, String syncAgentName, Context context) { + return new PagedFlux<>( + () -> listLinkedDatabasesSinglePageAsync(resourceGroupName, serverName, syncAgentName, context), + nextLink -> listLinkedDatabasesNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync agent linked databases as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listLinkedDatabases( + String resourceGroupName, String serverName, String syncAgentName) { + return new PagedIterable<>(listLinkedDatabasesAsync(resourceGroupName, serverName, 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync agent linked databases as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listLinkedDatabases( + String resourceGroupName, String serverName, String syncAgentName, Context context) { + return new PagedIterable<>(listLinkedDatabasesAsync(resourceGroupName, serverName, syncAgentName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync agents along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByServerNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync agents along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServerNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync agent linked databases along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listLinkedDatabasesNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listLinkedDatabasesNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync agent linked databases along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listLinkedDatabasesNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listLinkedDatabasesNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncAgentsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncAgentsImpl.java new file mode 100644 index 0000000000000..62ba2a3703d6a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncAgentsImpl.java @@ -0,0 +1,230 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.SyncAgentsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncAgentInner; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncAgentKeyPropertiesInner; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncAgentLinkedDatabaseInner; +import com.azure.resourcemanager.sql.generated.models.SyncAgent; +import com.azure.resourcemanager.sql.generated.models.SyncAgentKeyProperties; +import com.azure.resourcemanager.sql.generated.models.SyncAgentLinkedDatabase; +import com.azure.resourcemanager.sql.generated.models.SyncAgents; + +public final class SyncAgentsImpl implements SyncAgents { + private static final ClientLogger LOGGER = new ClientLogger(SyncAgentsImpl.class); + + private final SyncAgentsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public SyncAgentsImpl( + SyncAgentsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String syncAgentName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, syncAgentName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SyncAgentImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SyncAgent get(String resourceGroupName, String serverName, String syncAgentName) { + SyncAgentInner inner = this.serviceClient().get(resourceGroupName, serverName, syncAgentName); + if (inner != null) { + return new SyncAgentImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String serverName, String syncAgentName) { + this.serviceClient().delete(resourceGroupName, serverName, syncAgentName); + } + + public void delete(String resourceGroupName, String serverName, String syncAgentName, Context context) { + this.serviceClient().delete(resourceGroupName, serverName, syncAgentName, context); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new SyncAgentImpl(inner1, this.manager())); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { + PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new SyncAgentImpl(inner1, this.manager())); + } + + public Response generateKeyWithResponse( + String resourceGroupName, String serverName, String syncAgentName, Context context) { + Response inner = + this.serviceClient().generateKeyWithResponse(resourceGroupName, serverName, syncAgentName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SyncAgentKeyPropertiesImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SyncAgentKeyProperties generateKey(String resourceGroupName, String serverName, String syncAgentName) { + SyncAgentKeyPropertiesInner inner = + this.serviceClient().generateKey(resourceGroupName, serverName, syncAgentName); + if (inner != null) { + return new SyncAgentKeyPropertiesImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listLinkedDatabases( + String resourceGroupName, String serverName, String syncAgentName) { + PagedIterable inner = + this.serviceClient().listLinkedDatabases(resourceGroupName, serverName, syncAgentName); + return Utils.mapPage(inner, inner1 -> new SyncAgentLinkedDatabaseImpl(inner1, this.manager())); + } + + public PagedIterable listLinkedDatabases( + String resourceGroupName, String serverName, String syncAgentName, Context context) { + PagedIterable inner = + this.serviceClient().listLinkedDatabases(resourceGroupName, serverName, syncAgentName, context); + return Utils.mapPage(inner, inner1 -> new SyncAgentLinkedDatabaseImpl(inner1, this.manager())); + } + + public SyncAgent getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String syncAgentName = Utils.getValueFromIdByName(id, "syncAgents"); + if (syncAgentName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'syncAgents'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, syncAgentName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String syncAgentName = Utils.getValueFromIdByName(id, "syncAgents"); + if (syncAgentName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'syncAgents'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, syncAgentName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String syncAgentName = Utils.getValueFromIdByName(id, "syncAgents"); + if (syncAgentName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'syncAgents'.", id))); + } + this.delete(resourceGroupName, serverName, syncAgentName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String syncAgentName = Utils.getValueFromIdByName(id, "syncAgents"); + if (syncAgentName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'syncAgents'.", id))); + } + this.delete(resourceGroupName, serverName, syncAgentName, context); + } + + private SyncAgentsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public SyncAgentImpl define(String name) { + return new SyncAgentImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncDatabaseIdPropertiesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncDatabaseIdPropertiesImpl.java new file mode 100644 index 0000000000000..4718e8f8a2e28 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncDatabaseIdPropertiesImpl.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.SyncDatabaseIdPropertiesInner; +import com.azure.resourcemanager.sql.generated.models.SyncDatabaseIdProperties; + +public final class SyncDatabaseIdPropertiesImpl implements SyncDatabaseIdProperties { + private SyncDatabaseIdPropertiesInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + SyncDatabaseIdPropertiesImpl( + SyncDatabaseIdPropertiesInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public SyncDatabaseIdPropertiesInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncFullSchemaPropertiesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncFullSchemaPropertiesImpl.java new file mode 100644 index 0000000000000..2bf2920f621a7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncFullSchemaPropertiesImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.SyncFullSchemaPropertiesInner; +import com.azure.resourcemanager.sql.generated.models.SyncFullSchemaProperties; +import com.azure.resourcemanager.sql.generated.models.SyncFullSchemaTable; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class SyncFullSchemaPropertiesImpl implements SyncFullSchemaProperties { + private SyncFullSchemaPropertiesInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + SyncFullSchemaPropertiesImpl( + SyncFullSchemaPropertiesInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List tables() { + List inner = this.innerModel().tables(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public OffsetDateTime lastUpdateTime() { + return this.innerModel().lastUpdateTime(); + } + + public SyncFullSchemaPropertiesInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncGroupImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncGroupImpl.java new file mode 100644 index 0000000000000..6e400d92b3cee --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncGroupImpl.java @@ -0,0 +1,268 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncGroupInner; +import com.azure.resourcemanager.sql.generated.models.Sku; +import com.azure.resourcemanager.sql.generated.models.SyncConflictResolutionPolicy; +import com.azure.resourcemanager.sql.generated.models.SyncGroup; +import com.azure.resourcemanager.sql.generated.models.SyncGroupSchema; +import com.azure.resourcemanager.sql.generated.models.SyncGroupState; +import java.time.OffsetDateTime; + +public final class SyncGroupImpl implements SyncGroup, SyncGroup.Definition, SyncGroup.Update { + private SyncGroupInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public Sku sku() { + return this.innerModel().sku(); + } + + public Integer interval() { + return this.innerModel().interval(); + } + + public OffsetDateTime lastSyncTime() { + return this.innerModel().lastSyncTime(); + } + + public SyncConflictResolutionPolicy conflictResolutionPolicy() { + return this.innerModel().conflictResolutionPolicy(); + } + + public String syncDatabaseId() { + return this.innerModel().syncDatabaseId(); + } + + public String hubDatabaseUsername() { + return this.innerModel().hubDatabaseUsername(); + } + + public String hubDatabasePassword() { + return this.innerModel().hubDatabasePassword(); + } + + public SyncGroupState syncState() { + return this.innerModel().syncState(); + } + + public SyncGroupSchema schema() { + return this.innerModel().schema(); + } + + public Boolean enableConflictLogging() { + return this.innerModel().enableConflictLogging(); + } + + public Integer conflictLoggingRetentionInDays() { + return this.innerModel().conflictLoggingRetentionInDays(); + } + + public Boolean usePrivateLinkConnection() { + return this.innerModel().usePrivateLinkConnection(); + } + + public String privateEndpointName() { + return this.innerModel().privateEndpointName(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public SyncGroupInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String databaseName; + + private String syncGroupName; + + public SyncGroupImpl withExistingDatabase(String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + + public SyncGroup create() { + this.innerObject = + serviceManager + .serviceClient() + .getSyncGroups() + .createOrUpdate( + resourceGroupName, serverName, databaseName, syncGroupName, this.innerModel(), Context.NONE); + return this; + } + + public SyncGroup create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSyncGroups() + .createOrUpdate(resourceGroupName, serverName, databaseName, syncGroupName, this.innerModel(), context); + return this; + } + + SyncGroupImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new SyncGroupInner(); + this.serviceManager = serviceManager; + this.syncGroupName = name; + } + + public SyncGroupImpl update() { + return this; + } + + public SyncGroup apply() { + this.innerObject = + serviceManager + .serviceClient() + .getSyncGroups() + .update(resourceGroupName, serverName, databaseName, syncGroupName, this.innerModel(), Context.NONE); + return this; + } + + public SyncGroup apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSyncGroups() + .update(resourceGroupName, serverName, databaseName, syncGroupName, this.innerModel(), context); + return this; + } + + SyncGroupImpl(SyncGroupInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "databases"); + this.syncGroupName = Utils.getValueFromIdByName(innerObject.id(), "syncGroups"); + } + + public SyncGroup refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getSyncGroups() + .getWithResponse(resourceGroupName, serverName, databaseName, syncGroupName, Context.NONE) + .getValue(); + return this; + } + + public SyncGroup refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSyncGroups() + .getWithResponse(resourceGroupName, serverName, databaseName, syncGroupName, context) + .getValue(); + return this; + } + + public void refreshHubSchema() { + serviceManager.syncGroups().refreshHubSchema(resourceGroupName, serverName, databaseName, syncGroupName); + } + + public void refreshHubSchema(Context context) { + serviceManager + .syncGroups() + .refreshHubSchema(resourceGroupName, serverName, databaseName, syncGroupName, context); + } + + public Response cancelSyncWithResponse(Context context) { + return serviceManager + .syncGroups() + .cancelSyncWithResponse(resourceGroupName, serverName, databaseName, syncGroupName, context); + } + + public void cancelSync() { + serviceManager.syncGroups().cancelSync(resourceGroupName, serverName, databaseName, syncGroupName); + } + + public Response triggerSyncWithResponse(Context context) { + return serviceManager + .syncGroups() + .triggerSyncWithResponse(resourceGroupName, serverName, databaseName, syncGroupName, context); + } + + public void triggerSync() { + serviceManager.syncGroups().triggerSync(resourceGroupName, serverName, databaseName, syncGroupName); + } + + public SyncGroupImpl withSku(Sku sku) { + this.innerModel().withSku(sku); + return this; + } + + public SyncGroupImpl withInterval(Integer interval) { + this.innerModel().withInterval(interval); + return this; + } + + public SyncGroupImpl withConflictResolutionPolicy(SyncConflictResolutionPolicy conflictResolutionPolicy) { + this.innerModel().withConflictResolutionPolicy(conflictResolutionPolicy); + return this; + } + + public SyncGroupImpl withSyncDatabaseId(String syncDatabaseId) { + this.innerModel().withSyncDatabaseId(syncDatabaseId); + return this; + } + + public SyncGroupImpl withHubDatabaseUsername(String hubDatabaseUsername) { + this.innerModel().withHubDatabaseUsername(hubDatabaseUsername); + return this; + } + + public SyncGroupImpl withHubDatabasePassword(String hubDatabasePassword) { + this.innerModel().withHubDatabasePassword(hubDatabasePassword); + return this; + } + + public SyncGroupImpl withSchema(SyncGroupSchema schema) { + this.innerModel().withSchema(schema); + return this; + } + + public SyncGroupImpl withEnableConflictLogging(Boolean enableConflictLogging) { + this.innerModel().withEnableConflictLogging(enableConflictLogging); + return this; + } + + public SyncGroupImpl withConflictLoggingRetentionInDays(Integer conflictLoggingRetentionInDays) { + this.innerModel().withConflictLoggingRetentionInDays(conflictLoggingRetentionInDays); + return this; + } + + public SyncGroupImpl withUsePrivateLinkConnection(Boolean usePrivateLinkConnection) { + this.innerModel().withUsePrivateLinkConnection(usePrivateLinkConnection); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncGroupLogPropertiesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncGroupLogPropertiesImpl.java new file mode 100644 index 0000000000000..e7b1eb03741dc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncGroupLogPropertiesImpl.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.SyncGroupLogPropertiesInner; +import com.azure.resourcemanager.sql.generated.models.SyncGroupLogProperties; +import com.azure.resourcemanager.sql.generated.models.SyncGroupLogType; +import java.time.OffsetDateTime; +import java.util.UUID; + +public final class SyncGroupLogPropertiesImpl implements SyncGroupLogProperties { + private SyncGroupLogPropertiesInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + SyncGroupLogPropertiesImpl( + SyncGroupLogPropertiesInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public OffsetDateTime timestamp() { + return this.innerModel().timestamp(); + } + + public SyncGroupLogType type() { + return this.innerModel().type(); + } + + public String source() { + return this.innerModel().source(); + } + + public String details() { + return this.innerModel().details(); + } + + public UUID tracingId() { + return this.innerModel().tracingId(); + } + + public String operationStatus() { + return this.innerModel().operationStatus(); + } + + public SyncGroupLogPropertiesInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncGroupsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncGroupsClientImpl.java new file mode 100644 index 0000000000000..8d93a40ca61f8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncGroupsClientImpl.java @@ -0,0 +1,3386 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.SyncGroupsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncDatabaseIdPropertiesInner; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncFullSchemaPropertiesInner; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncGroupInner; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncGroupLogPropertiesInner; +import com.azure.resourcemanager.sql.generated.models.SyncDatabaseIdListResult; +import com.azure.resourcemanager.sql.generated.models.SyncFullSchemaPropertiesListResult; +import com.azure.resourcemanager.sql.generated.models.SyncGroupListResult; +import com.azure.resourcemanager.sql.generated.models.SyncGroupLogListResult; +import com.azure.resourcemanager.sql.generated.models.SyncGroupsType; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in SyncGroupsClient. */ +public final class SyncGroupsClientImpl implements SyncGroupsClient { + /** The proxy service used to perform REST calls. */ + private final SyncGroupsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of SyncGroupsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SyncGroupsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(SyncGroupsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientSyncGroups to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + public interface SyncGroupsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/syncDatabaseIds") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listSyncDatabaseIds( + @HostParam("$host") String endpoint, + @PathParam("locationName") String locationName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/refreshHubSchema") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> refreshHubSchema( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("syncGroupName") String syncGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/hubSchemas") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listHubSchemas( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("syncGroupName") String syncGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/logs") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listLogs( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("syncGroupName") String syncGroupName, + @QueryParam("startTime") String startTime, + @QueryParam("endTime") String endTime, + @QueryParam("type") SyncGroupsType type, + @QueryParam("continuationToken") String continuationToken, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/cancelSync") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> cancelSync( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("syncGroupName") String syncGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/triggerSync") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> triggerSync( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("syncGroupName") String syncGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("syncGroupName") String syncGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("syncGroupName") String syncGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SyncGroupInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("syncGroupName") String syncGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("syncGroupName") String syncGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SyncGroupInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/syncGroups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listSyncDatabaseIdsNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listHubSchemasNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listLogsNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabaseNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a collection of sync database ids along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSyncDatabaseIdsSinglePageAsync(String locationName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listSyncDatabaseIds( + this.client.getEndpoint(), + locationName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a collection of sync database ids. + * + * @param locationName The name of the region where the resource is located. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a collection of sync database ids along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSyncDatabaseIdsSinglePageAsync( + String locationName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listSyncDatabaseIds( + this.client.getEndpoint(), locationName, this.client.getSubscriptionId(), apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a collection of sync database ids as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listSyncDatabaseIdsAsync(String locationName) { + return new PagedFlux<>( + () -> listSyncDatabaseIdsSinglePageAsync(locationName), + nextLink -> listSyncDatabaseIdsNextSinglePageAsync(nextLink)); + } + + /** + * Gets a collection of sync database ids. + * + * @param locationName The name of the region where the resource is located. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a collection of sync database ids as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listSyncDatabaseIdsAsync(String locationName, Context context) { + return new PagedFlux<>( + () -> listSyncDatabaseIdsSinglePageAsync(locationName, context), + nextLink -> listSyncDatabaseIdsNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a collection of sync database ids as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listSyncDatabaseIds(String locationName) { + return new PagedIterable<>(listSyncDatabaseIdsAsync(locationName)); + } + + /** + * Gets a collection of sync database ids. + * + * @param locationName The name of the region where the resource is located. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a collection of sync database ids as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listSyncDatabaseIds(String locationName, Context context) { + return new PagedIterable<>(listSyncDatabaseIdsAsync(locationName, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> refreshHubSchemaWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .refreshHubSchema( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> refreshHubSchemaWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .refreshHubSchema( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRefreshHubSchemaAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + Mono>> mono = + refreshHubSchemaWithResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRefreshHubSchemaAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + refreshHubSchemaWithResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRefreshHubSchema( + String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + return beginRefreshHubSchemaAsync(resourceGroupName, serverName, databaseName, syncGroupName).getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRefreshHubSchema( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context) { + return beginRefreshHubSchemaAsync(resourceGroupName, serverName, databaseName, syncGroupName, context) + .getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono refreshHubSchemaAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + return beginRefreshHubSchemaAsync(resourceGroupName, serverName, databaseName, syncGroupName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono refreshHubSchemaAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context) { + return beginRefreshHubSchemaAsync(resourceGroupName, serverName, databaseName, syncGroupName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void refreshHubSchema( + String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + refreshHubSchemaAsync(resourceGroupName, serverName, databaseName, syncGroupName).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void refreshHubSchema( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context) { + refreshHubSchemaAsync(resourceGroupName, serverName, databaseName, syncGroupName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a collection of hub database schemas along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listHubSchemasSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listHubSchemas( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a collection of hub database schemas along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listHubSchemasSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listHubSchemas( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a collection of hub database schemas as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listHubSchemasAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + return new PagedFlux<>( + () -> listHubSchemasSinglePageAsync(resourceGroupName, serverName, databaseName, syncGroupName), + nextLink -> listHubSchemasNextSinglePageAsync(nextLink)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a collection of hub database schemas as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listHubSchemasAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context) { + return new PagedFlux<>( + () -> listHubSchemasSinglePageAsync(resourceGroupName, serverName, databaseName, syncGroupName, context), + nextLink -> listHubSchemasNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a collection of hub database schemas as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listHubSchemas( + String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + return new PagedIterable<>(listHubSchemasAsync(resourceGroupName, serverName, databaseName, syncGroupName)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a collection of hub database schemas as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listHubSchemas( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context) { + return new PagedIterable<>( + listHubSchemasAsync(resourceGroupName, serverName, databaseName, syncGroupName, context)); + } + + /** + * 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. + * @param continuationToken The continuation token for this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a collection of sync group logs along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listLogsSinglePageAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String startTime, + String endTime, + SyncGroupsType type, + String continuationToken) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (startTime == null) { + return Mono.error(new IllegalArgumentException("Parameter startTime is required and cannot be null.")); + } + if (endTime == null) { + return Mono.error(new IllegalArgumentException("Parameter endTime is required and cannot be null.")); + } + if (type == null) { + return Mono.error(new IllegalArgumentException("Parameter type is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listLogs( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + startTime, + endTime, + type, + continuationToken, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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. + * @param continuationToken The continuation token for this operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a collection of sync group logs along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listLogsSinglePageAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String startTime, + String endTime, + SyncGroupsType type, + String continuationToken, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (startTime == null) { + return Mono.error(new IllegalArgumentException("Parameter startTime is required and cannot be null.")); + } + if (endTime == null) { + return Mono.error(new IllegalArgumentException("Parameter endTime is required and cannot be null.")); + } + if (type == null) { + return Mono.error(new IllegalArgumentException("Parameter type is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listLogs( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + startTime, + endTime, + type, + continuationToken, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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. + * @param continuationToken The continuation token for this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a collection of sync group logs as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listLogsAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String startTime, + String endTime, + SyncGroupsType type, + String continuationToken) { + return new PagedFlux<>( + () -> + listLogsSinglePageAsync( + resourceGroupName, + serverName, + databaseName, + syncGroupName, + startTime, + endTime, + type, + continuationToken), + nextLink -> listLogsNextSinglePageAsync(nextLink)); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a collection of sync group logs as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listLogsAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String startTime, + String endTime, + SyncGroupsType type) { + final String continuationToken = null; + return new PagedFlux<>( + () -> + listLogsSinglePageAsync( + resourceGroupName, + serverName, + databaseName, + syncGroupName, + startTime, + endTime, + type, + continuationToken), + nextLink -> listLogsNextSinglePageAsync(nextLink)); + } + + /** + * 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. + * @param continuationToken The continuation token for this operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a collection of sync group logs as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listLogsAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String startTime, + String endTime, + SyncGroupsType type, + String continuationToken, + Context context) { + return new PagedFlux<>( + () -> + listLogsSinglePageAsync( + resourceGroupName, + serverName, + databaseName, + syncGroupName, + startTime, + endTime, + type, + continuationToken, + context), + nextLink -> listLogsNextSinglePageAsync(nextLink, context)); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a collection of sync group logs as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listLogs( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String startTime, + String endTime, + SyncGroupsType type) { + final String continuationToken = null; + return new PagedIterable<>( + listLogsAsync( + resourceGroupName, + serverName, + databaseName, + syncGroupName, + startTime, + endTime, + type, + continuationToken)); + } + + /** + * 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. + * @param continuationToken The continuation token for this operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a collection of sync group logs as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listLogs( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String startTime, + String endTime, + SyncGroupsType type, + String continuationToken, + Context context) { + return new PagedIterable<>( + listLogsAsync( + resourceGroupName, + serverName, + databaseName, + syncGroupName, + startTime, + endTime, + type, + continuationToken, + context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> cancelSyncWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .cancelSync( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> cancelSyncWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .cancelSync( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono cancelSyncAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + return cancelSyncWithResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response cancelSyncWithResponse( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context) { + return cancelSyncWithResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void cancelSync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + cancelSyncWithResponse(resourceGroupName, serverName, databaseName, syncGroupName, Context.NONE); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> triggerSyncWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .triggerSync( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> triggerSyncWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .triggerSync( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono triggerSyncAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + return triggerSyncWithResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response triggerSyncWithResponse( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context) { + return triggerSyncWithResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, context) + .block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void triggerSync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + triggerSyncWithResponse(resourceGroupName, serverName, databaseName, syncGroupName, Context.NONE); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sync group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sync group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sync group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sync group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sync group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncGroupInner get(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + return getWithResponse(resourceGroupName, serverName, databaseName, syncGroupName, Context.NONE).getValue(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + SyncGroupInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + SyncGroupInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SyncGroupInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + SyncGroupInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + SyncGroupInner.class, + SyncGroupInner.class, + this.client.getContext()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SyncGroupInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + SyncGroupInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, serverName, databaseName, syncGroupName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), SyncGroupInner.class, SyncGroupInner.class, context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SyncGroupInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + SyncGroupInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, syncGroupName, parameters) + .getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SyncGroupInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + SyncGroupInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, syncGroupName, parameters, context) + .getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + SyncGroupInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, syncGroupName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + SyncGroupInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, syncGroupName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncGroupInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + SyncGroupInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, databaseName, syncGroupName, parameters).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncGroupInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + SyncGroupInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, databaseName, syncGroupName, parameters, context) + .block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + return beginDeleteAsync(resourceGroupName, serverName, databaseName, syncGroupName).getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, databaseName, syncGroupName, context).getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + return beginDeleteAsync(resourceGroupName, serverName, databaseName, syncGroupName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, databaseName, syncGroupName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + deleteAsync(resourceGroupName, serverName, databaseName, syncGroupName).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context) { + deleteAsync(resourceGroupName, serverName, databaseName, syncGroupName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + SyncGroupInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + SyncGroupInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SyncGroupInner> beginUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + SyncGroupInner parameters) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + SyncGroupInner.class, + SyncGroupInner.class, + this.client.getContext()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SyncGroupInner> beginUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + SyncGroupInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), SyncGroupInner.class, SyncGroupInner.class, context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SyncGroupInner> beginUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + SyncGroupInner parameters) { + return beginUpdateAsync(resourceGroupName, serverName, databaseName, syncGroupName, parameters).getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SyncGroupInner> beginUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + SyncGroupInner parameters, + Context context) { + return beginUpdateAsync(resourceGroupName, serverName, databaseName, syncGroupName, parameters, context) + .getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + SyncGroupInner parameters) { + return beginUpdateAsync(resourceGroupName, serverName, databaseName, syncGroupName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + SyncGroupInner parameters, + Context context) { + return beginUpdateAsync(resourceGroupName, serverName, databaseName, syncGroupName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncGroupInner update( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + SyncGroupInner parameters) { + return updateAsync(resourceGroupName, serverName, databaseName, syncGroupName, parameters).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncGroupInner update( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + SyncGroupInner parameters, + Context context) { + return updateAsync(resourceGroupName, serverName, databaseName, syncGroupName, parameters, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync groups along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync groups along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync groups as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync groups as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, context), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync groups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync groups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync database ID properties along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSyncDatabaseIdsNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listSyncDatabaseIdsNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync database ID properties along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSyncDatabaseIdsNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listSyncDatabaseIdsNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync schema properties along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listHubSchemasNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listHubSchemasNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync schema properties along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listHubSchemasNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listHubSchemasNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync group log properties along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listLogsNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listLogsNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync group log properties along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listLogsNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listLogsNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync groups along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync groups along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncGroupsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncGroupsImpl.java new file mode 100644 index 0000000000000..e433d2b671472 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncGroupsImpl.java @@ -0,0 +1,326 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.SyncGroupsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncDatabaseIdPropertiesInner; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncFullSchemaPropertiesInner; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncGroupInner; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncGroupLogPropertiesInner; +import com.azure.resourcemanager.sql.generated.models.SyncDatabaseIdProperties; +import com.azure.resourcemanager.sql.generated.models.SyncFullSchemaProperties; +import com.azure.resourcemanager.sql.generated.models.SyncGroup; +import com.azure.resourcemanager.sql.generated.models.SyncGroupLogProperties; +import com.azure.resourcemanager.sql.generated.models.SyncGroups; +import com.azure.resourcemanager.sql.generated.models.SyncGroupsType; + +public final class SyncGroupsImpl implements SyncGroups { + private static final ClientLogger LOGGER = new ClientLogger(SyncGroupsImpl.class); + + private final SyncGroupsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public SyncGroupsImpl( + SyncGroupsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listSyncDatabaseIds(String locationName) { + PagedIterable inner = this.serviceClient().listSyncDatabaseIds(locationName); + return Utils.mapPage(inner, inner1 -> new SyncDatabaseIdPropertiesImpl(inner1, this.manager())); + } + + public PagedIterable listSyncDatabaseIds(String locationName, Context context) { + PagedIterable inner = + this.serviceClient().listSyncDatabaseIds(locationName, context); + return Utils.mapPage(inner, inner1 -> new SyncDatabaseIdPropertiesImpl(inner1, this.manager())); + } + + public void refreshHubSchema( + String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + this.serviceClient().refreshHubSchema(resourceGroupName, serverName, databaseName, syncGroupName); + } + + public void refreshHubSchema( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context) { + this.serviceClient().refreshHubSchema(resourceGroupName, serverName, databaseName, syncGroupName, context); + } + + public PagedIterable listHubSchemas( + String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + PagedIterable inner = + this.serviceClient().listHubSchemas(resourceGroupName, serverName, databaseName, syncGroupName); + return Utils.mapPage(inner, inner1 -> new SyncFullSchemaPropertiesImpl(inner1, this.manager())); + } + + public PagedIterable listHubSchemas( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listHubSchemas(resourceGroupName, serverName, databaseName, syncGroupName, context); + return Utils.mapPage(inner, inner1 -> new SyncFullSchemaPropertiesImpl(inner1, this.manager())); + } + + public PagedIterable listLogs( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String startTime, + String endTime, + SyncGroupsType type) { + PagedIterable inner = + this + .serviceClient() + .listLogs(resourceGroupName, serverName, databaseName, syncGroupName, startTime, endTime, type); + return Utils.mapPage(inner, inner1 -> new SyncGroupLogPropertiesImpl(inner1, this.manager())); + } + + public PagedIterable listLogs( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String startTime, + String endTime, + SyncGroupsType type, + String continuationToken, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listLogs( + resourceGroupName, + serverName, + databaseName, + syncGroupName, + startTime, + endTime, + type, + continuationToken, + context); + return Utils.mapPage(inner, inner1 -> new SyncGroupLogPropertiesImpl(inner1, this.manager())); + } + + public Response cancelSyncWithResponse( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context) { + return this + .serviceClient() + .cancelSyncWithResponse(resourceGroupName, serverName, databaseName, syncGroupName, context); + } + + public void cancelSync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + this.serviceClient().cancelSync(resourceGroupName, serverName, databaseName, syncGroupName); + } + + public Response triggerSyncWithResponse( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context) { + return this + .serviceClient() + .triggerSyncWithResponse(resourceGroupName, serverName, databaseName, syncGroupName, context); + } + + public void triggerSync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + this.serviceClient().triggerSync(resourceGroupName, serverName, databaseName, syncGroupName); + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, databaseName, syncGroupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SyncGroupImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SyncGroup get(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + SyncGroupInner inner = this.serviceClient().get(resourceGroupName, serverName, databaseName, syncGroupName); + if (inner != null) { + return new SyncGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + this.serviceClient().delete(resourceGroupName, serverName, databaseName, syncGroupName); + } + + public void delete( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context) { + this.serviceClient().delete(resourceGroupName, serverName, databaseName, syncGroupName, context); + } + + public PagedIterable listByDatabase(String resourceGroupName, String serverName, String databaseName) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName); + return Utils.mapPage(inner, inner1 -> new SyncGroupImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName, context); + return Utils.mapPage(inner, inner1 -> new SyncGroupImpl(inner1, this.manager())); + } + + public SyncGroup getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String syncGroupName = Utils.getValueFromIdByName(id, "syncGroups"); + if (syncGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'syncGroups'.", id))); + } + return this + .getWithResponse(resourceGroupName, serverName, databaseName, syncGroupName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String syncGroupName = Utils.getValueFromIdByName(id, "syncGroups"); + if (syncGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'syncGroups'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, databaseName, syncGroupName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String syncGroupName = Utils.getValueFromIdByName(id, "syncGroups"); + if (syncGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'syncGroups'.", id))); + } + this.delete(resourceGroupName, serverName, databaseName, syncGroupName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String syncGroupName = Utils.getValueFromIdByName(id, "syncGroups"); + if (syncGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'syncGroups'.", id))); + } + this.delete(resourceGroupName, serverName, databaseName, syncGroupName, context); + } + + private SyncGroupsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public SyncGroupImpl define(String name) { + return new SyncGroupImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncMemberImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncMemberImpl.java new file mode 100644 index 0000000000000..174b1b52e2bec --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncMemberImpl.java @@ -0,0 +1,277 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncMemberInner; +import com.azure.resourcemanager.sql.generated.models.SyncDirection; +import com.azure.resourcemanager.sql.generated.models.SyncMember; +import com.azure.resourcemanager.sql.generated.models.SyncMemberDbType; +import com.azure.resourcemanager.sql.generated.models.SyncMemberState; +import java.util.UUID; + +public final class SyncMemberImpl implements SyncMember, SyncMember.Definition, SyncMember.Update { + private SyncMemberInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SyncMemberDbType databaseType() { + return this.innerModel().databaseType(); + } + + public String syncAgentId() { + return this.innerModel().syncAgentId(); + } + + public UUID sqlServerDatabaseId() { + return this.innerModel().sqlServerDatabaseId(); + } + + public String syncMemberAzureDatabaseResourceId() { + return this.innerModel().syncMemberAzureDatabaseResourceId(); + } + + public Boolean usePrivateLinkConnection() { + return this.innerModel().usePrivateLinkConnection(); + } + + public String privateEndpointName() { + return this.innerModel().privateEndpointName(); + } + + public String serverName() { + return this.innerModel().serverName(); + } + + public String databaseName() { + return this.innerModel().databaseName(); + } + + public String username() { + return this.innerModel().username(); + } + + public String password() { + return this.innerModel().password(); + } + + public SyncDirection syncDirection() { + return this.innerModel().syncDirection(); + } + + public SyncMemberState syncState() { + return this.innerModel().syncState(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public SyncMemberInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String databaseName; + + private String syncGroupName; + + private String syncMemberName; + + 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; + } + + public SyncMember create() { + this.innerObject = + serviceManager + .serviceClient() + .getSyncMembers() + .createOrUpdate( + resourceGroupName, + serverName, + databaseName, + syncGroupName, + syncMemberName, + this.innerModel(), + Context.NONE); + return this; + } + + public SyncMember create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSyncMembers() + .createOrUpdate( + resourceGroupName, + serverName, + databaseName, + syncGroupName, + syncMemberName, + this.innerModel(), + context); + return this; + } + + SyncMemberImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new SyncMemberInner(); + this.serviceManager = serviceManager; + this.syncMemberName = name; + } + + public SyncMemberImpl update() { + return this; + } + + public SyncMember apply() { + this.innerObject = + serviceManager + .serviceClient() + .getSyncMembers() + .update( + resourceGroupName, + serverName, + databaseName, + syncGroupName, + syncMemberName, + this.innerModel(), + Context.NONE); + return this; + } + + public SyncMember apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSyncMembers() + .update( + resourceGroupName, + serverName, + databaseName, + syncGroupName, + syncMemberName, + this.innerModel(), + context); + return this; + } + + SyncMemberImpl(SyncMemberInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "databases"); + this.syncGroupName = Utils.getValueFromIdByName(innerObject.id(), "syncGroups"); + this.syncMemberName = Utils.getValueFromIdByName(innerObject.id(), "syncMembers"); + } + + public SyncMember refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getSyncMembers() + .getWithResponse( + resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, Context.NONE) + .getValue(); + return this; + } + + public SyncMember refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSyncMembers() + .getWithResponse(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, context) + .getValue(); + return this; + } + + public void refreshMemberSchema() { + serviceManager + .syncMembers() + .refreshMemberSchema(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName); + } + + public void refreshMemberSchema(Context context) { + serviceManager + .syncMembers() + .refreshMemberSchema(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, context); + } + + public SyncMemberImpl withDatabaseType(SyncMemberDbType databaseType) { + this.innerModel().withDatabaseType(databaseType); + return this; + } + + public SyncMemberImpl withSyncAgentId(String syncAgentId) { + this.innerModel().withSyncAgentId(syncAgentId); + return this; + } + + public SyncMemberImpl withSqlServerDatabaseId(UUID sqlServerDatabaseId) { + this.innerModel().withSqlServerDatabaseId(sqlServerDatabaseId); + return this; + } + + public SyncMemberImpl withSyncMemberAzureDatabaseResourceId(String syncMemberAzureDatabaseResourceId) { + this.innerModel().withSyncMemberAzureDatabaseResourceId(syncMemberAzureDatabaseResourceId); + return this; + } + + public SyncMemberImpl withUsePrivateLinkConnection(Boolean usePrivateLinkConnection) { + this.innerModel().withUsePrivateLinkConnection(usePrivateLinkConnection); + return this; + } + + public SyncMemberImpl withServerName(String serverName) { + this.innerModel().withServerName(serverName); + return this; + } + + public SyncMemberImpl withDatabaseName(String databaseName) { + this.innerModel().withDatabaseName(databaseName); + return this; + } + + public SyncMemberImpl withUsername(String username) { + this.innerModel().withUsername(username); + return this; + } + + public SyncMemberImpl withPassword(String password) { + this.innerModel().withPassword(password); + return this; + } + + public SyncMemberImpl withSyncDirection(SyncDirection syncDirection) { + this.innerModel().withSyncDirection(syncDirection); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncMembersClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncMembersClientImpl.java new file mode 100644 index 0000000000000..a65b3f4e623a6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncMembersClientImpl.java @@ -0,0 +1,2503 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.SyncMembersClient; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncFullSchemaPropertiesInner; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncMemberInner; +import com.azure.resourcemanager.sql.generated.models.SyncFullSchemaPropertiesListResult; +import com.azure.resourcemanager.sql.generated.models.SyncMemberListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in SyncMembersClient. */ +public final class SyncMembersClientImpl implements SyncMembersClient { + /** The proxy service used to perform REST calls. */ + private final SyncMembersService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of SyncMembersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SyncMembersClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(SyncMembersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientSyncMembers to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientS") + public interface SyncMembersService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("syncGroupName") String syncGroupName, + @PathParam("syncMemberName") String syncMemberName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("syncGroupName") String syncGroupName, + @PathParam("syncMemberName") String syncMemberName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SyncMemberInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("syncGroupName") String syncGroupName, + @PathParam("syncMemberName") String syncMemberName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("syncGroupName") String syncGroupName, + @PathParam("syncMemberName") String syncMemberName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SyncMemberInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySyncGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("syncGroupName") String syncGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}" + + "/schemas") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listMemberSchemas( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("syncGroupName") String syncGroupName, + @PathParam("syncMemberName") String syncMemberName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/syncGroups/{syncGroupName}/syncMembers/{syncMemberName}" + + "/refreshSchema") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> refreshMemberSchema( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("syncGroupName") String syncGroupName, + @PathParam("syncMemberName") String syncMemberName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySyncGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listMemberSchemasNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sync member along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (syncMemberName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncMemberName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + syncMemberName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sync member along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (syncMemberName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncMemberName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + syncMemberName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sync member on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sync member along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + Context context) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, context) + .block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sync member. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncMemberInner get( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + return getWithResponse(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, Context.NONE) + .getValue(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync member along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + SyncMemberInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (syncMemberName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncMemberName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + syncMemberName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync member along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + SyncMemberInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (syncMemberName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncMemberName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + syncMemberName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SyncMemberInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + SyncMemberInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + SyncMemberInner.class, + SyncMemberInner.class, + this.client.getContext()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SyncMemberInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + SyncMemberInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), SyncMemberInner.class, SyncMemberInner.class, context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SyncMemberInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + SyncMemberInner parameters) { + return beginCreateOrUpdateAsync( + resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters) + .getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SyncMemberInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + SyncMemberInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters, context) + .getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync member on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + SyncMemberInner parameters) { + return beginCreateOrUpdateAsync( + resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync member on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + SyncMemberInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncMemberInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + SyncMemberInner parameters) { + return createOrUpdateAsync( + resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters) + .block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncMemberInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + SyncMemberInner parameters, + Context context) { + return createOrUpdateAsync( + resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters, context) + .block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (syncMemberName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncMemberName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + syncMemberName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (syncMemberName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncMemberName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + syncMemberName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync( + resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + return beginDeleteAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName) + .getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + Context context) { + return beginDeleteAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, context) + .getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + return beginDeleteAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + Context context) { + return beginDeleteAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + deleteAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + Context context) { + deleteAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync member along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + SyncMemberInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (syncMemberName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncMemberName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + syncMemberName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync member along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + SyncMemberInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (syncMemberName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncMemberName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + syncMemberName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SyncMemberInner> beginUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + SyncMemberInner parameters) { + Mono>> mono = + updateWithResponseAsync( + resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + SyncMemberInner.class, + SyncMemberInner.class, + this.client.getContext()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SyncMemberInner> beginUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + SyncMemberInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync( + resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), SyncMemberInner.class, SyncMemberInner.class, context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SyncMemberInner> beginUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + SyncMemberInner parameters) { + return beginUpdateAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters) + .getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SyncMemberInner> beginUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + SyncMemberInner parameters, + Context context) { + return beginUpdateAsync( + resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters, context) + .getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync member on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + SyncMemberInner parameters) { + return beginUpdateAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync member on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + SyncMemberInner parameters, + Context context) { + return beginUpdateAsync( + resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncMemberInner update( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + SyncMemberInner parameters) { + return updateAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters) + .block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL Database sync member. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncMemberInner update( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + SyncMemberInner parameters, + Context context) { + return updateAsync( + resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters, context) + .block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Azure SQL Database sync members along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySyncGroupSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listBySyncGroup( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Azure SQL Database sync members along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySyncGroupSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySyncGroup( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Azure SQL Database sync members as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySyncGroupAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + return new PagedFlux<>( + () -> listBySyncGroupSinglePageAsync(resourceGroupName, serverName, databaseName, syncGroupName), + nextLink -> listBySyncGroupNextSinglePageAsync(nextLink)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Azure SQL Database sync members as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySyncGroupAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context) { + return new PagedFlux<>( + () -> listBySyncGroupSinglePageAsync(resourceGroupName, serverName, databaseName, syncGroupName, context), + nextLink -> listBySyncGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Azure SQL Database sync members as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySyncGroup( + String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + return new PagedIterable<>(listBySyncGroupAsync(resourceGroupName, serverName, databaseName, syncGroupName)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Azure SQL Database sync members as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySyncGroup( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context) { + return new PagedIterable<>( + listBySyncGroupAsync(resourceGroupName, serverName, databaseName, syncGroupName, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sync member database schema along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMemberSchemasSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (syncMemberName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncMemberName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMemberSchemas( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + syncMemberName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sync member database schema along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMemberSchemasSinglePageAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (syncMemberName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncMemberName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMemberSchemas( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + syncMemberName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sync member database schema as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMemberSchemasAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + return new PagedFlux<>( + () -> + listMemberSchemasSinglePageAsync( + resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName), + nextLink -> listMemberSchemasNextSinglePageAsync(nextLink)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sync member database schema as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMemberSchemasAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + Context context) { + return new PagedFlux<>( + () -> + listMemberSchemasSinglePageAsync( + resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, context), + nextLink -> listMemberSchemasNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sync member database schema as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMemberSchemas( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + return new PagedIterable<>( + listMemberSchemasAsync(resourceGroupName, serverName, databaseName, syncGroupName, 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sync member database schema as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMemberSchemas( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + Context context) { + return new PagedIterable<>( + listMemberSchemasAsync( + resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> refreshMemberSchemaWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (syncMemberName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncMemberName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .refreshMemberSchema( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + syncMemberName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> refreshMemberSchemaWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (syncGroupName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncGroupName is required and cannot be null.")); + } + if (syncMemberName == null) { + return Mono.error(new IllegalArgumentException("Parameter syncMemberName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .refreshMemberSchema( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + syncGroupName, + syncMemberName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRefreshMemberSchemaAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + Mono>> mono = + refreshMemberSchemaWithResponseAsync( + resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRefreshMemberSchemaAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + refreshMemberSchemaWithResponseAsync( + resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRefreshMemberSchema( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + return beginRefreshMemberSchemaAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName) + .getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRefreshMemberSchema( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + Context context) { + return beginRefreshMemberSchemaAsync( + resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, context) + .getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono refreshMemberSchemaAsync( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + return beginRefreshMemberSchemaAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono refreshMemberSchemaAsync( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + Context context) { + return beginRefreshMemberSchemaAsync( + resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void refreshMemberSchema( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + refreshMemberSchemaAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void refreshMemberSchema( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + Context context) { + refreshMemberSchemaAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, context) + .block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Azure SQL Database sync members along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySyncGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listBySyncGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Azure SQL Database sync members along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySyncGroupNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySyncGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync schema properties along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMemberSchemasNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listMemberSchemasNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync schema properties along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMemberSchemasNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMemberSchemasNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncMembersImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncMembersImpl.java new file mode 100644 index 0000000000000..39ce6ed2c30cd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/SyncMembersImpl.java @@ -0,0 +1,312 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.SyncMembersClient; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncFullSchemaPropertiesInner; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncMemberInner; +import com.azure.resourcemanager.sql.generated.models.SyncFullSchemaProperties; +import com.azure.resourcemanager.sql.generated.models.SyncMember; +import com.azure.resourcemanager.sql.generated.models.SyncMembers; + +public final class SyncMembersImpl implements SyncMembers { + private static final ClientLogger LOGGER = new ClientLogger(SyncMembersImpl.class); + + private final SyncMembersClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public SyncMembersImpl( + SyncMembersClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SyncMemberImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SyncMember get( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + SyncMemberInner inner = + this.serviceClient().get(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName); + if (inner != null) { + return new SyncMemberImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + this.serviceClient().delete(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName); + } + + public void delete( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + Context context) { + this + .serviceClient() + .delete(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, context); + } + + public PagedIterable listBySyncGroup( + String resourceGroupName, String serverName, String databaseName, String syncGroupName) { + PagedIterable inner = + this.serviceClient().listBySyncGroup(resourceGroupName, serverName, databaseName, syncGroupName); + return Utils.mapPage(inner, inner1 -> new SyncMemberImpl(inner1, this.manager())); + } + + public PagedIterable listBySyncGroup( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listBySyncGroup(resourceGroupName, serverName, databaseName, syncGroupName, context); + return Utils.mapPage(inner, inner1 -> new SyncMemberImpl(inner1, this.manager())); + } + + public PagedIterable listMemberSchemas( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + PagedIterable inner = + this + .serviceClient() + .listMemberSchemas(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName); + return Utils.mapPage(inner, inner1 -> new SyncFullSchemaPropertiesImpl(inner1, this.manager())); + } + + public PagedIterable listMemberSchemas( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listMemberSchemas(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, context); + return Utils.mapPage(inner, inner1 -> new SyncFullSchemaPropertiesImpl(inner1, this.manager())); + } + + public void refreshMemberSchema( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) { + this + .serviceClient() + .refreshMemberSchema(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName); + } + + public void refreshMemberSchema( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + Context context) { + this + .serviceClient() + .refreshMemberSchema(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, context); + } + + public SyncMember getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String syncGroupName = Utils.getValueFromIdByName(id, "syncGroups"); + if (syncGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'syncGroups'.", id))); + } + String syncMemberName = Utils.getValueFromIdByName(id, "syncMembers"); + if (syncMemberName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'syncMembers'.", id))); + } + return this + .getWithResponse(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String syncGroupName = Utils.getValueFromIdByName(id, "syncGroups"); + if (syncGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'syncGroups'.", id))); + } + String syncMemberName = Utils.getValueFromIdByName(id, "syncMembers"); + if (syncMemberName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'syncMembers'.", id))); + } + return this + .getWithResponse(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String syncGroupName = Utils.getValueFromIdByName(id, "syncGroups"); + if (syncGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'syncGroups'.", id))); + } + String syncMemberName = Utils.getValueFromIdByName(id, "syncMembers"); + if (syncMemberName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'syncMembers'.", id))); + } + this.delete(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String syncGroupName = Utils.getValueFromIdByName(id, "syncGroups"); + if (syncGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'syncGroups'.", id))); + } + String syncMemberName = Utils.getValueFromIdByName(id, "syncMembers"); + if (syncMemberName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'syncMembers'.", id))); + } + this.delete(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, context); + } + + private SyncMembersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public SyncMemberImpl define(String name) { + return new SyncMemberImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TdeCertificatesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TdeCertificatesClientImpl.java new file mode 100644 index 0000000000000..3a8e9b92ad791 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TdeCertificatesClientImpl.java @@ -0,0 +1,338 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.TdeCertificatesClient; +import com.azure.resourcemanager.sql.generated.models.TdeCertificate; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in TdeCertificatesClient. */ +public final class TdeCertificatesClientImpl implements TdeCertificatesClient { + /** The proxy service used to perform REST calls. */ + private final TdeCertificatesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of TdeCertificatesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TdeCertificatesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(TdeCertificatesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientTdeCertificates to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientT") + public interface TdeCertificatesService { + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/tdeCertificates") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") TdeCertificate parameters, + Context context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, String serverName, TdeCertificate parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, String serverName, TdeCertificate parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginCreateAsync( + String resourceGroupName, String serverName, TdeCertificate parameters) { + Mono>> mono = createWithResponseAsync(resourceGroupName, serverName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginCreateAsync( + String resourceGroupName, String serverName, TdeCertificate parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createWithResponseAsync(resourceGroupName, serverName, parameters, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginCreate( + String resourceGroupName, String serverName, TdeCertificate parameters) { + return beginCreateAsync(resourceGroupName, serverName, parameters).getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginCreate( + String resourceGroupName, String serverName, TdeCertificate parameters, Context context) { + return beginCreateAsync(resourceGroupName, serverName, parameters, context).getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String serverName, TdeCertificate parameters) { + return beginCreateAsync(resourceGroupName, serverName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String serverName, TdeCertificate parameters, Context context) { + return beginCreateAsync(resourceGroupName, serverName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void create(String resourceGroupName, String serverName, TdeCertificate parameters) { + createAsync(resourceGroupName, serverName, parameters).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void create(String resourceGroupName, String serverName, TdeCertificate parameters, Context context) { + createAsync(resourceGroupName, serverName, parameters, context).block(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TdeCertificatesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TdeCertificatesImpl.java new file mode 100644 index 0000000000000..27b4a77b9d0b3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TdeCertificatesImpl.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.TdeCertificatesClient; +import com.azure.resourcemanager.sql.generated.models.TdeCertificate; +import com.azure.resourcemanager.sql.generated.models.TdeCertificates; + +public final class TdeCertificatesImpl implements TdeCertificates { + private static final ClientLogger LOGGER = new ClientLogger(TdeCertificatesImpl.class); + + private final TdeCertificatesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public TdeCertificatesImpl( + TdeCertificatesClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void create(String resourceGroupName, String serverName, TdeCertificate parameters) { + this.serviceClient().create(resourceGroupName, serverName, parameters); + } + + public void create(String resourceGroupName, String serverName, TdeCertificate parameters, Context context) { + this.serviceClient().create(resourceGroupName, serverName, parameters, context); + } + + private TdeCertificatesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TimeZoneImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TimeZoneImpl.java new file mode 100644 index 0000000000000..6e87c4405a48b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TimeZoneImpl.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.TimeZoneInner; +import com.azure.resourcemanager.sql.generated.models.TimeZone; + +public final class TimeZoneImpl implements TimeZone { + private TimeZoneInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + TimeZoneImpl(TimeZoneInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String timeZoneId() { + return this.innerModel().timeZoneId(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public TimeZoneInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TimeZonesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TimeZonesClientImpl.java new file mode 100644 index 0000000000000..c0f912f941f21 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TimeZonesClientImpl.java @@ -0,0 +1,464 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.TimeZonesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.TimeZoneInner; +import com.azure.resourcemanager.sql.generated.models.TimeZoneListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in TimeZonesClient. */ +public final class TimeZonesClientImpl implements TimeZonesClient { + /** The proxy service used to perform REST calls. */ + private final TimeZonesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of TimeZonesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TimeZonesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(TimeZonesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientTimeZones to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientT") + public interface TimeZonesService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/timeZones") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByLocation( + @HostParam("$host") String endpoint, + @PathParam("locationName") String locationName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/timeZones/{timeZoneId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("locationName") String locationName, + @PathParam("timeZoneId") String timeZoneId, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByLocationNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a list of managed instance time zones by location. + * + * @param locationName The locationName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance time zones by location along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationSinglePageAsync(String locationName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByLocation( + this.client.getEndpoint(), + locationName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of managed instance time zones by location. + * + * @param locationName The locationName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance time zones by location along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationSinglePageAsync(String locationName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByLocation( + this.client.getEndpoint(), locationName, this.client.getSubscriptionId(), apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of managed instance time zones by location. + * + * @param locationName The locationName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance time zones by location as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByLocationAsync(String locationName) { + return new PagedFlux<>( + () -> listByLocationSinglePageAsync(locationName), nextLink -> listByLocationNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of managed instance time zones by location. + * + * @param locationName The locationName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance time zones by location as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByLocationAsync(String locationName, Context context) { + return new PagedFlux<>( + () -> listByLocationSinglePageAsync(locationName, context), + nextLink -> listByLocationNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of managed instance time zones by location. + * + * @param locationName The locationName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance time zones by location as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByLocation(String locationName) { + return new PagedIterable<>(listByLocationAsync(locationName)); + } + + /** + * Gets a list of managed instance time zones by location. + * + * @param locationName The locationName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance time zones by location as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByLocation(String locationName, Context context) { + return new PagedIterable<>(listByLocationAsync(locationName, context)); + } + + /** + * Gets a managed instance time zone. + * + * @param locationName The locationName parameter. + * @param timeZoneId The timeZoneId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance time zone along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String locationName, String timeZoneId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (timeZoneId == null) { + return Mono.error(new IllegalArgumentException("Parameter timeZoneId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + locationName, + timeZoneId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a managed instance time zone. + * + * @param locationName The locationName parameter. + * @param timeZoneId The timeZoneId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance time zone along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String locationName, String timeZoneId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (timeZoneId == null) { + return Mono.error(new IllegalArgumentException("Parameter timeZoneId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + locationName, + timeZoneId, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a managed instance time zone. + * + * @param locationName The locationName parameter. + * @param timeZoneId The timeZoneId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance time zone on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String locationName, String timeZoneId) { + return getWithResponseAsync(locationName, timeZoneId).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a managed instance time zone. + * + * @param locationName The locationName parameter. + * @param timeZoneId The timeZoneId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance time zone along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String locationName, String timeZoneId, Context context) { + return getWithResponseAsync(locationName, timeZoneId, context).block(); + } + + /** + * Gets a managed instance time zone. + * + * @param locationName The locationName parameter. + * @param timeZoneId The timeZoneId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance time zone. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TimeZoneInner get(String locationName, String timeZoneId) { + return getWithResponse(locationName, timeZoneId, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of time zones along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByLocationNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of time zones along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByLocationNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByLocationNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TimeZonesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TimeZonesImpl.java new file mode 100644 index 0000000000000..04287b234a4d5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TimeZonesImpl.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.TimeZonesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.TimeZoneInner; +import com.azure.resourcemanager.sql.generated.models.TimeZone; +import com.azure.resourcemanager.sql.generated.models.TimeZones; + +public final class TimeZonesImpl implements TimeZones { + private static final ClientLogger LOGGER = new ClientLogger(TimeZonesImpl.class); + + private final TimeZonesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public TimeZonesImpl( + TimeZonesClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByLocation(String locationName) { + PagedIterable inner = this.serviceClient().listByLocation(locationName); + return Utils.mapPage(inner, inner1 -> new TimeZoneImpl(inner1, this.manager())); + } + + public PagedIterable listByLocation(String locationName, Context context) { + PagedIterable inner = this.serviceClient().listByLocation(locationName, context); + return Utils.mapPage(inner, inner1 -> new TimeZoneImpl(inner1, this.manager())); + } + + public Response getWithResponse(String locationName, String timeZoneId, Context context) { + Response inner = this.serviceClient().getWithResponse(locationName, timeZoneId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new TimeZoneImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public TimeZone get(String locationName, String timeZoneId) { + TimeZoneInner inner = this.serviceClient().get(locationName, timeZoneId); + if (inner != null) { + return new TimeZoneImpl(inner, this.manager()); + } else { + return null; + } + } + + private TimeZonesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TopQueriesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TopQueriesImpl.java new file mode 100644 index 0000000000000..30a5b74427544 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TopQueriesImpl.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.QueryStatisticsProperties; +import com.azure.resourcemanager.sql.generated.fluent.models.TopQueriesInner; +import com.azure.resourcemanager.sql.generated.models.QueryTimeGrainType; +import com.azure.resourcemanager.sql.generated.models.TopQueries; +import java.util.Collections; +import java.util.List; + +public final class TopQueriesImpl implements TopQueries { + private TopQueriesInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + TopQueriesImpl(TopQueriesInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Integer numberOfQueries() { + return this.innerModel().numberOfQueries(); + } + + public String aggregationFunction() { + return this.innerModel().aggregationFunction(); + } + + public String observationMetric() { + return this.innerModel().observationMetric(); + } + + public QueryTimeGrainType intervalType() { + return this.innerModel().intervalType(); + } + + public String startTime() { + return this.innerModel().startTime(); + } + + public String endTime() { + return this.innerModel().endTime(); + } + + public List queries() { + List inner = this.innerModel().queries(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public TopQueriesInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TransparentDataEncryptionsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TransparentDataEncryptionsClientImpl.java new file mode 100644 index 0000000000000..81ebc7e4e6fdb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TransparentDataEncryptionsClientImpl.java @@ -0,0 +1,821 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.TransparentDataEncryptionsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.LogicalDatabaseTransparentDataEncryptionInner; +import com.azure.resourcemanager.sql.generated.models.LogicalDatabaseTransparentDataEncryptionListResult; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionName; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in TransparentDataEncryptionsClient. */ +public final class TransparentDataEncryptionsClientImpl implements TransparentDataEncryptionsClient { + /** The proxy service used to perform REST calls. */ + private final TransparentDataEncryptionsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of TransparentDataEncryptionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TransparentDataEncryptionsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy + .create( + TransparentDataEncryptionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientTransparentDataEncryptions to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientT") + public interface TransparentDataEncryptionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/transparentDataEncryption/{tdeName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("tdeName") TransparentDataEncryptionName tdeName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/transparentDataEncryption/{tdeName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("tdeName") TransparentDataEncryptionName tdeName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") LogicalDatabaseTransparentDataEncryptionInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/transparentDataEncryption") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabaseNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a logical database's transparent data encryption. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the logical database for which the transparent data encryption is defined. + * @param tdeName The name of the transparent data encryption configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a logical database's transparent data encryption along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, TransparentDataEncryptionName tdeName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (tdeName == null) { + return Mono.error(new IllegalArgumentException("Parameter tdeName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + tdeName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a logical database's transparent data encryption. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the logical database for which the transparent data encryption is defined. + * @param tdeName The name of the transparent data encryption configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a logical database's transparent data encryption along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + TransparentDataEncryptionName tdeName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (tdeName == null) { + return Mono.error(new IllegalArgumentException("Parameter tdeName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + tdeName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a logical database's transparent data encryption. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the logical database for which the transparent data encryption is defined. + * @param tdeName The name of the transparent data encryption configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a logical database's transparent data encryption on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String databaseName, TransparentDataEncryptionName tdeName) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, tdeName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a logical database's transparent data encryption. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the logical database for which the transparent data encryption is defined. + * @param tdeName The name of the transparent data encryption configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a logical database's transparent data encryption along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + TransparentDataEncryptionName tdeName, + Context context) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, tdeName, context).block(); + } + + /** + * Gets a logical database's transparent data encryption. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the logical database for which the transparent data encryption is defined. + * @param tdeName The name of the transparent data encryption configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a logical database's transparent data encryption. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LogicalDatabaseTransparentDataEncryptionInner get( + String resourceGroupName, String serverName, String databaseName, TransparentDataEncryptionName tdeName) { + return getWithResponse(resourceGroupName, serverName, databaseName, tdeName, Context.NONE).getValue(); + } + + /** + * Updates a logical 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 logical database for which the security alert policy is defined. + * @param tdeName The name of the transparent data encryption configuration. + * @param parameters The database transparent data encryption. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a logical database transparent data encryption state along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + TransparentDataEncryptionName tdeName, + LogicalDatabaseTransparentDataEncryptionInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (tdeName == null) { + return Mono.error(new IllegalArgumentException("Parameter tdeName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + tdeName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates a logical 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 logical database for which the security alert policy is defined. + * @param tdeName The name of the transparent data encryption configuration. + * @param parameters The database transparent data encryption. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a logical database transparent data encryption state along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + TransparentDataEncryptionName tdeName, + LogicalDatabaseTransparentDataEncryptionInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (tdeName == null) { + return Mono.error(new IllegalArgumentException("Parameter tdeName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + tdeName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Updates a logical 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 logical database for which the security alert policy is defined. + * @param tdeName The name of the transparent data encryption configuration. + * @param parameters The database transparent data encryption. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a logical database transparent data encryption state on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + TransparentDataEncryptionName tdeName, + LogicalDatabaseTransparentDataEncryptionInner parameters) { + return createOrUpdateWithResponseAsync(resourceGroupName, serverName, databaseName, tdeName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Updates a logical 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 logical database for which the security alert policy is defined. + * @param tdeName The name of the transparent data encryption configuration. + * @param parameters The database transparent data encryption. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a logical database transparent data encryption state along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + TransparentDataEncryptionName tdeName, + LogicalDatabaseTransparentDataEncryptionInner parameters, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, serverName, databaseName, tdeName, parameters, context) + .block(); + } + + /** + * Updates a logical 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 logical database for which the security alert policy is defined. + * @param tdeName The name of the transparent data encryption configuration. + * @param parameters The database transparent data encryption. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a logical database transparent data encryption state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LogicalDatabaseTransparentDataEncryptionInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + TransparentDataEncryptionName tdeName, + LogicalDatabaseTransparentDataEncryptionInner parameters) { + return createOrUpdateWithResponse( + resourceGroupName, serverName, databaseName, tdeName, parameters, Context.NONE) + .getValue(); + } + + /** + * Gets a list of the logical database's transparent data encryption. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the logical database for which the transparent data encryption is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the logical database's transparent data encryption along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of the logical database's transparent data encryption. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the logical database for which the transparent data encryption is defined. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the logical database's transparent data encryption along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of the logical database's transparent data encryption. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the logical database for which the transparent data encryption is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the logical database's transparent data encryption as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of the logical database's transparent data encryption. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the logical database for which the transparent data encryption is defined. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the logical database's transparent data encryption as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, context), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of the logical database's transparent data encryption. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the logical database for which the transparent data encryption is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the logical database's transparent data encryption as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName)); + } + + /** + * Gets a list of the logical database's transparent data encryption. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the logical database for which the transparent data encryption is defined. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the logical database's transparent data encryption as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of transparent data encryptions along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of transparent data encryptions along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TransparentDataEncryptionsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TransparentDataEncryptionsImpl.java new file mode 100644 index 0000000000000..184840f8fa0d1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/TransparentDataEncryptionsImpl.java @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.TransparentDataEncryptionsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.LogicalDatabaseTransparentDataEncryptionInner; +import com.azure.resourcemanager.sql.generated.models.LogicalDatabaseTransparentDataEncryption; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionName; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptions; + +public final class TransparentDataEncryptionsImpl implements TransparentDataEncryptions { + private static final ClientLogger LOGGER = new ClientLogger(TransparentDataEncryptionsImpl.class); + + private final TransparentDataEncryptionsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public TransparentDataEncryptionsImpl( + TransparentDataEncryptionsClient innerClient, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + TransparentDataEncryptionName tdeName, + Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, databaseName, tdeName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new LogicalDatabaseTransparentDataEncryptionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public LogicalDatabaseTransparentDataEncryption get( + String resourceGroupName, String serverName, String databaseName, TransparentDataEncryptionName tdeName) { + LogicalDatabaseTransparentDataEncryptionInner inner = + this.serviceClient().get(resourceGroupName, serverName, databaseName, tdeName); + if (inner != null) { + return new LogicalDatabaseTransparentDataEncryptionImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName); + return Utils.mapPage(inner, inner1 -> new LogicalDatabaseTransparentDataEncryptionImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName, context); + return Utils.mapPage(inner, inner1 -> new LogicalDatabaseTransparentDataEncryptionImpl(inner1, this.manager())); + } + + public LogicalDatabaseTransparentDataEncryption getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String tdeNameLocal = Utils.getValueFromIdByName(id, "transparentDataEncryption"); + if (tdeNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'transparentDataEncryption'.", + id))); + } + TransparentDataEncryptionName tdeName = TransparentDataEncryptionName.fromString(tdeNameLocal); + return this.getWithResponse(resourceGroupName, serverName, databaseName, tdeName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String tdeNameLocal = Utils.getValueFromIdByName(id, "transparentDataEncryption"); + if (tdeNameLocal == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'transparentDataEncryption'.", + id))); + } + TransparentDataEncryptionName tdeName = TransparentDataEncryptionName.fromString(tdeNameLocal); + return this.getWithResponse(resourceGroupName, serverName, databaseName, tdeName, context); + } + + private TransparentDataEncryptionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public LogicalDatabaseTransparentDataEncryptionImpl define(TransparentDataEncryptionName name) { + return new LogicalDatabaseTransparentDataEncryptionImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/UpdateVirtualClusterDnsServersOperationImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/UpdateVirtualClusterDnsServersOperationImpl.java new file mode 100644 index 0000000000000..0f84aa51331de --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/UpdateVirtualClusterDnsServersOperationImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.UpdateVirtualClusterDnsServersOperationInner; +import com.azure.resourcemanager.sql.generated.models.DnsRefreshOperationStatus; +import com.azure.resourcemanager.sql.generated.models.UpdateVirtualClusterDnsServersOperation; + +public final class UpdateVirtualClusterDnsServersOperationImpl implements UpdateVirtualClusterDnsServersOperation { + private UpdateVirtualClusterDnsServersOperationInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + UpdateVirtualClusterDnsServersOperationImpl( + UpdateVirtualClusterDnsServersOperationInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public DnsRefreshOperationStatus status() { + return this.innerModel().status(); + } + + public UpdateVirtualClusterDnsServersOperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/UsageImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/UsageImpl.java new file mode 100644 index 0000000000000..ad49a8d6b6754 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/UsageImpl.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.UsageInner; +import com.azure.resourcemanager.sql.generated.models.Name; +import com.azure.resourcemanager.sql.generated.models.Usage; + +public final class UsageImpl implements Usage { + private UsageInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + UsageImpl(UsageInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public Name name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String unit() { + return this.innerModel().unit(); + } + + public Integer currentValue() { + return this.innerModel().currentValue(); + } + + public Integer limit() { + return this.innerModel().limit(); + } + + public Integer requestedLimit() { + return this.innerModel().requestedLimit(); + } + + public UsageInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/UsagesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/UsagesClientImpl.java new file mode 100644 index 0000000000000..5ca5e49ee7de8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/UsagesClientImpl.java @@ -0,0 +1,379 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.sql.generated.fluent.UsagesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.UsageInner; +import com.azure.resourcemanager.sql.generated.models.UsageListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in UsagesClient. */ +public final class UsagesClientImpl implements UsagesClient { + /** The proxy service used to perform REST calls. */ + private final UsagesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of UsagesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + UsagesClientImpl(SqlManagementClientImpl client) { + this.service = RestProxy.create(UsagesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientUsages to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientU") + public interface UsagesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools" + + "/{instancePoolName}/usages") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInstancePool( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("instancePoolName") String instancePoolName, + @QueryParam("expandChildren") Boolean expandChildren, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInstancePoolNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets all instance pool usage metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @param expandChildren Optional request parameter to include managed instance usages within the instance pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all instance pool usage metrics along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstancePoolSinglePageAsync( + String resourceGroupName, String instancePoolName, Boolean expandChildren) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (instancePoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter instancePoolName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByInstancePool( + this.client.getEndpoint(), + resourceGroupName, + instancePoolName, + expandChildren, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets all instance pool usage metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @param expandChildren Optional request parameter to include managed instance usages within the instance pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all instance pool usage metrics along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstancePoolSinglePageAsync( + String resourceGroupName, String instancePoolName, Boolean expandChildren, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (instancePoolName == null) { + return Mono + .error(new IllegalArgumentException("Parameter instancePoolName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-02-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInstancePool( + this.client.getEndpoint(), + resourceGroupName, + instancePoolName, + expandChildren, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets all instance pool usage metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @param expandChildren Optional request parameter to include managed instance usages within the instance pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all instance pool usage metrics as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstancePoolAsync( + String resourceGroupName, String instancePoolName, Boolean expandChildren) { + return new PagedFlux<>( + () -> listByInstancePoolSinglePageAsync(resourceGroupName, instancePoolName, expandChildren), + nextLink -> listByInstancePoolNextSinglePageAsync(nextLink)); + } + + /** + * Gets all instance pool usage metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all instance pool usage metrics as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstancePoolAsync(String resourceGroupName, String instancePoolName) { + final Boolean expandChildren = null; + return new PagedFlux<>( + () -> listByInstancePoolSinglePageAsync(resourceGroupName, instancePoolName, expandChildren), + nextLink -> listByInstancePoolNextSinglePageAsync(nextLink)); + } + + /** + * Gets all instance pool usage metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @param expandChildren Optional request parameter to include managed instance usages within the instance pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all instance pool usage metrics as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInstancePoolAsync( + String resourceGroupName, String instancePoolName, Boolean expandChildren, Context context) { + return new PagedFlux<>( + () -> listByInstancePoolSinglePageAsync(resourceGroupName, instancePoolName, expandChildren, context), + nextLink -> listByInstancePoolNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all instance pool usage metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all instance pool usage metrics as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstancePool(String resourceGroupName, String instancePoolName) { + final Boolean expandChildren = null; + return new PagedIterable<>(listByInstancePoolAsync(resourceGroupName, instancePoolName, expandChildren)); + } + + /** + * Gets all instance pool usage metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @param expandChildren Optional request parameter to include managed instance usages within the instance pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all instance pool usage metrics as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInstancePool( + String resourceGroupName, String instancePoolName, Boolean expandChildren, Context context) { + return new PagedIterable<>( + listByInstancePoolAsync(resourceGroupName, instancePoolName, expandChildren, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of usages along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstancePoolNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByInstancePoolNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of usages along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInstancePoolNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInstancePoolNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/UsagesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/UsagesImpl.java new file mode 100644 index 0000000000000..8b85cf68074f7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/UsagesImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.UsagesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.UsageInner; +import com.azure.resourcemanager.sql.generated.models.Usage; +import com.azure.resourcemanager.sql.generated.models.Usages; + +public final class UsagesImpl implements Usages { + private static final ClientLogger LOGGER = new ClientLogger(UsagesImpl.class); + + private final UsagesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public UsagesImpl(UsagesClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByInstancePool(String resourceGroupName, String instancePoolName) { + PagedIterable inner = this.serviceClient().listByInstancePool(resourceGroupName, instancePoolName); + return Utils.mapPage(inner, inner1 -> new UsageImpl(inner1, this.manager())); + } + + public PagedIterable listByInstancePool( + String resourceGroupName, String instancePoolName, Boolean expandChildren, Context context) { + PagedIterable inner = + this.serviceClient().listByInstancePool(resourceGroupName, instancePoolName, expandChildren, context); + return Utils.mapPage(inner, inner1 -> new UsageImpl(inner1, this.manager())); + } + + private UsagesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/Utils.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/Utils.java new file mode 100644 index 0000000000000..325c85d1c949d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/Utils.java @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Flux; + +final class Utils { + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (segments.size() > 0 && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super( + PagedFlux + .create( + () -> + (continuationToken, pageSize) -> + Flux.fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> + new PagedResponseBase( + page.getRequest(), + page.getStatusCode(), + page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), + page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl, PagedResponse>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl(iterable.iterator(), mapper); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/VirtualClusterImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/VirtualClusterImpl.java new file mode 100644 index 0000000000000..d668734311caf --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/VirtualClusterImpl.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.VirtualClusterInner; +import com.azure.resourcemanager.sql.generated.models.VirtualCluster; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class VirtualClusterImpl implements VirtualCluster { + private VirtualClusterInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + VirtualClusterImpl( + VirtualClusterInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String subnetId() { + return this.innerModel().subnetId(); + } + + public String version() { + return this.innerModel().version(); + } + + public List childResources() { + List inner = this.innerModel().childResources(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public VirtualClusterInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/VirtualClustersClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/VirtualClustersClientImpl.java new file mode 100644 index 0000000000000..b95732dc0303e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/VirtualClustersClientImpl.java @@ -0,0 +1,1569 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.VirtualClustersClient; +import com.azure.resourcemanager.sql.generated.fluent.models.UpdateVirtualClusterDnsServersOperationInner; +import com.azure.resourcemanager.sql.generated.fluent.models.VirtualClusterInner; +import com.azure.resourcemanager.sql.generated.models.VirtualClusterListResult; +import com.azure.resourcemanager.sql.generated.models.VirtualClusterUpdate; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in VirtualClustersClient. */ +public final class VirtualClustersClientImpl implements VirtualClustersClient { + /** The proxy service used to perform REST calls. */ + private final VirtualClustersService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of VirtualClustersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + VirtualClustersClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(VirtualClustersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientVirtualClusters to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientV") + public interface VirtualClustersService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Sql/virtualClusters") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql" + + "/virtualClusters") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/virtualClusters" + + "/{virtualClusterName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualClusterName") String virtualClusterName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/virtualClusters" + + "/{virtualClusterName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualClusterName") String virtualClusterName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/virtualClusters" + + "/{virtualClusterName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualClusterName") String virtualClusterName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") VirtualClusterUpdate parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/virtualClusters" + + "/{virtualClusterName}/updateManagedInstanceDnsServers") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> updateDnsServers( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualClusterName") String virtualClusterName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a list of all virtualClusters in the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all virtualClusters in the subscription along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of all virtualClusters in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all virtualClusters in the subscription along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of all virtualClusters in the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all virtualClusters in the subscription as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of all virtualClusters in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all virtualClusters in the subscription as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of all virtualClusters in the subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all virtualClusters in the subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Gets a list of all virtualClusters in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all virtualClusters in the subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual clusters in a resource group along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual clusters in a resource group along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual clusters in a resource group as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual clusters in a resource group as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual clusters in a resource group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual clusters in a resource group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual cluster along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String virtualClusterName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualClusterName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + virtualClusterName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual cluster along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String virtualClusterName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualClusterName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + virtualClusterName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual cluster on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String virtualClusterName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, virtualClusterName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual cluster along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String virtualClusterName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, virtualClusterName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualClusterInner getByResourceGroup(String resourceGroupName, String virtualClusterName) { + return getByResourceGroupWithResponse(resourceGroupName, virtualClusterName, Context.NONE).getValue(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String virtualClusterName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualClusterName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-05-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + virtualClusterName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String virtualClusterName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualClusterName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-05-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + virtualClusterName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String virtualClusterName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, virtualClusterName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String virtualClusterName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, virtualClusterName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String virtualClusterName) { + return beginDeleteAsync(resourceGroupName, virtualClusterName).getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String virtualClusterName, Context context) { + return beginDeleteAsync(resourceGroupName, virtualClusterName, context).getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String virtualClusterName) { + return beginDeleteAsync(resourceGroupName, virtualClusterName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String virtualClusterName, Context context) { + return beginDeleteAsync(resourceGroupName, virtualClusterName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String virtualClusterName) { + deleteAsync(resourceGroupName, virtualClusterName).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String virtualClusterName, Context context) { + deleteAsync(resourceGroupName, virtualClusterName, context).block(); + } + + /** + * Updates an existing 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 virtual cluster resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL virtual cluster along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String virtualClusterName, VirtualClusterUpdate parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualClusterName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2022-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + virtualClusterName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates an existing 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 virtual cluster resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL virtual cluster along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String virtualClusterName, VirtualClusterUpdate parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualClusterName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2022-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + virtualClusterName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Updates an existing 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 virtual cluster resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an Azure SQL virtual cluster. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualClusterInner> beginUpdateAsync( + String resourceGroupName, String virtualClusterName, VirtualClusterUpdate parameters) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, virtualClusterName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualClusterInner.class, + VirtualClusterInner.class, + this.client.getContext()); + } + + /** + * Updates an existing 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 virtual cluster resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of an Azure SQL virtual cluster. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualClusterInner> beginUpdateAsync( + String resourceGroupName, String virtualClusterName, VirtualClusterUpdate parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, virtualClusterName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), VirtualClusterInner.class, VirtualClusterInner.class, context); + } + + /** + * Updates an existing 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 virtual cluster resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL virtual cluster. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualClusterInner> beginUpdate( + String resourceGroupName, String virtualClusterName, VirtualClusterUpdate parameters) { + return beginUpdateAsync(resourceGroupName, virtualClusterName, parameters).getSyncPoller(); + } + + /** + * Updates an existing 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 virtual cluster resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of an Azure SQL virtual cluster. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualClusterInner> beginUpdate( + String resourceGroupName, String virtualClusterName, VirtualClusterUpdate parameters, Context context) { + return beginUpdateAsync(resourceGroupName, virtualClusterName, parameters, context).getSyncPoller(); + } + + /** + * Updates an existing 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 virtual cluster resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL virtual cluster on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String virtualClusterName, VirtualClusterUpdate parameters) { + return beginUpdateAsync(resourceGroupName, virtualClusterName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates an existing 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 virtual cluster resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL virtual cluster on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String virtualClusterName, VirtualClusterUpdate parameters, Context context) { + return beginUpdateAsync(resourceGroupName, virtualClusterName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates an existing 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 virtual cluster resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL virtual cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualClusterInner update( + String resourceGroupName, String virtualClusterName, VirtualClusterUpdate parameters) { + return updateAsync(resourceGroupName, virtualClusterName, parameters).block(); + } + + /** + * Updates an existing 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 virtual cluster resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL virtual cluster. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualClusterInner update( + String resourceGroupName, String virtualClusterName, VirtualClusterUpdate parameters, Context context) { + return updateAsync(resourceGroupName, virtualClusterName, parameters, context).block(); + } + + /** + * Synchronizes the DNS server settings used by the managed instances inside the given 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a refresh DNS servers operation along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateDnsServersWithResponseAsync( + String resourceGroupName, String virtualClusterName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualClusterName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .updateDnsServers( + this.client.getEndpoint(), + resourceGroupName, + virtualClusterName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Synchronizes the DNS server settings used by the managed instances inside the given 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a refresh DNS servers operation along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateDnsServersWithResponseAsync( + String resourceGroupName, String virtualClusterName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualClusterName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualClusterName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .updateDnsServers( + this.client.getEndpoint(), + resourceGroupName, + virtualClusterName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Synchronizes the DNS server settings used by the managed instances inside the given 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a refresh DNS servers operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux< + PollResult, UpdateVirtualClusterDnsServersOperationInner> + beginUpdateDnsServersAsync(String resourceGroupName, String virtualClusterName) { + Mono>> mono = + updateDnsServersWithResponseAsync(resourceGroupName, virtualClusterName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + UpdateVirtualClusterDnsServersOperationInner.class, + UpdateVirtualClusterDnsServersOperationInner.class, + this.client.getContext()); + } + + /** + * Synchronizes the DNS server settings used by the managed instances inside the given 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a refresh DNS servers operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux< + PollResult, UpdateVirtualClusterDnsServersOperationInner> + beginUpdateDnsServersAsync(String resourceGroupName, String virtualClusterName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateDnsServersWithResponseAsync(resourceGroupName, virtualClusterName, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + UpdateVirtualClusterDnsServersOperationInner.class, + UpdateVirtualClusterDnsServersOperationInner.class, + context); + } + + /** + * Synchronizes the DNS server settings used by the managed instances inside the given 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a refresh DNS servers operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller< + PollResult, UpdateVirtualClusterDnsServersOperationInner> + beginUpdateDnsServers(String resourceGroupName, String virtualClusterName) { + return beginUpdateDnsServersAsync(resourceGroupName, virtualClusterName).getSyncPoller(); + } + + /** + * Synchronizes the DNS server settings used by the managed instances inside the given 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a refresh DNS servers operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller< + PollResult, UpdateVirtualClusterDnsServersOperationInner> + beginUpdateDnsServers(String resourceGroupName, String virtualClusterName, Context context) { + return beginUpdateDnsServersAsync(resourceGroupName, virtualClusterName, context).getSyncPoller(); + } + + /** + * Synchronizes the DNS server settings used by the managed instances inside the given 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a refresh DNS servers operation on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateDnsServersAsync( + String resourceGroupName, String virtualClusterName) { + return beginUpdateDnsServersAsync(resourceGroupName, virtualClusterName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Synchronizes the DNS server settings used by the managed instances inside the given 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a refresh DNS servers operation on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateDnsServersAsync( + String resourceGroupName, String virtualClusterName, Context context) { + return beginUpdateDnsServersAsync(resourceGroupName, virtualClusterName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Synchronizes the DNS server settings used by the managed instances inside the given 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a refresh DNS servers operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public UpdateVirtualClusterDnsServersOperationInner updateDnsServers( + String resourceGroupName, String virtualClusterName) { + return updateDnsServersAsync(resourceGroupName, virtualClusterName).block(); + } + + /** + * Synchronizes the DNS server settings used by the managed instances inside the given 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a refresh DNS servers operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public UpdateVirtualClusterDnsServersOperationInner updateDnsServers( + String resourceGroupName, String virtualClusterName, Context context) { + return updateDnsServersAsync(resourceGroupName, virtualClusterName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual clusters along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual clusters along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual clusters along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual clusters along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/VirtualClustersImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/VirtualClustersImpl.java new file mode 100644 index 0000000000000..675e9181883c2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/VirtualClustersImpl.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.VirtualClustersClient; +import com.azure.resourcemanager.sql.generated.fluent.models.UpdateVirtualClusterDnsServersOperationInner; +import com.azure.resourcemanager.sql.generated.fluent.models.VirtualClusterInner; +import com.azure.resourcemanager.sql.generated.models.UpdateVirtualClusterDnsServersOperation; +import com.azure.resourcemanager.sql.generated.models.VirtualCluster; +import com.azure.resourcemanager.sql.generated.models.VirtualClusterUpdate; +import com.azure.resourcemanager.sql.generated.models.VirtualClusters; + +public final class VirtualClustersImpl implements VirtualClusters { + private static final ClientLogger LOGGER = new ClientLogger(VirtualClustersImpl.class); + + private final VirtualClustersClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public VirtualClustersImpl( + VirtualClustersClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new VirtualClusterImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new VirtualClusterImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new VirtualClusterImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new VirtualClusterImpl(inner1, this.manager())); + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String virtualClusterName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, virtualClusterName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new VirtualClusterImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public VirtualCluster getByResourceGroup(String resourceGroupName, String virtualClusterName) { + VirtualClusterInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, virtualClusterName); + if (inner != null) { + return new VirtualClusterImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String virtualClusterName) { + this.serviceClient().delete(resourceGroupName, virtualClusterName); + } + + public void delete(String resourceGroupName, String virtualClusterName, Context context) { + this.serviceClient().delete(resourceGroupName, virtualClusterName, context); + } + + public VirtualCluster update(String resourceGroupName, String virtualClusterName, VirtualClusterUpdate parameters) { + VirtualClusterInner inner = this.serviceClient().update(resourceGroupName, virtualClusterName, parameters); + if (inner != null) { + return new VirtualClusterImpl(inner, this.manager()); + } else { + return null; + } + } + + public VirtualCluster update( + String resourceGroupName, String virtualClusterName, VirtualClusterUpdate parameters, Context context) { + VirtualClusterInner inner = + this.serviceClient().update(resourceGroupName, virtualClusterName, parameters, context); + if (inner != null) { + return new VirtualClusterImpl(inner, this.manager()); + } else { + return null; + } + } + + public UpdateVirtualClusterDnsServersOperation updateDnsServers( + String resourceGroupName, String virtualClusterName) { + UpdateVirtualClusterDnsServersOperationInner inner = + this.serviceClient().updateDnsServers(resourceGroupName, virtualClusterName); + if (inner != null) { + return new UpdateVirtualClusterDnsServersOperationImpl(inner, this.manager()); + } else { + return null; + } + } + + public UpdateVirtualClusterDnsServersOperation updateDnsServers( + String resourceGroupName, String virtualClusterName, Context context) { + UpdateVirtualClusterDnsServersOperationInner inner = + this.serviceClient().updateDnsServers(resourceGroupName, virtualClusterName, context); + if (inner != null) { + return new UpdateVirtualClusterDnsServersOperationImpl(inner, this.manager()); + } else { + return null; + } + } + + private VirtualClustersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/VirtualNetworkRuleImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/VirtualNetworkRuleImpl.java new file mode 100644 index 0000000000000..9250142e7509c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/VirtualNetworkRuleImpl.java @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.VirtualNetworkRuleInner; +import com.azure.resourcemanager.sql.generated.models.VirtualNetworkRule; +import com.azure.resourcemanager.sql.generated.models.VirtualNetworkRuleState; + +public final class VirtualNetworkRuleImpl + implements VirtualNetworkRule, VirtualNetworkRule.Definition, VirtualNetworkRule.Update { + private VirtualNetworkRuleInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String virtualNetworkSubnetId() { + return this.innerModel().virtualNetworkSubnetId(); + } + + public Boolean ignoreMissingVnetServiceEndpoint() { + return this.innerModel().ignoreMissingVnetServiceEndpoint(); + } + + public VirtualNetworkRuleState state() { + return this.innerModel().state(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public VirtualNetworkRuleInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String virtualNetworkRuleName; + + public VirtualNetworkRuleImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public VirtualNetworkRule create() { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualNetworkRules() + .createOrUpdate(resourceGroupName, serverName, virtualNetworkRuleName, this.innerModel(), Context.NONE); + return this; + } + + public VirtualNetworkRule create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualNetworkRules() + .createOrUpdate(resourceGroupName, serverName, virtualNetworkRuleName, this.innerModel(), context); + return this; + } + + VirtualNetworkRuleImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new VirtualNetworkRuleInner(); + this.serviceManager = serviceManager; + this.virtualNetworkRuleName = name; + } + + public VirtualNetworkRuleImpl update() { + return this; + } + + public VirtualNetworkRule apply() { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualNetworkRules() + .createOrUpdate(resourceGroupName, serverName, virtualNetworkRuleName, this.innerModel(), Context.NONE); + return this; + } + + public VirtualNetworkRule apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualNetworkRules() + .createOrUpdate(resourceGroupName, serverName, virtualNetworkRuleName, this.innerModel(), context); + return this; + } + + VirtualNetworkRuleImpl( + VirtualNetworkRuleInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.virtualNetworkRuleName = Utils.getValueFromIdByName(innerObject.id(), "virtualNetworkRules"); + } + + public VirtualNetworkRule refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualNetworkRules() + .getWithResponse(resourceGroupName, serverName, virtualNetworkRuleName, Context.NONE) + .getValue(); + return this; + } + + public VirtualNetworkRule refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualNetworkRules() + .getWithResponse(resourceGroupName, serverName, virtualNetworkRuleName, context) + .getValue(); + return this; + } + + public VirtualNetworkRuleImpl withVirtualNetworkSubnetId(String virtualNetworkSubnetId) { + this.innerModel().withVirtualNetworkSubnetId(virtualNetworkSubnetId); + return this; + } + + public VirtualNetworkRuleImpl withIgnoreMissingVnetServiceEndpoint(Boolean ignoreMissingVnetServiceEndpoint) { + this.innerModel().withIgnoreMissingVnetServiceEndpoint(ignoreMissingVnetServiceEndpoint); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/VirtualNetworkRulesClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/VirtualNetworkRulesClientImpl.java new file mode 100644 index 0000000000000..8d707408c248d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/VirtualNetworkRulesClientImpl.java @@ -0,0 +1,1180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.VirtualNetworkRulesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.VirtualNetworkRuleInner; +import com.azure.resourcemanager.sql.generated.models.VirtualNetworkRuleListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in VirtualNetworkRulesClient. */ +public final class VirtualNetworkRulesClientImpl implements VirtualNetworkRulesClient { + /** The proxy service used to perform REST calls. */ + private final VirtualNetworkRulesService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of VirtualNetworkRulesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + VirtualNetworkRulesClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(VirtualNetworkRulesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientVirtualNetworkRules to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientV") + public interface VirtualNetworkRulesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("virtualNetworkRuleName") String virtualNetworkRuleName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("virtualNetworkRuleName") String virtualNetworkRuleName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") VirtualNetworkRuleInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("virtualNetworkRuleName") String virtualNetworkRuleName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/virtualNetworkRules") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String virtualNetworkRuleName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (virtualNetworkRuleName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter virtualNetworkRuleName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + virtualNetworkRuleName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (virtualNetworkRuleName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter virtualNetworkRuleName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + virtualNetworkRuleName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String virtualNetworkRuleName) { + return getWithResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualNetworkRuleInner get(String resourceGroupName, String serverName, String virtualNetworkRuleName) { + return getWithResponse(resourceGroupName, serverName, virtualNetworkRuleName, Context.NONE).getValue(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (virtualNetworkRuleName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter virtualNetworkRuleName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + virtualNetworkRuleName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (virtualNetworkRuleName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter virtualNetworkRuleName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + virtualNetworkRuleName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualNetworkRuleInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualNetworkRuleInner.class, + VirtualNetworkRuleInner.class, + this.client.getContext()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualNetworkRuleInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualNetworkRuleInner.class, + VirtualNetworkRuleInner.class, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualNetworkRuleInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters) + .getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualNetworkRuleInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters, context) + .getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualNetworkRuleInner createOrUpdate( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualNetworkRuleInner createOrUpdate( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, String virtualNetworkRuleName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (virtualNetworkRuleName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter virtualNetworkRuleName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + virtualNetworkRuleName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (virtualNetworkRuleName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter virtualNetworkRuleName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + virtualNetworkRuleName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String virtualNetworkRuleName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String virtualNetworkRuleName) { + return beginDeleteAsync(resourceGroupName, serverName, virtualNetworkRuleName).getSyncPoller(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, virtualNetworkRuleName, context).getSyncPoller(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String serverName, String virtualNetworkRuleName) { + return beginDeleteAsync(resourceGroupName, serverName, virtualNetworkRuleName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, virtualNetworkRuleName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, String virtualNetworkRuleName) { + deleteAsync(resourceGroupName, serverName, virtualNetworkRuleName).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context) { + deleteAsync(resourceGroupName, serverName, virtualNetworkRuleName, context).block(); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual network rules in a server along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual network rules in a server along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual network rules in a server as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual network rules in a server as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual network rules in a server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual network rules in a server as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual network rules along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByServerNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual network rules along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServerNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/VirtualNetworkRulesImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/VirtualNetworkRulesImpl.java new file mode 100644 index 0000000000000..c10d3c933412a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/VirtualNetworkRulesImpl.java @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.VirtualNetworkRulesClient; +import com.azure.resourcemanager.sql.generated.fluent.models.VirtualNetworkRuleInner; +import com.azure.resourcemanager.sql.generated.models.VirtualNetworkRule; +import com.azure.resourcemanager.sql.generated.models.VirtualNetworkRules; + +public final class VirtualNetworkRulesImpl implements VirtualNetworkRules { + private static final ClientLogger LOGGER = new ClientLogger(VirtualNetworkRulesImpl.class); + + private final VirtualNetworkRulesClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public VirtualNetworkRulesImpl( + VirtualNetworkRulesClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, virtualNetworkRuleName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new VirtualNetworkRuleImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public VirtualNetworkRule get(String resourceGroupName, String serverName, String virtualNetworkRuleName) { + VirtualNetworkRuleInner inner = this.serviceClient().get(resourceGroupName, serverName, virtualNetworkRuleName); + if (inner != null) { + return new VirtualNetworkRuleImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String serverName, String virtualNetworkRuleName) { + this.serviceClient().delete(resourceGroupName, serverName, virtualNetworkRuleName); + } + + public void delete(String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context) { + this.serviceClient().delete(resourceGroupName, serverName, virtualNetworkRuleName, context); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new VirtualNetworkRuleImpl(inner1, this.manager())); + } + + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, context); + return Utils.mapPage(inner, inner1 -> new VirtualNetworkRuleImpl(inner1, this.manager())); + } + + public VirtualNetworkRule getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String virtualNetworkRuleName = Utils.getValueFromIdByName(id, "virtualNetworkRules"); + if (virtualNetworkRuleName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'virtualNetworkRules'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, virtualNetworkRuleName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String virtualNetworkRuleName = Utils.getValueFromIdByName(id, "virtualNetworkRules"); + if (virtualNetworkRuleName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'virtualNetworkRules'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, virtualNetworkRuleName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String virtualNetworkRuleName = Utils.getValueFromIdByName(id, "virtualNetworkRules"); + if (virtualNetworkRuleName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'virtualNetworkRules'.", id))); + } + this.delete(resourceGroupName, serverName, virtualNetworkRuleName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String virtualNetworkRuleName = Utils.getValueFromIdByName(id, "virtualNetworkRules"); + if (virtualNetworkRuleName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'virtualNetworkRules'.", id))); + } + this.delete(resourceGroupName, serverName, virtualNetworkRuleName, context); + } + + private VirtualNetworkRulesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public VirtualNetworkRuleImpl define(String name) { + return new VirtualNetworkRuleImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/VulnerabilityAssessmentScanRecordImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/VulnerabilityAssessmentScanRecordImpl.java new file mode 100644 index 0000000000000..06c06262d4901 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/VulnerabilityAssessmentScanRecordImpl.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.resourcemanager.sql.generated.fluent.models.VulnerabilityAssessmentScanRecordInner; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentScanError; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentScanRecord; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentScanState; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentScanTriggerType; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class VulnerabilityAssessmentScanRecordImpl implements VulnerabilityAssessmentScanRecord { + private VulnerabilityAssessmentScanRecordInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + VulnerabilityAssessmentScanRecordImpl( + VulnerabilityAssessmentScanRecordInner innerObject, + com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String scanId() { + return this.innerModel().scanId(); + } + + public VulnerabilityAssessmentScanTriggerType triggerType() { + return this.innerModel().triggerType(); + } + + public VulnerabilityAssessmentScanState state() { + return this.innerModel().state(); + } + + public OffsetDateTime startTime() { + return this.innerModel().startTime(); + } + + public OffsetDateTime endTime() { + return this.innerModel().endTime(); + } + + public List errors() { + List inner = this.innerModel().errors(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String storageContainerPath() { + return this.innerModel().storageContainerPath(); + } + + public Integer numberOfFailedSecurityChecks() { + return this.innerModel().numberOfFailedSecurityChecks(); + } + + public VulnerabilityAssessmentScanRecordInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/WorkloadClassifierImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/WorkloadClassifierImpl.java new file mode 100644 index 0000000000000..2ba3bb4a0a56d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/WorkloadClassifierImpl.java @@ -0,0 +1,225 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.WorkloadClassifierInner; +import com.azure.resourcemanager.sql.generated.models.WorkloadClassifier; + +public final class WorkloadClassifierImpl + implements WorkloadClassifier, WorkloadClassifier.Definition, WorkloadClassifier.Update { + private WorkloadClassifierInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String memberName() { + return this.innerModel().memberName(); + } + + public String label() { + return this.innerModel().label(); + } + + public String context() { + return this.innerModel().context(); + } + + public String startTime() { + return this.innerModel().startTime(); + } + + public String endTime() { + return this.innerModel().endTime(); + } + + public String importance() { + return this.innerModel().importance(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public WorkloadClassifierInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String databaseName; + + private String workloadGroupName; + + private String workloadClassifierName; + + public WorkloadClassifierImpl withExistingWorkloadGroup( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + this.workloadGroupName = workloadGroupName; + return this; + } + + public WorkloadClassifier create() { + this.innerObject = + serviceManager + .serviceClient() + .getWorkloadClassifiers() + .createOrUpdate( + resourceGroupName, + serverName, + databaseName, + workloadGroupName, + workloadClassifierName, + this.innerModel(), + Context.NONE); + return this; + } + + public WorkloadClassifier create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getWorkloadClassifiers() + .createOrUpdate( + resourceGroupName, + serverName, + databaseName, + workloadGroupName, + workloadClassifierName, + this.innerModel(), + context); + return this; + } + + WorkloadClassifierImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new WorkloadClassifierInner(); + this.serviceManager = serviceManager; + this.workloadClassifierName = name; + } + + public WorkloadClassifierImpl update() { + return this; + } + + public WorkloadClassifier apply() { + this.innerObject = + serviceManager + .serviceClient() + .getWorkloadClassifiers() + .createOrUpdate( + resourceGroupName, + serverName, + databaseName, + workloadGroupName, + workloadClassifierName, + this.innerModel(), + Context.NONE); + return this; + } + + public WorkloadClassifier apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getWorkloadClassifiers() + .createOrUpdate( + resourceGroupName, + serverName, + databaseName, + workloadGroupName, + workloadClassifierName, + this.innerModel(), + context); + return this; + } + + WorkloadClassifierImpl( + WorkloadClassifierInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "databases"); + this.workloadGroupName = Utils.getValueFromIdByName(innerObject.id(), "workloadGroups"); + this.workloadClassifierName = Utils.getValueFromIdByName(innerObject.id(), "workloadClassifiers"); + } + + public WorkloadClassifier refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getWorkloadClassifiers() + .getWithResponse( + resourceGroupName, + serverName, + databaseName, + workloadGroupName, + workloadClassifierName, + Context.NONE) + .getValue(); + return this; + } + + public WorkloadClassifier refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getWorkloadClassifiers() + .getWithResponse( + resourceGroupName, serverName, databaseName, workloadGroupName, workloadClassifierName, context) + .getValue(); + return this; + } + + public WorkloadClassifierImpl withMemberName(String memberName) { + this.innerModel().withMemberName(memberName); + return this; + } + + public WorkloadClassifierImpl withLabel(String label) { + this.innerModel().withLabel(label); + return this; + } + + public WorkloadClassifierImpl withContext(String context) { + this.innerModel().withContext(context); + return this; + } + + public WorkloadClassifierImpl withStartTime(String startTime) { + this.innerModel().withStartTime(startTime); + return this; + } + + public WorkloadClassifierImpl withEndTime(String endTime) { + this.innerModel().withEndTime(endTime); + return this; + } + + public WorkloadClassifierImpl withImportance(String importance) { + this.innerModel().withImportance(importance); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/WorkloadClassifiersClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/WorkloadClassifiersClientImpl.java new file mode 100644 index 0000000000000..bd4ca3f53ba3f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/WorkloadClassifiersClientImpl.java @@ -0,0 +1,1471 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.WorkloadClassifiersClient; +import com.azure.resourcemanager.sql.generated.fluent.models.WorkloadClassifierInner; +import com.azure.resourcemanager.sql.generated.models.WorkloadClassifierListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in WorkloadClassifiersClient. */ +public final class WorkloadClassifiersClientImpl implements WorkloadClassifiersClient { + /** The proxy service used to perform REST calls. */ + private final WorkloadClassifiersService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of WorkloadClassifiersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + WorkloadClassifiersClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(WorkloadClassifiersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientWorkloadClassifiers to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientW") + public interface WorkloadClassifiersService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/workloadGroups/{workloadGroupName}/workloadClassifiers" + + "/{workloadClassifierName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("workloadGroupName") String workloadGroupName, + @PathParam("workloadClassifierName") String workloadClassifierName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/workloadGroups/{workloadGroupName}/workloadClassifiers" + + "/{workloadClassifierName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("workloadGroupName") String workloadGroupName, + @PathParam("workloadClassifierName") String workloadClassifierName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") WorkloadClassifierInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/workloadGroups/{workloadGroupName}/workloadClassifiers" + + "/{workloadClassifierName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("workloadGroupName") String workloadGroupName, + @PathParam("workloadClassifierName") String workloadClassifierName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/workloadGroups/{workloadGroupName}/workloadClassifiers") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByWorkloadGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("workloadGroupName") String workloadGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByWorkloadGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workload classifier along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (workloadGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter workloadGroupName is required and cannot be null.")); + } + if (workloadClassifierName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter workloadClassifierName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + workloadGroupName, + workloadClassifierName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workload classifier along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (workloadGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter workloadGroupName is required and cannot be null.")); + } + if (workloadClassifierName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter workloadClassifierName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + workloadGroupName, + workloadClassifierName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workload classifier on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName) { + return getWithResponseAsync( + resourceGroupName, serverName, databaseName, workloadGroupName, workloadClassifierName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workload classifier along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName, + Context context) { + return getWithResponseAsync( + resourceGroupName, serverName, databaseName, workloadGroupName, workloadClassifierName, context) + .block(); + } + + /** + * Gets a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workload classifier. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkloadClassifierInner get( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName) { + return getWithResponse( + resourceGroupName, serverName, databaseName, workloadGroupName, workloadClassifierName, Context.NONE) + .getValue(); + } + + /** + * Creates or updates a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to create/update. + * @param parameters The properties of the workload classifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workload classifier operations for a data warehouse along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName, + WorkloadClassifierInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (workloadGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter workloadGroupName is required and cannot be null.")); + } + if (workloadClassifierName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter workloadClassifierName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + workloadGroupName, + workloadClassifierName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to create/update. + * @param parameters The properties of the workload classifier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workload classifier operations for a data warehouse along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName, + WorkloadClassifierInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (workloadGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter workloadGroupName is required and cannot be null.")); + } + if (workloadClassifierName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter workloadClassifierName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + workloadGroupName, + workloadClassifierName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to create/update. + * @param parameters The properties of the workload classifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of workload classifier operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, WorkloadClassifierInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName, + WorkloadClassifierInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, serverName, databaseName, workloadGroupName, workloadClassifierName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + WorkloadClassifierInner.class, + WorkloadClassifierInner.class, + this.client.getContext()); + } + + /** + * Creates or updates a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to create/update. + * @param parameters The properties of the workload classifier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of workload classifier operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, WorkloadClassifierInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName, + WorkloadClassifierInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, + serverName, + databaseName, + workloadGroupName, + workloadClassifierName, + parameters, + context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + WorkloadClassifierInner.class, + WorkloadClassifierInner.class, + context); + } + + /** + * Creates or updates a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to create/update. + * @param parameters The properties of the workload classifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of workload classifier operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, WorkloadClassifierInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName, + WorkloadClassifierInner parameters) { + return beginCreateOrUpdateAsync( + resourceGroupName, serverName, databaseName, workloadGroupName, workloadClassifierName, parameters) + .getSyncPoller(); + } + + /** + * Creates or updates a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to create/update. + * @param parameters The properties of the workload classifier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of workload classifier operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, WorkloadClassifierInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName, + WorkloadClassifierInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, + serverName, + databaseName, + workloadGroupName, + workloadClassifierName, + parameters, + context) + .getSyncPoller(); + } + + /** + * Creates or updates a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to create/update. + * @param parameters The properties of the workload classifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workload classifier operations for a data warehouse on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName, + WorkloadClassifierInner parameters) { + return beginCreateOrUpdateAsync( + resourceGroupName, serverName, databaseName, workloadGroupName, workloadClassifierName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to create/update. + * @param parameters The properties of the workload classifier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workload classifier operations for a data warehouse on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName, + WorkloadClassifierInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, + serverName, + databaseName, + workloadGroupName, + workloadClassifierName, + parameters, + context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to create/update. + * @param parameters The properties of the workload classifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workload classifier operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkloadClassifierInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName, + WorkloadClassifierInner parameters) { + return createOrUpdateAsync( + resourceGroupName, serverName, databaseName, workloadGroupName, workloadClassifierName, parameters) + .block(); + } + + /** + * Creates or updates a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to create/update. + * @param parameters The properties of the workload classifier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workload classifier operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkloadClassifierInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName, + WorkloadClassifierInner parameters, + Context context) { + return createOrUpdateAsync( + resourceGroupName, + serverName, + databaseName, + workloadGroupName, + workloadClassifierName, + parameters, + context) + .block(); + } + + /** + * Deletes a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (workloadGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter workloadGroupName is required and cannot be null.")); + } + if (workloadClassifierName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter workloadClassifierName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + workloadGroupName, + workloadClassifierName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (workloadGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter workloadGroupName is required and cannot be null.")); + } + if (workloadClassifierName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter workloadClassifierName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + workloadGroupName, + workloadClassifierName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName) { + Mono>> mono = + deleteWithResponseAsync( + resourceGroupName, serverName, databaseName, workloadGroupName, workloadClassifierName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync( + resourceGroupName, serverName, databaseName, workloadGroupName, workloadClassifierName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName) { + return beginDeleteAsync(resourceGroupName, serverName, databaseName, workloadGroupName, workloadClassifierName) + .getSyncPoller(); + } + + /** + * Deletes a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName, + Context context) { + return beginDeleteAsync( + resourceGroupName, serverName, databaseName, workloadGroupName, workloadClassifierName, context) + .getSyncPoller(); + } + + /** + * Deletes a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName) { + return beginDeleteAsync(resourceGroupName, serverName, databaseName, workloadGroupName, workloadClassifierName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName, + Context context) { + return beginDeleteAsync( + resourceGroupName, serverName, databaseName, workloadGroupName, workloadClassifierName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName) { + deleteAsync(resourceGroupName, serverName, databaseName, workloadGroupName, workloadClassifierName).block(); + } + + /** + * Deletes a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName, + Context context) { + deleteAsync(resourceGroupName, serverName, databaseName, workloadGroupName, workloadClassifierName, context) + .block(); + } + + /** + * Gets the list of workload classifiers for a workload 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. + * @param workloadGroupName The name of the workload group from which to receive the classifiers from. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of workload classifiers for a workload group along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByWorkloadGroupSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (workloadGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter workloadGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByWorkloadGroup( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + workloadGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the list of workload classifiers for a workload 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. + * @param workloadGroupName The name of the workload group from which to receive the classifiers from. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of workload classifiers for a workload group along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByWorkloadGroupSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (workloadGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter workloadGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByWorkloadGroup( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + workloadGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets the list of workload classifiers for a workload 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. + * @param workloadGroupName The name of the workload group from which to receive the classifiers from. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of workload classifiers for a workload group as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByWorkloadGroupAsync( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName) { + return new PagedFlux<>( + () -> listByWorkloadGroupSinglePageAsync(resourceGroupName, serverName, databaseName, workloadGroupName), + nextLink -> listByWorkloadGroupNextSinglePageAsync(nextLink)); + } + + /** + * Gets the list of workload classifiers for a workload 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. + * @param workloadGroupName The name of the workload group from which to receive the classifiers from. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of workload classifiers for a workload group as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByWorkloadGroupAsync( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName, Context context) { + return new PagedFlux<>( + () -> + listByWorkloadGroupSinglePageAsync( + resourceGroupName, serverName, databaseName, workloadGroupName, context), + nextLink -> listByWorkloadGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets the list of workload classifiers for a workload 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. + * @param workloadGroupName The name of the workload group from which to receive the classifiers from. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of workload classifiers for a workload group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByWorkloadGroup( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName) { + return new PagedIterable<>( + listByWorkloadGroupAsync(resourceGroupName, serverName, databaseName, workloadGroupName)); + } + + /** + * Gets the list of workload classifiers for a workload 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. + * @param workloadGroupName The name of the workload group from which to receive the classifiers from. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of workload classifiers for a workload group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByWorkloadGroup( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName, Context context) { + return new PagedIterable<>( + listByWorkloadGroupAsync(resourceGroupName, serverName, databaseName, workloadGroupName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of workload classifiers for a workload group along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByWorkloadGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByWorkloadGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of workload classifiers for a workload group along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByWorkloadGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByWorkloadGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/WorkloadClassifiersImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/WorkloadClassifiersImpl.java new file mode 100644 index 0000000000000..c97c56c5d3af9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/WorkloadClassifiersImpl.java @@ -0,0 +1,299 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.WorkloadClassifiersClient; +import com.azure.resourcemanager.sql.generated.fluent.models.WorkloadClassifierInner; +import com.azure.resourcemanager.sql.generated.models.WorkloadClassifier; +import com.azure.resourcemanager.sql.generated.models.WorkloadClassifiers; + +public final class WorkloadClassifiersImpl implements WorkloadClassifiers { + private static final ClientLogger LOGGER = new ClientLogger(WorkloadClassifiersImpl.class); + + private final WorkloadClassifiersClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public WorkloadClassifiersImpl( + WorkloadClassifiersClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse( + resourceGroupName, serverName, databaseName, workloadGroupName, workloadClassifierName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new WorkloadClassifierImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public WorkloadClassifier get( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName) { + WorkloadClassifierInner inner = + this + .serviceClient() + .get(resourceGroupName, serverName, databaseName, workloadGroupName, workloadClassifierName); + if (inner != null) { + return new WorkloadClassifierImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName) { + this + .serviceClient() + .delete(resourceGroupName, serverName, databaseName, workloadGroupName, workloadClassifierName); + } + + public void delete( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName, + Context context) { + this + .serviceClient() + .delete(resourceGroupName, serverName, databaseName, workloadGroupName, workloadClassifierName, context); + } + + public PagedIterable listByWorkloadGroup( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName) { + PagedIterable inner = + this.serviceClient().listByWorkloadGroup(resourceGroupName, serverName, databaseName, workloadGroupName); + return Utils.mapPage(inner, inner1 -> new WorkloadClassifierImpl(inner1, this.manager())); + } + + public PagedIterable listByWorkloadGroup( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName, Context context) { + PagedIterable inner = + this + .serviceClient() + .listByWorkloadGroup(resourceGroupName, serverName, databaseName, workloadGroupName, context); + return Utils.mapPage(inner, inner1 -> new WorkloadClassifierImpl(inner1, this.manager())); + } + + public WorkloadClassifier getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String workloadGroupName = Utils.getValueFromIdByName(id, "workloadGroups"); + if (workloadGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'workloadGroups'.", id))); + } + String workloadClassifierName = Utils.getValueFromIdByName(id, "workloadClassifiers"); + if (workloadClassifierName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'workloadClassifiers'.", id))); + } + return this + .getWithResponse( + resourceGroupName, serverName, databaseName, workloadGroupName, workloadClassifierName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String workloadGroupName = Utils.getValueFromIdByName(id, "workloadGroups"); + if (workloadGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'workloadGroups'.", id))); + } + String workloadClassifierName = Utils.getValueFromIdByName(id, "workloadClassifiers"); + if (workloadClassifierName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'workloadClassifiers'.", id))); + } + return this + .getWithResponse( + resourceGroupName, serverName, databaseName, workloadGroupName, workloadClassifierName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String workloadGroupName = Utils.getValueFromIdByName(id, "workloadGroups"); + if (workloadGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'workloadGroups'.", id))); + } + String workloadClassifierName = Utils.getValueFromIdByName(id, "workloadClassifiers"); + if (workloadClassifierName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'workloadClassifiers'.", id))); + } + this + .delete( + resourceGroupName, serverName, databaseName, workloadGroupName, workloadClassifierName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String workloadGroupName = Utils.getValueFromIdByName(id, "workloadGroups"); + if (workloadGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'workloadGroups'.", id))); + } + String workloadClassifierName = Utils.getValueFromIdByName(id, "workloadClassifiers"); + if (workloadClassifierName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'workloadClassifiers'.", id))); + } + this.delete(resourceGroupName, serverName, databaseName, workloadGroupName, workloadClassifierName, context); + } + + private WorkloadClassifiersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public WorkloadClassifierImpl define(String name) { + return new WorkloadClassifierImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/WorkloadGroupImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/WorkloadGroupImpl.java new file mode 100644 index 0000000000000..72d7492f243aa --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/WorkloadGroupImpl.java @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.WorkloadGroupInner; +import com.azure.resourcemanager.sql.generated.models.WorkloadGroup; + +public final class WorkloadGroupImpl implements WorkloadGroup, WorkloadGroup.Definition, WorkloadGroup.Update { + private WorkloadGroupInner innerObject; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public int minResourcePercent() { + return this.innerModel().minResourcePercent(); + } + + public int maxResourcePercent() { + return this.innerModel().maxResourcePercent(); + } + + public double minResourcePercentPerRequest() { + return this.innerModel().minResourcePercentPerRequest(); + } + + public Double maxResourcePercentPerRequest() { + return this.innerModel().maxResourcePercentPerRequest(); + } + + public String importance() { + return this.innerModel().importance(); + } + + public Integer queryExecutionTimeout() { + return this.innerModel().queryExecutionTimeout(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public WorkloadGroupInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String databaseName; + + private String workloadGroupName; + + public WorkloadGroupImpl withExistingDatabase(String resourceGroupName, String serverName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + this.databaseName = databaseName; + return this; + } + + public WorkloadGroup create() { + this.innerObject = + serviceManager + .serviceClient() + .getWorkloadGroups() + .createOrUpdate( + resourceGroupName, serverName, databaseName, workloadGroupName, this.innerModel(), Context.NONE); + return this; + } + + public WorkloadGroup create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getWorkloadGroups() + .createOrUpdate( + resourceGroupName, serverName, databaseName, workloadGroupName, this.innerModel(), context); + return this; + } + + WorkloadGroupImpl(String name, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = new WorkloadGroupInner(); + this.serviceManager = serviceManager; + this.workloadGroupName = name; + } + + public WorkloadGroupImpl update() { + return this; + } + + public WorkloadGroup apply() { + this.innerObject = + serviceManager + .serviceClient() + .getWorkloadGroups() + .createOrUpdate( + resourceGroupName, serverName, databaseName, workloadGroupName, this.innerModel(), Context.NONE); + return this; + } + + public WorkloadGroup apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getWorkloadGroups() + .createOrUpdate( + resourceGroupName, serverName, databaseName, workloadGroupName, this.innerModel(), context); + return this; + } + + WorkloadGroupImpl( + WorkloadGroupInner innerObject, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "databases"); + this.workloadGroupName = Utils.getValueFromIdByName(innerObject.id(), "workloadGroups"); + } + + public WorkloadGroup refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getWorkloadGroups() + .getWithResponse(resourceGroupName, serverName, databaseName, workloadGroupName, Context.NONE) + .getValue(); + return this; + } + + public WorkloadGroup refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getWorkloadGroups() + .getWithResponse(resourceGroupName, serverName, databaseName, workloadGroupName, context) + .getValue(); + return this; + } + + public WorkloadGroupImpl withMinResourcePercent(int minResourcePercent) { + this.innerModel().withMinResourcePercent(minResourcePercent); + return this; + } + + public WorkloadGroupImpl withMaxResourcePercent(int maxResourcePercent) { + this.innerModel().withMaxResourcePercent(maxResourcePercent); + return this; + } + + public WorkloadGroupImpl withMinResourcePercentPerRequest(double minResourcePercentPerRequest) { + this.innerModel().withMinResourcePercentPerRequest(minResourcePercentPerRequest); + return this; + } + + public WorkloadGroupImpl withMaxResourcePercentPerRequest(Double maxResourcePercentPerRequest) { + this.innerModel().withMaxResourcePercentPerRequest(maxResourcePercentPerRequest); + return this; + } + + public WorkloadGroupImpl withImportance(String importance) { + this.innerModel().withImportance(importance); + return this; + } + + public WorkloadGroupImpl withQueryExecutionTimeout(Integer queryExecutionTimeout) { + this.innerModel().withQueryExecutionTimeout(queryExecutionTimeout); + return this; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/WorkloadGroupsClientImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/WorkloadGroupsClientImpl.java new file mode 100644 index 0000000000000..16a0714be6bde --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/WorkloadGroupsClientImpl.java @@ -0,0 +1,1255 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.sql.generated.fluent.WorkloadGroupsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.WorkloadGroupInner; +import com.azure.resourcemanager.sql.generated.models.WorkloadGroupListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in WorkloadGroupsClient. */ +public final class WorkloadGroupsClientImpl implements WorkloadGroupsClient { + /** The proxy service used to perform REST calls. */ + private final WorkloadGroupsService service; + + /** The service client containing this operation class. */ + private final SqlManagementClientImpl client; + + /** + * Initializes an instance of WorkloadGroupsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + WorkloadGroupsClientImpl(SqlManagementClientImpl client) { + this.service = + RestProxy.create(WorkloadGroupsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SqlManagementClientWorkloadGroups to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SqlManagementClientW") + public interface WorkloadGroupsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/workloadGroups/{workloadGroupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("workloadGroupName") String workloadGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/workloadGroups/{workloadGroupName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("workloadGroupName") String workloadGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") WorkloadGroupInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/workloadGroups/{workloadGroupName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("workloadGroupName") String workloadGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers" + + "/{serverName}/databases/{databaseName}/workloadGroups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabase( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDatabaseNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a workload 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. + * @param workloadGroupName The name of the workload group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workload group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (workloadGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter workloadGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + workloadGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a workload 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. + * @param workloadGroupName The name of the workload group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workload group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (workloadGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter workloadGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + workloadGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a workload 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. + * @param workloadGroupName The name of the workload group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workload group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, workloadGroupName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a workload 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. + * @param workloadGroupName The name of the workload group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workload group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, workloadGroupName, context).block(); + } + + /** + * Gets a workload 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. + * @param workloadGroupName The name of the workload group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workload group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkloadGroupInner get( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName) { + return getWithResponse(resourceGroupName, serverName, databaseName, workloadGroupName, Context.NONE).getValue(); + } + + /** + * Creates or updates a workload 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. + * @param workloadGroupName The name of the workload group. + * @param parameters The requested workload group state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workload group operations for a data warehouse along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + WorkloadGroupInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (workloadGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter workloadGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + workloadGroupName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a workload 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. + * @param workloadGroupName The name of the workload group. + * @param parameters The requested workload group state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workload group operations for a data warehouse along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + WorkloadGroupInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (workloadGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter workloadGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + workloadGroupName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates a workload 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. + * @param workloadGroupName The name of the workload group. + * @param parameters The requested workload group state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of workload group operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, WorkloadGroupInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + WorkloadGroupInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, databaseName, workloadGroupName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + WorkloadGroupInner.class, + WorkloadGroupInner.class, + this.client.getContext()); + } + + /** + * Creates or updates a workload 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. + * @param workloadGroupName The name of the workload group. + * @param parameters The requested workload group state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of workload group operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, WorkloadGroupInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + WorkloadGroupInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, serverName, databaseName, workloadGroupName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), WorkloadGroupInner.class, WorkloadGroupInner.class, context); + } + + /** + * Creates or updates a workload 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. + * @param workloadGroupName The name of the workload group. + * @param parameters The requested workload group state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of workload group operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, WorkloadGroupInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + WorkloadGroupInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, workloadGroupName, parameters) + .getSyncPoller(); + } + + /** + * Creates or updates a workload 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. + * @param workloadGroupName The name of the workload group. + * @param parameters The requested workload group state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of workload group operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, WorkloadGroupInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + WorkloadGroupInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, serverName, databaseName, workloadGroupName, parameters, context) + .getSyncPoller(); + } + + /** + * Creates or updates a workload 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. + * @param workloadGroupName The name of the workload group. + * @param parameters The requested workload group state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workload group operations for a data warehouse on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + WorkloadGroupInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, workloadGroupName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a workload 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. + * @param workloadGroupName The name of the workload group. + * @param parameters The requested workload group state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workload group operations for a data warehouse on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + WorkloadGroupInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, serverName, databaseName, workloadGroupName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a workload 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. + * @param workloadGroupName The name of the workload group. + * @param parameters The requested workload group state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workload group operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkloadGroupInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + WorkloadGroupInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, databaseName, workloadGroupName, parameters).block(); + } + + /** + * Creates or updates a workload 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. + * @param workloadGroupName The name of the workload group. + * @param parameters The requested workload group state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workload group operations for a data warehouse. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkloadGroupInner createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + WorkloadGroupInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, databaseName, workloadGroupName, parameters, context) + .block(); + } + + /** + * Deletes a workload 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. + * @param workloadGroupName The name of the workload group to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (workloadGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter workloadGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + workloadGroupName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a workload 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. + * @param workloadGroupName The name of the workload group to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (workloadGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter workloadGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + workloadGroupName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes a workload 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. + * @param workloadGroupName The name of the workload group to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, databaseName, workloadGroupName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes a workload 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. + * @param workloadGroupName The name of the workload group to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, databaseName, workloadGroupName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a workload 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. + * @param workloadGroupName The name of the workload group to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName) { + return beginDeleteAsync(resourceGroupName, serverName, databaseName, workloadGroupName).getSyncPoller(); + } + + /** + * Deletes a workload 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. + * @param workloadGroupName The name of the workload group to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, databaseName, workloadGroupName, context) + .getSyncPoller(); + } + + /** + * Deletes a workload 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. + * @param workloadGroupName The name of the workload group to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName) { + return beginDeleteAsync(resourceGroupName, serverName, databaseName, workloadGroupName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a workload 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. + * @param workloadGroupName The name of the workload group to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, databaseName, workloadGroupName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a workload 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. + * @param workloadGroupName The name of the workload group to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, String databaseName, String workloadGroupName) { + deleteAsync(resourceGroupName, serverName, databaseName, workloadGroupName).block(); + } + + /** + * Deletes a workload 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. + * @param workloadGroupName The name of the workload group to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName, Context context) { + deleteAsync(resourceGroupName, serverName, databaseName, workloadGroupName, context).block(); + } + + /** + * Gets the list of workload 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 serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of workload groups along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the list of workload 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of workload groups along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseSinglePageAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-11-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabase( + this.client.getEndpoint(), + resourceGroupName, + serverName, + databaseName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets the list of workload 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 serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of workload groups as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink)); + } + + /** + * Gets the list of workload 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of workload groups as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDatabaseAsync( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedFlux<>( + () -> listByDatabaseSinglePageAsync(resourceGroupName, serverName, databaseName, context), + nextLink -> listByDatabaseNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets the list of workload 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 serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of workload groups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName)); + } + + /** + * Gets the list of workload 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of workload groups as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + return new PagedIterable<>(listByDatabaseAsync(resourceGroupName, serverName, databaseName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of workload groups along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of workload groups along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByDatabaseNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDatabaseNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/WorkloadGroupsImpl.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/WorkloadGroupsImpl.java new file mode 100644 index 0000000000000..6cf8be07b34bd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/WorkloadGroupsImpl.java @@ -0,0 +1,230 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.WorkloadGroupsClient; +import com.azure.resourcemanager.sql.generated.fluent.models.WorkloadGroupInner; +import com.azure.resourcemanager.sql.generated.models.WorkloadGroup; +import com.azure.resourcemanager.sql.generated.models.WorkloadGroups; + +public final class WorkloadGroupsImpl implements WorkloadGroups { + private static final ClientLogger LOGGER = new ClientLogger(WorkloadGroupsImpl.class); + + private final WorkloadGroupsClient innerClient; + + private final com.azure.resourcemanager.sql.generated.SqlManager serviceManager; + + public WorkloadGroupsImpl( + WorkloadGroupsClient innerClient, com.azure.resourcemanager.sql.generated.SqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName, Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, serverName, databaseName, workloadGroupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new WorkloadGroupImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public WorkloadGroup get( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName) { + WorkloadGroupInner inner = + this.serviceClient().get(resourceGroupName, serverName, databaseName, workloadGroupName); + if (inner != null) { + return new WorkloadGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String serverName, String databaseName, String workloadGroupName) { + this.serviceClient().delete(resourceGroupName, serverName, databaseName, workloadGroupName); + } + + public void delete( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName, Context context) { + this.serviceClient().delete(resourceGroupName, serverName, databaseName, workloadGroupName, context); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName); + return Utils.mapPage(inner, inner1 -> new WorkloadGroupImpl(inner1, this.manager())); + } + + public PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context) { + PagedIterable inner = + this.serviceClient().listByDatabase(resourceGroupName, serverName, databaseName, context); + return Utils.mapPage(inner, inner1 -> new WorkloadGroupImpl(inner1, this.manager())); + } + + public WorkloadGroup getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String workloadGroupName = Utils.getValueFromIdByName(id, "workloadGroups"); + if (workloadGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'workloadGroups'.", id))); + } + return this + .getWithResponse(resourceGroupName, serverName, databaseName, workloadGroupName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String workloadGroupName = Utils.getValueFromIdByName(id, "workloadGroups"); + if (workloadGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'workloadGroups'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, databaseName, workloadGroupName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String workloadGroupName = Utils.getValueFromIdByName(id, "workloadGroups"); + if (workloadGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'workloadGroups'.", id))); + } + this.delete(resourceGroupName, serverName, databaseName, workloadGroupName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + String workloadGroupName = Utils.getValueFromIdByName(id, "workloadGroups"); + if (workloadGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'workloadGroups'.", id))); + } + this.delete(resourceGroupName, serverName, databaseName, workloadGroupName, context); + } + + private WorkloadGroupsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.sql.generated.SqlManager manager() { + return this.serviceManager; + } + + public WorkloadGroupImpl define(String name) { + return new WorkloadGroupImpl(name, this.manager()); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/package-info.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/package-info.java new file mode 100644 index 0000000000000..9b53ba196ce85 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/implementation/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the implementations 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.azure.resourcemanager.sql.generated.implementation; diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AdministratorListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AdministratorListResult.java new file mode 100644 index 0000000000000..d9f69dc4e663c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AdministratorListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerAzureADAdministratorInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of active directory administrators. */ +@Immutable +public final class AdministratorListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of AdministratorListResult class. */ + public AdministratorListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AdministratorName.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AdministratorName.java new file mode 100644 index 0000000000000..00b671db1f0eb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AdministratorName.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AdministratorName. */ +public final class AdministratorName extends ExpandableStringEnum { + /** Static value ActiveDirectory for AdministratorName. */ + public static final AdministratorName ACTIVE_DIRECTORY = fromString("ActiveDirectory"); + + /** + * Creates or finds a AdministratorName from its string representation. + * + * @param name a name to look for. + * @return the corresponding AdministratorName. + */ + @JsonCreator + public static AdministratorName fromString(String name) { + return fromString(name, AdministratorName.class); + } + + /** + * Gets known AdministratorName values. + * + * @return known AdministratorName values. + */ + public static Collection values() { + return values(AdministratorName.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AdministratorType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AdministratorType.java new file mode 100644 index 0000000000000..5f5786dfea7b4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AdministratorType.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Type of the sever administrator. */ +public final class AdministratorType extends ExpandableStringEnum { + /** Static value ActiveDirectory for AdministratorType. */ + public static final AdministratorType ACTIVE_DIRECTORY = fromString("ActiveDirectory"); + + /** + * Creates or finds a AdministratorType from its string representation. + * + * @param name a name to look for. + * @return the corresponding AdministratorType. + */ + @JsonCreator + public static AdministratorType fromString(String name) { + return fromString(name, AdministratorType.class); + } + + /** + * Gets known AdministratorType values. + * + * @return known AdministratorType values. + */ + public static Collection values() { + return values(AdministratorType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AdvancedThreatProtectionName.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AdvancedThreatProtectionName.java new file mode 100644 index 0000000000000..1ca7200dd2362 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AdvancedThreatProtectionName.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AdvancedThreatProtectionName. */ +public final class AdvancedThreatProtectionName extends ExpandableStringEnum { + /** Static value Default for AdvancedThreatProtectionName. */ + public static final AdvancedThreatProtectionName DEFAULT = fromString("Default"); + + /** + * Creates or finds a AdvancedThreatProtectionName from its string representation. + * + * @param name a name to look for. + * @return the corresponding AdvancedThreatProtectionName. + */ + @JsonCreator + public static AdvancedThreatProtectionName fromString(String name) { + return fromString(name, AdvancedThreatProtectionName.class); + } + + /** + * Gets known AdvancedThreatProtectionName values. + * + * @return known AdvancedThreatProtectionName values. + */ + public static Collection values() { + return values(AdvancedThreatProtectionName.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AdvancedThreatProtectionState.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AdvancedThreatProtectionState.java new file mode 100644 index 0000000000000..81dadf7d455a2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AdvancedThreatProtectionState.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Specifies the state of the Advanced Threat Protection, whether it is enabled or disabled or a state has not been + * applied yet on the specific database or server. + */ +public enum AdvancedThreatProtectionState { + /** Enum value New. */ + NEW("New"), + + /** Enum value Enabled. */ + ENABLED("Enabled"), + + /** Enum value Disabled. */ + DISABLED("Disabled"); + + /** The actual serialized value for a AdvancedThreatProtectionState instance. */ + private final String value; + + AdvancedThreatProtectionState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AdvancedThreatProtectionState instance. + * + * @param value the serialized value to parse. + * @return the parsed AdvancedThreatProtectionState object, or null if unable to parse. + */ + @JsonCreator + public static AdvancedThreatProtectionState fromString(String value) { + if (value == null) { + return null; + } + AdvancedThreatProtectionState[] items = AdvancedThreatProtectionState.values(); + for (AdvancedThreatProtectionState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Advisor.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Advisor.java new file mode 100644 index 0000000000000..3c4e8e198b866 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Advisor.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.AdvisorInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of Advisor. */ +public interface Advisor { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the kind property: Resource kind. + * + * @return the kind value. + */ + String kind(); + + /** + * Gets the location property: Resource location. + * + * @return the location value. + */ + String location(); + + /** + * Gets the advisorStatus property: Gets the status of availability of this advisor to customers. Possible values + * are 'GA', 'PublicPreview', 'LimitedPublicPreview' and 'PrivatePreview'. + * + * @return the advisorStatus value. + */ + AdvisorStatus advisorStatus(); + + /** + * Gets the autoExecuteStatus property: Gets the auto-execute status (whether to let the system execute the + * recommendations) of this advisor. Possible values are 'Enabled' and 'Disabled'. + * + * @return the autoExecuteStatus value. + */ + AutoExecuteStatus autoExecuteStatus(); + + /** + * Gets the autoExecuteStatusInheritedFrom property: Gets the resource from which current value of auto-execute + * status is inherited. Auto-execute status can be set on (and inherited from) different levels in the resource + * hierarchy. Possible values are 'Subscription', 'Server', 'ElasticPool', 'Database' and 'Default' (when status is + * not explicitly set on any level). + * + * @return the autoExecuteStatusInheritedFrom value. + */ + AutoExecuteStatusInheritedFrom autoExecuteStatusInheritedFrom(); + + /** + * Gets the recommendationsStatus property: 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. + */ + String recommendationsStatus(); + + /** + * Gets the lastChecked property: Gets the time when the current resource was analyzed for recommendations by this + * advisor. + * + * @return the lastChecked value. + */ + OffsetDateTime lastChecked(); + + /** + * Gets the recommendedActions property: Gets the recommended actions for this advisor. + * + * @return the recommendedActions value. + */ + List recommendedActions(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.AdvisorInner object. + * + * @return the inner object. + */ + AdvisorInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AdvisorStatus.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AdvisorStatus.java new file mode 100644 index 0000000000000..0a443d171e782 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AdvisorStatus.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets the status of availability of this advisor to customers. Possible values are 'GA', 'PublicPreview', + * 'LimitedPublicPreview' and 'PrivatePreview'. + */ +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 final 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) { + if (value == null) { + return null; + } + AdvisorStatus[] items = AdvisorStatus.values(); + for (AdvisorStatus item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AggregationFunctionType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AggregationFunctionType.java new file mode 100644 index 0000000000000..0df5095b8a047 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AggregationFunctionType.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AggregationFunctionType. */ +public final class AggregationFunctionType extends ExpandableStringEnum { + /** Static value avg for AggregationFunctionType. */ + public static final AggregationFunctionType AVG = fromString("avg"); + + /** Static value min for AggregationFunctionType. */ + public static final AggregationFunctionType MIN = fromString("min"); + + /** Static value max for AggregationFunctionType. */ + public static final AggregationFunctionType MAX = fromString("max"); + + /** Static value stdev for AggregationFunctionType. */ + public static final AggregationFunctionType STDEV = fromString("stdev"); + + /** Static value sum for AggregationFunctionType. */ + public static final AggregationFunctionType SUM = fromString("sum"); + + /** + * Creates or finds a AggregationFunctionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding AggregationFunctionType. + */ + @JsonCreator + public static AggregationFunctionType fromString(String name) { + return fromString(name, AggregationFunctionType.class); + } + + /** + * Gets known AggregationFunctionType values. + * + * @return known AggregationFunctionType values. + */ + public static Collection values() { + return values(AggregationFunctionType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AlwaysEncryptedEnclaveType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AlwaysEncryptedEnclaveType.java new file mode 100644 index 0000000000000..c7208ca352632 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AlwaysEncryptedEnclaveType.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Type of enclave requested on the database i.e. Default or VBS enclaves. */ +public final class AlwaysEncryptedEnclaveType extends ExpandableStringEnum { + /** Static value Default for AlwaysEncryptedEnclaveType. */ + public static final AlwaysEncryptedEnclaveType DEFAULT = fromString("Default"); + + /** Static value VBS for AlwaysEncryptedEnclaveType. */ + public static final AlwaysEncryptedEnclaveType VBS = fromString("VBS"); + + /** + * Creates or finds a AlwaysEncryptedEnclaveType from its string representation. + * + * @param name a name to look for. + * @return the corresponding AlwaysEncryptedEnclaveType. + */ + @JsonCreator + public static AlwaysEncryptedEnclaveType fromString(String name) { + return fromString(name, AlwaysEncryptedEnclaveType.class); + } + + /** + * Gets known AlwaysEncryptedEnclaveType values. + * + * @return known AlwaysEncryptedEnclaveType values. + */ + public static Collection values() { + return values(AlwaysEncryptedEnclaveType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AuthenticationName.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AuthenticationName.java new file mode 100644 index 0000000000000..6e385ff6e2286 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AuthenticationName.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AuthenticationName. */ +public final class AuthenticationName extends ExpandableStringEnum { + /** Static value Default for AuthenticationName. */ + public static final AuthenticationName DEFAULT = fromString("Default"); + + /** + * Creates or finds a AuthenticationName from its string representation. + * + * @param name a name to look for. + * @return the corresponding AuthenticationName. + */ + @JsonCreator + public static AuthenticationName fromString(String name) { + return fromString(name, AuthenticationName.class); + } + + /** + * Gets known AuthenticationName values. + * + * @return known AuthenticationName values. + */ + public static Collection values() { + return values(AuthenticationName.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutoExecuteStatus.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutoExecuteStatus.java new file mode 100644 index 0000000000000..f099f41bd480b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutoExecuteStatus.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets the auto-execute status (whether to let the system execute the recommendations) of this advisor. Possible values + * are 'Enabled' and 'Disabled'. + */ +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 final 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) { + if (value == null) { + return null; + } + AutoExecuteStatus[] items = AutoExecuteStatus.values(); + for (AutoExecuteStatus item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutoExecuteStatusInheritedFrom.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutoExecuteStatusInheritedFrom.java new file mode 100644 index 0000000000000..9289ca6ba91b7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutoExecuteStatusInheritedFrom.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets the resource from which current value of auto-execute status is inherited. Auto-execute status can be set on + * (and inherited from) different levels in the resource hierarchy. Possible values are 'Subscription', 'Server', + * 'ElasticPool', 'Database' and 'Default' (when status is not explicitly set on any level). + */ +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 final 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) { + if (value == null) { + return null; + } + AutoExecuteStatusInheritedFrom[] items = AutoExecuteStatusInheritedFrom.values(); + for (AutoExecuteStatusInheritedFrom item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutoPauseDelayTimeRange.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutoPauseDelayTimeRange.java new file mode 100644 index 0000000000000..9eb90dbc9e5be --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutoPauseDelayTimeRange.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Supported auto pause delay time range. */ +@Immutable +public final class AutoPauseDelayTimeRange { + /* + * Minimum value + */ + @JsonProperty(value = "minValue", access = JsonProperty.Access.WRITE_ONLY) + private Integer minValue; + + /* + * Maximum value + */ + @JsonProperty(value = "maxValue", access = JsonProperty.Access.WRITE_ONLY) + private Integer maxValue; + + /* + * Step value for discrete values between the minimum value and the maximum value. + */ + @JsonProperty(value = "stepSize", access = JsonProperty.Access.WRITE_ONLY) + private Integer stepSize; + + /* + * Default value is no value is provided + */ + @JsonProperty(value = "default", access = JsonProperty.Access.WRITE_ONLY) + private Integer defaultProperty; + + /* + * Unit of time that delay is expressed in + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private PauseDelayTimeUnit unit; + + /* + * Value that is used to not pause (infinite delay before pause) + */ + @JsonProperty(value = "doNotPauseValue", access = JsonProperty.Access.WRITE_ONLY) + private Integer doNotPauseValue; + + /** Creates an instance of AutoPauseDelayTimeRange class. */ + public AutoPauseDelayTimeRange() { + } + + /** + * Get the minValue property: Minimum value. + * + * @return the minValue value. + */ + public Integer minValue() { + return this.minValue; + } + + /** + * Get the maxValue property: Maximum value. + * + * @return the maxValue value. + */ + public Integer maxValue() { + return this.maxValue; + } + + /** + * Get the stepSize property: Step value for discrete values between the minimum value and the maximum value. + * + * @return the stepSize value. + */ + public Integer stepSize() { + return this.stepSize; + } + + /** + * Get the defaultProperty property: Default value is no value is provided. + * + * @return the defaultProperty value. + */ + public Integer defaultProperty() { + return this.defaultProperty; + } + + /** + * Get the unit property: Unit of time that delay is expressed in. + * + * @return the unit value. + */ + public PauseDelayTimeUnit unit() { + return this.unit; + } + + /** + * Get the doNotPauseValue property: Value that is used to not pause (infinite delay before pause). + * + * @return the doNotPauseValue value. + */ + public Integer doNotPauseValue() { + return this.doNotPauseValue; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutomaticTuningDisabledReason.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutomaticTuningDisabledReason.java new file mode 100644 index 0000000000000..24aa2227fe5be --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutomaticTuningDisabledReason.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Reason description if desired and actual state are different. */ +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 final 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) { + if (value == null) { + return null; + } + AutomaticTuningDisabledReason[] items = AutomaticTuningDisabledReason.values(); + for (AutomaticTuningDisabledReason item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutomaticTuningMode.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutomaticTuningMode.java new file mode 100644 index 0000000000000..da97ddd80105b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutomaticTuningMode.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Automatic tuning desired state. */ +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 final 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) { + if (value == null) { + return null; + } + AutomaticTuningMode[] items = AutomaticTuningMode.values(); + for (AutomaticTuningMode item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutomaticTuningOptionModeActual.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutomaticTuningOptionModeActual.java new file mode 100644 index 0000000000000..ac4113e71cab1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutomaticTuningOptionModeActual.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Automatic tuning option actual state. */ +public enum AutomaticTuningOptionModeActual { + /** Enum value Off. */ + OFF("Off"), + + /** Enum value On. */ + ON("On"); + + /** The actual serialized value for a AutomaticTuningOptionModeActual instance. */ + private final 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) { + if (value == null) { + return null; + } + AutomaticTuningOptionModeActual[] items = AutomaticTuningOptionModeActual.values(); + for (AutomaticTuningOptionModeActual item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutomaticTuningOptionModeDesired.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutomaticTuningOptionModeDesired.java new file mode 100644 index 0000000000000..8de3da407fd7f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutomaticTuningOptionModeDesired.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Automatic tuning option desired state. */ +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 final 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) { + if (value == null) { + return null; + } + AutomaticTuningOptionModeDesired[] items = AutomaticTuningOptionModeDesired.values(); + for (AutomaticTuningOptionModeDesired item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutomaticTuningOptions.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutomaticTuningOptions.java new file mode 100644 index 0000000000000..2b7aca9f6979b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutomaticTuningOptions.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Automatic tuning properties for individual advisors. */ +@Fluent +public final class AutomaticTuningOptions { + /* + * Automatic tuning option desired state. + */ + @JsonProperty(value = "desiredState") + private AutomaticTuningOptionModeDesired desiredState; + + /* + * Automatic tuning option actual state. + */ + @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. + */ + @JsonProperty(value = "reasonDesc", access = JsonProperty.Access.WRITE_ONLY) + private AutomaticTuningDisabledReason reasonDesc; + + /** Creates an instance of AutomaticTuningOptions class. */ + public AutomaticTuningOptions() { + } + + /** + * Get the desiredState property: Automatic tuning option desired state. + * + * @return the desiredState value. + */ + public AutomaticTuningOptionModeDesired desiredState() { + return this.desiredState; + } + + /** + * Set the desiredState property: Automatic tuning option desired state. + * + * @param desiredState the desiredState value to set. + * @return the AutomaticTuningOptions object itself. + */ + public AutomaticTuningOptions withDesiredState(AutomaticTuningOptionModeDesired desiredState) { + this.desiredState = desiredState; + return this; + } + + /** + * Get the actualState property: Automatic tuning option actual state. + * + * @return the actualState value. + */ + public AutomaticTuningOptionModeActual actualState() { + return this.actualState; + } + + /** + * Get the reasonCode property: Reason code if desired and actual state are different. + * + * @return the reasonCode value. + */ + public Integer reasonCode() { + return this.reasonCode; + } + + /** + * Get the reasonDesc property: Reason description if desired and actual state are different. + * + * @return the reasonDesc value. + */ + public AutomaticTuningDisabledReason reasonDesc() { + return this.reasonDesc; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutomaticTuningServerMode.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutomaticTuningServerMode.java new file mode 100644 index 0000000000000..5d38b5b005a2b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutomaticTuningServerMode.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Automatic tuning desired state. */ +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 final 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) { + if (value == null) { + return null; + } + AutomaticTuningServerMode[] items = AutomaticTuningServerMode.values(); + for (AutomaticTuningServerMode item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutomaticTuningServerOptions.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutomaticTuningServerOptions.java new file mode 100644 index 0000000000000..2b5b00a38f0d9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutomaticTuningServerOptions.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Automatic tuning properties for individual advisors. */ +@Fluent +public final class AutomaticTuningServerOptions { + /* + * Automatic tuning option desired state. + */ + @JsonProperty(value = "desiredState") + private AutomaticTuningOptionModeDesired desiredState; + + /* + * Automatic tuning option actual state. + */ + @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. + */ + @JsonProperty(value = "reasonDesc", access = JsonProperty.Access.WRITE_ONLY) + private AutomaticTuningServerReason reasonDesc; + + /** Creates an instance of AutomaticTuningServerOptions class. */ + public AutomaticTuningServerOptions() { + } + + /** + * Get the desiredState property: Automatic tuning option desired state. + * + * @return the desiredState value. + */ + public AutomaticTuningOptionModeDesired desiredState() { + return this.desiredState; + } + + /** + * Set the desiredState property: Automatic tuning option desired state. + * + * @param desiredState the desiredState value to set. + * @return the AutomaticTuningServerOptions object itself. + */ + public AutomaticTuningServerOptions withDesiredState(AutomaticTuningOptionModeDesired desiredState) { + this.desiredState = desiredState; + return this; + } + + /** + * Get the actualState property: Automatic tuning option actual state. + * + * @return the actualState value. + */ + public AutomaticTuningOptionModeActual actualState() { + return this.actualState; + } + + /** + * Get the reasonCode property: Reason code if desired and actual state are different. + * + * @return the reasonCode value. + */ + public Integer reasonCode() { + return this.reasonCode; + } + + /** + * Get the reasonDesc property: Reason description if desired and actual state are different. + * + * @return the reasonDesc value. + */ + public AutomaticTuningServerReason reasonDesc() { + return this.reasonDesc; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutomaticTuningServerReason.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutomaticTuningServerReason.java new file mode 100644 index 0000000000000..528ba02b20aee --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AutomaticTuningServerReason.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Reason description if desired and actual state are different. */ +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 final 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) { + if (value == null) { + return null; + } + AutomaticTuningServerReason[] items = AutomaticTuningServerReason.values(); + for (AutomaticTuningServerReason item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AzureADOnlyAuthListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AzureADOnlyAuthListResult.java new file mode 100644 index 0000000000000..add3ead53af72 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/AzureADOnlyAuthListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerAzureADOnlyAuthenticationInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of active directory only authentications. */ +@Immutable +public final class AzureADOnlyAuthListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of AzureADOnlyAuthListResult class. */ + public AzureADOnlyAuthListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/BackupShortTermRetentionPolicies.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/BackupShortTermRetentionPolicies.java new file mode 100644 index 0000000000000..1de79c789417c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/BackupShortTermRetentionPolicies.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of BackupShortTermRetentionPolicies. */ +public interface BackupShortTermRetentionPolicies { + /** + * 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 policyName The policy name. Should always be "default". + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's short term retention policy along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + ShortTermRetentionPolicyName policyName, + Context context); + + /** + * 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 policyName The policy name. Should always be "default". + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's short term retention policy. + */ + BackupShortTermRetentionPolicy get( + String resourceGroupName, String serverName, String databaseName, ShortTermRetentionPolicyName policyName); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's short term retention policy as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's short term retention policy as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Gets a database's short term retention policy. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's short term retention policy along with {@link Response}. + */ + BackupShortTermRetentionPolicy getById(String id); + + /** + * Gets a database's short term retention policy. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's short term retention policy along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new BackupShortTermRetentionPolicy resource. + * + * @param name resource name. + * @return the first stage of the new BackupShortTermRetentionPolicy definition. + */ + BackupShortTermRetentionPolicy.DefinitionStages.Blank define(ShortTermRetentionPolicyName name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/BackupShortTermRetentionPolicy.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/BackupShortTermRetentionPolicy.java new file mode 100644 index 0000000000000..f2cc913076152 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/BackupShortTermRetentionPolicy.java @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.BackupShortTermRetentionPolicyInner; + +/** An immutable client-side representation of BackupShortTermRetentionPolicy. */ +public interface BackupShortTermRetentionPolicy { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the retentionDays property: The backup retention period in days. This is how many days Point-in-Time Restore + * will be supported. + * + * @return the retentionDays value. + */ + Integer retentionDays(); + + /** + * Gets the diffBackupIntervalInHours property: The differential backup interval in hours. This is how many interval + * hours between each differential backup will be supported. This is only applicable to live databases but not + * dropped databases. + * + * @return the diffBackupIntervalInHours value. + */ + DiffBackupIntervalInHours diffBackupIntervalInHours(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.BackupShortTermRetentionPolicyInner object. + * + * @return the inner object. + */ + BackupShortTermRetentionPolicyInner innerModel(); + + /** The entirety of the BackupShortTermRetentionPolicy definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The BackupShortTermRetentionPolicy definition stages. */ + interface DefinitionStages { + /** The first stage of the BackupShortTermRetentionPolicy definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the BackupShortTermRetentionPolicy definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName, databaseName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @return the next definition stage. + */ + WithCreate withExistingDatabase(String resourceGroupName, String serverName, String databaseName); + } + /** + * The stage of the BackupShortTermRetentionPolicy definition which contains all the minimum required properties + * for the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithRetentionDays, DefinitionStages.WithDiffBackupIntervalInHours { + /** + * Executes the create request. + * + * @return the created resource. + */ + BackupShortTermRetentionPolicy create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + BackupShortTermRetentionPolicy create(Context context); + } + /** The stage of the BackupShortTermRetentionPolicy definition allowing to specify retentionDays. */ + interface WithRetentionDays { + /** + * Specifies the retentionDays property: The backup retention period in days. This is how many days + * Point-in-Time Restore will be supported.. + * + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore + * will be supported. + * @return the next definition stage. + */ + WithCreate withRetentionDays(Integer retentionDays); + } + /** The stage of the BackupShortTermRetentionPolicy definition allowing to specify diffBackupIntervalInHours. */ + interface WithDiffBackupIntervalInHours { + /** + * Specifies the diffBackupIntervalInHours property: The differential backup interval in hours. This is how + * many interval hours between each differential backup will be supported. This is only applicable to live + * databases but not dropped databases.. + * + * @param diffBackupIntervalInHours The differential backup interval in hours. This is how many interval + * hours between each differential backup will be supported. This is only applicable to live databases + * but not dropped databases. + * @return the next definition stage. + */ + WithCreate withDiffBackupIntervalInHours(DiffBackupIntervalInHours diffBackupIntervalInHours); + } + } + /** + * Begins update for the BackupShortTermRetentionPolicy resource. + * + * @return the stage of resource update. + */ + BackupShortTermRetentionPolicy.Update update(); + + /** The template for BackupShortTermRetentionPolicy update. */ + interface Update extends UpdateStages.WithRetentionDays, UpdateStages.WithDiffBackupIntervalInHours { + /** + * Executes the update request. + * + * @return the updated resource. + */ + BackupShortTermRetentionPolicy apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + BackupShortTermRetentionPolicy apply(Context context); + } + /** The BackupShortTermRetentionPolicy update stages. */ + interface UpdateStages { + /** The stage of the BackupShortTermRetentionPolicy update allowing to specify retentionDays. */ + interface WithRetentionDays { + /** + * Specifies the retentionDays property: The backup retention period in days. This is how many days + * Point-in-Time Restore will be supported.. + * + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore + * will be supported. + * @return the next definition stage. + */ + Update withRetentionDays(Integer retentionDays); + } + /** The stage of the BackupShortTermRetentionPolicy update allowing to specify diffBackupIntervalInHours. */ + interface WithDiffBackupIntervalInHours { + /** + * Specifies the diffBackupIntervalInHours property: The differential backup interval in hours. This is how + * many interval hours between each differential backup will be supported. This is only applicable to live + * databases but not dropped databases.. + * + * @param diffBackupIntervalInHours The differential backup interval in hours. This is how many interval + * hours between each differential backup will be supported. This is only applicable to live databases + * but not dropped databases. + * @return the next definition stage. + */ + Update withDiffBackupIntervalInHours(DiffBackupIntervalInHours diffBackupIntervalInHours); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + BackupShortTermRetentionPolicy refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + BackupShortTermRetentionPolicy refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/BackupShortTermRetentionPolicyListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/BackupShortTermRetentionPolicyListResult.java new file mode 100644 index 0000000000000..6cff678269729 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/BackupShortTermRetentionPolicyListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.BackupShortTermRetentionPolicyInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of short term retention policies. */ +@Immutable +public final class BackupShortTermRetentionPolicyListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of BackupShortTermRetentionPolicyListResult class. */ + public BackupShortTermRetentionPolicyListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/BackupStorageRedundancy.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/BackupStorageRedundancy.java new file mode 100644 index 0000000000000..cc83186484dbd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/BackupStorageRedundancy.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The storage redundancy type of the copied backup. */ +public final class BackupStorageRedundancy extends ExpandableStringEnum { + /** Static value Geo for BackupStorageRedundancy. */ + public static final BackupStorageRedundancy GEO = fromString("Geo"); + + /** Static value Local for BackupStorageRedundancy. */ + public static final BackupStorageRedundancy LOCAL = fromString("Local"); + + /** Static value Zone for BackupStorageRedundancy. */ + public static final BackupStorageRedundancy ZONE = fromString("Zone"); + + /** Static value GeoZone for BackupStorageRedundancy. */ + public static final BackupStorageRedundancy GEO_ZONE = fromString("GeoZone"); + + /** + * Creates or finds a BackupStorageRedundancy from its string representation. + * + * @param name a name to look for. + * @return the corresponding BackupStorageRedundancy. + */ + @JsonCreator + public static BackupStorageRedundancy fromString(String name) { + return fromString(name, BackupStorageRedundancy.class); + } + + /** + * Gets known BackupStorageRedundancy values. + * + * @return known BackupStorageRedundancy values. + */ + public static Collection values() { + return values(BackupStorageRedundancy.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Baseline.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Baseline.java new file mode 100644 index 0000000000000..5f30982f96101 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Baseline.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** SQL Vulnerability Assessment baseline Details. */ +@Immutable +public final class Baseline { + /* + * SQL Vulnerability Assessment baseline expected results + */ + @JsonProperty(value = "expectedResults", access = JsonProperty.Access.WRITE_ONLY) + private List> expectedResults; + + /* + * SQL Vulnerability Assessment baseline update time (UTC) + */ + @JsonProperty(value = "updatedTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime updatedTime; + + /** Creates an instance of Baseline class. */ + public Baseline() { + } + + /** + * Get the expectedResults property: SQL Vulnerability Assessment baseline expected results. + * + * @return the expectedResults value. + */ + public List> expectedResults() { + return this.expectedResults; + } + + /** + * Get the updatedTime property: SQL Vulnerability Assessment baseline update time (UTC). + * + * @return the updatedTime value. + */ + public OffsetDateTime updatedTime() { + return this.updatedTime; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/BaselineAdjustedResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/BaselineAdjustedResult.java new file mode 100644 index 0000000000000..7f2a76098d2a7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/BaselineAdjustedResult.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** SQL Vulnerability Assessment baseline adjusted results. */ +@Immutable +public final class BaselineAdjustedResult { + /* + * SQL Vulnerability Assessment baseline details + */ + @JsonProperty(value = "baseline", access = JsonProperty.Access.WRITE_ONLY) + private Baseline baseline; + + /* + * SQL Vulnerability Assessment baseline status + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private RuleStatus status; + + /* + * SQL Vulnerability Assessment results that are not in baseline + */ + @JsonProperty(value = "resultsNotInBaseline", access = JsonProperty.Access.WRITE_ONLY) + private List> resultsNotInBaseline; + + /* + * SQL Vulnerability Assessment results that are in baseline. + */ + @JsonProperty(value = "resultsOnlyInBaseline", access = JsonProperty.Access.WRITE_ONLY) + private List> resultsOnlyInBaseline; + + /** Creates an instance of BaselineAdjustedResult class. */ + public BaselineAdjustedResult() { + } + + /** + * Get the baseline property: SQL Vulnerability Assessment baseline details. + * + * @return the baseline value. + */ + public Baseline baseline() { + return this.baseline; + } + + /** + * Get the status property: SQL Vulnerability Assessment baseline status. + * + * @return the status value. + */ + public RuleStatus status() { + return this.status; + } + + /** + * Get the resultsNotInBaseline property: SQL Vulnerability Assessment results that are not in baseline. + * + * @return the resultsNotInBaseline value. + */ + public List> resultsNotInBaseline() { + return this.resultsNotInBaseline; + } + + /** + * Get the resultsOnlyInBaseline property: SQL Vulnerability Assessment results that are in baseline. + * + * @return the resultsOnlyInBaseline value. + */ + public List> resultsOnlyInBaseline() { + return this.resultsOnlyInBaseline; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (baseline() != null) { + baseline().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/BaselineName.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/BaselineName.java new file mode 100644 index 0000000000000..12783dabe9acd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/BaselineName.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for BaselineName. */ +public final class BaselineName extends ExpandableStringEnum { + /** Static value default for BaselineName. */ + public static final BaselineName DEFAULT = fromString("default"); + + /** + * Creates or finds a BaselineName from its string representation. + * + * @param name a name to look for. + * @return the corresponding BaselineName. + */ + @JsonCreator + public static BaselineName fromString(String name) { + return fromString(name, BaselineName.class); + } + + /** + * Gets known BaselineName values. + * + * @return known BaselineName values. + */ + public static Collection values() { + return values(BaselineName.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/BenchmarkReference.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/BenchmarkReference.java new file mode 100644 index 0000000000000..d9c47a37cce53 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/BenchmarkReference.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** SQL Vulnerability Assessment benchmark reference. */ +@Immutable +public final class BenchmarkReference { + /* + * SQL Vulnerability Assessment benchmark name + */ + @JsonProperty(value = "benchmark", access = JsonProperty.Access.WRITE_ONLY) + private String benchmark; + + /* + * SQL Vulnerability Assessment benchmark reference. + */ + @JsonProperty(value = "reference", access = JsonProperty.Access.WRITE_ONLY) + private String reference; + + /** Creates an instance of BenchmarkReference class. */ + public BenchmarkReference() { + } + + /** + * Get the benchmark property: SQL Vulnerability Assessment benchmark name. + * + * @return the benchmark value. + */ + public String benchmark() { + return this.benchmark; + } + + /** + * Get the reference property: SQL Vulnerability Assessment benchmark reference. + * + * @return the reference value. + */ + public String reference() { + return this.reference; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/BlobAuditingPolicyState.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/BlobAuditingPolicyState.java new file mode 100644 index 0000000000000..f7935cc077d3c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/BlobAuditingPolicyState.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Specifies the state of the audit. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. + */ +public enum BlobAuditingPolicyState { + /** Enum value Enabled. */ + ENABLED("Enabled"), + + /** Enum value Disabled. */ + DISABLED("Disabled"); + + /** The actual serialized value for a BlobAuditingPolicyState instance. */ + private final 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) { + if (value == null) { + return null; + } + BlobAuditingPolicyState[] items = BlobAuditingPolicyState.values(); + for (BlobAuditingPolicyState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Capabilities.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Capabilities.java new file mode 100644 index 0000000000000..042f0e1013be0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Capabilities.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Capabilities. */ +public interface Capabilities { + /** + * 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the subscription capabilities available for the specified location along with {@link Response}. + */ + Response listByLocationWithResponse( + String locationName, CapabilityGroup include, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the subscription capabilities available for the specified location. + */ + LocationCapabilities listByLocation(String locationName); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CapabilityGroup.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CapabilityGroup.java new file mode 100644 index 0000000000000..2ba6c60ffe322 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CapabilityGroup.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** 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"); + + /** Static value supportedInstancePoolEditions for CapabilityGroup. */ + public static final CapabilityGroup SUPPORTED_INSTANCE_POOL_EDITIONS = fromString("supportedInstancePoolEditions"); + + /** Static value supportedManagedInstanceEditions for CapabilityGroup. */ + public static final CapabilityGroup SUPPORTED_MANAGED_INSTANCE_EDITIONS = + fromString("supportedManagedInstanceEditions"); + + /** + * 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); + } + + /** + * Gets known CapabilityGroup values. + * + * @return known CapabilityGroup values. + */ + public static Collection values() { + return values(CapabilityGroup.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CapabilityStatus.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CapabilityStatus.java new file mode 100644 index 0000000000000..d9bd3b1d19c51 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CapabilityStatus.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** The status of the capability. */ +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 final 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) { + if (value == null) { + return null; + } + CapabilityStatus[] items = CapabilityStatus.values(); + for (CapabilityStatus item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CatalogCollationType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CatalogCollationType.java new file mode 100644 index 0000000000000..728b316ff3011 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CatalogCollationType.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Collation of the metadata catalog. */ +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); + } + + /** + * Gets known CatalogCollationType values. + * + * @return known CatalogCollationType values. + */ + public static Collection values() { + return values(CatalogCollationType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CheckNameAvailabilityReason.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CheckNameAvailabilityReason.java new file mode 100644 index 0000000000000..2fd521674fc93 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CheckNameAvailabilityReason.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** The reason code explaining why the name is unavailable. Will be undefined if the name is available. */ +public enum CheckNameAvailabilityReason { + /** Enum value Invalid. */ + INVALID("Invalid"), + + /** Enum value AlreadyExists. */ + ALREADY_EXISTS("AlreadyExists"); + + /** The actual serialized value for a CheckNameAvailabilityReason instance. */ + private final 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) { + if (value == null) { + return null; + } + CheckNameAvailabilityReason[] items = CheckNameAvailabilityReason.values(); + for (CheckNameAvailabilityReason item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CheckNameAvailabilityRequest.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CheckNameAvailabilityRequest.java new file mode 100644 index 0000000000000..26d5e669635ce --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CheckNameAvailabilityRequest.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A request to check whether the specified name for a resource is available. */ +@Fluent +public final class CheckNameAvailabilityRequest { + /* + * The name property. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The type property. + */ + @JsonProperty(value = "type", required = true) + private String type = "Microsoft.Sql/servers"; + + /** Creates an instance of CheckNameAvailabilityRequest class. */ + public CheckNameAvailabilityRequest() { + type = "Microsoft.Sql/servers"; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name property. + * + * @param name the name value to set. + * @return the CheckNameAvailabilityRequest object itself. + */ + public CheckNameAvailabilityRequest withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type property: The type property. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: The type property. + * + * @param type the type value to set. + * @return the CheckNameAvailabilityRequest object itself. + */ + public CheckNameAvailabilityRequest withType(String type) { + this.type = type; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property name in model CheckNameAvailabilityRequest")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CheckNameAvailabilityRequest.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CheckNameAvailabilityResponse.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CheckNameAvailabilityResponse.java new file mode 100644 index 0000000000000..5ef4b748bf903 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CheckNameAvailabilityResponse.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.CheckNameAvailabilityResponseInner; + +/** An immutable client-side representation of CheckNameAvailabilityResponse. */ +public interface CheckNameAvailabilityResponse { + /** + * Gets the name property: The name whose availability was checked. + * + * @return the name value. + */ + String name(); + + /** + * Gets the available property: True if the name is available, otherwise false. + * + * @return the available value. + */ + Boolean available(); + + /** + * Gets the reason property: The reason code explaining why the name is unavailable. Will be undefined if the name + * is available. + * + * @return the reason value. + */ + CheckNameAvailabilityReason reason(); + + /** + * Gets the message property: A message explaining why the name is unavailable. Will be undefined if the name is + * available. + * + * @return the message value. + */ + String message(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.CheckNameAvailabilityResponseInner object. + * + * @return the inner object. + */ + CheckNameAvailabilityResponseInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ColumnDataType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ColumnDataType.java new file mode 100644 index 0000000000000..e2832857c5619 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ColumnDataType.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The column data type. */ +public final class ColumnDataType extends ExpandableStringEnum { + /** Static value image for ColumnDataType. */ + public static final ColumnDataType IMAGE = fromString("image"); + + /** Static value text for ColumnDataType. */ + public static final ColumnDataType TEXT = fromString("text"); + + /** Static value uniqueidentifier for ColumnDataType. */ + public static final ColumnDataType UNIQUEIDENTIFIER = fromString("uniqueidentifier"); + + /** Static value date for ColumnDataType. */ + public static final ColumnDataType DATE = fromString("date"); + + /** Static value time for ColumnDataType. */ + public static final ColumnDataType TIME = fromString("time"); + + /** Static value datetime2 for ColumnDataType. */ + public static final ColumnDataType DATETIME2 = fromString("datetime2"); + + /** Static value datetimeoffset for ColumnDataType. */ + public static final ColumnDataType DATETIMEOFFSET = fromString("datetimeoffset"); + + /** Static value tinyint for ColumnDataType. */ + public static final ColumnDataType TINYINT = fromString("tinyint"); + + /** Static value smallint for ColumnDataType. */ + public static final ColumnDataType SMALLINT = fromString("smallint"); + + /** Static value int for ColumnDataType. */ + public static final ColumnDataType INT = fromString("int"); + + /** Static value smalldatetime for ColumnDataType. */ + public static final ColumnDataType SMALLDATETIME = fromString("smalldatetime"); + + /** Static value real for ColumnDataType. */ + public static final ColumnDataType REAL = fromString("real"); + + /** Static value money for ColumnDataType. */ + public static final ColumnDataType MONEY = fromString("money"); + + /** Static value datetime for ColumnDataType. */ + public static final ColumnDataType DATETIME = fromString("datetime"); + + /** Static value float for ColumnDataType. */ + public static final ColumnDataType FLOAT = fromString("float"); + + /** Static value sql_variant for ColumnDataType. */ + public static final ColumnDataType SQL_VARIANT = fromString("sql_variant"); + + /** Static value ntext for ColumnDataType. */ + public static final ColumnDataType NTEXT = fromString("ntext"); + + /** Static value bit for ColumnDataType. */ + public static final ColumnDataType BIT = fromString("bit"); + + /** Static value decimal for ColumnDataType. */ + public static final ColumnDataType DECIMAL = fromString("decimal"); + + /** Static value numeric for ColumnDataType. */ + public static final ColumnDataType NUMERIC = fromString("numeric"); + + /** Static value smallmoney for ColumnDataType. */ + public static final ColumnDataType SMALLMONEY = fromString("smallmoney"); + + /** Static value bigint for ColumnDataType. */ + public static final ColumnDataType BIGINT = fromString("bigint"); + + /** Static value hierarchyid for ColumnDataType. */ + public static final ColumnDataType HIERARCHYID = fromString("hierarchyid"); + + /** Static value geometry for ColumnDataType. */ + public static final ColumnDataType GEOMETRY = fromString("geometry"); + + /** Static value geography for ColumnDataType. */ + public static final ColumnDataType GEOGRAPHY = fromString("geography"); + + /** Static value varbinary for ColumnDataType. */ + public static final ColumnDataType VARBINARY = fromString("varbinary"); + + /** Static value varchar for ColumnDataType. */ + public static final ColumnDataType VARCHAR = fromString("varchar"); + + /** Static value binary for ColumnDataType. */ + public static final ColumnDataType BINARY = fromString("binary"); + + /** Static value char for ColumnDataType. */ + public static final ColumnDataType CHAR = fromString("char"); + + /** Static value timestamp for ColumnDataType. */ + public static final ColumnDataType TIMESTAMP = fromString("timestamp"); + + /** Static value nvarchar for ColumnDataType. */ + public static final ColumnDataType NVARCHAR = fromString("nvarchar"); + + /** Static value nchar for ColumnDataType. */ + public static final ColumnDataType NCHAR = fromString("nchar"); + + /** Static value xml for ColumnDataType. */ + public static final ColumnDataType XML = fromString("xml"); + + /** Static value sysname for ColumnDataType. */ + public static final ColumnDataType SYSNAME = fromString("sysname"); + + /** + * Creates or finds a ColumnDataType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ColumnDataType. + */ + @JsonCreator + public static ColumnDataType fromString(String name) { + return fromString(name, ColumnDataType.class); + } + + /** + * Gets known ColumnDataType values. + * + * @return known ColumnDataType values. + */ + public static Collection values() { + return values(ColumnDataType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CompleteDatabaseRestoreDefinition.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CompleteDatabaseRestoreDefinition.java new file mode 100644 index 0000000000000..36f66df7df91c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CompleteDatabaseRestoreDefinition.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Contains the information necessary to perform a complete database restore operation. */ +@Fluent +public final class CompleteDatabaseRestoreDefinition { + /* + * The last backup name to apply + */ + @JsonProperty(value = "lastBackupName", required = true) + private String lastBackupName; + + /** Creates an instance of CompleteDatabaseRestoreDefinition class. */ + public CompleteDatabaseRestoreDefinition() { + } + + /** + * Get the lastBackupName property: The last backup name to apply. + * + * @return the lastBackupName value. + */ + public String lastBackupName() { + return this.lastBackupName; + } + + /** + * Set the lastBackupName property: 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (lastBackupName() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property lastBackupName in model CompleteDatabaseRestoreDefinition")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CompleteDatabaseRestoreDefinition.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ConnectionPolicyName.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ConnectionPolicyName.java new file mode 100644 index 0000000000000..cfdf367ea409f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ConnectionPolicyName.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ConnectionPolicyName. */ +public final class ConnectionPolicyName extends ExpandableStringEnum { + /** Static value default for ConnectionPolicyName. */ + public static final ConnectionPolicyName DEFAULT = fromString("default"); + + /** + * Creates or finds a ConnectionPolicyName from its string representation. + * + * @param name a name to look for. + * @return the corresponding ConnectionPolicyName. + */ + @JsonCreator + public static ConnectionPolicyName fromString(String name) { + return fromString(name, ConnectionPolicyName.class); + } + + /** + * Gets known ConnectionPolicyName values. + * + * @return known ConnectionPolicyName values. + */ + public static Collection values() { + return values(ConnectionPolicyName.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CopyLongTermRetentionBackupParameters.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CopyLongTermRetentionBackupParameters.java new file mode 100644 index 0000000000000..d8f5fb7721860 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CopyLongTermRetentionBackupParameters.java @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.fluent.models.CopyLongTermRetentionBackupParametersProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Contains the information necessary to perform long term retention backup copy operation. */ +@Fluent +public final class CopyLongTermRetentionBackupParameters { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private CopyLongTermRetentionBackupParametersProperties innerProperties; + + /** Creates an instance of CopyLongTermRetentionBackupParameters class. */ + public CopyLongTermRetentionBackupParameters() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private CopyLongTermRetentionBackupParametersProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the targetSubscriptionId property: The subscription that owns the target server. + * + * @return the targetSubscriptionId value. + */ + public String targetSubscriptionId() { + return this.innerProperties() == null ? null : this.innerProperties().targetSubscriptionId(); + } + + /** + * Set the targetSubscriptionId property: The subscription that owns the target server. + * + * @param targetSubscriptionId the targetSubscriptionId value to set. + * @return the CopyLongTermRetentionBackupParameters object itself. + */ + public CopyLongTermRetentionBackupParameters withTargetSubscriptionId(String targetSubscriptionId) { + if (this.innerProperties() == null) { + this.innerProperties = new CopyLongTermRetentionBackupParametersProperties(); + } + this.innerProperties().withTargetSubscriptionId(targetSubscriptionId); + return this; + } + + /** + * Get the targetResourceGroup property: The resource group that owns the target server. + * + * @return the targetResourceGroup value. + */ + public String targetResourceGroup() { + return this.innerProperties() == null ? null : this.innerProperties().targetResourceGroup(); + } + + /** + * Set the targetResourceGroup property: The resource group that owns the target server. + * + * @param targetResourceGroup the targetResourceGroup value to set. + * @return the CopyLongTermRetentionBackupParameters object itself. + */ + public CopyLongTermRetentionBackupParameters withTargetResourceGroup(String targetResourceGroup) { + if (this.innerProperties() == null) { + this.innerProperties = new CopyLongTermRetentionBackupParametersProperties(); + } + this.innerProperties().withTargetResourceGroup(targetResourceGroup); + return this; + } + + /** + * Get the targetServerResourceId property: The resource Id of the target server that owns the database. + * + * @return the targetServerResourceId value. + */ + public String targetServerResourceId() { + return this.innerProperties() == null ? null : this.innerProperties().targetServerResourceId(); + } + + /** + * Set the targetServerResourceId property: The resource Id of the target server that owns the database. + * + * @param targetServerResourceId the targetServerResourceId value to set. + * @return the CopyLongTermRetentionBackupParameters object itself. + */ + public CopyLongTermRetentionBackupParameters withTargetServerResourceId(String targetServerResourceId) { + if (this.innerProperties() == null) { + this.innerProperties = new CopyLongTermRetentionBackupParametersProperties(); + } + this.innerProperties().withTargetServerResourceId(targetServerResourceId); + return this; + } + + /** + * Get the targetServerFullyQualifiedDomainName property: The fully qualified domain name of the target server. + * + * @return the targetServerFullyQualifiedDomainName value. + */ + public String targetServerFullyQualifiedDomainName() { + return this.innerProperties() == null ? null : this.innerProperties().targetServerFullyQualifiedDomainName(); + } + + /** + * Set the targetServerFullyQualifiedDomainName property: The fully qualified domain name of the target server. + * + * @param targetServerFullyQualifiedDomainName the targetServerFullyQualifiedDomainName value to set. + * @return the CopyLongTermRetentionBackupParameters object itself. + */ + public CopyLongTermRetentionBackupParameters withTargetServerFullyQualifiedDomainName( + String targetServerFullyQualifiedDomainName) { + if (this.innerProperties() == null) { + this.innerProperties = new CopyLongTermRetentionBackupParametersProperties(); + } + this.innerProperties().withTargetServerFullyQualifiedDomainName(targetServerFullyQualifiedDomainName); + return this; + } + + /** + * Get the targetDatabaseName property: The name of the database owns the copied backup. + * + * @return the targetDatabaseName value. + */ + public String targetDatabaseName() { + return this.innerProperties() == null ? null : this.innerProperties().targetDatabaseName(); + } + + /** + * Set the targetDatabaseName property: The name of the database owns the copied backup. + * + * @param targetDatabaseName the targetDatabaseName value to set. + * @return the CopyLongTermRetentionBackupParameters object itself. + */ + public CopyLongTermRetentionBackupParameters withTargetDatabaseName(String targetDatabaseName) { + if (this.innerProperties() == null) { + this.innerProperties = new CopyLongTermRetentionBackupParametersProperties(); + } + this.innerProperties().withTargetDatabaseName(targetDatabaseName); + return this; + } + + /** + * Get the targetBackupStorageRedundancy property: The storage redundancy type of the copied backup. + * + * @return the targetBackupStorageRedundancy value. + */ + public BackupStorageRedundancy targetBackupStorageRedundancy() { + return this.innerProperties() == null ? null : this.innerProperties().targetBackupStorageRedundancy(); + } + + /** + * Set the targetBackupStorageRedundancy property: The storage redundancy type of the copied backup. + * + * @param targetBackupStorageRedundancy the targetBackupStorageRedundancy value to set. + * @return the CopyLongTermRetentionBackupParameters object itself. + */ + public CopyLongTermRetentionBackupParameters withTargetBackupStorageRedundancy( + BackupStorageRedundancy targetBackupStorageRedundancy) { + if (this.innerProperties() == null) { + this.innerProperties = new CopyLongTermRetentionBackupParametersProperties(); + } + this.innerProperties().withTargetBackupStorageRedundancy(targetBackupStorageRedundancy); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CreateDatabaseRestorePointDefinition.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CreateDatabaseRestorePointDefinition.java new file mode 100644 index 0000000000000..c55743bf500d7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CreateDatabaseRestorePointDefinition.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Contains the information necessary to perform a create database restore point operation. */ +@Fluent +public final class CreateDatabaseRestorePointDefinition { + /* + * The restore point label to apply + */ + @JsonProperty(value = "restorePointLabel", required = true) + private String restorePointLabel; + + /** Creates an instance of CreateDatabaseRestorePointDefinition class. */ + public CreateDatabaseRestorePointDefinition() { + } + + /** + * Get the restorePointLabel property: The restore point label to apply. + * + * @return the restorePointLabel value. + */ + public String restorePointLabel() { + return this.restorePointLabel; + } + + /** + * Set the restorePointLabel property: 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (restorePointLabel() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property restorePointLabel in model CreateDatabaseRestorePointDefinition")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CreateDatabaseRestorePointDefinition.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CreateMode.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CreateMode.java new file mode 100644 index 0000000000000..a83dbe82f6c2f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/CreateMode.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * 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. + */ +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); + } + + /** + * Gets known CreateMode values. + * + * @return known CreateMode values. + */ + public static Collection values() { + return values(CreateMode.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataMaskingFunction.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataMaskingFunction.java new file mode 100644 index 0000000000000..3681847ac08c4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataMaskingFunction.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** The masking function that is used for the data masking rule. */ +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 final 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) { + if (value == null) { + return null; + } + DataMaskingFunction[] items = DataMaskingFunction.values(); + for (DataMaskingFunction item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataMaskingPolicies.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataMaskingPolicies.java new file mode 100644 index 0000000000000..298ead85d19f1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataMaskingPolicies.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of DataMaskingPolicies. */ +public interface DataMaskingPolicies { + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database data masking policy along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database data masking policy. + */ + DataMaskingPolicy get(String resourceGroupName, String serverName, String databaseName); + + /** + * Gets a database data masking policy. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database data masking policy along with {@link Response}. + */ + DataMaskingPolicy getById(String id); + + /** + * Gets a database data masking policy. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database data masking policy along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new DataMaskingPolicy resource. + * + * @return the first stage of the new DataMaskingPolicy definition. + */ + DataMaskingPolicy.DefinitionStages.Blank define(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataMaskingPolicy.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataMaskingPolicy.java new file mode 100644 index 0000000000000..739cfc03f8f6c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataMaskingPolicy.java @@ -0,0 +1,239 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DataMaskingPolicyInner; + +/** An immutable client-side representation of DataMaskingPolicy. */ +public interface DataMaskingPolicy { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The location of the data masking policy. + * + * @return the location value. + */ + String location(); + + /** + * Gets the kind property: The kind of data masking policy. Metadata, used for Azure portal. + * + * @return the kind value. + */ + String kind(); + + /** + * Gets the dataMaskingState property: The state of the data masking policy. + * + * @return the dataMaskingState value. + */ + DataMaskingState dataMaskingState(); + + /** + * Gets the exemptPrincipals property: 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. + */ + String exemptPrincipals(); + + /** + * Gets the applicationPrincipals property: The list of the application principals. This is a legacy parameter and + * is no longer used. + * + * @return the applicationPrincipals value. + */ + String applicationPrincipals(); + + /** + * Gets the maskingLevel property: The masking level. This is a legacy parameter and is no longer used. + * + * @return the maskingLevel value. + */ + String maskingLevel(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.DataMaskingPolicyInner object. + * + * @return the inner object. + */ + DataMaskingPolicyInner innerModel(); + + /** The entirety of the DataMaskingPolicy definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The DataMaskingPolicy definition stages. */ + interface DefinitionStages { + /** The first stage of the DataMaskingPolicy definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the DataMaskingPolicy definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName, databaseName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @return the next definition stage. + */ + WithCreate withExistingDatabase(String resourceGroupName, String serverName, String databaseName); + } + /** + * The stage of the DataMaskingPolicy definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithDataMaskingState, DefinitionStages.WithExemptPrincipals { + /** + * Executes the create request. + * + * @return the created resource. + */ + DataMaskingPolicy create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + DataMaskingPolicy create(Context context); + } + /** The stage of the DataMaskingPolicy definition allowing to specify dataMaskingState. */ + interface WithDataMaskingState { + /** + * Specifies the dataMaskingState property: The state of the data masking policy.. + * + * @param dataMaskingState The state of the data masking policy. + * @return the next definition stage. + */ + WithCreate withDataMaskingState(DataMaskingState dataMaskingState); + } + /** The stage of the DataMaskingPolicy definition allowing to specify exemptPrincipals. */ + interface WithExemptPrincipals { + /** + * Specifies the exemptPrincipals property: 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 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 next definition stage. + */ + WithCreate withExemptPrincipals(String exemptPrincipals); + } + } + /** + * Begins update for the DataMaskingPolicy resource. + * + * @return the stage of resource update. + */ + DataMaskingPolicy.Update update(); + + /** The template for DataMaskingPolicy update. */ + interface Update extends UpdateStages.WithDataMaskingState, UpdateStages.WithExemptPrincipals { + /** + * Executes the update request. + * + * @return the updated resource. + */ + DataMaskingPolicy apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + DataMaskingPolicy apply(Context context); + } + /** The DataMaskingPolicy update stages. */ + interface UpdateStages { + /** The stage of the DataMaskingPolicy update allowing to specify dataMaskingState. */ + interface WithDataMaskingState { + /** + * Specifies the dataMaskingState property: The state of the data masking policy.. + * + * @param dataMaskingState The state of the data masking policy. + * @return the next definition stage. + */ + Update withDataMaskingState(DataMaskingState dataMaskingState); + } + /** The stage of the DataMaskingPolicy update allowing to specify exemptPrincipals. */ + interface WithExemptPrincipals { + /** + * Specifies the exemptPrincipals property: 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 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 next definition stage. + */ + Update withExemptPrincipals(String exemptPrincipals); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + DataMaskingPolicy refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + DataMaskingPolicy refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataMaskingRule.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataMaskingRule.java new file mode 100644 index 0000000000000..33af0d77b3f41 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataMaskingRule.java @@ -0,0 +1,512 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DataMaskingRuleInner; + +/** An immutable client-side representation of DataMaskingRule. */ +public interface DataMaskingRule { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The location of the data masking rule. + * + * @return the location value. + */ + String location(); + + /** + * Gets the kind property: The kind of Data Masking Rule. Metadata, used for Azure portal. + * + * @return the kind value. + */ + String kind(); + + /** + * Gets the idPropertiesId property: The rule Id. + * + * @return the idPropertiesId value. + */ + String idPropertiesId(); + + /** + * Gets the aliasName property: The alias name. This is a legacy parameter and is no longer used. + * + * @return the aliasName value. + */ + String aliasName(); + + /** + * Gets the ruleState property: 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. + * + * @return the ruleState value. + */ + DataMaskingRuleState ruleState(); + + /** + * Gets the schemaName property: The schema name on which the data masking rule is applied. + * + * @return the schemaName value. + */ + String schemaName(); + + /** + * Gets the tableName property: The table name on which the data masking rule is applied. + * + * @return the tableName value. + */ + String tableName(); + + /** + * Gets the columnName property: The column name on which the data masking rule is applied. + * + * @return the columnName value. + */ + String columnName(); + + /** + * Gets the maskingFunction property: The masking function that is used for the data masking rule. + * + * @return the maskingFunction value. + */ + DataMaskingFunction maskingFunction(); + + /** + * Gets the numberFrom property: The numberFrom property of the masking rule. Required if maskingFunction is set to + * Number, otherwise this parameter will be ignored. + * + * @return the numberFrom value. + */ + String numberFrom(); + + /** + * Gets the numberTo property: 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. + */ + String numberTo(); + + /** + * Gets the prefixSize property: 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. + */ + String prefixSize(); + + /** + * Gets the suffixSize property: 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. + */ + String suffixSize(); + + /** + * Gets the replacementString property: 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. + */ + String replacementString(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.DataMaskingRuleInner object. + * + * @return the inner object. + */ + DataMaskingRuleInner innerModel(); + + /** The entirety of the DataMaskingRule definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The DataMaskingRule definition stages. */ + interface DefinitionStages { + /** The first stage of the DataMaskingRule definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the DataMaskingRule definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName, databaseName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @return the next definition stage. + */ + WithCreate withExistingDatabase(String resourceGroupName, String serverName, String databaseName); + } + /** + * The stage of the DataMaskingRule definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithAliasName, + DefinitionStages.WithRuleState, + DefinitionStages.WithSchemaName, + DefinitionStages.WithTableName, + DefinitionStages.WithColumnName, + DefinitionStages.WithMaskingFunction, + DefinitionStages.WithNumberFrom, + DefinitionStages.WithNumberTo, + DefinitionStages.WithPrefixSize, + DefinitionStages.WithSuffixSize, + DefinitionStages.WithReplacementString { + /** + * Executes the create request. + * + * @return the created resource. + */ + DataMaskingRule create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + DataMaskingRule create(Context context); + } + /** The stage of the DataMaskingRule definition allowing to specify aliasName. */ + interface WithAliasName { + /** + * Specifies the aliasName property: The alias name. This is a legacy parameter and is no longer used.. + * + * @param aliasName The alias name. This is a legacy parameter and is no longer used. + * @return the next definition stage. + */ + WithCreate withAliasName(String aliasName); + } + /** The stage of the DataMaskingRule definition allowing to specify ruleState. */ + interface WithRuleState { + /** + * Specifies the ruleState property: 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.. + * + * @param ruleState 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. + * @return the next definition stage. + */ + WithCreate withRuleState(DataMaskingRuleState ruleState); + } + /** The stage of the DataMaskingRule definition allowing to specify schemaName. */ + interface WithSchemaName { + /** + * Specifies the schemaName property: The schema name on which the data masking rule is applied.. + * + * @param schemaName The schema name on which the data masking rule is applied. + * @return the next definition stage. + */ + WithCreate withSchemaName(String schemaName); + } + /** The stage of the DataMaskingRule definition allowing to specify tableName. */ + interface WithTableName { + /** + * Specifies the tableName property: The table name on which the data masking rule is applied.. + * + * @param tableName The table name on which the data masking rule is applied. + * @return the next definition stage. + */ + WithCreate withTableName(String tableName); + } + /** The stage of the DataMaskingRule definition allowing to specify columnName. */ + interface WithColumnName { + /** + * Specifies the columnName property: The column name on which the data masking rule is applied.. + * + * @param columnName The column name on which the data masking rule is applied. + * @return the next definition stage. + */ + WithCreate withColumnName(String columnName); + } + /** The stage of the DataMaskingRule definition allowing to specify maskingFunction. */ + interface WithMaskingFunction { + /** + * Specifies the maskingFunction property: The masking function that is used for the data masking rule.. + * + * @param maskingFunction The masking function that is used for the data masking rule. + * @return the next definition stage. + */ + WithCreate withMaskingFunction(DataMaskingFunction maskingFunction); + } + /** The stage of the DataMaskingRule definition allowing to specify numberFrom. */ + interface WithNumberFrom { + /** + * Specifies the numberFrom property: The numberFrom property of the masking rule. Required if + * maskingFunction is set to Number, otherwise this parameter will be ignored.. + * + * @param numberFrom The numberFrom property of the masking rule. Required if maskingFunction is set to + * Number, otherwise this parameter will be ignored. + * @return the next definition stage. + */ + WithCreate withNumberFrom(String numberFrom); + } + /** The stage of the DataMaskingRule definition allowing to specify numberTo. */ + interface WithNumberTo { + /** + * Specifies the numberTo property: 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 property of the data masking rule. Required if maskingFunction is set to + * Number, otherwise this parameter will be ignored. + * @return the next definition stage. + */ + WithCreate withNumberTo(String numberTo); + } + /** The stage of the DataMaskingRule definition allowing to specify prefixSize. */ + interface WithPrefixSize { + /** + * Specifies the prefixSize property: 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 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 next definition stage. + */ + WithCreate withPrefixSize(String prefixSize); + } + /** The stage of the DataMaskingRule definition allowing to specify suffixSize. */ + interface WithSuffixSize { + /** + * Specifies the suffixSize property: 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 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 next definition stage. + */ + WithCreate withSuffixSize(String suffixSize); + } + /** The stage of the DataMaskingRule definition allowing to specify replacementString. */ + interface WithReplacementString { + /** + * Specifies the replacementString property: 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 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 next definition stage. + */ + WithCreate withReplacementString(String replacementString); + } + } + /** + * Begins update for the DataMaskingRule resource. + * + * @return the stage of resource update. + */ + DataMaskingRule.Update update(); + + /** The template for DataMaskingRule update. */ + interface Update + extends UpdateStages.WithAliasName, + UpdateStages.WithRuleState, + UpdateStages.WithSchemaName, + UpdateStages.WithTableName, + UpdateStages.WithColumnName, + UpdateStages.WithMaskingFunction, + UpdateStages.WithNumberFrom, + UpdateStages.WithNumberTo, + UpdateStages.WithPrefixSize, + UpdateStages.WithSuffixSize, + UpdateStages.WithReplacementString { + /** + * Executes the update request. + * + * @return the updated resource. + */ + DataMaskingRule apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + DataMaskingRule apply(Context context); + } + /** The DataMaskingRule update stages. */ + interface UpdateStages { + /** The stage of the DataMaskingRule update allowing to specify aliasName. */ + interface WithAliasName { + /** + * Specifies the aliasName property: The alias name. This is a legacy parameter and is no longer used.. + * + * @param aliasName The alias name. This is a legacy parameter and is no longer used. + * @return the next definition stage. + */ + Update withAliasName(String aliasName); + } + /** The stage of the DataMaskingRule update allowing to specify ruleState. */ + interface WithRuleState { + /** + * Specifies the ruleState property: 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.. + * + * @param ruleState 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. + * @return the next definition stage. + */ + Update withRuleState(DataMaskingRuleState ruleState); + } + /** The stage of the DataMaskingRule update allowing to specify schemaName. */ + interface WithSchemaName { + /** + * Specifies the schemaName property: The schema name on which the data masking rule is applied.. + * + * @param schemaName The schema name on which the data masking rule is applied. + * @return the next definition stage. + */ + Update withSchemaName(String schemaName); + } + /** The stage of the DataMaskingRule update allowing to specify tableName. */ + interface WithTableName { + /** + * Specifies the tableName property: The table name on which the data masking rule is applied.. + * + * @param tableName The table name on which the data masking rule is applied. + * @return the next definition stage. + */ + Update withTableName(String tableName); + } + /** The stage of the DataMaskingRule update allowing to specify columnName. */ + interface WithColumnName { + /** + * Specifies the columnName property: The column name on which the data masking rule is applied.. + * + * @param columnName The column name on which the data masking rule is applied. + * @return the next definition stage. + */ + Update withColumnName(String columnName); + } + /** The stage of the DataMaskingRule update allowing to specify maskingFunction. */ + interface WithMaskingFunction { + /** + * Specifies the maskingFunction property: The masking function that is used for the data masking rule.. + * + * @param maskingFunction The masking function that is used for the data masking rule. + * @return the next definition stage. + */ + Update withMaskingFunction(DataMaskingFunction maskingFunction); + } + /** The stage of the DataMaskingRule update allowing to specify numberFrom. */ + interface WithNumberFrom { + /** + * Specifies the numberFrom property: The numberFrom property of the masking rule. Required if + * maskingFunction is set to Number, otherwise this parameter will be ignored.. + * + * @param numberFrom The numberFrom property of the masking rule. Required if maskingFunction is set to + * Number, otherwise this parameter will be ignored. + * @return the next definition stage. + */ + Update withNumberFrom(String numberFrom); + } + /** The stage of the DataMaskingRule update allowing to specify numberTo. */ + interface WithNumberTo { + /** + * Specifies the numberTo property: 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 property of the data masking rule. Required if maskingFunction is set to + * Number, otherwise this parameter will be ignored. + * @return the next definition stage. + */ + Update withNumberTo(String numberTo); + } + /** The stage of the DataMaskingRule update allowing to specify prefixSize. */ + interface WithPrefixSize { + /** + * Specifies the prefixSize property: 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 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 next definition stage. + */ + Update withPrefixSize(String prefixSize); + } + /** The stage of the DataMaskingRule update allowing to specify suffixSize. */ + interface WithSuffixSize { + /** + * Specifies the suffixSize property: 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 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 next definition stage. + */ + Update withSuffixSize(String suffixSize); + } + /** The stage of the DataMaskingRule update allowing to specify replacementString. */ + interface WithReplacementString { + /** + * Specifies the replacementString property: 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 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 next definition stage. + */ + Update withReplacementString(String replacementString); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataMaskingRuleListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataMaskingRuleListResult.java new file mode 100644 index 0000000000000..e64d9fa5a7a8f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataMaskingRuleListResult.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.fluent.models.DataMaskingRuleInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response to a list data masking rules request. */ +@Fluent +public final class DataMaskingRuleListResult { + /* + * The list of database data masking rules. + */ + @JsonProperty(value = "value") + private List value; + + /** Creates an instance of DataMaskingRuleListResult class. */ + public DataMaskingRuleListResult() { + } + + /** + * Get the value property: The list of database data masking rules. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of database data masking rules. + * + * @param value the value value to set. + * @return the DataMaskingRuleListResult object itself. + */ + public DataMaskingRuleListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataMaskingRuleState.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataMaskingRuleState.java new file mode 100644 index 0000000000000..ca655f4b50c3b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataMaskingRuleState.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * 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. + */ +public enum DataMaskingRuleState { + /** Enum value Disabled. */ + DISABLED("Disabled"), + + /** Enum value Enabled. */ + ENABLED("Enabled"); + + /** The actual serialized value for a DataMaskingRuleState instance. */ + private final 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) { + if (value == null) { + return null; + } + DataMaskingRuleState[] items = DataMaskingRuleState.values(); + for (DataMaskingRuleState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataMaskingRules.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataMaskingRules.java new file mode 100644 index 0000000000000..f5c926aca3dc9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataMaskingRules.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of DataMaskingRules. */ +public interface DataMaskingRules { + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database data masking rules as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase(String resourceGroupName, String serverName, String databaseName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database data masking rules as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Begins definition for a new DataMaskingRule resource. + * + * @param name resource name. + * @return the first stage of the new DataMaskingRule definition. + */ + DataMaskingRule.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataMaskingState.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataMaskingState.java new file mode 100644 index 0000000000000..f702828e3dee6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataMaskingState.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** The state of the data masking policy. */ +public enum DataMaskingState { + /** Enum value Disabled. */ + DISABLED("Disabled"), + + /** Enum value Enabled. */ + ENABLED("Enabled"); + + /** The actual serialized value for a DataMaskingState instance. */ + private final 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) { + if (value == null) { + return null; + } + DataMaskingState[] items = DataMaskingState.values(); + for (DataMaskingState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataWarehouseUserActivities.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataWarehouseUserActivities.java new file mode 100644 index 0000000000000..8dbe6b6473bbc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataWarehouseUserActivities.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.DataWarehouseUserActivitiesInner; + +/** An immutable client-side representation of DataWarehouseUserActivities. */ +public interface DataWarehouseUserActivities { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the activeQueriesCount property: Count of running and suspended queries. + * + * @return the activeQueriesCount value. + */ + Integer activeQueriesCount(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.DataWarehouseUserActivitiesInner object. + * + * @return the inner object. + */ + DataWarehouseUserActivitiesInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataWarehouseUserActivitiesListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataWarehouseUserActivitiesListResult.java new file mode 100644 index 0000000000000..01a6898fa60f1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataWarehouseUserActivitiesListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.DataWarehouseUserActivitiesInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** User activities of a data warehouse. */ +@Immutable +public final class DataWarehouseUserActivitiesListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of DataWarehouseUserActivitiesListResult class. */ + public DataWarehouseUserActivitiesListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataWarehouseUserActivitiesOperations.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataWarehouseUserActivitiesOperations.java new file mode 100644 index 0000000000000..e360010f346d8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataWarehouseUserActivitiesOperations.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of DataWarehouseUserActivitiesOperations. */ +public interface DataWarehouseUserActivitiesOperations { + /** + * 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 dataWarehouseUserActivityName The activity name of the data warehouse. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the user activities of a data warehouse which includes running and suspended queries along with {@link + * Response}. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + DataWarehouseUserActivityName dataWarehouseUserActivityName, + Context context); + + /** + * 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 dataWarehouseUserActivityName The activity name of the data warehouse. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the user activities of a data warehouse which includes running and suspended queries. + */ + DataWarehouseUserActivities get( + String resourceGroupName, + String serverName, + String databaseName, + DataWarehouseUserActivityName dataWarehouseUserActivityName); + + /** + * List 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return user activities of a data warehouse as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName); + + /** + * List 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return user activities of a data warehouse as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataWarehouseUserActivityName.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataWarehouseUserActivityName.java new file mode 100644 index 0000000000000..d8bd2e30f6f0a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DataWarehouseUserActivityName.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for DataWarehouseUserActivityName. */ +public final class DataWarehouseUserActivityName extends ExpandableStringEnum { + /** Static value current for DataWarehouseUserActivityName. */ + public static final DataWarehouseUserActivityName CURRENT = fromString("current"); + + /** + * Creates or finds a DataWarehouseUserActivityName from its string representation. + * + * @param name a name to look for. + * @return the corresponding DataWarehouseUserActivityName. + */ + @JsonCreator + public static DataWarehouseUserActivityName fromString(String name) { + return fromString(name, DataWarehouseUserActivityName.class); + } + + /** + * Gets known DataWarehouseUserActivityName values. + * + * @return known DataWarehouseUserActivityName values. + */ + public static Collection values() { + return values(DataWarehouseUserActivityName.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Database.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Database.java new file mode 100644 index 0000000000000..84b456e86d254 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Database.java @@ -0,0 +1,1362 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseInner; +import java.time.OffsetDateTime; +import java.util.Map; +import java.util.UUID; + +/** An immutable client-side representation of Database. */ +public interface Database { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the sku property: The database SKU. + * + *

The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU name, + * tier/edition, family, and capacity) that are available to your subscription in an Azure region, use the + * `Capabilities_ListByLocation` REST API or one of the following commands: + * + *

```azurecli az sql db list-editions -l <location> -o table ```` + * + *

```powershell Get-AzSqlServerServiceObjective -Location <location> ````. + * + * @return the sku value. + */ + Sku sku(); + + /** + * Gets the kind property: Kind of database. This is metadata used for the Azure portal experience. + * + * @return the kind value. + */ + String kind(); + + /** + * Gets the managedBy property: Resource that manages the database. + * + * @return the managedBy value. + */ + String managedBy(); + + /** + * Gets the identity property: The Azure Active Directory identity of the database. + * + * @return the identity value. + */ + DatabaseIdentity identity(); + + /** + * Gets the createMode property: 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. + * + * @return the createMode value. + */ + CreateMode createMode(); + + /** + * Gets the collation property: The collation of the database. + * + * @return the collation value. + */ + String collation(); + + /** + * Gets the maxSizeBytes property: The max size of the database expressed in bytes. + * + * @return the maxSizeBytes value. + */ + Long maxSizeBytes(); + + /** + * Gets the sampleName property: The name of the sample schema to apply when creating this database. + * + * @return the sampleName value. + */ + SampleName sampleName(); + + /** + * Gets the elasticPoolId property: The resource identifier of the elastic pool containing this database. + * + * @return the elasticPoolId value. + */ + String elasticPoolId(); + + /** + * Gets the sourceDatabaseId property: The resource identifier of the source database associated with create + * operation of this database. + * + * @return the sourceDatabaseId value. + */ + String sourceDatabaseId(); + + /** + * Gets the status property: The status of the database. + * + * @return the status value. + */ + DatabaseStatus status(); + + /** + * Gets the databaseId property: The ID of the database. + * + * @return the databaseId value. + */ + UUID databaseId(); + + /** + * Gets the creationDate property: The creation date of the database (ISO8601 format). + * + * @return the creationDate value. + */ + OffsetDateTime creationDate(); + + /** + * Gets the currentServiceObjectiveName property: The current service level objective name of the database. + * + * @return the currentServiceObjectiveName value. + */ + String currentServiceObjectiveName(); + + /** + * Gets the requestedServiceObjectiveName property: The requested service level objective name of the database. + * + * @return the requestedServiceObjectiveName value. + */ + String requestedServiceObjectiveName(); + + /** + * Gets the defaultSecondaryLocation property: The default secondary region for this database. + * + * @return the defaultSecondaryLocation value. + */ + String defaultSecondaryLocation(); + + /** + * Gets the failoverGroupId property: Failover Group resource identifier that this database belongs to. + * + * @return the failoverGroupId value. + */ + String failoverGroupId(); + + /** + * Gets the restorePointInTime property: Specifies the point in time (ISO8601 format) of the source database that + * will be restored to create the new database. + * + * @return the restorePointInTime value. + */ + OffsetDateTime restorePointInTime(); + + /** + * Gets the sourceDatabaseDeletionDate property: Specifies the time that the database was deleted. + * + * @return the sourceDatabaseDeletionDate value. + */ + OffsetDateTime sourceDatabaseDeletionDate(); + + /** + * Gets the recoveryServicesRecoveryPointId property: The resource identifier of the recovery point associated with + * create operation of this database. + * + * @return the recoveryServicesRecoveryPointId value. + */ + String recoveryServicesRecoveryPointId(); + + /** + * Gets the longTermRetentionBackupResourceId property: The resource identifier of the long term retention backup + * associated with create operation of this database. + * + * @return the longTermRetentionBackupResourceId value. + */ + String longTermRetentionBackupResourceId(); + + /** + * Gets the recoverableDatabaseId property: The resource identifier of the recoverable database associated with + * create operation of this database. + * + * @return the recoverableDatabaseId value. + */ + String recoverableDatabaseId(); + + /** + * Gets the restorableDroppedDatabaseId property: The resource identifier of the restorable dropped database + * associated with create operation of this database. + * + * @return the restorableDroppedDatabaseId value. + */ + String restorableDroppedDatabaseId(); + + /** + * Gets the catalogCollation property: Collation of the metadata catalog. + * + * @return the catalogCollation value. + */ + CatalogCollationType catalogCollation(); + + /** + * Gets the zoneRedundant property: 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. + */ + Boolean zoneRedundant(); + + /** + * Gets the licenseType property: The license type to apply for this database. `LicenseIncluded` if you need a + * license, or `BasePrice` if you have a license and are eligible for the Azure Hybrid Benefit. + * + * @return the licenseType value. + */ + DatabaseLicenseType licenseType(); + + /** + * Gets the maxLogSizeBytes property: The max log size for this database. + * + * @return the maxLogSizeBytes value. + */ + Long maxLogSizeBytes(); + + /** + * Gets the earliestRestoreDate property: This records the earliest start date and time that restore is available + * for this database (ISO8601 format). + * + * @return the earliestRestoreDate value. + */ + OffsetDateTime earliestRestoreDate(); + + /** + * Gets the readScale property: 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. Not + * applicable to a Hyperscale database within an elastic pool. + * + * @return the readScale value. + */ + DatabaseReadScale readScale(); + + /** + * Gets the highAvailabilityReplicaCount property: The number of secondary replicas associated with the database + * that are used to provide high availability. Not applicable to a Hyperscale database within an elastic pool. + * + * @return the highAvailabilityReplicaCount value. + */ + Integer highAvailabilityReplicaCount(); + + /** + * Gets the secondaryType property: The secondary type of the database if it is a secondary. Valid values are Geo, + * Named and Standby. + * + * @return the secondaryType value. + */ + SecondaryType secondaryType(); + + /** + * Gets the currentSku property: The name and tier of the SKU. + * + * @return the currentSku value. + */ + Sku currentSku(); + + /** + * Gets the autoPauseDelay property: Time in minutes after which database is automatically paused. A value of -1 + * means that automatic pause is disabled. + * + * @return the autoPauseDelay value. + */ + Integer autoPauseDelay(); + + /** + * Gets the currentBackupStorageRedundancy property: The storage account type used to store backups for this + * database. + * + * @return the currentBackupStorageRedundancy value. + */ + BackupStorageRedundancy currentBackupStorageRedundancy(); + + /** + * Gets the requestedBackupStorageRedundancy property: The storage account type to be used to store backups for this + * database. + * + * @return the requestedBackupStorageRedundancy value. + */ + BackupStorageRedundancy requestedBackupStorageRedundancy(); + + /** + * Gets the minCapacity property: Minimal capacity that database will always have allocated, if not paused. + * + * @return the minCapacity value. + */ + Double minCapacity(); + + /** + * Gets the pausedDate property: The date when database was paused by user configuration or action(ISO8601 format). + * Null if the database is ready. + * + * @return the pausedDate value. + */ + OffsetDateTime pausedDate(); + + /** + * Gets the resumedDate property: The date when database was resumed by user action or database login (ISO8601 + * format). Null if the database is paused. + * + * @return the resumedDate value. + */ + OffsetDateTime resumedDate(); + + /** + * Gets the maintenanceConfigurationId property: Maintenance configuration id assigned to the database. This + * configuration defines the period when the maintenance updates will occur. + * + * @return the maintenanceConfigurationId value. + */ + String maintenanceConfigurationId(); + + /** + * Gets the isLedgerOn property: Whether or not this database is a ledger database, which means all tables in the + * database are ledger tables. Note: the value of this property cannot be changed after the database has been + * created. + * + * @return the isLedgerOn value. + */ + Boolean isLedgerOn(); + + /** + * Gets the isInfraEncryptionEnabled property: Infra encryption is enabled for this database. + * + * @return the isInfraEncryptionEnabled value. + */ + Boolean isInfraEncryptionEnabled(); + + /** + * Gets the federatedClientId property: The Client id used for cross tenant per database CMK scenario. + * + * @return the federatedClientId value. + */ + UUID federatedClientId(); + + /** + * Gets the preferredEnclaveType property: Type of enclave requested on the database i.e. Default or VBS enclaves. + * + * @return the preferredEnclaveType value. + */ + AlwaysEncryptedEnclaveType preferredEnclaveType(); + + /** + * Gets the sourceResourceId property: The resource identifier of the source associated with the create operation of + * this database. + * + *

This property is only supported for DataWarehouse edition and allows to restore across subscriptions. + * + *

When sourceResourceId is specified, sourceDatabaseId, recoverableDatabaseId, restorableDroppedDatabaseId and + * sourceDatabaseDeletionDate must not be specified and CreateMode must be PointInTimeRestore, Restore or Recover. + * + *

When createMode is PointInTimeRestore, sourceResourceId must be the resource ID of the existing database or + * existing sql pool, and restorePointInTime must be specified. + * + *

When createMode is Restore, sourceResourceId must be the resource ID of restorable dropped database or + * restorable dropped sql pool. + * + *

When createMode is Recover, sourceResourceId must be the resource ID of recoverable database or recoverable + * sql pool. + * + *

When source subscription belongs to a different tenant than target subscription, + * “x-ms-authorization-auxiliary” header must contain authentication token for the source tenant. For more details + * about “x-ms-authorization-auxiliary” header see + * https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/authenticate-multi-tenant. + * + * @return the sourceResourceId value. + */ + String sourceResourceId(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.DatabaseInner object. + * + * @return the inner object. + */ + DatabaseInner innerModel(); + + /** The entirety of the Database definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, + DefinitionStages.WithCreate { + } + /** The Database definition stages. */ + interface DefinitionStages { + /** The first stage of the Database definition. */ + interface Blank extends WithLocation { + } + /** The stage of the Database definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + /** The stage of the Database definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @return the next definition stage. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + /** + * The stage of the Database definition which contains all the minimum required properties for the resource to + * be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithSku, + DefinitionStages.WithIdentity, + DefinitionStages.WithCreateMode, + DefinitionStages.WithCollation, + DefinitionStages.WithMaxSizeBytes, + DefinitionStages.WithSampleName, + DefinitionStages.WithElasticPoolId, + DefinitionStages.WithSourceDatabaseId, + DefinitionStages.WithRestorePointInTime, + DefinitionStages.WithSourceDatabaseDeletionDate, + DefinitionStages.WithRecoveryServicesRecoveryPointId, + DefinitionStages.WithLongTermRetentionBackupResourceId, + DefinitionStages.WithRecoverableDatabaseId, + DefinitionStages.WithRestorableDroppedDatabaseId, + DefinitionStages.WithCatalogCollation, + DefinitionStages.WithZoneRedundant, + DefinitionStages.WithLicenseType, + DefinitionStages.WithHighAvailabilityReplicaCount, + DefinitionStages.WithSecondaryType, + DefinitionStages.WithAutoPauseDelay, + DefinitionStages.WithRequestedBackupStorageRedundancy, + DefinitionStages.WithMinCapacity, + DefinitionStages.WithMaintenanceConfigurationId, + DefinitionStages.WithIsLedgerOn, + DefinitionStages.WithFederatedClientId, + DefinitionStages.WithPreferredEnclaveType, + DefinitionStages.WithSourceResourceId { + /** + * Executes the create request. + * + * @return the created resource. + */ + Database create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Database create(Context context); + } + /** The stage of the Database definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the Database definition allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: The database SKU. + * + *

The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU name, + * tier/edition, family, and capacity) that are available to your subscription in an Azure region, use the + * `Capabilities_ListByLocation` REST API or one of the following commands: + * + *

```azurecli az sql db list-editions -l <location> -o table ```` + * + *

```powershell Get-AzSqlServerServiceObjective -Location <location> ```` . + * + * @param sku The database SKU. + *

The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU + * name, tier/edition, family, and capacity) that are available to your subscription in an Azure region, + * use the `Capabilities_ListByLocation` REST API or one of the following commands: + *

```azurecli az sql db list-editions -l <location> -o table ```` + *

```powershell Get-AzSqlServerServiceObjective -Location <location> ````. + * @return the next definition stage. + */ + WithCreate withSku(Sku sku); + } + /** The stage of the Database definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: The Azure Active Directory identity of the database.. + * + * @param identity The Azure Active Directory identity of the database. + * @return the next definition stage. + */ + WithCreate withIdentity(DatabaseIdentity identity); + } + /** The stage of the Database definition allowing to specify createMode. */ + interface WithCreateMode { + /** + * Specifies the createMode property: 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.. + * + * @param createMode 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. + * @return the next definition stage. + */ + WithCreate withCreateMode(CreateMode createMode); + } + /** The stage of the Database definition allowing to specify collation. */ + interface WithCollation { + /** + * Specifies the collation property: The collation of the database.. + * + * @param collation The collation of the database. + * @return the next definition stage. + */ + WithCreate withCollation(String collation); + } + /** The stage of the Database definition allowing to specify maxSizeBytes. */ + interface WithMaxSizeBytes { + /** + * Specifies the maxSizeBytes property: The max size of the database expressed in bytes.. + * + * @param maxSizeBytes The max size of the database expressed in bytes. + * @return the next definition stage. + */ + WithCreate withMaxSizeBytes(Long maxSizeBytes); + } + /** The stage of the Database definition allowing to specify sampleName. */ + interface WithSampleName { + /** + * Specifies the sampleName property: The name of the sample schema to apply when creating this database.. + * + * @param sampleName The name of the sample schema to apply when creating this database. + * @return the next definition stage. + */ + WithCreate withSampleName(SampleName sampleName); + } + /** The stage of the Database definition allowing to specify elasticPoolId. */ + interface WithElasticPoolId { + /** + * Specifies the elasticPoolId property: The resource identifier of the elastic pool containing this + * database.. + * + * @param elasticPoolId The resource identifier of the elastic pool containing this database. + * @return the next definition stage. + */ + WithCreate withElasticPoolId(String elasticPoolId); + } + /** The stage of the Database definition allowing to specify sourceDatabaseId. */ + interface WithSourceDatabaseId { + /** + * Specifies the sourceDatabaseId property: The resource identifier of the source database associated with + * create operation of this database.. + * + * @param sourceDatabaseId The resource identifier of the source database associated with create operation + * of this database. + * @return the next definition stage. + */ + WithCreate withSourceDatabaseId(String sourceDatabaseId); + } + /** The stage of the Database definition allowing to specify restorePointInTime. */ + interface WithRestorePointInTime { + /** + * Specifies the restorePointInTime property: Specifies the point in time (ISO8601 format) of the source + * database that will be restored to create the new database.. + * + * @param restorePointInTime Specifies the point in time (ISO8601 format) of the source database that will + * be restored to create the new database. + * @return the next definition stage. + */ + WithCreate withRestorePointInTime(OffsetDateTime restorePointInTime); + } + /** The stage of the Database definition allowing to specify sourceDatabaseDeletionDate. */ + interface WithSourceDatabaseDeletionDate { + /** + * Specifies the sourceDatabaseDeletionDate property: Specifies the time that the database was deleted.. + * + * @param sourceDatabaseDeletionDate Specifies the time that the database was deleted. + * @return the next definition stage. + */ + WithCreate withSourceDatabaseDeletionDate(OffsetDateTime sourceDatabaseDeletionDate); + } + /** The stage of the Database definition allowing to specify recoveryServicesRecoveryPointId. */ + interface WithRecoveryServicesRecoveryPointId { + /** + * Specifies the recoveryServicesRecoveryPointId property: The resource identifier of the recovery point + * associated with create operation of this database.. + * + * @param recoveryServicesRecoveryPointId The resource identifier of the recovery point associated with + * create operation of this database. + * @return the next definition stage. + */ + WithCreate withRecoveryServicesRecoveryPointId(String recoveryServicesRecoveryPointId); + } + /** The stage of the Database definition allowing to specify longTermRetentionBackupResourceId. */ + interface WithLongTermRetentionBackupResourceId { + /** + * Specifies the longTermRetentionBackupResourceId property: The resource identifier of the long term + * retention backup associated with create operation of this database.. + * + * @param longTermRetentionBackupResourceId The resource identifier of the long term retention backup + * associated with create operation of this database. + * @return the next definition stage. + */ + WithCreate withLongTermRetentionBackupResourceId(String longTermRetentionBackupResourceId); + } + /** The stage of the Database definition allowing to specify recoverableDatabaseId. */ + interface WithRecoverableDatabaseId { + /** + * Specifies the recoverableDatabaseId property: The resource identifier of the recoverable database + * associated with create operation of this database.. + * + * @param recoverableDatabaseId The resource identifier of the recoverable database associated with create + * operation of this database. + * @return the next definition stage. + */ + WithCreate withRecoverableDatabaseId(String recoverableDatabaseId); + } + /** The stage of the Database definition allowing to specify restorableDroppedDatabaseId. */ + interface WithRestorableDroppedDatabaseId { + /** + * Specifies the restorableDroppedDatabaseId property: The resource identifier of the restorable dropped + * database associated with create operation of this database.. + * + * @param restorableDroppedDatabaseId The resource identifier of the restorable dropped database associated + * with create operation of this database. + * @return the next definition stage. + */ + WithCreate withRestorableDroppedDatabaseId(String restorableDroppedDatabaseId); + } + /** The stage of the Database definition allowing to specify catalogCollation. */ + interface WithCatalogCollation { + /** + * Specifies the catalogCollation property: Collation of the metadata catalog.. + * + * @param catalogCollation Collation of the metadata catalog. + * @return the next definition stage. + */ + WithCreate withCatalogCollation(CatalogCollationType catalogCollation); + } + /** The stage of the Database definition allowing to specify zoneRedundant. */ + interface WithZoneRedundant { + /** + * Specifies the zoneRedundant property: Whether or not this database is zone redundant, which means the + * replicas of this database will be spread across multiple availability zones.. + * + * @param zoneRedundant Whether or not this database is zone redundant, which means the replicas of this + * database will be spread across multiple availability zones. + * @return the next definition stage. + */ + WithCreate withZoneRedundant(Boolean zoneRedundant); + } + /** The stage of the Database definition allowing to specify licenseType. */ + interface WithLicenseType { + /** + * Specifies the licenseType property: The license type to apply for this database. `LicenseIncluded` if you + * need a license, or `BasePrice` if you have a license and are eligible for the Azure Hybrid Benefit.. + * + * @param licenseType The license type to apply for this database. `LicenseIncluded` if you need a license, + * or `BasePrice` if you have a license and are eligible for the Azure Hybrid Benefit. + * @return the next definition stage. + */ + WithCreate withLicenseType(DatabaseLicenseType licenseType); + } + /** The stage of the Database definition allowing to specify highAvailabilityReplicaCount. */ + interface WithHighAvailabilityReplicaCount { + /** + * Specifies the highAvailabilityReplicaCount property: The number of secondary replicas associated with the + * database that are used to provide high availability. Not applicable to a Hyperscale database within an + * elastic pool.. + * + * @param highAvailabilityReplicaCount The number of secondary replicas associated with the database that + * are used to provide high availability. Not applicable to a Hyperscale database within an elastic + * pool. + * @return the next definition stage. + */ + WithCreate withHighAvailabilityReplicaCount(Integer highAvailabilityReplicaCount); + } + /** The stage of the Database definition allowing to specify secondaryType. */ + interface WithSecondaryType { + /** + * Specifies the secondaryType property: The secondary type of the database if it is a secondary. Valid + * values are Geo, Named and Standby.. + * + * @param secondaryType The secondary type of the database if it is a secondary. Valid values are Geo, Named + * and Standby. + * @return the next definition stage. + */ + WithCreate withSecondaryType(SecondaryType secondaryType); + } + /** The stage of the Database definition allowing to specify autoPauseDelay. */ + interface WithAutoPauseDelay { + /** + * Specifies the autoPauseDelay property: Time in minutes after which database is automatically paused. A + * value of -1 means that automatic pause is disabled. + * + * @param autoPauseDelay Time in minutes after which database is automatically paused. A value of -1 means + * that automatic pause is disabled. + * @return the next definition stage. + */ + WithCreate withAutoPauseDelay(Integer autoPauseDelay); + } + /** The stage of the Database definition allowing to specify requestedBackupStorageRedundancy. */ + interface WithRequestedBackupStorageRedundancy { + /** + * Specifies the requestedBackupStorageRedundancy property: The storage account type to be used to store + * backups for this database.. + * + * @param requestedBackupStorageRedundancy The storage account type to be used to store backups for this + * database. + * @return the next definition stage. + */ + WithCreate withRequestedBackupStorageRedundancy(BackupStorageRedundancy requestedBackupStorageRedundancy); + } + /** The stage of the Database definition allowing to specify minCapacity. */ + interface WithMinCapacity { + /** + * Specifies the minCapacity property: Minimal capacity that database will always have allocated, if not + * paused. + * + * @param minCapacity Minimal capacity that database will always have allocated, if not paused. + * @return the next definition stage. + */ + WithCreate withMinCapacity(Double minCapacity); + } + /** The stage of the Database definition allowing to specify maintenanceConfigurationId. */ + interface WithMaintenanceConfigurationId { + /** + * Specifies the maintenanceConfigurationId property: Maintenance configuration id assigned to the database. + * This configuration defines the period when the maintenance updates will occur.. + * + * @param maintenanceConfigurationId Maintenance configuration id assigned to the database. This + * configuration defines the period when the maintenance updates will occur. + * @return the next definition stage. + */ + WithCreate withMaintenanceConfigurationId(String maintenanceConfigurationId); + } + /** The stage of the Database definition allowing to specify isLedgerOn. */ + interface WithIsLedgerOn { + /** + * Specifies the isLedgerOn property: Whether or not this database is a ledger database, which means all + * tables in the database are ledger tables. Note: the value of this property cannot be changed after the + * database has been created.. + * + * @param isLedgerOn Whether or not this database is a ledger database, which means all tables in the + * database are ledger tables. Note: the value of this property cannot be changed after the database has + * been created. + * @return the next definition stage. + */ + WithCreate withIsLedgerOn(Boolean isLedgerOn); + } + /** The stage of the Database definition allowing to specify federatedClientId. */ + interface WithFederatedClientId { + /** + * Specifies the federatedClientId property: The Client id used for cross tenant per database CMK scenario. + * + * @param federatedClientId The Client id used for cross tenant per database CMK scenario. + * @return the next definition stage. + */ + WithCreate withFederatedClientId(UUID federatedClientId); + } + /** The stage of the Database definition allowing to specify preferredEnclaveType. */ + interface WithPreferredEnclaveType { + /** + * Specifies the preferredEnclaveType property: Type of enclave requested on the database i.e. Default or + * VBS enclaves.. + * + * @param preferredEnclaveType Type of enclave requested on the database i.e. Default or VBS enclaves. + * @return the next definition stage. + */ + WithCreate withPreferredEnclaveType(AlwaysEncryptedEnclaveType preferredEnclaveType); + } + /** The stage of the Database definition allowing to specify sourceResourceId. */ + interface WithSourceResourceId { + /** + * Specifies the sourceResourceId property: The resource identifier of the source associated with the create + * operation of this database. + * + *

This property is only supported for DataWarehouse edition and allows to restore across subscriptions. + * + *

When sourceResourceId is specified, sourceDatabaseId, recoverableDatabaseId, + * restorableDroppedDatabaseId and sourceDatabaseDeletionDate must not be specified and CreateMode must be + * PointInTimeRestore, Restore or Recover. + * + *

When createMode is PointInTimeRestore, sourceResourceId must be the resource ID of the existing + * database or existing sql pool, and restorePointInTime must be specified. + * + *

When createMode is Restore, sourceResourceId must be the resource ID of restorable dropped database or + * restorable dropped sql pool. + * + *

When createMode is Recover, sourceResourceId must be the resource ID of recoverable database or + * recoverable sql pool. + * + *

When source subscription belongs to a different tenant than target subscription, + * “x-ms-authorization-auxiliary” header must contain authentication token for the source tenant. For more + * details about “x-ms-authorization-auxiliary” header see + * https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/authenticate-multi-tenant . + * + * @param sourceResourceId The resource identifier of the source associated with the create operation of + * this database. + *

This property is only supported for DataWarehouse edition and allows to restore across + * subscriptions. + *

When sourceResourceId is specified, sourceDatabaseId, recoverableDatabaseId, + * restorableDroppedDatabaseId and sourceDatabaseDeletionDate must not be specified and CreateMode must + * be PointInTimeRestore, Restore or Recover. + *

When createMode is PointInTimeRestore, sourceResourceId must be the resource ID of the existing + * database or existing sql pool, and restorePointInTime must be specified. + *

When createMode is Restore, sourceResourceId must be the resource ID of restorable dropped + * database or restorable dropped sql pool. + *

When createMode is Recover, sourceResourceId must be the resource ID of recoverable database or + * recoverable sql pool. + *

When source subscription belongs to a different tenant than target subscription, + * “x-ms-authorization-auxiliary” header must contain authentication token for the source tenant. For + * more details about “x-ms-authorization-auxiliary” header see + * https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/authenticate-multi-tenant. + * @return the next definition stage. + */ + WithCreate withSourceResourceId(String sourceResourceId); + } + } + /** + * Begins update for the Database resource. + * + * @return the stage of resource update. + */ + Database.Update update(); + + /** The template for Database update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithSku, + UpdateStages.WithIdentity, + UpdateStages.WithMaxSizeBytes, + UpdateStages.WithElasticPoolId, + UpdateStages.WithZoneRedundant, + UpdateStages.WithLicenseType, + UpdateStages.WithReadScale, + UpdateStages.WithHighAvailabilityReplicaCount, + UpdateStages.WithSecondaryType, + UpdateStages.WithAutoPauseDelay, + UpdateStages.WithRequestedBackupStorageRedundancy, + UpdateStages.WithMinCapacity, + UpdateStages.WithMaintenanceConfigurationId, + UpdateStages.WithIsLedgerOn, + UpdateStages.WithFederatedClientId, + UpdateStages.WithPreferredEnclaveType { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Database apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Database apply(Context context); + } + /** The Database update stages. */ + interface UpdateStages { + /** The stage of the Database update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the Database update allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: The name and tier of the SKU.. + * + * @param sku The name and tier of the SKU. + * @return the next definition stage. + */ + Update withSku(Sku sku); + } + /** The stage of the Database update allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Database identity. + * + * @param identity Database identity. + * @return the next definition stage. + */ + Update withIdentity(DatabaseIdentity identity); + } + /** The stage of the Database update allowing to specify maxSizeBytes. */ + interface WithMaxSizeBytes { + /** + * Specifies the maxSizeBytes property: The max size of the database expressed in bytes.. + * + * @param maxSizeBytes The max size of the database expressed in bytes. + * @return the next definition stage. + */ + Update withMaxSizeBytes(Long maxSizeBytes); + } + /** The stage of the Database update allowing to specify elasticPoolId. */ + interface WithElasticPoolId { + /** + * Specifies the elasticPoolId property: The resource identifier of the elastic pool containing this + * database.. + * + * @param elasticPoolId The resource identifier of the elastic pool containing this database. + * @return the next definition stage. + */ + Update withElasticPoolId(String elasticPoolId); + } + /** The stage of the Database update allowing to specify zoneRedundant. */ + interface WithZoneRedundant { + /** + * Specifies the zoneRedundant property: Whether or not this database is zone redundant, which means the + * replicas of this database will be spread across multiple availability zones.. + * + * @param zoneRedundant Whether or not this database is zone redundant, which means the replicas of this + * database will be spread across multiple availability zones. + * @return the next definition stage. + */ + Update withZoneRedundant(Boolean zoneRedundant); + } + /** The stage of the Database update allowing to specify licenseType. */ + interface WithLicenseType { + /** + * Specifies the licenseType property: The license type to apply for this database. `LicenseIncluded` if you + * need a license, or `BasePrice` if you have a license and are eligible for the Azure Hybrid Benefit.. + * + * @param licenseType The license type to apply for this database. `LicenseIncluded` if you need a license, + * or `BasePrice` if you have a license and are eligible for the Azure Hybrid Benefit. + * @return the next definition stage. + */ + Update withLicenseType(DatabaseLicenseType licenseType); + } + /** The stage of the Database update allowing to specify readScale. */ + interface WithReadScale { + /** + * Specifies the readScale property: 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. Not applicable to a Hyperscale database within an elastic pool.. + * + * @param readScale 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. Not applicable to a Hyperscale database within an elastic pool. + * @return the next definition stage. + */ + Update withReadScale(DatabaseReadScale readScale); + } + /** The stage of the Database update allowing to specify highAvailabilityReplicaCount. */ + interface WithHighAvailabilityReplicaCount { + /** + * Specifies the highAvailabilityReplicaCount property: The number of secondary replicas associated with the + * database that are used to provide high availability. Not applicable to a Hyperscale database within an + * elastic pool.. + * + * @param highAvailabilityReplicaCount The number of secondary replicas associated with the database that + * are used to provide high availability. Not applicable to a Hyperscale database within an elastic + * pool. + * @return the next definition stage. + */ + Update withHighAvailabilityReplicaCount(Integer highAvailabilityReplicaCount); + } + /** The stage of the Database update allowing to specify secondaryType. */ + interface WithSecondaryType { + /** + * Specifies the secondaryType property: The secondary type of the database if it is a secondary. Valid + * values are Geo, Named and Standby.. + * + * @param secondaryType The secondary type of the database if it is a secondary. Valid values are Geo, Named + * and Standby. + * @return the next definition stage. + */ + Update withSecondaryType(SecondaryType secondaryType); + } + /** The stage of the Database update allowing to specify autoPauseDelay. */ + interface WithAutoPauseDelay { + /** + * Specifies the autoPauseDelay property: Time in minutes after which database is automatically paused. A + * value of -1 means that automatic pause is disabled. + * + * @param autoPauseDelay Time in minutes after which database is automatically paused. A value of -1 means + * that automatic pause is disabled. + * @return the next definition stage. + */ + Update withAutoPauseDelay(Integer autoPauseDelay); + } + /** The stage of the Database update allowing to specify requestedBackupStorageRedundancy. */ + interface WithRequestedBackupStorageRedundancy { + /** + * Specifies the requestedBackupStorageRedundancy property: The storage account type to be used to store + * backups for this database.. + * + * @param requestedBackupStorageRedundancy The storage account type to be used to store backups for this + * database. + * @return the next definition stage. + */ + Update withRequestedBackupStorageRedundancy(BackupStorageRedundancy requestedBackupStorageRedundancy); + } + /** The stage of the Database update allowing to specify minCapacity. */ + interface WithMinCapacity { + /** + * Specifies the minCapacity property: Minimal capacity that database will always have allocated, if not + * paused. + * + * @param minCapacity Minimal capacity that database will always have allocated, if not paused. + * @return the next definition stage. + */ + Update withMinCapacity(Double minCapacity); + } + /** The stage of the Database update allowing to specify maintenanceConfigurationId. */ + interface WithMaintenanceConfigurationId { + /** + * Specifies the maintenanceConfigurationId property: Maintenance configuration id assigned to the database. + * This configuration defines the period when the maintenance updates will occur.. + * + * @param maintenanceConfigurationId Maintenance configuration id assigned to the database. This + * configuration defines the period when the maintenance updates will occur. + * @return the next definition stage. + */ + Update withMaintenanceConfigurationId(String maintenanceConfigurationId); + } + /** The stage of the Database update allowing to specify isLedgerOn. */ + interface WithIsLedgerOn { + /** + * Specifies the isLedgerOn property: Whether or not this database is a ledger database, which means all + * tables in the database are ledger tables. Note: the value of this property cannot be changed after the + * database has been created.. + * + * @param isLedgerOn Whether or not this database is a ledger database, which means all tables in the + * database are ledger tables. Note: the value of this property cannot be changed after the database has + * been created. + * @return the next definition stage. + */ + Update withIsLedgerOn(Boolean isLedgerOn); + } + /** The stage of the Database update allowing to specify federatedClientId. */ + interface WithFederatedClientId { + /** + * Specifies the federatedClientId property: The Client id used for cross tenant per database CMK scenario. + * + * @param federatedClientId The Client id used for cross tenant per database CMK scenario. + * @return the next definition stage. + */ + Update withFederatedClientId(UUID federatedClientId); + } + /** The stage of the Database update allowing to specify preferredEnclaveType. */ + interface WithPreferredEnclaveType { + /** + * Specifies the preferredEnclaveType property: Type of enclave requested on the database i.e. Default or + * VBS enclaves.. + * + * @param preferredEnclaveType Type of enclave requested on the database i.e. Default or VBS enclaves. + * @return the next definition stage. + */ + Update withPreferredEnclaveType(AlwaysEncryptedEnclaveType preferredEnclaveType); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Database refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Database refresh(Context context); + + /** + * Exports a database. + * + * @param parameters The database export request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + ImportExportOperationResult export(ExportDatabaseDefinition parameters); + + /** + * Exports a database. + * + * @param parameters The database export request parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + ImportExportOperationResult export(ExportDatabaseDefinition parameters, Context context); + + /** + * Failovers a database. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void failover(); + + /** + * Failovers a database. + * + * @param replicaType The type of replica to be failed over. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void failover(ReplicaType replicaType, Context context); + + /** + * Imports a bacpac into a new database. + * + * @param parameters The database import request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + ImportExportOperationResult importMethod(ImportExistingDatabaseDefinition parameters); + + /** + * Imports a bacpac into a new database. + * + * @param parameters The database import request parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + ImportExportOperationResult importMethod(ImportExistingDatabaseDefinition parameters, Context context); + + /** + * Renames a database. + * + * @param parameters The resource move definition for renaming this database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response renameWithResponse(ResourceMoveDefinition parameters, Context context); + + /** + * Renames a database. + * + * @param parameters The resource move definition for renaming this database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void rename(ResourceMoveDefinition parameters); + + /** + * Pauses a database. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database resource. + */ + Database pause(); + + /** + * Pauses a database. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database resource. + */ + Database pause(Context context); + + /** + * Resumes a database. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database resource. + */ + Database resume(); + + /** + * Resumes a database. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database resource. + */ + Database resume(Context context); + + /** + * Upgrades a data warehouse. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void upgradeDataWarehouse(); + + /** + * Upgrades a data warehouse. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void upgradeDataWarehouse(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseAdvancedThreatProtection.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseAdvancedThreatProtection.java new file mode 100644 index 0000000000000..59fc3bd278d24 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseAdvancedThreatProtection.java @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseAdvancedThreatProtectionInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of DatabaseAdvancedThreatProtection. */ +public interface DatabaseAdvancedThreatProtection { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: SystemData of AdvancedThreatProtectionResource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the state property: Specifies the state of the Advanced Threat Protection, whether it is enabled or disabled + * or a state has not been applied yet on the specific database or server. + * + * @return the state value. + */ + AdvancedThreatProtectionState state(); + + /** + * Gets the creationTime property: Specifies the UTC creation time of the policy. + * + * @return the creationTime value. + */ + OffsetDateTime creationTime(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.DatabaseAdvancedThreatProtectionInner + * object. + * + * @return the inner object. + */ + DatabaseAdvancedThreatProtectionInner innerModel(); + + /** The entirety of the DatabaseAdvancedThreatProtection definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The DatabaseAdvancedThreatProtection definition stages. */ + interface DefinitionStages { + /** The first stage of the DatabaseAdvancedThreatProtection definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the DatabaseAdvancedThreatProtection definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName, databaseName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @return the next definition stage. + */ + WithCreate withExistingDatabase(String resourceGroupName, String serverName, String databaseName); + } + /** + * The stage of the DatabaseAdvancedThreatProtection definition which contains all the minimum required + * properties for the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithState { + /** + * Executes the create request. + * + * @return the created resource. + */ + DatabaseAdvancedThreatProtection create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + DatabaseAdvancedThreatProtection create(Context context); + } + /** The stage of the DatabaseAdvancedThreatProtection definition allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the Advanced Threat Protection, whether it is + * enabled or disabled or a state has not been applied yet on the specific database or server.. + * + * @param state Specifies the state of the Advanced Threat Protection, whether it is enabled or disabled or + * a state has not been applied yet on the specific database or server. + * @return the next definition stage. + */ + WithCreate withState(AdvancedThreatProtectionState state); + } + } + /** + * Begins update for the DatabaseAdvancedThreatProtection resource. + * + * @return the stage of resource update. + */ + DatabaseAdvancedThreatProtection.Update update(); + + /** The template for DatabaseAdvancedThreatProtection update. */ + interface Update extends UpdateStages.WithState { + /** + * Executes the update request. + * + * @return the updated resource. + */ + DatabaseAdvancedThreatProtection apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + DatabaseAdvancedThreatProtection apply(Context context); + } + /** The DatabaseAdvancedThreatProtection update stages. */ + interface UpdateStages { + /** The stage of the DatabaseAdvancedThreatProtection update allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the Advanced Threat Protection, whether it is + * enabled or disabled or a state has not been applied yet on the specific database or server.. + * + * @param state Specifies the state of the Advanced Threat Protection, whether it is enabled or disabled or + * a state has not been applied yet on the specific database or server. + * @return the next definition stage. + */ + Update withState(AdvancedThreatProtectionState state); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + DatabaseAdvancedThreatProtection refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + DatabaseAdvancedThreatProtection refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseAdvancedThreatProtectionListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseAdvancedThreatProtectionListResult.java new file mode 100644 index 0000000000000..68f665585a830 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseAdvancedThreatProtectionListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseAdvancedThreatProtectionInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of the database's Advanced Threat Protection configurations. */ +@Immutable +public final class DatabaseAdvancedThreatProtectionListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of DatabaseAdvancedThreatProtectionListResult class. */ + public DatabaseAdvancedThreatProtectionListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseAdvancedThreatProtectionSettings.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseAdvancedThreatProtectionSettings.java new file mode 100644 index 0000000000000..f3e750388059f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseAdvancedThreatProtectionSettings.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of DatabaseAdvancedThreatProtectionSettings. */ +public interface DatabaseAdvancedThreatProtectionSettings { + /** + * Gets a list of database's Advanced Threat Protection states. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's Advanced Threat Protection states as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName); + + /** + * Gets a list of database's Advanced Threat Protection states. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's Advanced Threat Protection states as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Gets a database's Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's Advanced Threat Protection state along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + AdvancedThreatProtectionName advancedThreatProtectionName, + Context context); + + /** + * Gets a database's Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's Advanced Threat Protection state. + */ + DatabaseAdvancedThreatProtection get( + String resourceGroupName, + String serverName, + String databaseName, + AdvancedThreatProtectionName advancedThreatProtectionName); + + /** + * Gets a database's Advanced Threat Protection state. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's Advanced Threat Protection state along with {@link Response}. + */ + DatabaseAdvancedThreatProtection getById(String id); + + /** + * Gets a database's Advanced Threat Protection state. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's Advanced Threat Protection state along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new DatabaseAdvancedThreatProtection resource. + * + * @param name resource name. + * @return the first stage of the new DatabaseAdvancedThreatProtection definition. + */ + DatabaseAdvancedThreatProtection.DefinitionStages.Blank define(AdvancedThreatProtectionName name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseAdvisors.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseAdvisors.java new file mode 100644 index 0000000000000..823e0dfbc1eac --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseAdvisors.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.AdvisorInner; +import java.util.List; + +/** Resource collection API of DatabaseAdvisors. */ +public interface DatabaseAdvisors { + /** + * 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 expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database advisors along with {@link Response}. + */ + Response> listByDatabaseWithResponse( + String resourceGroupName, String serverName, String databaseName, String expand, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database advisors. + */ + List listByDatabase(String resourceGroupName, String serverName, String databaseName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database advisor along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, String advisorName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database advisor. + */ + Advisor get(String resourceGroupName, String serverName, String databaseName, String advisorName); + + /** + * 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 parameters The requested advisor resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database, Server or Elastic Pool Advisor along with {@link Response}. + */ + Response updateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String advisorName, + AdvisorInner parameters, + Context context); + + /** + * 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 parameters The requested advisor resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database, Server or Elastic Pool Advisor. + */ + Advisor update( + String resourceGroupName, String serverName, String databaseName, String advisorName, AdvisorInner parameters); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseAutomaticTuning.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseAutomaticTuning.java new file mode 100644 index 0000000000000..ad15607f14c61 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseAutomaticTuning.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseAutomaticTuningInner; +import java.util.Map; + +/** An immutable client-side representation of DatabaseAutomaticTuning. */ +public interface DatabaseAutomaticTuning { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the desiredState property: Automatic tuning desired state. + * + * @return the desiredState value. + */ + AutomaticTuningMode desiredState(); + + /** + * Gets the actualState property: Automatic tuning actual state. + * + * @return the actualState value. + */ + AutomaticTuningMode actualState(); + + /** + * Gets the options property: Automatic tuning options definition. + * + * @return the options value. + */ + Map options(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.DatabaseAutomaticTuningInner object. + * + * @return the inner object. + */ + DatabaseAutomaticTuningInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseAutomaticTunings.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseAutomaticTunings.java new file mode 100644 index 0000000000000..e08451e7ecd5d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseAutomaticTunings.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseAutomaticTuningInner; + +/** Resource collection API of DatabaseAutomaticTunings. */ +public interface DatabaseAutomaticTunings { + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's automatic tuning along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's automatic tuning. + */ + DatabaseAutomaticTuning get(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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database-level Automatic Tuning along with {@link Response}. + */ + Response updateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + DatabaseAutomaticTuningInner parameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database-level Automatic Tuning. + */ + DatabaseAutomaticTuning update( + String resourceGroupName, String serverName, String databaseName, DatabaseAutomaticTuningInner parameters); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseBlobAuditingPolicies.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseBlobAuditingPolicies.java new file mode 100644 index 0000000000000..007d54f05ca3a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseBlobAuditingPolicies.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of DatabaseBlobAuditingPolicies. */ +public interface DatabaseBlobAuditingPolicies { + /** + * Lists auditing settings 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database auditing settings as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName); + + /** + * Lists auditing settings 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database auditing settings as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's blob auditing policy along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's blob auditing policy. + */ + DatabaseBlobAuditingPolicy get(String resourceGroupName, String serverName, String databaseName); + + /** + * Gets a database's blob auditing policy. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's blob auditing policy along with {@link Response}. + */ + DatabaseBlobAuditingPolicy getById(String id); + + /** + * Gets a database's blob auditing policy. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's blob auditing policy along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new DatabaseBlobAuditingPolicy resource. + * + * @return the first stage of the new DatabaseBlobAuditingPolicy definition. + */ + DatabaseBlobAuditingPolicy.DefinitionStages.Blank define(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseBlobAuditingPolicy.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseBlobAuditingPolicy.java new file mode 100644 index 0000000000000..905a6fba68145 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseBlobAuditingPolicy.java @@ -0,0 +1,741 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseBlobAuditingPolicyInner; +import java.util.List; +import java.util.UUID; + +/** An immutable client-side representation of DatabaseBlobAuditingPolicy. */ +public interface DatabaseBlobAuditingPolicy { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the kind property: Resource kind. + * + * @return the kind value. + */ + String kind(); + + /** + * Gets the retentionDays property: Specifies the number of days to keep in the audit logs in the storage account. + * + * @return the retentionDays value. + */ + Integer retentionDays(); + + /** + * Gets the auditActionsAndGroups property: 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 + * DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP LEDGER_OPERATION_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. + */ + List auditActionsAndGroups(); + + /** + * Gets the isStorageSecondaryKeyInUse property: Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + * + * @return the isStorageSecondaryKeyInUse value. + */ + Boolean isStorageSecondaryKeyInUse(); + + /** + * Gets the isAzureMonitorTargetEnabled property: 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. + */ + Boolean isAzureMonitorTargetEnabled(); + + /** + * Gets the queueDelayMs property: Specifies the amount of time in milliseconds that can elapse before audit actions + * are forced to be processed. The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + * + * @return the queueDelayMs value. + */ + Integer queueDelayMs(); + + /** + * Gets the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob storage. + * + * @return the isManagedIdentityInUse value. + */ + Boolean isManagedIdentityInUse(); + + /** + * Gets the state property: Specifies the state of the audit. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * + * @return the state value. + */ + BlobAuditingPolicyState state(); + + /** + * Gets the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is + * required. + * + * @return the storageEndpoint value. + */ + String storageEndpoint(); + + /** + * Gets the storageAccountAccessKey property: Specifies the identifier key of the auditing storage account. If state + * is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server + * system-assigned managed identity to access the storage. Prerequisites for using managed identity authentication: + * 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). 2. Grant SQL Server + * identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server + * identity. For more information, see [Auditing to storage using Managed Identity + * authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @return the storageAccountAccessKey value. + */ + String storageAccountAccessKey(); + + /** + * Gets the storageAccountSubscriptionId property: Specifies the blob storage subscription Id. + * + * @return the storageAccountSubscriptionId value. + */ + UUID storageAccountSubscriptionId(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.DatabaseBlobAuditingPolicyInner object. + * + * @return the inner object. + */ + DatabaseBlobAuditingPolicyInner innerModel(); + + /** The entirety of the DatabaseBlobAuditingPolicy definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The DatabaseBlobAuditingPolicy definition stages. */ + interface DefinitionStages { + /** The first stage of the DatabaseBlobAuditingPolicy definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the DatabaseBlobAuditingPolicy definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName, databaseName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @return the next definition stage. + */ + WithCreate withExistingDatabase(String resourceGroupName, String serverName, String databaseName); + } + /** + * The stage of the DatabaseBlobAuditingPolicy definition which contains all the minimum required properties for + * the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithRetentionDays, + DefinitionStages.WithAuditActionsAndGroups, + DefinitionStages.WithIsStorageSecondaryKeyInUse, + DefinitionStages.WithIsAzureMonitorTargetEnabled, + DefinitionStages.WithQueueDelayMs, + DefinitionStages.WithIsManagedIdentityInUse, + DefinitionStages.WithState, + DefinitionStages.WithStorageEndpoint, + DefinitionStages.WithStorageAccountAccessKey, + DefinitionStages.WithStorageAccountSubscriptionId { + /** + * Executes the create request. + * + * @return the created resource. + */ + DatabaseBlobAuditingPolicy create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + DatabaseBlobAuditingPolicy create(Context context); + } + /** The stage of the DatabaseBlobAuditingPolicy definition allowing to specify retentionDays. */ + interface WithRetentionDays { + /** + * Specifies the retentionDays property: Specifies the number of days to keep in the audit logs in the + * storage account.. + * + * @param retentionDays Specifies the number of days to keep in the audit logs in the storage account. + * @return the next definition stage. + */ + WithCreate withRetentionDays(Integer retentionDays); + } + /** The stage of the DatabaseBlobAuditingPolicy definition allowing to specify auditActionsAndGroups. */ + interface WithAuditActionsAndGroups { + /** + * Specifies the auditActionsAndGroups property: 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 DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP + * LEDGER_OPERATION_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 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 DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP + * LEDGER_OPERATION_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 next definition stage. + */ + WithCreate withAuditActionsAndGroups(List auditActionsAndGroups); + } + /** The stage of the DatabaseBlobAuditingPolicy definition allowing to specify isStorageSecondaryKeyInUse. */ + interface WithIsStorageSecondaryKeyInUse { + /** + * Specifies the isStorageSecondaryKeyInUse property: Specifies whether storageAccountAccessKey value is the + * storage's secondary key.. + * + * @param isStorageSecondaryKeyInUse Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + * @return the next definition stage. + */ + WithCreate withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse); + } + /** The stage of the DatabaseBlobAuditingPolicy definition allowing to specify isAzureMonitorTargetEnabled. */ + interface WithIsAzureMonitorTargetEnabled { + /** + * Specifies the isAzureMonitorTargetEnabled property: 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 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 next definition stage. + */ + WithCreate withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled); + } + /** The stage of the DatabaseBlobAuditingPolicy definition allowing to specify queueDelayMs. */ + interface WithQueueDelayMs { + /** + * Specifies the queueDelayMs property: Specifies the amount of time in milliseconds that can elapse before + * audit actions are forced to be processed. The default minimum value is 1000 (1 second). The maximum is + * 2,147,483,647.. + * + * @param queueDelayMs Specifies the amount of time in milliseconds that can elapse before audit actions are + * forced to be processed. The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + * @return the next definition stage. + */ + WithCreate withQueueDelayMs(Integer queueDelayMs); + } + /** The stage of the DatabaseBlobAuditingPolicy definition allowing to specify isManagedIdentityInUse. */ + interface WithIsManagedIdentityInUse { + /** + * Specifies the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob + * storage. + * + * @param isManagedIdentityInUse Specifies whether Managed Identity is used to access blob storage. + * @return the next definition stage. + */ + WithCreate withIsManagedIdentityInUse(Boolean isManagedIdentityInUse); + } + /** The stage of the DatabaseBlobAuditingPolicy definition allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the audit. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required.. + * + * @param state Specifies the state of the audit. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * @return the next definition stage. + */ + WithCreate withState(BlobAuditingPolicyState state); + } + /** The stage of the DatabaseBlobAuditingPolicy definition allowing to specify storageEndpoint. */ + interface WithStorageEndpoint { + /** + * Specifies the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled is required.. + * + * @param storageEndpoint Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled is required. + * @return the next definition stage. + */ + WithCreate withStorageEndpoint(String storageEndpoint); + } + /** The stage of the DatabaseBlobAuditingPolicy definition allowing to specify storageAccountAccessKey. */ + interface WithStorageAccountAccessKey { + /** + * Specifies the storageAccountAccessKey property: Specifies the identifier key of the auditing storage + * account. If state is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey + * will use SQL server system-assigned managed identity to access the storage. Prerequisites for using + * managed identity authentication: 1. Assign SQL Server a system-assigned managed identity in Azure Active + * Directory (AAD). 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data + * Contributor' RBAC role to the server identity. For more information, see [Auditing to storage using + * Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @param storageAccountAccessKey Specifies the identifier key of the auditing storage account. If state is + * Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL + * server system-assigned managed identity to access the storage. Prerequisites for using managed + * identity authentication: 1. Assign SQL Server a system-assigned managed identity in Azure Active + * Directory (AAD). 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob + * Data Contributor' RBAC role to the server identity. For more information, see [Auditing to storage + * using Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * @return the next definition stage. + */ + WithCreate withStorageAccountAccessKey(String storageAccountAccessKey); + } + /** The stage of the DatabaseBlobAuditingPolicy definition allowing to specify storageAccountSubscriptionId. */ + interface WithStorageAccountSubscriptionId { + /** + * Specifies the storageAccountSubscriptionId property: Specifies the blob storage subscription Id.. + * + * @param storageAccountSubscriptionId Specifies the blob storage subscription Id. + * @return the next definition stage. + */ + WithCreate withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId); + } + } + /** + * Begins update for the DatabaseBlobAuditingPolicy resource. + * + * @return the stage of resource update. + */ + DatabaseBlobAuditingPolicy.Update update(); + + /** The template for DatabaseBlobAuditingPolicy update. */ + interface Update + extends UpdateStages.WithRetentionDays, + UpdateStages.WithAuditActionsAndGroups, + UpdateStages.WithIsStorageSecondaryKeyInUse, + UpdateStages.WithIsAzureMonitorTargetEnabled, + UpdateStages.WithQueueDelayMs, + UpdateStages.WithIsManagedIdentityInUse, + UpdateStages.WithState, + UpdateStages.WithStorageEndpoint, + UpdateStages.WithStorageAccountAccessKey, + UpdateStages.WithStorageAccountSubscriptionId { + /** + * Executes the update request. + * + * @return the updated resource. + */ + DatabaseBlobAuditingPolicy apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + DatabaseBlobAuditingPolicy apply(Context context); + } + /** The DatabaseBlobAuditingPolicy update stages. */ + interface UpdateStages { + /** The stage of the DatabaseBlobAuditingPolicy update allowing to specify retentionDays. */ + interface WithRetentionDays { + /** + * Specifies the retentionDays property: Specifies the number of days to keep in the audit logs in the + * storage account.. + * + * @param retentionDays Specifies the number of days to keep in the audit logs in the storage account. + * @return the next definition stage. + */ + Update withRetentionDays(Integer retentionDays); + } + /** The stage of the DatabaseBlobAuditingPolicy update allowing to specify auditActionsAndGroups. */ + interface WithAuditActionsAndGroups { + /** + * Specifies the auditActionsAndGroups property: 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 DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP + * LEDGER_OPERATION_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 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 DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP + * LEDGER_OPERATION_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 next definition stage. + */ + Update withAuditActionsAndGroups(List auditActionsAndGroups); + } + /** The stage of the DatabaseBlobAuditingPolicy update allowing to specify isStorageSecondaryKeyInUse. */ + interface WithIsStorageSecondaryKeyInUse { + /** + * Specifies the isStorageSecondaryKeyInUse property: Specifies whether storageAccountAccessKey value is the + * storage's secondary key.. + * + * @param isStorageSecondaryKeyInUse Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + * @return the next definition stage. + */ + Update withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse); + } + /** The stage of the DatabaseBlobAuditingPolicy update allowing to specify isAzureMonitorTargetEnabled. */ + interface WithIsAzureMonitorTargetEnabled { + /** + * Specifies the isAzureMonitorTargetEnabled property: 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 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 next definition stage. + */ + Update withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled); + } + /** The stage of the DatabaseBlobAuditingPolicy update allowing to specify queueDelayMs. */ + interface WithQueueDelayMs { + /** + * Specifies the queueDelayMs property: Specifies the amount of time in milliseconds that can elapse before + * audit actions are forced to be processed. The default minimum value is 1000 (1 second). The maximum is + * 2,147,483,647.. + * + * @param queueDelayMs Specifies the amount of time in milliseconds that can elapse before audit actions are + * forced to be processed. The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + * @return the next definition stage. + */ + Update withQueueDelayMs(Integer queueDelayMs); + } + /** The stage of the DatabaseBlobAuditingPolicy update allowing to specify isManagedIdentityInUse. */ + interface WithIsManagedIdentityInUse { + /** + * Specifies the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob + * storage. + * + * @param isManagedIdentityInUse Specifies whether Managed Identity is used to access blob storage. + * @return the next definition stage. + */ + Update withIsManagedIdentityInUse(Boolean isManagedIdentityInUse); + } + /** The stage of the DatabaseBlobAuditingPolicy update allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the audit. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required.. + * + * @param state Specifies the state of the audit. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * @return the next definition stage. + */ + Update withState(BlobAuditingPolicyState state); + } + /** The stage of the DatabaseBlobAuditingPolicy update allowing to specify storageEndpoint. */ + interface WithStorageEndpoint { + /** + * Specifies the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled is required.. + * + * @param storageEndpoint Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled is required. + * @return the next definition stage. + */ + Update withStorageEndpoint(String storageEndpoint); + } + /** The stage of the DatabaseBlobAuditingPolicy update allowing to specify storageAccountAccessKey. */ + interface WithStorageAccountAccessKey { + /** + * Specifies the storageAccountAccessKey property: Specifies the identifier key of the auditing storage + * account. If state is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey + * will use SQL server system-assigned managed identity to access the storage. Prerequisites for using + * managed identity authentication: 1. Assign SQL Server a system-assigned managed identity in Azure Active + * Directory (AAD). 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data + * Contributor' RBAC role to the server identity. For more information, see [Auditing to storage using + * Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @param storageAccountAccessKey Specifies the identifier key of the auditing storage account. If state is + * Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL + * server system-assigned managed identity to access the storage. Prerequisites for using managed + * identity authentication: 1. Assign SQL Server a system-assigned managed identity in Azure Active + * Directory (AAD). 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob + * Data Contributor' RBAC role to the server identity. For more information, see [Auditing to storage + * using Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * @return the next definition stage. + */ + Update withStorageAccountAccessKey(String storageAccountAccessKey); + } + /** The stage of the DatabaseBlobAuditingPolicy update allowing to specify storageAccountSubscriptionId. */ + interface WithStorageAccountSubscriptionId { + /** + * Specifies the storageAccountSubscriptionId property: Specifies the blob storage subscription Id.. + * + * @param storageAccountSubscriptionId Specifies the blob storage subscription Id. + * @return the next definition stage. + */ + Update withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + DatabaseBlobAuditingPolicy refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + DatabaseBlobAuditingPolicy refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseBlobAuditingPolicyListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseBlobAuditingPolicyListResult.java new file mode 100644 index 0000000000000..02a433884a48a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseBlobAuditingPolicyListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseBlobAuditingPolicyInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of database auditing settings. */ +@Immutable +public final class DatabaseBlobAuditingPolicyListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of DatabaseBlobAuditingPolicyListResult class. */ + public DatabaseBlobAuditingPolicyListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseColumn.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseColumn.java new file mode 100644 index 0000000000000..1bb7d8c2d2eeb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseColumn.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseColumnInner; + +/** An immutable client-side representation of DatabaseColumn. */ +public interface DatabaseColumn { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the columnType property: The column data type. + * + * @return the columnType value. + */ + ColumnDataType columnType(); + + /** + * Gets the temporalType property: The table temporal type. + * + * @return the temporalType value. + */ + TableTemporalType temporalType(); + + /** + * Gets the memoryOptimized property: Whether or not the column belongs to a memory optimized table. + * + * @return the memoryOptimized value. + */ + Boolean memoryOptimized(); + + /** + * Gets the isComputed property: Whether or not the column is computed. + * + * @return the isComputed value. + */ + Boolean isComputed(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.DatabaseColumnInner object. + * + * @return the inner object. + */ + DatabaseColumnInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseColumnListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseColumnListResult.java new file mode 100644 index 0000000000000..59e1336eb87ad --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseColumnListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseColumnInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of database columns. */ +@Immutable +public final class DatabaseColumnListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of DatabaseColumnListResult class. */ + public DatabaseColumnListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseColumns.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseColumns.java new file mode 100644 index 0000000000000..15034c9726a8c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseColumns.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import java.util.List; + +/** Resource collection API of DatabaseColumns. */ +public interface DatabaseColumns { + /** + * List database columns. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database columns as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase(String resourceGroupName, String serverName, String databaseName); + + /** + * List database columns. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param schema Array of Get3ItemsItem. + * @param table Array of Get4ItemsItem. + * @param column Array of Get5ItemsItem. + * @param orderBy Array of Get6ItemsItem. + * @param skiptoken An opaque token that identifies a starting point in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database columns as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, + String serverName, + String databaseName, + List schema, + List table, + List column, + List orderBy, + String skiptoken, + Context context); + + /** + * List database columns. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database columns as paginated response with {@link PagedIterable}. + */ + PagedIterable listByTable( + String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName); + + /** + * List database columns. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param 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 filter An OData filter expression that filters elements in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database columns as paginated response with {@link PagedIterable}. + */ + PagedIterable listByTable( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String filter, + Context context); + + /** + * Get database 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database column along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context); + + /** + * Get database 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database column. + */ + DatabaseColumn get( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseExtensions.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseExtensions.java new file mode 100644 index 0000000000000..ec2561d43d18f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseExtensions.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseExtensionsProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An export managed database operation result resource. */ +@Fluent +public final class DatabaseExtensions extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private DatabaseExtensionsProperties innerProperties; + + /** Creates an instance of DatabaseExtensions class. */ + public DatabaseExtensions() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private DatabaseExtensionsProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the operationMode property: Operation Mode. + * + * @return the operationMode value. + */ + public OperationMode operationMode() { + return this.innerProperties() == null ? null : this.innerProperties().operationMode(); + } + + /** + * Set the operationMode property: Operation Mode. + * + * @param operationMode the operationMode value to set. + * @return the DatabaseExtensions object itself. + */ + public DatabaseExtensions withOperationMode(OperationMode operationMode) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseExtensionsProperties(); + } + this.innerProperties().withOperationMode(operationMode); + return this; + } + + /** + * Get the storageKeyType property: Storage key type. + * + * @return the storageKeyType value. + */ + public StorageKeyType storageKeyType() { + return this.innerProperties() == null ? null : this.innerProperties().storageKeyType(); + } + + /** + * Set the storageKeyType property: Storage key type. + * + * @param storageKeyType the storageKeyType value to set. + * @return the DatabaseExtensions object itself. + */ + public DatabaseExtensions withStorageKeyType(StorageKeyType storageKeyType) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseExtensionsProperties(); + } + this.innerProperties().withStorageKeyType(storageKeyType); + return this; + } + + /** + * Get the storageKey property: Storage key. + * + * @return the storageKey value. + */ + public String storageKey() { + return this.innerProperties() == null ? null : this.innerProperties().storageKey(); + } + + /** + * Set the storageKey property: Storage key. + * + * @param storageKey the storageKey value to set. + * @return the DatabaseExtensions object itself. + */ + public DatabaseExtensions withStorageKey(String storageKey) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseExtensionsProperties(); + } + this.innerProperties().withStorageKey(storageKey); + return this; + } + + /** + * Get the storageUri property: Storage Uri. + * + * @return the storageUri value. + */ + public String storageUri() { + return this.innerProperties() == null ? null : this.innerProperties().storageUri(); + } + + /** + * Set the storageUri property: Storage Uri. + * + * @param storageUri the storageUri value to set. + * @return the DatabaseExtensions object itself. + */ + public DatabaseExtensions withStorageUri(String storageUri) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseExtensionsProperties(); + } + this.innerProperties().withStorageUri(storageUri); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseExtensionsOperations.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseExtensionsOperations.java new file mode 100644 index 0000000000000..b146d363d7493 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseExtensionsOperations.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of DatabaseExtensionsOperations. */ +public interface DatabaseExtensionsOperations { + /** + * Gets a database extension. This will return resource not found as it is not supported. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param extensionName The extensionName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database extension along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, String extensionName, Context context); + + /** + * Gets a database extension. This will return resource not found as it is not supported. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param extensionName The extensionName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void get(String resourceGroupName, String serverName, String databaseName, String extensionName); + + /** + * List database extension. This will return an empty list as it is not supported. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return import export operation extensions list as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName); + + /** + * List database extension. This will return an empty list as it is not supported. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return import export operation extensions list as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Begins definition for a new ImportExportExtensionsOperationResult resource. + * + * @param name resource name. + * @return the first stage of the new ImportExportExtensionsOperationResult definition. + */ + ImportExportExtensionsOperationResult.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseIdentity.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseIdentity.java new file mode 100644 index 0000000000000..d570deefb6eae --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseIdentity.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; +import java.util.UUID; + +/** Azure Active Directory identity configuration for a resource. */ +@Fluent +public class DatabaseIdentity { + /* + * The identity type + */ + @JsonProperty(value = "type") + private DatabaseIdentityType type; + + /* + * The Azure Active Directory tenant id. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private UUID tenantId; + + /* + * The resource ids of the user assigned identities to use + */ + @JsonProperty(value = "userAssignedIdentities") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map userAssignedIdentities; + + /** Creates an instance of DatabaseIdentity class. */ + public DatabaseIdentity() { + } + + /** + * Get the type property: The identity type. + * + * @return the type value. + */ + public DatabaseIdentityType type() { + return this.type; + } + + /** + * Set the type property: The identity type. + * + * @param type the type value to set. + * @return the DatabaseIdentity object itself. + */ + public DatabaseIdentity withType(DatabaseIdentityType type) { + this.type = type; + return this; + } + + /** + * Get the tenantId property: The Azure Active Directory tenant id. + * + * @return the tenantId value. + */ + public UUID tenantId() { + return this.tenantId; + } + + /** + * Get the userAssignedIdentities property: The resource ids of the user assigned identities to use. + * + * @return the userAssignedIdentities value. + */ + public Map userAssignedIdentities() { + return this.userAssignedIdentities; + } + + /** + * Set the userAssignedIdentities property: The resource ids of the user assigned identities to use. + * + * @param userAssignedIdentities the userAssignedIdentities value to set. + * @return the DatabaseIdentity object itself. + */ + public DatabaseIdentity withUserAssignedIdentities(Map userAssignedIdentities) { + this.userAssignedIdentities = userAssignedIdentities; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (userAssignedIdentities() != null) { + userAssignedIdentities() + .values() + .forEach( + e -> { + if (e != null) { + e.validate(); + } + }); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseIdentityType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseIdentityType.java new file mode 100644 index 0000000000000..29f21b2477b51 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseIdentityType.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The identity type. */ +public final class DatabaseIdentityType extends ExpandableStringEnum { + /** Static value None for DatabaseIdentityType. */ + public static final DatabaseIdentityType NONE = fromString("None"); + + /** Static value UserAssigned for DatabaseIdentityType. */ + public static final DatabaseIdentityType USER_ASSIGNED = fromString("UserAssigned"); + + /** + * Creates or finds a DatabaseIdentityType from its string representation. + * + * @param name a name to look for. + * @return the corresponding DatabaseIdentityType. + */ + @JsonCreator + public static DatabaseIdentityType fromString(String name) { + return fromString(name, DatabaseIdentityType.class); + } + + /** + * Gets known DatabaseIdentityType values. + * + * @return known DatabaseIdentityType values. + */ + public static Collection values() { + return values(DatabaseIdentityType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseLicenseType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseLicenseType.java new file mode 100644 index 0000000000000..206180fa0dbf7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseLicenseType.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * The license type to apply for this database. `LicenseIncluded` if you need a license, or `BasePrice` if you have a + * license and are eligible for the Azure Hybrid Benefit. + */ +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); + } + + /** + * Gets known DatabaseLicenseType values. + * + * @return known DatabaseLicenseType values. + */ + public static Collection values() { + return values(DatabaseLicenseType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseListResult.java new file mode 100644 index 0000000000000..54e6a3caeecb7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of databases. */ +@Immutable +public final class DatabaseListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of DatabaseListResult class. */ + public DatabaseListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseOperation.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseOperation.java new file mode 100644 index 0000000000000..446d8229da9cc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseOperation.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseOperationInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of DatabaseOperation. */ +public interface DatabaseOperation { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the databaseName property: The name of the database the operation is being performed on. + * + * @return the databaseName value. + */ + String databaseName(); + + /** + * Gets the operation property: The name of operation. + * + * @return the operation value. + */ + String operation(); + + /** + * Gets the operationFriendlyName property: The friendly name of operation. + * + * @return the operationFriendlyName value. + */ + String operationFriendlyName(); + + /** + * Gets the percentComplete property: The percentage of the operation completed. + * + * @return the percentComplete value. + */ + Integer percentComplete(); + + /** + * Gets the serverName property: The name of the server. + * + * @return the serverName value. + */ + String serverName(); + + /** + * Gets the startTime property: The operation start time. + * + * @return the startTime value. + */ + OffsetDateTime startTime(); + + /** + * Gets the state property: The operation state. + * + * @return the state value. + */ + ManagementOperationState state(); + + /** + * Gets the errorCode property: The operation error code. + * + * @return the errorCode value. + */ + Integer errorCode(); + + /** + * Gets the errorDescription property: The operation error description. + * + * @return the errorDescription value. + */ + String errorDescription(); + + /** + * Gets the errorSeverity property: The operation error severity. + * + * @return the errorSeverity value. + */ + Integer errorSeverity(); + + /** + * Gets the isUserError property: Whether or not the error is a user error. + * + * @return the isUserError value. + */ + Boolean isUserError(); + + /** + * Gets the estimatedCompletionTime property: The estimated completion time of the operation. + * + * @return the estimatedCompletionTime value. + */ + OffsetDateTime estimatedCompletionTime(); + + /** + * Gets the description property: The operation description. + * + * @return the description value. + */ + String description(); + + /** + * Gets the isCancellable property: Whether the operation can be cancelled. + * + * @return the isCancellable value. + */ + Boolean isCancellable(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.DatabaseOperationInner object. + * + * @return the inner object. + */ + DatabaseOperationInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseOperationListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseOperationListResult.java new file mode 100644 index 0000000000000..eacfd0228d1e3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseOperationListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseOperationInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response to a list database operations request. */ +@Immutable +public final class DatabaseOperationListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of DatabaseOperationListResult class. */ + public DatabaseOperationListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseOperations.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseOperations.java new file mode 100644 index 0000000000000..ee04e02a17df1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseOperations.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import java.util.UUID; + +/** Resource collection API of DatabaseOperations. */ +public interface DatabaseOperations { + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response cancelWithResponse( + String resourceGroupName, String serverName, String databaseName, UUID operationId, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void cancel(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. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of operations performed on the database as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase(String resourceGroupName, String serverName, String databaseName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of operations performed on the database as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseReadScale.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseReadScale.java new file mode 100644 index 0000000000000..55a84305696f5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseReadScale.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * 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. Not applicable to a Hyperscale + * database within an elastic pool. + */ +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); + } + + /** + * Gets known DatabaseReadScale values. + * + * @return known DatabaseReadScale values. + */ + public static Collection values() { + return values(DatabaseReadScale.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseRecommendedActions.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseRecommendedActions.java new file mode 100644 index 0000000000000..7ee08d4e2eaa2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseRecommendedActions.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.RecommendedActionInner; +import java.util.List; + +/** Resource collection API of DatabaseRecommendedActions. */ +public interface DatabaseRecommendedActions { + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Database Recommended Actions along with {@link Response}. + */ + Response> listByDatabaseAdvisorWithResponse( + String resourceGroupName, String serverName, String databaseName, String advisorName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Database Recommended Actions. + */ + List listByDatabaseAdvisor( + String resourceGroupName, String serverName, String databaseName, String advisorName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database recommended action along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String advisorName, + String recommendedActionName, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database recommended action. + */ + RecommendedAction get( + String resourceGroupName, + String serverName, + String databaseName, + String advisorName, + String recommendedActionName); + + /** + * 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 parameters The requested recommended action resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database, Server or Elastic Pool Recommended Action along with {@link Response}. + */ + Response updateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String advisorName, + String recommendedActionName, + RecommendedActionInner parameters, + Context context); + + /** + * 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 parameters The requested recommended action resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database, Server or Elastic Pool Recommended Action. + */ + RecommendedAction update( + String resourceGroupName, + String serverName, + String databaseName, + String advisorName, + String recommendedActionName, + RecommendedActionInner parameters); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSchema.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSchema.java new file mode 100644 index 0000000000000..eae76d211b13d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSchema.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseSchemaInner; + +/** An immutable client-side representation of DatabaseSchema. */ +public interface DatabaseSchema { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.DatabaseSchemaInner object. + * + * @return the inner object. + */ + DatabaseSchemaInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSchemaListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSchemaListResult.java new file mode 100644 index 0000000000000..1d9c40cdb6def --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSchemaListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseSchemaInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of database schemas. */ +@Immutable +public final class DatabaseSchemaListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of DatabaseSchemaListResult class. */ + public DatabaseSchemaListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSchemas.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSchemas.java new file mode 100644 index 0000000000000..7121fec8b6f2d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSchemas.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of DatabaseSchemas. */ +public interface DatabaseSchemas { + /** + * List 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database schemas as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase(String resourceGroupName, String serverName, String databaseName); + + /** + * List 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. + * @param filter An OData filter expression that filters elements in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database schemas as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, String filter, Context context); + + /** + * Get 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. + * @param schemaName The name of the schema. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database schema along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, String schemaName, Context context); + + /** + * Get 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. + * @param schemaName The name of the schema. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database schema. + */ + DatabaseSchema get(String resourceGroupName, String serverName, String databaseName, String schemaName); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSecurityAlertListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSecurityAlertListResult.java new file mode 100644 index 0000000000000..a15b827dad8d1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSecurityAlertListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseSecurityAlertPolicyInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of the database's security alert policies. */ +@Immutable +public final class DatabaseSecurityAlertListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of DatabaseSecurityAlertListResult class. */ + public DatabaseSecurityAlertListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSecurityAlertPolicies.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSecurityAlertPolicies.java new file mode 100644 index 0000000000000..81ac5f52e2297 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSecurityAlertPolicies.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of DatabaseSecurityAlertPolicies. */ +public interface DatabaseSecurityAlertPolicies { + /** + * Gets a database's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the security alert policy is defined. + * @param securityAlertPolicyName The name of the security alert policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's security alert policy along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName, + Context context); + + /** + * Gets a database's security alert policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the security alert policy is defined. + * @param securityAlertPolicyName The name of the security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's security alert policy. + */ + DatabaseSecurityAlertPolicy get( + String resourceGroupName, + String serverName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName); + + /** + * Gets a list of database's security alert policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the security alert policy is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's security alert policies as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName); + + /** + * Gets a list of database's security alert policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the security alert policy is defined. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's security alert policies as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Gets a database's security alert policy. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's security alert policy along with {@link Response}. + */ + DatabaseSecurityAlertPolicy getById(String id); + + /** + * Gets a database's security alert policy. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's security alert policy along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new DatabaseSecurityAlertPolicy resource. + * + * @param name resource name. + * @return the first stage of the new DatabaseSecurityAlertPolicy definition. + */ + DatabaseSecurityAlertPolicy.DefinitionStages.Blank define(SecurityAlertPolicyName name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSecurityAlertPolicy.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSecurityAlertPolicy.java new file mode 100644 index 0000000000000..01805ac9ecbe9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSecurityAlertPolicy.java @@ -0,0 +1,381 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseSecurityAlertPolicyInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of DatabaseSecurityAlertPolicy. */ +public interface DatabaseSecurityAlertPolicy { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: SystemData of SecurityAlertPolicyResource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the state property: Specifies the state of the policy, whether it is enabled or disabled or a policy has not + * been applied yet on the specific database. + * + * @return the state value. + */ + SecurityAlertsPolicyState state(); + + /** + * Gets the disabledAlerts property: Specifies an array of alerts that are disabled. Allowed values are: + * Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action, Brute_Force. + * + * @return the disabledAlerts value. + */ + List disabledAlerts(); + + /** + * Gets the emailAddresses property: Specifies an array of e-mail addresses to which the alert is sent. + * + * @return the emailAddresses value. + */ + List emailAddresses(); + + /** + * Gets the emailAccountAdmins property: Specifies that the alert is sent to the account administrators. + * + * @return the emailAccountAdmins value. + */ + Boolean emailAccountAdmins(); + + /** + * Gets the storageEndpoint property: 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. + */ + String storageEndpoint(); + + /** + * Gets the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection audit storage + * account. + * + * @return the storageAccountAccessKey value. + */ + String storageAccountAccessKey(); + + /** + * Gets the retentionDays property: Specifies the number of days to keep in the Threat Detection audit logs. + * + * @return the retentionDays value. + */ + Integer retentionDays(); + + /** + * Gets the creationTime property: Specifies the UTC creation time of the policy. + * + * @return the creationTime value. + */ + OffsetDateTime creationTime(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.DatabaseSecurityAlertPolicyInner object. + * + * @return the inner object. + */ + DatabaseSecurityAlertPolicyInner innerModel(); + + /** The entirety of the DatabaseSecurityAlertPolicy definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The DatabaseSecurityAlertPolicy definition stages. */ + interface DefinitionStages { + /** The first stage of the DatabaseSecurityAlertPolicy definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the DatabaseSecurityAlertPolicy definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName, databaseName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the security alert policy is defined. + * @return the next definition stage. + */ + WithCreate withExistingDatabase(String resourceGroupName, String serverName, String databaseName); + } + /** + * The stage of the DatabaseSecurityAlertPolicy definition which contains all the minimum required properties + * for the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithState, + DefinitionStages.WithDisabledAlerts, + DefinitionStages.WithEmailAddresses, + DefinitionStages.WithEmailAccountAdmins, + DefinitionStages.WithStorageEndpoint, + DefinitionStages.WithStorageAccountAccessKey, + DefinitionStages.WithRetentionDays { + /** + * Executes the create request. + * + * @return the created resource. + */ + DatabaseSecurityAlertPolicy create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + DatabaseSecurityAlertPolicy create(Context context); + } + /** The stage of the DatabaseSecurityAlertPolicy definition allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the policy, whether it is enabled or disabled or a + * policy has not been applied yet on the specific database.. + * + * @param state Specifies the state of the policy, whether it is enabled or disabled or a policy has not + * been applied yet on the specific database. + * @return the next definition stage. + */ + WithCreate withState(SecurityAlertsPolicyState state); + } + /** The stage of the DatabaseSecurityAlertPolicy definition allowing to specify disabledAlerts. */ + interface WithDisabledAlerts { + /** + * Specifies the disabledAlerts property: Specifies an array of alerts that are disabled. Allowed values + * are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action, + * Brute_Force. + * + * @param disabledAlerts Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, + * Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action, Brute_Force. + * @return the next definition stage. + */ + WithCreate withDisabledAlerts(List disabledAlerts); + } + /** The stage of the DatabaseSecurityAlertPolicy definition allowing to specify emailAddresses. */ + interface WithEmailAddresses { + /** + * Specifies the emailAddresses property: Specifies an array of e-mail addresses to which the alert is + * sent.. + * + * @param emailAddresses Specifies an array of e-mail addresses to which the alert is sent. + * @return the next definition stage. + */ + WithCreate withEmailAddresses(List emailAddresses); + } + /** The stage of the DatabaseSecurityAlertPolicy definition allowing to specify emailAccountAdmins. */ + interface WithEmailAccountAdmins { + /** + * Specifies the emailAccountAdmins property: Specifies that the alert is sent to the account + * administrators.. + * + * @param emailAccountAdmins Specifies that the alert is sent to the account administrators. + * @return the next definition stage. + */ + WithCreate withEmailAccountAdmins(Boolean emailAccountAdmins); + } + /** The stage of the DatabaseSecurityAlertPolicy definition allowing to specify storageEndpoint. */ + interface WithStorageEndpoint { + /** + * Specifies the storageEndpoint property: 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 Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit + * logs. + * @return the next definition stage. + */ + WithCreate withStorageEndpoint(String storageEndpoint); + } + /** The stage of the DatabaseSecurityAlertPolicy definition allowing to specify storageAccountAccessKey. */ + interface WithStorageAccountAccessKey { + /** + * Specifies the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection + * audit storage account.. + * + * @param storageAccountAccessKey Specifies the identifier key of the Threat Detection audit storage + * account. + * @return the next definition stage. + */ + WithCreate withStorageAccountAccessKey(String storageAccountAccessKey); + } + /** The stage of the DatabaseSecurityAlertPolicy definition allowing to specify retentionDays. */ + interface WithRetentionDays { + /** + * Specifies the retentionDays property: Specifies the number of days to keep in the Threat Detection audit + * logs.. + * + * @param retentionDays Specifies the number of days to keep in the Threat Detection audit logs. + * @return the next definition stage. + */ + WithCreate withRetentionDays(Integer retentionDays); + } + } + /** + * Begins update for the DatabaseSecurityAlertPolicy resource. + * + * @return the stage of resource update. + */ + DatabaseSecurityAlertPolicy.Update update(); + + /** The template for DatabaseSecurityAlertPolicy update. */ + interface Update + extends UpdateStages.WithState, + UpdateStages.WithDisabledAlerts, + UpdateStages.WithEmailAddresses, + UpdateStages.WithEmailAccountAdmins, + UpdateStages.WithStorageEndpoint, + UpdateStages.WithStorageAccountAccessKey, + UpdateStages.WithRetentionDays { + /** + * Executes the update request. + * + * @return the updated resource. + */ + DatabaseSecurityAlertPolicy apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + DatabaseSecurityAlertPolicy apply(Context context); + } + /** The DatabaseSecurityAlertPolicy update stages. */ + interface UpdateStages { + /** The stage of the DatabaseSecurityAlertPolicy update allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the policy, whether it is enabled or disabled or a + * policy has not been applied yet on the specific database.. + * + * @param state Specifies the state of the policy, whether it is enabled or disabled or a policy has not + * been applied yet on the specific database. + * @return the next definition stage. + */ + Update withState(SecurityAlertsPolicyState state); + } + /** The stage of the DatabaseSecurityAlertPolicy update allowing to specify disabledAlerts. */ + interface WithDisabledAlerts { + /** + * Specifies the disabledAlerts property: Specifies an array of alerts that are disabled. Allowed values + * are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action, + * Brute_Force. + * + * @param disabledAlerts Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, + * Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action, Brute_Force. + * @return the next definition stage. + */ + Update withDisabledAlerts(List disabledAlerts); + } + /** The stage of the DatabaseSecurityAlertPolicy update allowing to specify emailAddresses. */ + interface WithEmailAddresses { + /** + * Specifies the emailAddresses property: Specifies an array of e-mail addresses to which the alert is + * sent.. + * + * @param emailAddresses Specifies an array of e-mail addresses to which the alert is sent. + * @return the next definition stage. + */ + Update withEmailAddresses(List emailAddresses); + } + /** The stage of the DatabaseSecurityAlertPolicy update allowing to specify emailAccountAdmins. */ + interface WithEmailAccountAdmins { + /** + * Specifies the emailAccountAdmins property: Specifies that the alert is sent to the account + * administrators.. + * + * @param emailAccountAdmins Specifies that the alert is sent to the account administrators. + * @return the next definition stage. + */ + Update withEmailAccountAdmins(Boolean emailAccountAdmins); + } + /** The stage of the DatabaseSecurityAlertPolicy update allowing to specify storageEndpoint. */ + interface WithStorageEndpoint { + /** + * Specifies the storageEndpoint property: 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 Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit + * logs. + * @return the next definition stage. + */ + Update withStorageEndpoint(String storageEndpoint); + } + /** The stage of the DatabaseSecurityAlertPolicy update allowing to specify storageAccountAccessKey. */ + interface WithStorageAccountAccessKey { + /** + * Specifies the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection + * audit storage account.. + * + * @param storageAccountAccessKey Specifies the identifier key of the Threat Detection audit storage + * account. + * @return the next definition stage. + */ + Update withStorageAccountAccessKey(String storageAccountAccessKey); + } + /** The stage of the DatabaseSecurityAlertPolicy update allowing to specify retentionDays. */ + interface WithRetentionDays { + /** + * Specifies the retentionDays property: Specifies the number of days to keep in the Threat Detection audit + * logs.. + * + * @param retentionDays Specifies the number of days to keep in the Threat Detection audit logs. + * @return the next definition stage. + */ + Update withRetentionDays(Integer retentionDays); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + DatabaseSecurityAlertPolicy refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + DatabaseSecurityAlertPolicy refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSqlVulnerabilityAssessmentBaselineSet.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSqlVulnerabilityAssessmentBaselineSet.java new file mode 100644 index 0000000000000..6a700d3259ec7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSqlVulnerabilityAssessmentBaselineSet.java @@ -0,0 +1,198 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseSqlVulnerabilityAssessmentBaselineSetInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of DatabaseSqlVulnerabilityAssessmentBaselineSet. */ +public interface DatabaseSqlVulnerabilityAssessmentBaselineSet { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: SystemData of DatabaseSqlVulnerabilityAssessmentBaselineSetResource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the results property: The baseline set result. + * + * @return the results value. + */ + Map>> results(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner + * com.azure.resourcemanager.sql.generated.fluent.models.DatabaseSqlVulnerabilityAssessmentBaselineSetInner object. + * + * @return the inner object. + */ + DatabaseSqlVulnerabilityAssessmentBaselineSetInner innerModel(); + + /** The entirety of the DatabaseSqlVulnerabilityAssessmentBaselineSet definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The DatabaseSqlVulnerabilityAssessmentBaselineSet definition stages. */ + interface DefinitionStages { + /** The first stage of the DatabaseSqlVulnerabilityAssessmentBaselineSet definition. */ + interface Blank extends WithParentResource { + } + /** + * The stage of the DatabaseSqlVulnerabilityAssessmentBaselineSet definition allowing to specify parent + * resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @return the next definition stage. + */ + WithCreate withExistingSqlVulnerabilityAssessment( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName); + } + /** + * The stage of the DatabaseSqlVulnerabilityAssessmentBaselineSet definition which contains all the minimum + * required properties for the resource to be created, but also allows for any other optional properties to be + * specified. + */ + interface WithCreate extends DefinitionStages.WithLatestScan, DefinitionStages.WithResults { + /** + * Executes the create request. + * + * @return the created resource. + */ + DatabaseSqlVulnerabilityAssessmentBaselineSet create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + DatabaseSqlVulnerabilityAssessmentBaselineSet create(Context context); + } + /** The stage of the DatabaseSqlVulnerabilityAssessmentBaselineSet definition allowing to specify latestScan. */ + interface WithLatestScan { + /** + * Specifies the latestScan property: The latest scan flag. + * + * @param latestScan The latest scan flag. + * @return the next definition stage. + */ + WithCreate withLatestScan(boolean latestScan); + } + /** The stage of the DatabaseSqlVulnerabilityAssessmentBaselineSet definition allowing to specify results. */ + interface WithResults { + /** + * Specifies the results property: The rule baseline result list. + * + * @param results The rule baseline result list. + * @return the next definition stage. + */ + WithCreate withResults(Map>> results); + } + } + /** + * Begins update for the DatabaseSqlVulnerabilityAssessmentBaselineSet resource. + * + * @return the stage of resource update. + */ + DatabaseSqlVulnerabilityAssessmentBaselineSet.Update update(); + + /** The template for DatabaseSqlVulnerabilityAssessmentBaselineSet update. */ + interface Update extends UpdateStages.WithLatestScan, UpdateStages.WithResults { + /** + * Executes the update request. + * + * @return the updated resource. + */ + DatabaseSqlVulnerabilityAssessmentBaselineSet apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + DatabaseSqlVulnerabilityAssessmentBaselineSet apply(Context context); + } + /** The DatabaseSqlVulnerabilityAssessmentBaselineSet update stages. */ + interface UpdateStages { + /** The stage of the DatabaseSqlVulnerabilityAssessmentBaselineSet update allowing to specify latestScan. */ + interface WithLatestScan { + /** + * Specifies the latestScan property: The latest scan flag. + * + * @param latestScan The latest scan flag. + * @return the next definition stage. + */ + Update withLatestScan(boolean latestScan); + } + /** The stage of the DatabaseSqlVulnerabilityAssessmentBaselineSet update allowing to specify results. */ + interface WithResults { + /** + * Specifies the results property: The rule baseline result list. + * + * @param results The rule baseline result list. + * @return the next definition stage. + */ + Update withResults(Map>> results); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + DatabaseSqlVulnerabilityAssessmentBaselineSet refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + DatabaseSqlVulnerabilityAssessmentBaselineSet refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSqlVulnerabilityAssessmentBaselineSetListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSqlVulnerabilityAssessmentBaselineSetListResult.java new file mode 100644 index 0000000000000..0e16c28924e16 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSqlVulnerabilityAssessmentBaselineSetListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseSqlVulnerabilityAssessmentBaselineSetInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of SQL Vulnerability Assessments baseline set. */ +@Immutable +public final class DatabaseSqlVulnerabilityAssessmentBaselineSetListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of DatabaseSqlVulnerabilityAssessmentBaselineSetListResult class. */ + public DatabaseSqlVulnerabilityAssessmentBaselineSetListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSqlVulnerabilityAssessmentBaselines.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSqlVulnerabilityAssessmentBaselines.java new file mode 100644 index 0000000000000..04215b3743cc1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSqlVulnerabilityAssessmentBaselines.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of DatabaseSqlVulnerabilityAssessmentBaselines. */ +public interface DatabaseSqlVulnerabilityAssessmentBaselines { + /** + * Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's sql vulnerability assessment rule baselines as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listBySqlVulnerabilityAssessment( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName); + + /** + * Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's sql vulnerability assessment rule baselines as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listBySqlVulnerabilityAssessment( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context); + + /** + * Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's sql vulnerability assessment rule baselines along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + Context context); + + /** + * Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's sql vulnerability assessment rule baselines. + */ + DatabaseSqlVulnerabilityAssessmentBaselineSet get( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName); + + /** + * Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's sql vulnerability assessment rule baselines along with {@link Response}. + */ + DatabaseSqlVulnerabilityAssessmentBaselineSet getById(String id); + + /** + * Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's sql vulnerability assessment rule baselines along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new DatabaseSqlVulnerabilityAssessmentBaselineSet resource. + * + * @param name resource name. + * @return the first stage of the new DatabaseSqlVulnerabilityAssessmentBaselineSet definition. + */ + DatabaseSqlVulnerabilityAssessmentBaselineSet.DefinitionStages.Blank define(BaselineName name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSqlVulnerabilityAssessmentExecuteScans.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSqlVulnerabilityAssessmentExecuteScans.java new file mode 100644 index 0000000000000..338e6d609cdb1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSqlVulnerabilityAssessmentExecuteScans.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; + +/** Resource collection API of DatabaseSqlVulnerabilityAssessmentExecuteScans. */ +public interface DatabaseSqlVulnerabilityAssessmentExecuteScans { + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void execute( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void execute( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSqlVulnerabilityAssessmentRuleBaseline.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSqlVulnerabilityAssessmentRuleBaseline.java new file mode 100644 index 0000000000000..e70fa112ebf70 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSqlVulnerabilityAssessmentRuleBaseline.java @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseSqlVulnerabilityAssessmentRuleBaselineInner; +import java.util.List; + +/** An immutable client-side representation of DatabaseSqlVulnerabilityAssessmentRuleBaseline. */ +public interface DatabaseSqlVulnerabilityAssessmentRuleBaseline { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: SystemData of DatabaseSqlVulnerabilityAssessmentRuleBaselineResource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the results property: The rule baseline result. + * + * @return the results value. + */ + List> results(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner + * com.azure.resourcemanager.sql.generated.fluent.models.DatabaseSqlVulnerabilityAssessmentRuleBaselineInner object. + * + * @return the inner object. + */ + DatabaseSqlVulnerabilityAssessmentRuleBaselineInner innerModel(); + + /** The entirety of the DatabaseSqlVulnerabilityAssessmentRuleBaseline definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The DatabaseSqlVulnerabilityAssessmentRuleBaseline definition stages. */ + interface DefinitionStages { + /** The first stage of the DatabaseSqlVulnerabilityAssessmentRuleBaseline definition. */ + interface Blank extends WithParentResource { + } + /** + * The stage of the DatabaseSqlVulnerabilityAssessmentRuleBaseline definition allowing to specify parent + * resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, baselineName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @return the next definition stage. + */ + WithCreate withExistingBaseline( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName); + } + /** + * The stage of the DatabaseSqlVulnerabilityAssessmentRuleBaseline definition which contains all the minimum + * required properties for the resource to be created, but also allows for any other optional properties to be + * specified. + */ + interface WithCreate extends DefinitionStages.WithLatestScan, DefinitionStages.WithResults { + /** + * Executes the create request. + * + * @return the created resource. + */ + DatabaseSqlVulnerabilityAssessmentRuleBaseline create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + DatabaseSqlVulnerabilityAssessmentRuleBaseline create(Context context); + } + /** + * The stage of the DatabaseSqlVulnerabilityAssessmentRuleBaseline definition allowing to specify latestScan. + */ + interface WithLatestScan { + /** + * Specifies the latestScan property: The latest scan flag. + * + * @param latestScan The latest scan flag. + * @return the next definition stage. + */ + WithCreate withLatestScan(boolean latestScan); + } + /** The stage of the DatabaseSqlVulnerabilityAssessmentRuleBaseline definition allowing to specify results. */ + interface WithResults { + /** + * Specifies the results property: The rule baseline result. + * + * @param results The rule baseline result. + * @return the next definition stage. + */ + WithCreate withResults(List> results); + } + } + /** + * Begins update for the DatabaseSqlVulnerabilityAssessmentRuleBaseline resource. + * + * @return the stage of resource update. + */ + DatabaseSqlVulnerabilityAssessmentRuleBaseline.Update update(); + + /** The template for DatabaseSqlVulnerabilityAssessmentRuleBaseline update. */ + interface Update extends UpdateStages.WithLatestScan, UpdateStages.WithResults { + /** + * Executes the update request. + * + * @return the updated resource. + */ + DatabaseSqlVulnerabilityAssessmentRuleBaseline apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + DatabaseSqlVulnerabilityAssessmentRuleBaseline apply(Context context); + } + /** The DatabaseSqlVulnerabilityAssessmentRuleBaseline update stages. */ + interface UpdateStages { + /** The stage of the DatabaseSqlVulnerabilityAssessmentRuleBaseline update allowing to specify latestScan. */ + interface WithLatestScan { + /** + * Specifies the latestScan property: The latest scan flag. + * + * @param latestScan The latest scan flag. + * @return the next definition stage. + */ + Update withLatestScan(boolean latestScan); + } + /** The stage of the DatabaseSqlVulnerabilityAssessmentRuleBaseline update allowing to specify results. */ + interface WithResults { + /** + * Specifies the results property: The rule baseline result. + * + * @param results The rule baseline result. + * @return the next definition stage. + */ + Update withResults(List> results); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + DatabaseSqlVulnerabilityAssessmentRuleBaseline refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + DatabaseSqlVulnerabilityAssessmentRuleBaseline refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSqlVulnerabilityAssessmentRuleBaselineInput.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSqlVulnerabilityAssessmentRuleBaselineInput.java new file mode 100644 index 0000000000000..934ded42f1cd7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSqlVulnerabilityAssessmentRuleBaselineInput.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseSqlVulnerabilityAssessmentRuleBaselineInputProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A database sql vulnerability assessment rule baseline input. */ +@Fluent +public final class DatabaseSqlVulnerabilityAssessmentRuleBaselineInput extends ProxyResource { + /* + * SystemData of DatabaseSqlVulnerabilityAssessmentRuleBaselineInputResource. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private DatabaseSqlVulnerabilityAssessmentRuleBaselineInputProperties innerProperties; + + /** Creates an instance of DatabaseSqlVulnerabilityAssessmentRuleBaselineInput class. */ + public DatabaseSqlVulnerabilityAssessmentRuleBaselineInput() { + } + + /** + * Get the systemData property: SystemData of DatabaseSqlVulnerabilityAssessmentRuleBaselineInputResource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private DatabaseSqlVulnerabilityAssessmentRuleBaselineInputProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the latestScan property: The latest scan flag. + * + * @return the latestScan value. + */ + public Boolean latestScan() { + return this.innerProperties() == null ? null : this.innerProperties().latestScan(); + } + + /** + * Set the latestScan property: The latest scan flag. + * + * @param latestScan the latestScan value to set. + * @return the DatabaseSqlVulnerabilityAssessmentRuleBaselineInput object itself. + */ + public DatabaseSqlVulnerabilityAssessmentRuleBaselineInput withLatestScan(Boolean latestScan) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseSqlVulnerabilityAssessmentRuleBaselineInputProperties(); + } + this.innerProperties().withLatestScan(latestScan); + return this; + } + + /** + * Get the results property: The rule baseline result. + * + * @return the results value. + */ + public List> results() { + return this.innerProperties() == null ? null : this.innerProperties().results(); + } + + /** + * Set the results property: The rule baseline result. + * + * @param results the results value to set. + * @return the DatabaseSqlVulnerabilityAssessmentRuleBaselineInput object itself. + */ + public DatabaseSqlVulnerabilityAssessmentRuleBaselineInput withResults(List> results) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseSqlVulnerabilityAssessmentRuleBaselineInputProperties(); + } + this.innerProperties().withResults(results); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSqlVulnerabilityAssessmentRuleBaselineListInput.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSqlVulnerabilityAssessmentRuleBaselineListInput.java new file mode 100644 index 0000000000000..83cdff6494357 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSqlVulnerabilityAssessmentRuleBaselineListInput.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseSqlVulnerabilityAssessmentRuleBaselineListInputProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** A database sql vulnerability assessment rule baseline list input. */ +@Fluent +public final class DatabaseSqlVulnerabilityAssessmentRuleBaselineListInput extends ProxyResource { + /* + * SystemData of DatabaseSqlVulnerabilityAssessmentRuleBaselineListInputResource. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private DatabaseSqlVulnerabilityAssessmentRuleBaselineListInputProperties innerProperties; + + /** Creates an instance of DatabaseSqlVulnerabilityAssessmentRuleBaselineListInput class. */ + public DatabaseSqlVulnerabilityAssessmentRuleBaselineListInput() { + } + + /** + * Get the systemData property: SystemData of DatabaseSqlVulnerabilityAssessmentRuleBaselineListInputResource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private DatabaseSqlVulnerabilityAssessmentRuleBaselineListInputProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the latestScan property: The latest scan flag. + * + * @return the latestScan value. + */ + public Boolean latestScan() { + return this.innerProperties() == null ? null : this.innerProperties().latestScan(); + } + + /** + * Set the latestScan property: The latest scan flag. + * + * @param latestScan the latestScan value to set. + * @return the DatabaseSqlVulnerabilityAssessmentRuleBaselineListInput object itself. + */ + public DatabaseSqlVulnerabilityAssessmentRuleBaselineListInput withLatestScan(Boolean latestScan) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseSqlVulnerabilityAssessmentRuleBaselineListInputProperties(); + } + this.innerProperties().withLatestScan(latestScan); + return this; + } + + /** + * Get the results property: The rule baseline result list. + * + * @return the results value. + */ + public Map>> results() { + return this.innerProperties() == null ? null : this.innerProperties().results(); + } + + /** + * Set the results property: The rule baseline result list. + * + * @param results the results value to set. + * @return the DatabaseSqlVulnerabilityAssessmentRuleBaselineListInput object itself. + */ + public DatabaseSqlVulnerabilityAssessmentRuleBaselineListInput withResults( + Map>> results) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseSqlVulnerabilityAssessmentRuleBaselineListInputProperties(); + } + this.innerProperties().withResults(results); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSqlVulnerabilityAssessmentRuleBaselineListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSqlVulnerabilityAssessmentRuleBaselineListResult.java new file mode 100644 index 0000000000000..2be5e4355736d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSqlVulnerabilityAssessmentRuleBaselineListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseSqlVulnerabilityAssessmentRuleBaselineInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of SQL Vulnerability Assessments rule baseline. */ +@Immutable +public final class DatabaseSqlVulnerabilityAssessmentRuleBaselineListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of DatabaseSqlVulnerabilityAssessmentRuleBaselineListResult class. */ + public DatabaseSqlVulnerabilityAssessmentRuleBaselineListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSqlVulnerabilityAssessmentRuleBaselines.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSqlVulnerabilityAssessmentRuleBaselines.java new file mode 100644 index 0000000000000..59c88d32d5d7f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSqlVulnerabilityAssessmentRuleBaselines.java @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of DatabaseSqlVulnerabilityAssessmentRuleBaselines. */ +public interface DatabaseSqlVulnerabilityAssessmentRuleBaselines { + /** + * Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's sql vulnerability assessment rule baselines as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByBaseline( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName); + + /** + * Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's sql vulnerability assessment rule baselines as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByBaseline( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + Context context); + + /** + * Gets a database's sql 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. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param ruleId The vulnerability assessment rule ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's sql vulnerability assessment rule baseline along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId, + Context context); + + /** + * Gets a database's sql 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. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param ruleId The vulnerability assessment rule ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's sql vulnerability assessment rule baseline. + */ + DatabaseSqlVulnerabilityAssessmentRuleBaseline get( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId); + + /** + * 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. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param ruleId The vulnerability assessment rule ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId, + Context context); + + /** + * 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. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param ruleId The vulnerability assessment rule ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId); + + /** + * Gets a database's sql vulnerability assessment rule baseline. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's sql vulnerability assessment rule baseline along with {@link Response}. + */ + DatabaseSqlVulnerabilityAssessmentRuleBaseline getById(String id); + + /** + * Gets a database's sql vulnerability assessment rule baseline. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's sql vulnerability assessment rule baseline along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Removes the database's vulnerability assessment rule baseline. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Removes the database's vulnerability assessment rule baseline. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new DatabaseSqlVulnerabilityAssessmentRuleBaseline resource. + * + * @param name resource name. + * @return the first stage of the new DatabaseSqlVulnerabilityAssessmentRuleBaseline definition. + */ + DatabaseSqlVulnerabilityAssessmentRuleBaseline.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSqlVulnerabilityAssessmentScanResults.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSqlVulnerabilityAssessmentScanResults.java new file mode 100644 index 0000000000000..5386b32ef9b53 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSqlVulnerabilityAssessmentScanResults.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of DatabaseSqlVulnerabilityAssessmentScanResults. */ +public interface DatabaseSqlVulnerabilityAssessmentScanResults { + /** + * 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 vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @param scanId The scan id of the SQL Vulnerability Assessment scan to retrieve result from. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a vulnerability assessment scan record of a database as paginated response with {@link PagedIterable}. + */ + PagedIterable listByScan( + String resourceGroupName, + String serverName, + String databaseName, + SqlVulnerabilityAssessmentName vulnerabilityAssessmentName, + 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @param scanId The scan id of the SQL Vulnerability Assessment scan to retrieve result from. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a vulnerability assessment scan record of a database as paginated response with {@link PagedIterable}. + */ + PagedIterable listByScan( + String resourceGroupName, + String serverName, + String databaseName, + SqlVulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @param scanId The scan id of the SQL Vulnerability Assessment scan to retrieve result from. + * @param scanResultId The scan result id of the specific result to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a vulnerability assessment scan record of a database along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + SqlVulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + String scanResultId, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @param scanId The scan id of the SQL Vulnerability Assessment scan to retrieve result from. + * @param scanResultId The scan result id of the specific result to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a vulnerability assessment scan record of a database. + */ + SqlVulnerabilityAssessmentScanResults get( + String resourceGroupName, + String serverName, + String databaseName, + SqlVulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + String scanResultId); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSqlVulnerabilityAssessmentScans.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSqlVulnerabilityAssessmentScans.java new file mode 100644 index 0000000000000..a1562616068cf --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSqlVulnerabilityAssessmentScans.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of DatabaseSqlVulnerabilityAssessmentScans. */ +public interface DatabaseSqlVulnerabilityAssessmentScans { + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan records as paginated response with {@link PagedIterable}. + */ + PagedIterable listBySqlVulnerabilityAssessments( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan records as paginated response with {@link PagedIterable}. + */ + PagedIterable listBySqlVulnerabilityAssessments( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context); + + /** + * Get a database vulnerability assessment scan 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. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database vulnerability assessment scan result along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context); + + /** + * Get a database vulnerability assessment scan 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. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database vulnerability assessment scan result. + */ + SqlVulnerabilityAssessmentScanRecord get( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSqlVulnerabilityAssessmentsSettings.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSqlVulnerabilityAssessmentsSettings.java new file mode 100644 index 0000000000000..29183cb6dc004 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseSqlVulnerabilityAssessmentsSettings.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of DatabaseSqlVulnerabilityAssessmentsSettings. */ +public interface DatabaseSqlVulnerabilityAssessmentsSettings { + /** + * Lists SQL 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Vulnerability Assessments as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName); + + /** + * Lists SQL 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Vulnerability Assessments as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Gets SQL Vulnerability Assessment policy for database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return sQL Vulnerability Assessment policy for database along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + SqlVulnerabilityAssessmentNameAutoGenerated vulnerabilityAssessmentName, + Context context); + + /** + * Gets SQL Vulnerability Assessment policy for database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return sQL Vulnerability Assessment policy for database. + */ + SqlVulnerabilityAssessment get( + String resourceGroupName, + String serverName, + String databaseName, + SqlVulnerabilityAssessmentNameAutoGenerated vulnerabilityAssessmentName); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseState.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseState.java new file mode 100644 index 0000000000000..e4cf88b3a89dd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseState.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for DatabaseState. */ +public final class DatabaseState extends ExpandableStringEnum { + /** Static value All for DatabaseState. */ + public static final DatabaseState ALL = fromString("All"); + + /** Static value Live for DatabaseState. */ + public static final DatabaseState LIVE = fromString("Live"); + + /** Static value Deleted for DatabaseState. */ + public static final DatabaseState DELETED = fromString("Deleted"); + + /** + * Creates or finds a DatabaseState from its string representation. + * + * @param name a name to look for. + * @return the corresponding DatabaseState. + */ + @JsonCreator + public static DatabaseState fromString(String name) { + return fromString(name, DatabaseState.class); + } + + /** + * Gets known DatabaseState values. + * + * @return known DatabaseState values. + */ + public static Collection values() { + return values(DatabaseState.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseStatus.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseStatus.java new file mode 100644 index 0000000000000..f931fd48c6bad --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseStatus.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The status of the database. */ +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"); + + /** Static value OfflineChangingDwPerformanceTiers for DatabaseStatus. */ + public static final DatabaseStatus OFFLINE_CHANGING_DW_PERFORMANCE_TIERS = + fromString("OfflineChangingDwPerformanceTiers"); + + /** Static value OnlineChangingDwPerformanceTiers for DatabaseStatus. */ + public static final DatabaseStatus ONLINE_CHANGING_DW_PERFORMANCE_TIERS = + fromString("OnlineChangingDwPerformanceTiers"); + + /** Static value Disabled for DatabaseStatus. */ + public static final DatabaseStatus DISABLED = fromString("Disabled"); + + /** Static value Stopping for DatabaseStatus. */ + public static final DatabaseStatus STOPPING = fromString("Stopping"); + + /** Static value Stopped for DatabaseStatus. */ + public static final DatabaseStatus STOPPED = fromString("Stopped"); + + /** Static value Starting for DatabaseStatus. */ + public static final DatabaseStatus STARTING = fromString("Starting"); + + /** + * 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); + } + + /** + * Gets known DatabaseStatus values. + * + * @return known DatabaseStatus values. + */ + public static Collection values() { + return values(DatabaseStatus.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseTable.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseTable.java new file mode 100644 index 0000000000000..926d24ce679fe --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseTable.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseTableInner; + +/** An immutable client-side representation of DatabaseTable. */ +public interface DatabaseTable { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the temporalType property: The table temporal type. + * + * @return the temporalType value. + */ + TableTemporalType temporalType(); + + /** + * Gets the memoryOptimized property: Whether or not the table is memory optimized. + * + * @return the memoryOptimized value. + */ + Boolean memoryOptimized(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.DatabaseTableInner object. + * + * @return the inner object. + */ + DatabaseTableInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseTableListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseTableListResult.java new file mode 100644 index 0000000000000..69d84bb86bf95 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseTableListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseTableInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of database tables. */ +@Immutable +public final class DatabaseTableListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of DatabaseTableListResult class. */ + public DatabaseTableListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseTables.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseTables.java new file mode 100644 index 0000000000000..9969c7f00fde5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseTables.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of DatabaseTables. */ +public interface DatabaseTables { + /** + * List database tables. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database tables as paginated response with {@link PagedIterable}. + */ + PagedIterable listBySchema( + String resourceGroupName, String serverName, String databaseName, String schemaName); + + /** + * List database tables. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 filter An OData filter expression that filters elements in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database tables as paginated response with {@link PagedIterable}. + */ + PagedIterable listBySchema( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String filter, + Context context); + + /** + * Get database table. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database table along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + Context context); + + /** + * Get database table. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database table. + */ + DatabaseTable get( + String resourceGroupName, String serverName, String databaseName, String schemaName, String tableName); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseUpdate.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseUpdate.java new file mode 100644 index 0000000000000..3db0c576b0c20 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseUpdate.java @@ -0,0 +1,922 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseUpdateProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.Map; +import java.util.UUID; + +/** A database update resource. */ +@Fluent +public final class DatabaseUpdate { + /* + * The name and tier of the SKU. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /* + * Database identity + */ + @JsonProperty(value = "identity") + private DatabaseIdentity identity; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private DatabaseUpdateProperties innerProperties; + + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** Creates an instance of DatabaseUpdate class. */ + public DatabaseUpdate() { + } + + /** + * Get the sku property: The name and tier of the SKU. + * + * @return the sku value. + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku property: 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 the identity property: Database identity. + * + * @return the identity value. + */ + public DatabaseIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: Database identity. + * + * @param identity the identity value to set. + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withIdentity(DatabaseIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private DatabaseUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the createMode property: 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. + * + * @return the createMode value. + */ + public CreateMode createMode() { + return this.innerProperties() == null ? null : this.innerProperties().createMode(); + } + + /** + * Set the createMode property: 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. + * + * @param createMode the createMode value to set. + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withCreateMode(CreateMode createMode) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseUpdateProperties(); + } + this.innerProperties().withCreateMode(createMode); + return this; + } + + /** + * Get the collation property: The collation of the database. + * + * @return the collation value. + */ + public String collation() { + return this.innerProperties() == null ? null : this.innerProperties().collation(); + } + + /** + * Set the collation property: The collation of the database. + * + * @param collation the collation value to set. + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withCollation(String collation) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseUpdateProperties(); + } + this.innerProperties().withCollation(collation); + return this; + } + + /** + * Get the maxSizeBytes property: The max size of the database expressed in bytes. + * + * @return the maxSizeBytes value. + */ + public Long maxSizeBytes() { + return this.innerProperties() == null ? null : this.innerProperties().maxSizeBytes(); + } + + /** + * Set the maxSizeBytes property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseUpdateProperties(); + } + this.innerProperties().withMaxSizeBytes(maxSizeBytes); + return this; + } + + /** + * Get the sampleName property: The name of the sample schema to apply when creating this database. + * + * @return the sampleName value. + */ + public SampleName sampleName() { + return this.innerProperties() == null ? null : this.innerProperties().sampleName(); + } + + /** + * Set the sampleName property: The name of the sample schema to apply when creating this database. + * + * @param sampleName the sampleName value to set. + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withSampleName(SampleName sampleName) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseUpdateProperties(); + } + this.innerProperties().withSampleName(sampleName); + return this; + } + + /** + * Get the elasticPoolId property: The resource identifier of the elastic pool containing this database. + * + * @return the elasticPoolId value. + */ + public String elasticPoolId() { + return this.innerProperties() == null ? null : this.innerProperties().elasticPoolId(); + } + + /** + * Set the elasticPoolId property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseUpdateProperties(); + } + this.innerProperties().withElasticPoolId(elasticPoolId); + return this; + } + + /** + * Get the sourceDatabaseId property: The resource identifier of the source database associated with create + * operation of this database. + * + * @return the sourceDatabaseId value. + */ + public String sourceDatabaseId() { + return this.innerProperties() == null ? null : this.innerProperties().sourceDatabaseId(); + } + + /** + * Set the sourceDatabaseId property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseUpdateProperties(); + } + this.innerProperties().withSourceDatabaseId(sourceDatabaseId); + return this; + } + + /** + * Get the status property: The status of the database. + * + * @return the status value. + */ + public DatabaseStatus status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); + } + + /** + * Get the databaseId property: The ID of the database. + * + * @return the databaseId value. + */ + public UUID databaseId() { + return this.innerProperties() == null ? null : this.innerProperties().databaseId(); + } + + /** + * Get the creationDate property: The creation date of the database (ISO8601 format). + * + * @return the creationDate value. + */ + public OffsetDateTime creationDate() { + return this.innerProperties() == null ? null : this.innerProperties().creationDate(); + } + + /** + * Get the currentServiceObjectiveName property: The current service level objective name of the database. + * + * @return the currentServiceObjectiveName value. + */ + public String currentServiceObjectiveName() { + return this.innerProperties() == null ? null : this.innerProperties().currentServiceObjectiveName(); + } + + /** + * Get the requestedServiceObjectiveName property: The requested service level objective name of the database. + * + * @return the requestedServiceObjectiveName value. + */ + public String requestedServiceObjectiveName() { + return this.innerProperties() == null ? null : this.innerProperties().requestedServiceObjectiveName(); + } + + /** + * Get the defaultSecondaryLocation property: The default secondary region for this database. + * + * @return the defaultSecondaryLocation value. + */ + public String defaultSecondaryLocation() { + return this.innerProperties() == null ? null : this.innerProperties().defaultSecondaryLocation(); + } + + /** + * Get the failoverGroupId property: Failover Group resource identifier that this database belongs to. + * + * @return the failoverGroupId value. + */ + public String failoverGroupId() { + return this.innerProperties() == null ? null : this.innerProperties().failoverGroupId(); + } + + /** + * Get the restorePointInTime property: Specifies the point in time (ISO8601 format) of the source database that + * will be restored to create the new database. + * + * @return the restorePointInTime value. + */ + public OffsetDateTime restorePointInTime() { + return this.innerProperties() == null ? null : this.innerProperties().restorePointInTime(); + } + + /** + * Set the restorePointInTime property: 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(OffsetDateTime restorePointInTime) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseUpdateProperties(); + } + this.innerProperties().withRestorePointInTime(restorePointInTime); + return this; + } + + /** + * Get the sourceDatabaseDeletionDate property: Specifies the time that the database was deleted. + * + * @return the sourceDatabaseDeletionDate value. + */ + public OffsetDateTime sourceDatabaseDeletionDate() { + return this.innerProperties() == null ? null : this.innerProperties().sourceDatabaseDeletionDate(); + } + + /** + * Set the sourceDatabaseDeletionDate property: Specifies the time that the database was deleted. + * + * @param sourceDatabaseDeletionDate the sourceDatabaseDeletionDate value to set. + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withSourceDatabaseDeletionDate(OffsetDateTime sourceDatabaseDeletionDate) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseUpdateProperties(); + } + this.innerProperties().withSourceDatabaseDeletionDate(sourceDatabaseDeletionDate); + return this; + } + + /** + * Get the recoveryServicesRecoveryPointId property: The resource identifier of the recovery point associated with + * create operation of this database. + * + * @return the recoveryServicesRecoveryPointId value. + */ + public String recoveryServicesRecoveryPointId() { + return this.innerProperties() == null ? null : this.innerProperties().recoveryServicesRecoveryPointId(); + } + + /** + * Set the recoveryServicesRecoveryPointId property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseUpdateProperties(); + } + this.innerProperties().withRecoveryServicesRecoveryPointId(recoveryServicesRecoveryPointId); + return this; + } + + /** + * Get the longTermRetentionBackupResourceId property: 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.innerProperties() == null ? null : this.innerProperties().longTermRetentionBackupResourceId(); + } + + /** + * Set the longTermRetentionBackupResourceId property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseUpdateProperties(); + } + this.innerProperties().withLongTermRetentionBackupResourceId(longTermRetentionBackupResourceId); + return this; + } + + /** + * Get the recoverableDatabaseId property: The resource identifier of the recoverable database associated with + * create operation of this database. + * + * @return the recoverableDatabaseId value. + */ + public String recoverableDatabaseId() { + return this.innerProperties() == null ? null : this.innerProperties().recoverableDatabaseId(); + } + + /** + * Set the recoverableDatabaseId property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseUpdateProperties(); + } + this.innerProperties().withRecoverableDatabaseId(recoverableDatabaseId); + return this; + } + + /** + * Get the restorableDroppedDatabaseId property: The resource identifier of the restorable dropped database + * associated with create operation of this database. + * + * @return the restorableDroppedDatabaseId value. + */ + public String restorableDroppedDatabaseId() { + return this.innerProperties() == null ? null : this.innerProperties().restorableDroppedDatabaseId(); + } + + /** + * Set the restorableDroppedDatabaseId property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseUpdateProperties(); + } + this.innerProperties().withRestorableDroppedDatabaseId(restorableDroppedDatabaseId); + return this; + } + + /** + * Get the catalogCollation property: Collation of the metadata catalog. + * + * @return the catalogCollation value. + */ + public CatalogCollationType catalogCollation() { + return this.innerProperties() == null ? null : this.innerProperties().catalogCollation(); + } + + /** + * Set the catalogCollation property: Collation of the metadata catalog. + * + * @param catalogCollation the catalogCollation value to set. + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withCatalogCollation(CatalogCollationType catalogCollation) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseUpdateProperties(); + } + this.innerProperties().withCatalogCollation(catalogCollation); + return this; + } + + /** + * Get the zoneRedundant property: 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.innerProperties() == null ? null : this.innerProperties().zoneRedundant(); + } + + /** + * Set the zoneRedundant property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseUpdateProperties(); + } + this.innerProperties().withZoneRedundant(zoneRedundant); + return this; + } + + /** + * Get the licenseType property: The license type to apply for this database. `LicenseIncluded` if you need a + * license, or `BasePrice` if you have a license and are eligible for the Azure Hybrid Benefit. + * + * @return the licenseType value. + */ + public DatabaseLicenseType licenseType() { + return this.innerProperties() == null ? null : this.innerProperties().licenseType(); + } + + /** + * Set the licenseType property: The license type to apply for this database. `LicenseIncluded` if you need a + * license, or `BasePrice` if you have a license and are eligible for the Azure Hybrid Benefit. + * + * @param licenseType the licenseType value to set. + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withLicenseType(DatabaseLicenseType licenseType) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseUpdateProperties(); + } + this.innerProperties().withLicenseType(licenseType); + return this; + } + + /** + * Get the maxLogSizeBytes property: The max log size for this database. + * + * @return the maxLogSizeBytes value. + */ + public Long maxLogSizeBytes() { + return this.innerProperties() == null ? null : this.innerProperties().maxLogSizeBytes(); + } + + /** + * Get the earliestRestoreDate property: This records the earliest start date and time that restore is available for + * this database (ISO8601 format). + * + * @return the earliestRestoreDate value. + */ + public OffsetDateTime earliestRestoreDate() { + return this.innerProperties() == null ? null : this.innerProperties().earliestRestoreDate(); + } + + /** + * Get the readScale property: 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. Not + * applicable to a Hyperscale database within an elastic pool. + * + * @return the readScale value. + */ + public DatabaseReadScale readScale() { + return this.innerProperties() == null ? null : this.innerProperties().readScale(); + } + + /** + * Set the readScale property: 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. Not + * applicable to a Hyperscale database within an elastic pool. + * + * @param readScale the readScale value to set. + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withReadScale(DatabaseReadScale readScale) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseUpdateProperties(); + } + this.innerProperties().withReadScale(readScale); + return this; + } + + /** + * Get the highAvailabilityReplicaCount property: The number of secondary replicas associated with the database that + * are used to provide high availability. Not applicable to a Hyperscale database within an elastic pool. + * + * @return the highAvailabilityReplicaCount value. + */ + public Integer highAvailabilityReplicaCount() { + return this.innerProperties() == null ? null : this.innerProperties().highAvailabilityReplicaCount(); + } + + /** + * Set the highAvailabilityReplicaCount property: The number of secondary replicas associated with the database that + * are used to provide high availability. Not applicable to a Hyperscale database within an elastic pool. + * + * @param highAvailabilityReplicaCount the highAvailabilityReplicaCount value to set. + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withHighAvailabilityReplicaCount(Integer highAvailabilityReplicaCount) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseUpdateProperties(); + } + this.innerProperties().withHighAvailabilityReplicaCount(highAvailabilityReplicaCount); + return this; + } + + /** + * Get the secondaryType property: The secondary type of the database if it is a secondary. Valid values are Geo, + * Named and Standby. + * + * @return the secondaryType value. + */ + public SecondaryType secondaryType() { + return this.innerProperties() == null ? null : this.innerProperties().secondaryType(); + } + + /** + * Set the secondaryType property: The secondary type of the database if it is a secondary. Valid values are Geo, + * Named and Standby. + * + * @param secondaryType the secondaryType value to set. + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withSecondaryType(SecondaryType secondaryType) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseUpdateProperties(); + } + this.innerProperties().withSecondaryType(secondaryType); + return this; + } + + /** + * Get the currentSku property: The name and tier of the SKU. + * + * @return the currentSku value. + */ + public Sku currentSku() { + return this.innerProperties() == null ? null : this.innerProperties().currentSku(); + } + + /** + * Get the autoPauseDelay property: Time in minutes after which database is automatically paused. A value of -1 + * means that automatic pause is disabled. + * + * @return the autoPauseDelay value. + */ + public Integer autoPauseDelay() { + return this.innerProperties() == null ? null : this.innerProperties().autoPauseDelay(); + } + + /** + * Set the autoPauseDelay property: Time in minutes after which database is automatically paused. A value of -1 + * means that automatic pause is disabled. + * + * @param autoPauseDelay the autoPauseDelay value to set. + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withAutoPauseDelay(Integer autoPauseDelay) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseUpdateProperties(); + } + this.innerProperties().withAutoPauseDelay(autoPauseDelay); + return this; + } + + /** + * Get the currentBackupStorageRedundancy property: The storage account type used to store backups for this + * database. + * + * @return the currentBackupStorageRedundancy value. + */ + public BackupStorageRedundancy currentBackupStorageRedundancy() { + return this.innerProperties() == null ? null : this.innerProperties().currentBackupStorageRedundancy(); + } + + /** + * Get the requestedBackupStorageRedundancy property: The storage account type to be used to store backups for this + * database. + * + * @return the requestedBackupStorageRedundancy value. + */ + public BackupStorageRedundancy requestedBackupStorageRedundancy() { + return this.innerProperties() == null ? null : this.innerProperties().requestedBackupStorageRedundancy(); + } + + /** + * Set the requestedBackupStorageRedundancy property: The storage account type to be used to store backups for this + * database. + * + * @param requestedBackupStorageRedundancy the requestedBackupStorageRedundancy value to set. + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withRequestedBackupStorageRedundancy( + BackupStorageRedundancy requestedBackupStorageRedundancy) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseUpdateProperties(); + } + this.innerProperties().withRequestedBackupStorageRedundancy(requestedBackupStorageRedundancy); + return this; + } + + /** + * Get the minCapacity property: Minimal capacity that database will always have allocated, if not paused. + * + * @return the minCapacity value. + */ + public Double minCapacity() { + return this.innerProperties() == null ? null : this.innerProperties().minCapacity(); + } + + /** + * Set the minCapacity property: Minimal capacity that database will always have allocated, if not paused. + * + * @param minCapacity the minCapacity value to set. + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withMinCapacity(Double minCapacity) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseUpdateProperties(); + } + this.innerProperties().withMinCapacity(minCapacity); + return this; + } + + /** + * Get the pausedDate property: The date when database was paused by user configuration or action(ISO8601 format). + * Null if the database is ready. + * + * @return the pausedDate value. + */ + public OffsetDateTime pausedDate() { + return this.innerProperties() == null ? null : this.innerProperties().pausedDate(); + } + + /** + * Get the resumedDate property: The date when database was resumed by user action or database login (ISO8601 + * format). Null if the database is paused. + * + * @return the resumedDate value. + */ + public OffsetDateTime resumedDate() { + return this.innerProperties() == null ? null : this.innerProperties().resumedDate(); + } + + /** + * Get the maintenanceConfigurationId property: Maintenance configuration id assigned to the database. This + * configuration defines the period when the maintenance updates will occur. + * + * @return the maintenanceConfigurationId value. + */ + public String maintenanceConfigurationId() { + return this.innerProperties() == null ? null : this.innerProperties().maintenanceConfigurationId(); + } + + /** + * Set the maintenanceConfigurationId property: Maintenance configuration id assigned to the database. This + * configuration defines the period when the maintenance updates will occur. + * + * @param maintenanceConfigurationId the maintenanceConfigurationId value to set. + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withMaintenanceConfigurationId(String maintenanceConfigurationId) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseUpdateProperties(); + } + this.innerProperties().withMaintenanceConfigurationId(maintenanceConfigurationId); + return this; + } + + /** + * Get the isLedgerOn property: Whether or not this database is a ledger database, which means all tables in the + * database are ledger tables. Note: the value of this property cannot be changed after the database has been + * created. + * + * @return the isLedgerOn value. + */ + public Boolean isLedgerOn() { + return this.innerProperties() == null ? null : this.innerProperties().isLedgerOn(); + } + + /** + * Set the isLedgerOn property: Whether or not this database is a ledger database, which means all tables in the + * database are ledger tables. Note: the value of this property cannot be changed after the database has been + * created. + * + * @param isLedgerOn the isLedgerOn value to set. + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withIsLedgerOn(Boolean isLedgerOn) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseUpdateProperties(); + } + this.innerProperties().withIsLedgerOn(isLedgerOn); + return this; + } + + /** + * Get the isInfraEncryptionEnabled property: Infra encryption is enabled for this database. + * + * @return the isInfraEncryptionEnabled value. + */ + public Boolean isInfraEncryptionEnabled() { + return this.innerProperties() == null ? null : this.innerProperties().isInfraEncryptionEnabled(); + } + + /** + * Get the federatedClientId property: The Client id used for cross tenant per database CMK scenario. + * + * @return the federatedClientId value. + */ + public UUID federatedClientId() { + return this.innerProperties() == null ? null : this.innerProperties().federatedClientId(); + } + + /** + * Set the federatedClientId property: The Client id used for cross tenant per database CMK scenario. + * + * @param federatedClientId the federatedClientId value to set. + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withFederatedClientId(UUID federatedClientId) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseUpdateProperties(); + } + this.innerProperties().withFederatedClientId(federatedClientId); + return this; + } + + /** + * Get the preferredEnclaveType property: Type of enclave requested on the database i.e. Default or VBS enclaves. + * + * @return the preferredEnclaveType value. + */ + public AlwaysEncryptedEnclaveType preferredEnclaveType() { + return this.innerProperties() == null ? null : this.innerProperties().preferredEnclaveType(); + } + + /** + * Set the preferredEnclaveType property: Type of enclave requested on the database i.e. Default or VBS enclaves. + * + * @param preferredEnclaveType the preferredEnclaveType value to set. + * @return the DatabaseUpdate object itself. + */ + public DatabaseUpdate withPreferredEnclaveType(AlwaysEncryptedEnclaveType preferredEnclaveType) { + if (this.innerProperties() == null) { + this.innerProperties = new DatabaseUpdateProperties(); + } + this.innerProperties().withPreferredEnclaveType(preferredEnclaveType); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + if (identity() != null) { + identity().validate(); + } + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseUsage.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseUsage.java new file mode 100644 index 0000000000000..4a410c4a26b7f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseUsage.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseUsageInner; + +/** An immutable client-side representation of DatabaseUsage. */ +public interface DatabaseUsage { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the displayName property: User-readable name of the metric. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the currentValue property: Current value of the metric. + * + * @return the currentValue value. + */ + Double currentValue(); + + /** + * Gets the limit property: Boundary value of the metric. + * + * @return the limit value. + */ + Double limit(); + + /** + * Gets the unit property: Unit of the metric. + * + * @return the unit value. + */ + String unit(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.DatabaseUsageInner object. + * + * @return the inner object. + */ + DatabaseUsageInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseUsageListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseUsageListResult.java new file mode 100644 index 0000000000000..c91aba232a1ed --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseUsageListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseUsageInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of database usage metrics. */ +@Immutable +public final class DatabaseUsageListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of DatabaseUsageListResult class. */ + public DatabaseUsageListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseUsages.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseUsages.java new file mode 100644 index 0000000000000..ca839503458d5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseUsages.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of DatabaseUsages. */ +public interface DatabaseUsages { + /** + * Gets 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database usages as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase(String resourceGroupName, String serverName, String databaseName); + + /** + * Gets 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database usages as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseUserIdentity.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseUserIdentity.java new file mode 100644 index 0000000000000..ef3a158912e24 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseUserIdentity.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +/** Azure Active Directory identity configuration for a resource. */ +@Immutable +public class DatabaseUserIdentity { + /* + * The Azure Active Directory principal id. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private UUID principalId; + + /* + * The Azure Active Directory client id. + */ + @JsonProperty(value = "clientId", access = JsonProperty.Access.WRITE_ONLY) + private UUID clientId; + + /** Creates an instance of DatabaseUserIdentity class. */ + public DatabaseUserIdentity() { + } + + /** + * Get the principalId property: The Azure Active Directory principal id. + * + * @return the principalId value. + */ + public UUID principalId() { + return this.principalId; + } + + /** + * Get the clientId property: The Azure Active Directory client id. + * + * @return the clientId value. + */ + public UUID clientId() { + return this.clientId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseVulnerabilityAssessment.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseVulnerabilityAssessment.java new file mode 100644 index 0000000000000..8c9a5767488ef --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseVulnerabilityAssessment.java @@ -0,0 +1,276 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentInner; + +/** An immutable client-side representation of DatabaseVulnerabilityAssessment. */ +public interface DatabaseVulnerabilityAssessment { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the storageContainerPath property: 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. + */ + String storageContainerPath(); + + /** + * Gets the storageContainerSasKey property: 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. + */ + String storageContainerSasKey(); + + /** + * Gets the storageAccountAccessKey property: 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. + */ + String storageAccountAccessKey(); + + /** + * Gets the recurringScans property: The recurring scans settings. + * + * @return the recurringScans value. + */ + VulnerabilityAssessmentRecurringScansProperties recurringScans(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentInner object. + * + * @return the inner object. + */ + DatabaseVulnerabilityAssessmentInner innerModel(); + + /** The entirety of the DatabaseVulnerabilityAssessment definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The DatabaseVulnerabilityAssessment definition stages. */ + interface DefinitionStages { + /** The first stage of the DatabaseVulnerabilityAssessment definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the DatabaseVulnerabilityAssessment definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName, databaseName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database for which the vulnerability assessment is defined. + * @return the next definition stage. + */ + WithCreate withExistingDatabase(String resourceGroupName, String serverName, String databaseName); + } + /** + * The stage of the DatabaseVulnerabilityAssessment definition which contains all the minimum required + * properties for the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithStorageContainerPath, + DefinitionStages.WithStorageContainerSasKey, + DefinitionStages.WithStorageAccountAccessKey, + DefinitionStages.WithRecurringScans { + /** + * Executes the create request. + * + * @return the created resource. + */ + DatabaseVulnerabilityAssessment create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + DatabaseVulnerabilityAssessment create(Context context); + } + /** The stage of the DatabaseVulnerabilityAssessment definition allowing to specify storageContainerPath. */ + interface WithStorageContainerPath { + /** + * Specifies the storageContainerPath property: 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 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 next definition stage. + */ + WithCreate withStorageContainerPath(String storageContainerPath); + } + /** The stage of the DatabaseVulnerabilityAssessment definition allowing to specify storageContainerSasKey. */ + interface WithStorageContainerSasKey { + /** + * Specifies the storageContainerSasKey property: A shared access signature (SAS Key) that has write access + * to the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't + * specified, StorageContainerSasKey is required.. + * + * @param storageContainerSasKey A shared access signature (SAS Key) that has write access to the blob + * container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't + * specified, StorageContainerSasKey is required. + * @return the next definition stage. + */ + WithCreate withStorageContainerSasKey(String storageContainerSasKey); + } + /** The stage of the DatabaseVulnerabilityAssessment definition allowing to specify storageAccountAccessKey. */ + interface WithStorageAccountAccessKey { + /** + * Specifies the storageAccountAccessKey property: Specifies the identifier key of the storage account for + * vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified, + * storageAccountAccessKey is required.. + * + * @param storageAccountAccessKey Specifies the identifier key of the storage account for vulnerability + * assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is + * required. + * @return the next definition stage. + */ + WithCreate withStorageAccountAccessKey(String storageAccountAccessKey); + } + /** The stage of the DatabaseVulnerabilityAssessment definition allowing to specify recurringScans. */ + interface WithRecurringScans { + /** + * Specifies the recurringScans property: The recurring scans settings. + * + * @param recurringScans The recurring scans settings. + * @return the next definition stage. + */ + WithCreate withRecurringScans(VulnerabilityAssessmentRecurringScansProperties recurringScans); + } + } + /** + * Begins update for the DatabaseVulnerabilityAssessment resource. + * + * @return the stage of resource update. + */ + DatabaseVulnerabilityAssessment.Update update(); + + /** The template for DatabaseVulnerabilityAssessment update. */ + interface Update + extends UpdateStages.WithStorageContainerPath, + UpdateStages.WithStorageContainerSasKey, + UpdateStages.WithStorageAccountAccessKey, + UpdateStages.WithRecurringScans { + /** + * Executes the update request. + * + * @return the updated resource. + */ + DatabaseVulnerabilityAssessment apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + DatabaseVulnerabilityAssessment apply(Context context); + } + /** The DatabaseVulnerabilityAssessment update stages. */ + interface UpdateStages { + /** The stage of the DatabaseVulnerabilityAssessment update allowing to specify storageContainerPath. */ + interface WithStorageContainerPath { + /** + * Specifies the storageContainerPath property: 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 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 next definition stage. + */ + Update withStorageContainerPath(String storageContainerPath); + } + /** The stage of the DatabaseVulnerabilityAssessment update allowing to specify storageContainerSasKey. */ + interface WithStorageContainerSasKey { + /** + * Specifies the storageContainerSasKey property: A shared access signature (SAS Key) that has write access + * to the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't + * specified, StorageContainerSasKey is required.. + * + * @param storageContainerSasKey A shared access signature (SAS Key) that has write access to the blob + * container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't + * specified, StorageContainerSasKey is required. + * @return the next definition stage. + */ + Update withStorageContainerSasKey(String storageContainerSasKey); + } + /** The stage of the DatabaseVulnerabilityAssessment update allowing to specify storageAccountAccessKey. */ + interface WithStorageAccountAccessKey { + /** + * Specifies the storageAccountAccessKey property: Specifies the identifier key of the storage account for + * vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified, + * storageAccountAccessKey is required.. + * + * @param storageAccountAccessKey Specifies the identifier key of the storage account for vulnerability + * assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is + * required. + * @return the next definition stage. + */ + Update withStorageAccountAccessKey(String storageAccountAccessKey); + } + /** The stage of the DatabaseVulnerabilityAssessment update allowing to specify recurringScans. */ + interface WithRecurringScans { + /** + * Specifies the recurringScans property: The recurring scans settings. + * + * @param recurringScans The recurring scans settings. + * @return the next definition stage. + */ + Update withRecurringScans(VulnerabilityAssessmentRecurringScansProperties recurringScans); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + DatabaseVulnerabilityAssessment refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + DatabaseVulnerabilityAssessment refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseVulnerabilityAssessmentListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseVulnerabilityAssessmentListResult.java new file mode 100644 index 0000000000000..7f24fa7649a2c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseVulnerabilityAssessmentListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of the database's vulnerability assessments. */ +@Immutable +public final class DatabaseVulnerabilityAssessmentListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of DatabaseVulnerabilityAssessmentListResult class. */ + public DatabaseVulnerabilityAssessmentListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseVulnerabilityAssessmentRuleBaseline.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseVulnerabilityAssessmentRuleBaseline.java new file mode 100644 index 0000000000000..9f71d6fa01e7e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseVulnerabilityAssessmentRuleBaseline.java @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentRuleBaselineInner; +import java.util.List; + +/** An immutable client-side representation of DatabaseVulnerabilityAssessmentRuleBaseline. */ +public interface DatabaseVulnerabilityAssessmentRuleBaseline { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the baselineResults property: The rule baseline result. + * + * @return the baselineResults value. + */ + List baselineResults(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner + * com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentRuleBaselineInner object. + * + * @return the inner object. + */ + DatabaseVulnerabilityAssessmentRuleBaselineInner innerModel(); + + /** The entirety of the DatabaseVulnerabilityAssessmentRuleBaseline definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The DatabaseVulnerabilityAssessmentRuleBaseline definition stages. */ + interface DefinitionStages { + /** The first stage of the DatabaseVulnerabilityAssessmentRuleBaseline definition. */ + interface Blank extends WithParentResource { + } + /** + * The stage of the DatabaseVulnerabilityAssessmentRuleBaseline definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, ruleId. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param ruleId The vulnerability assessment rule ID. + * @return the next definition stage. + */ + WithCreate withExistingRule( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId); + } + /** + * The stage of the DatabaseVulnerabilityAssessmentRuleBaseline definition which contains all the minimum + * required properties for the resource to be created, but also allows for any other optional properties to be + * specified. + */ + interface WithCreate extends DefinitionStages.WithBaselineResults { + /** + * Executes the create request. + * + * @return the created resource. + */ + DatabaseVulnerabilityAssessmentRuleBaseline create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + DatabaseVulnerabilityAssessmentRuleBaseline create(Context context); + } + /** + * The stage of the DatabaseVulnerabilityAssessmentRuleBaseline definition allowing to specify baselineResults. + */ + interface WithBaselineResults { + /** + * Specifies the baselineResults property: The rule baseline result. + * + * @param baselineResults The rule baseline result. + * @return the next definition stage. + */ + WithCreate withBaselineResults(List baselineResults); + } + } + /** + * Begins update for the DatabaseVulnerabilityAssessmentRuleBaseline resource. + * + * @return the stage of resource update. + */ + DatabaseVulnerabilityAssessmentRuleBaseline.Update update(); + + /** The template for DatabaseVulnerabilityAssessmentRuleBaseline update. */ + interface Update extends UpdateStages.WithBaselineResults { + /** + * Executes the update request. + * + * @return the updated resource. + */ + DatabaseVulnerabilityAssessmentRuleBaseline apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + DatabaseVulnerabilityAssessmentRuleBaseline apply(Context context); + } + /** The DatabaseVulnerabilityAssessmentRuleBaseline update stages. */ + interface UpdateStages { + /** The stage of the DatabaseVulnerabilityAssessmentRuleBaseline update allowing to specify baselineResults. */ + interface WithBaselineResults { + /** + * Specifies the baselineResults property: The rule baseline result. + * + * @param baselineResults The rule baseline result. + * @return the next definition stage. + */ + Update withBaselineResults(List baselineResults); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + DatabaseVulnerabilityAssessmentRuleBaseline refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + DatabaseVulnerabilityAssessmentRuleBaseline refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseVulnerabilityAssessmentRuleBaselineItem.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseVulnerabilityAssessmentRuleBaselineItem.java new file mode 100644 index 0000000000000..2cc7079394a54 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseVulnerabilityAssessmentRuleBaselineItem.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties for an Azure SQL Database Vulnerability Assessment rule baseline's result. */ +@Fluent +public final class DatabaseVulnerabilityAssessmentRuleBaselineItem { + /* + * The rule baseline result + */ + @JsonProperty(value = "result", required = true) + private List result; + + /** Creates an instance of DatabaseVulnerabilityAssessmentRuleBaselineItem class. */ + public DatabaseVulnerabilityAssessmentRuleBaselineItem() { + } + + /** + * Get the result property: The rule baseline result. + * + * @return the result value. + */ + public List result() { + return this.result; + } + + /** + * Set the result property: 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (result() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property result in model DatabaseVulnerabilityAssessmentRuleBaselineItem")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DatabaseVulnerabilityAssessmentRuleBaselineItem.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseVulnerabilityAssessmentRuleBaselines.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseVulnerabilityAssessmentRuleBaselines.java new file mode 100644 index 0000000000000..0f815bf6ac0ed --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseVulnerabilityAssessmentRuleBaselines.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of DatabaseVulnerabilityAssessmentRuleBaselines. */ +public interface DatabaseVulnerabilityAssessmentRuleBaselines { + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's vulnerability assessment rule baseline along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's vulnerability assessment rule baseline. + */ + DatabaseVulnerabilityAssessmentRuleBaseline get( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName); + + /** + * Gets a database's vulnerability assessment rule baseline. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's vulnerability assessment rule baseline along with {@link Response}. + */ + DatabaseVulnerabilityAssessmentRuleBaseline getById(String id); + + /** + * Gets a database's vulnerability assessment rule baseline. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's vulnerability assessment rule baseline along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Removes the database's vulnerability assessment rule baseline. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Removes the database's vulnerability assessment rule baseline. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new DatabaseVulnerabilityAssessmentRuleBaseline resource. + * + * @param name resource name. + * @return the first stage of the new DatabaseVulnerabilityAssessmentRuleBaseline definition. + */ + DatabaseVulnerabilityAssessmentRuleBaseline.DefinitionStages.Blank define( + VulnerabilityAssessmentPolicyBaselineName name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseVulnerabilityAssessmentScans.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseVulnerabilityAssessmentScans.java new file mode 100644 index 0000000000000..67f26e93eb6d5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseVulnerabilityAssessmentScans.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of DatabaseVulnerabilityAssessmentScans. */ +public interface DatabaseVulnerabilityAssessmentScans { + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void initiateScan( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void initiateScan( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan records as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan records as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a vulnerability assessment scan record of a database along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a vulnerability assessment scan record of a database. + */ + VulnerabilityAssessmentScanRecord get( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database Vulnerability Assessment scan export resource along with {@link Response}. + */ + Response exportWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database Vulnerability Assessment scan export resource. + */ + DatabaseVulnerabilityAssessmentScansExport export( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseVulnerabilityAssessmentScansExport.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseVulnerabilityAssessmentScansExport.java new file mode 100644 index 0000000000000..9915c9f27281f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseVulnerabilityAssessmentScansExport.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentScansExportInner; + +/** An immutable client-side representation of DatabaseVulnerabilityAssessmentScansExport. */ +public interface DatabaseVulnerabilityAssessmentScansExport { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the exportedReportLocation property: Location of the exported report (e.g. + * https://myStorage.blob.core.windows.net/VaScans/scans/serverName/databaseName/scan_scanId.xlsx). + * + * @return the exportedReportLocation value. + */ + String exportedReportLocation(); + + /** + * Gets the inner + * com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentScansExportInner object. + * + * @return the inner object. + */ + DatabaseVulnerabilityAssessmentScansExportInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseVulnerabilityAssessments.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseVulnerabilityAssessments.java new file mode 100644 index 0000000000000..747871f4d5e34 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DatabaseVulnerabilityAssessments.java @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of DatabaseVulnerabilityAssessments. */ +public interface DatabaseVulnerabilityAssessments { + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the database's vulnerability assessment along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the database's vulnerability assessment. + */ + DatabaseVulnerabilityAssessment get( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete( + String resourceGroupName, + String serverName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the database's vulnerability assessments as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the database's vulnerability assessments as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Gets the database's vulnerability assessment. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the database's vulnerability assessment along with {@link Response}. + */ + DatabaseVulnerabilityAssessment getById(String id); + + /** + * Gets the database's vulnerability assessment. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the database's vulnerability assessment along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Removes the database's vulnerability assessment. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Removes the database's vulnerability assessment. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new DatabaseVulnerabilityAssessment resource. + * + * @param name resource name. + * @return the first stage of the new DatabaseVulnerabilityAssessment definition. + */ + DatabaseVulnerabilityAssessment.DefinitionStages.Blank define(VulnerabilityAssessmentName name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Databases.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Databases.java new file mode 100644 index 0000000000000..1220447a08ef8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Databases.java @@ -0,0 +1,495 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Databases. */ +public interface Databases { + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list database metrics request as paginated response with {@link PagedIterable}. + */ + PagedIterable listMetrics(String resourceGroupName, String serverName, String databaseName, String filter); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list database metrics request as paginated response with {@link PagedIterable}. + */ + PagedIterable listMetrics( + String resourceGroupName, String serverName, String databaseName, String filter, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list database metric definitions request as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listMetricDefinitions( + String resourceGroupName, String serverName, String databaseName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list database metric definitions request as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listMetricDefinitions( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of databases as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * 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 skipToken The skipToken parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of databases as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer( + String resourceGroupName, String serverName, String skipToken, Context context); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database. + */ + Database get(String resourceGroupName, String serverName, String databaseName); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, String databaseName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + ImportExportOperationResult export( + String resourceGroupName, String serverName, String databaseName, ExportDatabaseDefinition parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + ImportExportOperationResult export( + String resourceGroupName, + String serverName, + String databaseName, + ExportDatabaseDefinition parameters, + Context context); + + /** + * Failovers a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to failover. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void failover(String resourceGroupName, String serverName, String databaseName); + + /** + * Failovers a database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database to failover. + * @param replicaType The type of replica to be failed over. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void failover( + String resourceGroupName, String serverName, String databaseName, ReplicaType replicaType, Context context); + + /** + * 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 databaseName The name of the database. + * @param parameters The database import request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + ImportExportOperationResult importMethod( + String resourceGroupName, String serverName, String databaseName, ImportExistingDatabaseDefinition 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 databaseName The name of the database. + * @param parameters The database import request parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + ImportExportOperationResult importMethod( + String resourceGroupName, + String serverName, + String databaseName, + ImportExistingDatabaseDefinition parameters, + Context context); + + /** + * 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 parameters The resource move definition for renaming this database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response renameWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + ResourceMoveDefinition parameters, + Context context); + + /** + * 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 parameters The resource move definition for renaming this database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void rename(String resourceGroupName, String serverName, String databaseName, ResourceMoveDefinition 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. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database resource. + */ + Database pause(String resourceGroupName, String serverName, String databaseName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database resource. + */ + Database pause(String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database resource. + */ + Database resume(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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database resource. + */ + Database resume(String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void upgradeDataWarehouse(String resourceGroupName, String serverName, String databaseName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void upgradeDataWarehouse(String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of databases in an elastic pool as paginated response with {@link PagedIterable}. + */ + PagedIterable listByElasticPool(String resourceGroupName, String serverName, String elasticPoolName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of databases in an elastic pool as paginated response with {@link PagedIterable}. + */ + PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName, Context context); + + /** + * Gets a list of inaccessible databases in a logical server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of inaccessible databases in a logical server as paginated response with {@link PagedIterable}. + */ + PagedIterable listInaccessibleByServer(String resourceGroupName, String serverName); + + /** + * Gets a list of inaccessible databases in a logical server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of inaccessible databases in a logical server as paginated response with {@link PagedIterable}. + */ + PagedIterable listInaccessibleByServer(String resourceGroupName, String serverName, Context context); + + /** + * Gets a database. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database along with {@link Response}. + */ + Database getById(String id); + + /** + * Gets a database. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the database. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes the database. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Database resource. + * + * @param name resource name. + * @return the first stage of the new Database definition. + */ + Database.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DayOfWeek.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DayOfWeek.java new file mode 100644 index 0000000000000..450ae5adee9c1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DayOfWeek.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Day of maintenance window. */ +public final class DayOfWeek extends ExpandableStringEnum { + /** Static value Sunday for DayOfWeek. */ + public static final DayOfWeek SUNDAY = fromString("Sunday"); + + /** Static value Monday for DayOfWeek. */ + public static final DayOfWeek MONDAY = fromString("Monday"); + + /** Static value Tuesday for DayOfWeek. */ + public static final DayOfWeek TUESDAY = fromString("Tuesday"); + + /** Static value Wednesday for DayOfWeek. */ + public static final DayOfWeek WEDNESDAY = fromString("Wednesday"); + + /** Static value Thursday for DayOfWeek. */ + public static final DayOfWeek THURSDAY = fromString("Thursday"); + + /** Static value Friday for DayOfWeek. */ + public static final DayOfWeek FRIDAY = fromString("Friday"); + + /** Static value Saturday for DayOfWeek. */ + public static final DayOfWeek SATURDAY = fromString("Saturday"); + + /** + * Creates or finds a DayOfWeek from its string representation. + * + * @param name a name to look for. + * @return the corresponding DayOfWeek. + */ + @JsonCreator + public static DayOfWeek fromString(String name) { + return fromString(name, DayOfWeek.class); + } + + /** + * Gets known DayOfWeek values. + * + * @return known DayOfWeek values. + */ + public static Collection values() { + return values(DayOfWeek.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DeletedServer.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DeletedServer.java new file mode 100644 index 0000000000000..6b156a354e64a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DeletedServer.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.DeletedServerInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of DeletedServer. */ +public interface DeletedServer { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the version property: The version of the deleted server. + * + * @return the version value. + */ + String version(); + + /** + * Gets the deletionTime property: The deletion time of the deleted server. + * + * @return the deletionTime value. + */ + OffsetDateTime deletionTime(); + + /** + * Gets the originalId property: The original ID of the server before deletion. + * + * @return the originalId value. + */ + String originalId(); + + /** + * Gets the fullyQualifiedDomainName property: The fully qualified domain name of the server. + * + * @return the fullyQualifiedDomainName value. + */ + String fullyQualifiedDomainName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.DeletedServerInner object. + * + * @return the inner object. + */ + DeletedServerInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DeletedServerListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DeletedServerListResult.java new file mode 100644 index 0000000000000..ce7e1be2f9d23 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DeletedServerListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.DeletedServerInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of deleted servers. */ +@Immutable +public final class DeletedServerListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of DeletedServerListResult class. */ + public DeletedServerListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DeletedServers.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DeletedServers.java new file mode 100644 index 0000000000000..ee80c599d86c0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DeletedServers.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of DeletedServers. */ +public interface DeletedServers { + /** + * Gets a list of all deleted servers in a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all deleted servers in a subscription as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Gets a list of all deleted servers in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all deleted servers in a subscription as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Gets a deleted server. + * + * @param locationName The name of the region where the resource is located. + * @param deletedServerName The name of the deleted server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deleted server along with {@link Response}. + */ + Response getWithResponse(String locationName, String deletedServerName, Context context); + + /** + * Gets a deleted server. + * + * @param locationName The name of the region where the resource is located. + * @param deletedServerName The name of the deleted server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deleted server. + */ + DeletedServer get(String locationName, String deletedServerName); + + /** + * Gets a list of deleted servers for a location. + * + * @param locationName The name of the region where the resource is located. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of deleted servers for a location as paginated response with {@link PagedIterable}. + */ + PagedIterable listByLocation(String locationName); + + /** + * Gets a list of deleted servers for a location. + * + * @param locationName The name of the region where the resource is located. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of deleted servers for a location as paginated response with {@link PagedIterable}. + */ + PagedIterable listByLocation(String locationName, Context context); + + /** + * Recovers a deleted server. + * + * @param locationName The name of the region where the resource is located. + * @param deletedServerName The name of the deleted server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deleted server. + */ + DeletedServer recover(String locationName, String deletedServerName); + + /** + * Recovers a deleted server. + * + * @param locationName The name of the region where the resource is located. + * @param deletedServerName The name of the deleted server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a deleted server. + */ + DeletedServer recover(String locationName, String deletedServerName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DevOpsAuditingSettingsName.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DevOpsAuditingSettingsName.java new file mode 100644 index 0000000000000..7520b96e57ab2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DevOpsAuditingSettingsName.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for DevOpsAuditingSettingsName. */ +public final class DevOpsAuditingSettingsName extends ExpandableStringEnum { + /** Static value Default for DevOpsAuditingSettingsName. */ + public static final DevOpsAuditingSettingsName DEFAULT = fromString("Default"); + + /** + * Creates or finds a DevOpsAuditingSettingsName from its string representation. + * + * @param name a name to look for. + * @return the corresponding DevOpsAuditingSettingsName. + */ + @JsonCreator + public static DevOpsAuditingSettingsName fromString(String name) { + return fromString(name, DevOpsAuditingSettingsName.class); + } + + /** + * Gets known DevOpsAuditingSettingsName values. + * + * @return known DevOpsAuditingSettingsName values. + */ + public static Collection values() { + return values(DevOpsAuditingSettingsName.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DiffBackupIntervalInHours.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DiffBackupIntervalInHours.java new file mode 100644 index 0000000000000..226baa6728901 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DiffBackupIntervalInHours.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * The differential backup interval in hours. This is how many interval hours between each differential backup will be + * supported. This is only applicable to live databases but not dropped databases. + */ +public final class DiffBackupIntervalInHours extends ExpandableStringEnum { + /** Static value 12 for DiffBackupIntervalInHours. */ + public static final DiffBackupIntervalInHours ONE_TWO = fromInt(12); + + /** Static value 24 for DiffBackupIntervalInHours. */ + public static final DiffBackupIntervalInHours TWO_FOUR = fromInt(24); + + /** + * Creates or finds a DiffBackupIntervalInHours from its string representation. + * + * @param name a name to look for. + * @return the corresponding DiffBackupIntervalInHours. + */ + @JsonCreator + public static DiffBackupIntervalInHours fromInt(int name) { + return fromString(String.valueOf(name), DiffBackupIntervalInHours.class); + } + + /** + * Gets known DiffBackupIntervalInHours values. + * + * @return known DiffBackupIntervalInHours values. + */ + public static Collection values() { + return values(DiffBackupIntervalInHours.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DistributedAvailabilityGroup.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DistributedAvailabilityGroup.java new file mode 100644 index 0000000000000..7717da799f6d1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DistributedAvailabilityGroup.java @@ -0,0 +1,320 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DistributedAvailabilityGroupInner; +import java.util.UUID; + +/** An immutable client-side representation of DistributedAvailabilityGroup. */ +public interface DistributedAvailabilityGroup { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the targetDatabase property: The name of the target database. + * + * @return the targetDatabase value. + */ + String targetDatabase(); + + /** + * Gets the sourceEndpoint property: The source endpoint. + * + * @return the sourceEndpoint value. + */ + String sourceEndpoint(); + + /** + * Gets the primaryAvailabilityGroupName property: The primary availability group name. + * + * @return the primaryAvailabilityGroupName value. + */ + String primaryAvailabilityGroupName(); + + /** + * Gets the secondaryAvailabilityGroupName property: The secondary availability group name. + * + * @return the secondaryAvailabilityGroupName value. + */ + String secondaryAvailabilityGroupName(); + + /** + * Gets the replicationMode property: The replication mode of a distributed availability group. Parameter will be + * ignored during link creation. + * + * @return the replicationMode value. + */ + ReplicationMode replicationMode(); + + /** + * Gets the distributedAvailabilityGroupId property: The distributed availability group id. + * + * @return the distributedAvailabilityGroupId value. + */ + UUID distributedAvailabilityGroupId(); + + /** + * Gets the sourceReplicaId property: The source replica id. + * + * @return the sourceReplicaId value. + */ + UUID sourceReplicaId(); + + /** + * Gets the targetReplicaId property: The target replica id. + * + * @return the targetReplicaId value. + */ + UUID targetReplicaId(); + + /** + * Gets the linkState property: The link state. + * + * @return the linkState value. + */ + String linkState(); + + /** + * Gets the lastHardenedLsn property: The last hardened lsn. + * + * @return the lastHardenedLsn value. + */ + String lastHardenedLsn(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.DistributedAvailabilityGroupInner object. + * + * @return the inner object. + */ + DistributedAvailabilityGroupInner innerModel(); + + /** The entirety of the DistributedAvailabilityGroup definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The DistributedAvailabilityGroup definition stages. */ + interface DefinitionStages { + /** The first stage of the DistributedAvailabilityGroup definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the DistributedAvailabilityGroup definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, managedInstanceName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @return the next definition stage. + */ + WithCreate withExistingManagedInstance(String resourceGroupName, String managedInstanceName); + } + /** + * The stage of the DistributedAvailabilityGroup definition which contains all the minimum required properties + * for the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTargetDatabase, + DefinitionStages.WithSourceEndpoint, + DefinitionStages.WithPrimaryAvailabilityGroupName, + DefinitionStages.WithSecondaryAvailabilityGroupName, + DefinitionStages.WithReplicationMode { + /** + * Executes the create request. + * + * @return the created resource. + */ + DistributedAvailabilityGroup create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + DistributedAvailabilityGroup create(Context context); + } + /** The stage of the DistributedAvailabilityGroup definition allowing to specify targetDatabase. */ + interface WithTargetDatabase { + /** + * Specifies the targetDatabase property: The name of the target database. + * + * @param targetDatabase The name of the target database. + * @return the next definition stage. + */ + WithCreate withTargetDatabase(String targetDatabase); + } + /** The stage of the DistributedAvailabilityGroup definition allowing to specify sourceEndpoint. */ + interface WithSourceEndpoint { + /** + * Specifies the sourceEndpoint property: The source endpoint. + * + * @param sourceEndpoint The source endpoint. + * @return the next definition stage. + */ + WithCreate withSourceEndpoint(String sourceEndpoint); + } + /** + * The stage of the DistributedAvailabilityGroup definition allowing to specify primaryAvailabilityGroupName. + */ + interface WithPrimaryAvailabilityGroupName { + /** + * Specifies the primaryAvailabilityGroupName property: The primary availability group name. + * + * @param primaryAvailabilityGroupName The primary availability group name. + * @return the next definition stage. + */ + WithCreate withPrimaryAvailabilityGroupName(String primaryAvailabilityGroupName); + } + /** + * The stage of the DistributedAvailabilityGroup definition allowing to specify secondaryAvailabilityGroupName. + */ + interface WithSecondaryAvailabilityGroupName { + /** + * Specifies the secondaryAvailabilityGroupName property: The secondary availability group name. + * + * @param secondaryAvailabilityGroupName The secondary availability group name. + * @return the next definition stage. + */ + WithCreate withSecondaryAvailabilityGroupName(String secondaryAvailabilityGroupName); + } + /** The stage of the DistributedAvailabilityGroup definition allowing to specify replicationMode. */ + interface WithReplicationMode { + /** + * Specifies the replicationMode property: The replication mode of a distributed availability group. + * Parameter will be ignored during link creation.. + * + * @param replicationMode The replication mode of a distributed availability group. Parameter will be + * ignored during link creation. + * @return the next definition stage. + */ + WithCreate withReplicationMode(ReplicationMode replicationMode); + } + } + /** + * Begins update for the DistributedAvailabilityGroup resource. + * + * @return the stage of resource update. + */ + DistributedAvailabilityGroup.Update update(); + + /** The template for DistributedAvailabilityGroup update. */ + interface Update + extends UpdateStages.WithTargetDatabase, + UpdateStages.WithSourceEndpoint, + UpdateStages.WithPrimaryAvailabilityGroupName, + UpdateStages.WithSecondaryAvailabilityGroupName, + UpdateStages.WithReplicationMode { + /** + * Executes the update request. + * + * @return the updated resource. + */ + DistributedAvailabilityGroup apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + DistributedAvailabilityGroup apply(Context context); + } + /** The DistributedAvailabilityGroup update stages. */ + interface UpdateStages { + /** The stage of the DistributedAvailabilityGroup update allowing to specify targetDatabase. */ + interface WithTargetDatabase { + /** + * Specifies the targetDatabase property: The name of the target database. + * + * @param targetDatabase The name of the target database. + * @return the next definition stage. + */ + Update withTargetDatabase(String targetDatabase); + } + /** The stage of the DistributedAvailabilityGroup update allowing to specify sourceEndpoint. */ + interface WithSourceEndpoint { + /** + * Specifies the sourceEndpoint property: The source endpoint. + * + * @param sourceEndpoint The source endpoint. + * @return the next definition stage. + */ + Update withSourceEndpoint(String sourceEndpoint); + } + /** The stage of the DistributedAvailabilityGroup update allowing to specify primaryAvailabilityGroupName. */ + interface WithPrimaryAvailabilityGroupName { + /** + * Specifies the primaryAvailabilityGroupName property: The primary availability group name. + * + * @param primaryAvailabilityGroupName The primary availability group name. + * @return the next definition stage. + */ + Update withPrimaryAvailabilityGroupName(String primaryAvailabilityGroupName); + } + /** The stage of the DistributedAvailabilityGroup update allowing to specify secondaryAvailabilityGroupName. */ + interface WithSecondaryAvailabilityGroupName { + /** + * Specifies the secondaryAvailabilityGroupName property: The secondary availability group name. + * + * @param secondaryAvailabilityGroupName The secondary availability group name. + * @return the next definition stage. + */ + Update withSecondaryAvailabilityGroupName(String secondaryAvailabilityGroupName); + } + /** The stage of the DistributedAvailabilityGroup update allowing to specify replicationMode. */ + interface WithReplicationMode { + /** + * Specifies the replicationMode property: The replication mode of a distributed availability group. + * Parameter will be ignored during link creation.. + * + * @param replicationMode The replication mode of a distributed availability group. Parameter will be + * ignored during link creation. + * @return the next definition stage. + */ + Update withReplicationMode(ReplicationMode replicationMode); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + DistributedAvailabilityGroup refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + DistributedAvailabilityGroup refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DistributedAvailabilityGroups.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DistributedAvailabilityGroups.java new file mode 100644 index 0000000000000..3c1602340c9ae --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DistributedAvailabilityGroups.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of DistributedAvailabilityGroups. */ +public interface DistributedAvailabilityGroups { + /** + * Gets a list of a distributed availability groups in 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of a distributed availability groups in instance as paginated response with {@link PagedIterable}. + */ + PagedIterable listByInstance(String resourceGroupName, String managedInstanceName); + + /** + * Gets a list of a distributed availability groups in 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of a distributed availability groups in instance as paginated response with {@link PagedIterable}. + */ + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * Gets a distributed availability group info. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param distributedAvailabilityGroupName The distributed availability group name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a distributed availability group info along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String managedInstanceName, String distributedAvailabilityGroupName, Context context); + + /** + * Gets a distributed availability group info. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param distributedAvailabilityGroupName The distributed availability group name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a distributed availability group info. + */ + DistributedAvailabilityGroup get( + String resourceGroupName, String managedInstanceName, String distributedAvailabilityGroupName); + + /** + * Drops a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String managedInstanceName, String distributedAvailabilityGroupName); + + /** + * Drops a distributed availability group between Sql On-Prem and Sql 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 distributedAvailabilityGroupName The distributed availability group name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete( + String resourceGroupName, String managedInstanceName, String distributedAvailabilityGroupName, Context context); + + /** + * Gets a distributed availability group info. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a distributed availability group info along with {@link Response}. + */ + DistributedAvailabilityGroup getById(String id); + + /** + * Gets a distributed availability group info. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a distributed availability group info along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Drops a distributed availability group between Sql On-Prem and Sql Managed Instance. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Drops a distributed availability group between Sql On-Prem and Sql Managed Instance. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new DistributedAvailabilityGroup resource. + * + * @param name resource name. + * @return the first stage of the new DistributedAvailabilityGroup definition. + */ + DistributedAvailabilityGroup.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DistributedAvailabilityGroupsListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DistributedAvailabilityGroupsListResult.java new file mode 100644 index 0000000000000..9b07174d6aa49 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DistributedAvailabilityGroupsListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.DistributedAvailabilityGroupInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of distributed availability groups in instance. */ +@Immutable +public final class DistributedAvailabilityGroupsListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of DistributedAvailabilityGroupsListResult class. */ + public DistributedAvailabilityGroupsListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DnsRefreshOperationStatus.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DnsRefreshOperationStatus.java new file mode 100644 index 0000000000000..b3057d6ba5bfd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DnsRefreshOperationStatus.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The status of the DNS refresh operation. */ +public final class DnsRefreshOperationStatus extends ExpandableStringEnum { + /** Static value Succeeded for DnsRefreshOperationStatus. */ + public static final DnsRefreshOperationStatus SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for DnsRefreshOperationStatus. */ + public static final DnsRefreshOperationStatus FAILED = fromString("Failed"); + + /** Static value InProgress for DnsRefreshOperationStatus. */ + public static final DnsRefreshOperationStatus IN_PROGRESS = fromString("InProgress"); + + /** + * Creates or finds a DnsRefreshOperationStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding DnsRefreshOperationStatus. + */ + @JsonCreator + public static DnsRefreshOperationStatus fromString(String name) { + return fromString(name, DnsRefreshOperationStatus.class); + } + + /** + * Gets known DnsRefreshOperationStatus values. + * + * @return known DnsRefreshOperationStatus values. + */ + public static Collection values() { + return values(DnsRefreshOperationStatus.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DtcName.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DtcName.java new file mode 100644 index 0000000000000..f4dcb2d579b62 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/DtcName.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for DtcName. */ +public final class DtcName extends ExpandableStringEnum { + /** Static value current for DtcName. */ + public static final DtcName CURRENT = fromString("current"); + + /** + * Creates or finds a DtcName from its string representation. + * + * @param name a name to look for. + * @return the corresponding DtcName. + */ + @JsonCreator + public static DtcName fromString(String name) { + return fromString(name, DtcName.class); + } + + /** + * Gets known DtcName values. + * + * @return known DtcName values. + */ + public static Collection values() { + return values(DtcName.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/EditionCapability.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/EditionCapability.java new file mode 100644 index 0000000000000..10abb7a68c0f1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/EditionCapability.java @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The edition capability. */ +@Fluent +public final 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 read scale capability for the edition. + */ + @JsonProperty(value = "readScale", access = JsonProperty.Access.WRITE_ONLY) + private ReadScaleCapability readScale; + + /* + * The list of supported storage capabilities for this edition + */ + @JsonProperty(value = "supportedStorageCapabilities", access = JsonProperty.Access.WRITE_ONLY) + private List supportedStorageCapabilities; + + /* + * The status of the capability. + */ + @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; + + /** Creates an instance of EditionCapability class. */ + public EditionCapability() { + } + + /** + * Get the name property: The database edition name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the supportedServiceLevelObjectives property: The list of supported service objectives for the edition. + * + * @return the supportedServiceLevelObjectives value. + */ + public List supportedServiceLevelObjectives() { + return this.supportedServiceLevelObjectives; + } + + /** + * Get the zoneRedundant property: Whether or not zone redundancy is supported for the edition. + * + * @return the zoneRedundant value. + */ + public Boolean zoneRedundant() { + return this.zoneRedundant; + } + + /** + * Get the readScale property: The read scale capability for the edition. + * + * @return the readScale value. + */ + public ReadScaleCapability readScale() { + return this.readScale; + } + + /** + * Get the supportedStorageCapabilities property: The list of supported storage capabilities for this edition. + * + * @return the supportedStorageCapabilities value. + */ + public List supportedStorageCapabilities() { + return this.supportedStorageCapabilities; + } + + /** + * Get the status property: The status of the capability. + * + * @return the status value. + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason property: The reason for the capability not being available. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (supportedServiceLevelObjectives() != null) { + supportedServiceLevelObjectives().forEach(e -> e.validate()); + } + if (readScale() != null) { + readScale().validate(); + } + if (supportedStorageCapabilities() != null) { + supportedStorageCapabilities().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPool.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPool.java new file mode 100644 index 0000000000000..99089f5204cb1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPool.java @@ -0,0 +1,477 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ElasticPoolInner; +import java.time.OffsetDateTime; +import java.util.Map; + +/** An immutable client-side representation of ElasticPool. */ +public interface ElasticPool { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the sku property: The elastic pool SKU. + * + *

The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU name, + * tier/edition, family, and capacity) that are available to your subscription in an Azure region, use the + * `Capabilities_ListByLocation` REST API or the following command: + * + *

```azurecli az sql elastic-pool list-editions -l <location> -o table ````. + * + * @return the sku value. + */ + Sku sku(); + + /** + * Gets the kind property: Kind of elastic pool. This is metadata used for the Azure portal experience. + * + * @return the kind value. + */ + String kind(); + + /** + * Gets the state property: The state of the elastic pool. + * + * @return the state value. + */ + ElasticPoolState state(); + + /** + * Gets the creationDate property: The creation date of the elastic pool (ISO8601 format). + * + * @return the creationDate value. + */ + OffsetDateTime creationDate(); + + /** + * Gets the maxSizeBytes property: The storage limit for the database elastic pool in bytes. + * + * @return the maxSizeBytes value. + */ + Long maxSizeBytes(); + + /** + * Gets the perDatabaseSettings property: The per database settings for the elastic pool. + * + * @return the perDatabaseSettings value. + */ + ElasticPoolPerDatabaseSettings perDatabaseSettings(); + + /** + * Gets the zoneRedundant property: 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. + */ + Boolean zoneRedundant(); + + /** + * Gets the licenseType property: The license type to apply for this elastic pool. + * + * @return the licenseType value. + */ + ElasticPoolLicenseType licenseType(); + + /** + * Gets the maintenanceConfigurationId property: Maintenance configuration id assigned to the elastic pool. This + * configuration defines the period when the maintenance updates will will occur. + * + * @return the maintenanceConfigurationId value. + */ + String maintenanceConfigurationId(); + + /** + * Gets the highAvailabilityReplicaCount property: The number of secondary replicas associated with the elastic pool + * that are used to provide high availability. + * + * @return the highAvailabilityReplicaCount value. + */ + Integer highAvailabilityReplicaCount(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ElasticPoolInner object. + * + * @return the inner object. + */ + ElasticPoolInner innerModel(); + + /** The entirety of the ElasticPool definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, + DefinitionStages.WithCreate { + } + /** The ElasticPool definition stages. */ + interface DefinitionStages { + /** The first stage of the ElasticPool definition. */ + interface Blank extends WithLocation { + } + /** The stage of the ElasticPool definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + /** The stage of the ElasticPool definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @return the next definition stage. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + /** + * The stage of the ElasticPool definition which contains all the minimum required properties for the resource + * to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithSku, + DefinitionStages.WithMaxSizeBytes, + DefinitionStages.WithPerDatabaseSettings, + DefinitionStages.WithZoneRedundant, + DefinitionStages.WithLicenseType, + DefinitionStages.WithMaintenanceConfigurationId, + DefinitionStages.WithHighAvailabilityReplicaCount { + /** + * Executes the create request. + * + * @return the created resource. + */ + ElasticPool create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ElasticPool create(Context context); + } + /** The stage of the ElasticPool definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the ElasticPool definition allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: The elastic pool SKU. + * + *

The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU name, + * tier/edition, family, and capacity) that are available to your subscription in an Azure region, use the + * `Capabilities_ListByLocation` REST API or the following command: + * + *

```azurecli az sql elastic-pool list-editions -l <location> -o table ```` . + * + * @param sku The elastic pool SKU. + *

The list of SKUs may vary by region and support offer. To determine the SKUs (including the SKU + * name, tier/edition, family, and capacity) that are available to your subscription in an Azure region, + * use the `Capabilities_ListByLocation` REST API or the following command: + *

```azurecli az sql elastic-pool list-editions -l <location> -o table ````. + * @return the next definition stage. + */ + WithCreate withSku(Sku sku); + } + /** The stage of the ElasticPool definition allowing to specify maxSizeBytes. */ + interface WithMaxSizeBytes { + /** + * Specifies the maxSizeBytes property: The storage limit for the database elastic pool in bytes.. + * + * @param maxSizeBytes The storage limit for the database elastic pool in bytes. + * @return the next definition stage. + */ + WithCreate withMaxSizeBytes(Long maxSizeBytes); + } + /** The stage of the ElasticPool definition allowing to specify perDatabaseSettings. */ + interface WithPerDatabaseSettings { + /** + * Specifies the perDatabaseSettings property: The per database settings for the elastic pool.. + * + * @param perDatabaseSettings The per database settings for the elastic pool. + * @return the next definition stage. + */ + WithCreate withPerDatabaseSettings(ElasticPoolPerDatabaseSettings perDatabaseSettings); + } + /** The stage of the ElasticPool definition allowing to specify zoneRedundant. */ + interface WithZoneRedundant { + /** + * Specifies the zoneRedundant property: 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 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 next definition stage. + */ + WithCreate withZoneRedundant(Boolean zoneRedundant); + } + /** The stage of the ElasticPool definition allowing to specify licenseType. */ + interface WithLicenseType { + /** + * Specifies the licenseType property: The license type to apply for this elastic pool.. + * + * @param licenseType The license type to apply for this elastic pool. + * @return the next definition stage. + */ + WithCreate withLicenseType(ElasticPoolLicenseType licenseType); + } + /** The stage of the ElasticPool definition allowing to specify maintenanceConfigurationId. */ + interface WithMaintenanceConfigurationId { + /** + * Specifies the maintenanceConfigurationId property: Maintenance configuration id assigned to the elastic + * pool. This configuration defines the period when the maintenance updates will will occur.. + * + * @param maintenanceConfigurationId Maintenance configuration id assigned to the elastic pool. This + * configuration defines the period when the maintenance updates will will occur. + * @return the next definition stage. + */ + WithCreate withMaintenanceConfigurationId(String maintenanceConfigurationId); + } + /** The stage of the ElasticPool definition allowing to specify highAvailabilityReplicaCount. */ + interface WithHighAvailabilityReplicaCount { + /** + * Specifies the highAvailabilityReplicaCount property: The number of secondary replicas associated with the + * elastic pool that are used to provide high availability.. + * + * @param highAvailabilityReplicaCount The number of secondary replicas associated with the elastic pool + * that are used to provide high availability. + * @return the next definition stage. + */ + WithCreate withHighAvailabilityReplicaCount(Integer highAvailabilityReplicaCount); + } + } + /** + * Begins update for the ElasticPool resource. + * + * @return the stage of resource update. + */ + ElasticPool.Update update(); + + /** The template for ElasticPool update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithSku, + UpdateStages.WithMaxSizeBytes, + UpdateStages.WithPerDatabaseSettings, + UpdateStages.WithZoneRedundant, + UpdateStages.WithLicenseType, + UpdateStages.WithMaintenanceConfigurationId, + UpdateStages.WithHighAvailabilityReplicaCount { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ElasticPool apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ElasticPool apply(Context context); + } + /** The ElasticPool update stages. */ + interface UpdateStages { + /** The stage of the ElasticPool update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the ElasticPool update allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: An ARM Resource SKU.. + * + * @param sku An ARM Resource SKU. + * @return the next definition stage. + */ + Update withSku(Sku sku); + } + /** The stage of the ElasticPool update allowing to specify maxSizeBytes. */ + interface WithMaxSizeBytes { + /** + * Specifies the maxSizeBytes property: The storage limit for the database elastic pool in bytes.. + * + * @param maxSizeBytes The storage limit for the database elastic pool in bytes. + * @return the next definition stage. + */ + Update withMaxSizeBytes(Long maxSizeBytes); + } + /** The stage of the ElasticPool update allowing to specify perDatabaseSettings. */ + interface WithPerDatabaseSettings { + /** + * Specifies the perDatabaseSettings property: The per database settings for the elastic pool.. + * + * @param perDatabaseSettings The per database settings for the elastic pool. + * @return the next definition stage. + */ + Update withPerDatabaseSettings(ElasticPoolPerDatabaseSettings perDatabaseSettings); + } + /** The stage of the ElasticPool update allowing to specify zoneRedundant. */ + interface WithZoneRedundant { + /** + * Specifies the zoneRedundant property: 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 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 next definition stage. + */ + Update withZoneRedundant(Boolean zoneRedundant); + } + /** The stage of the ElasticPool update allowing to specify licenseType. */ + interface WithLicenseType { + /** + * Specifies the licenseType property: The license type to apply for this elastic pool.. + * + * @param licenseType The license type to apply for this elastic pool. + * @return the next definition stage. + */ + Update withLicenseType(ElasticPoolLicenseType licenseType); + } + /** The stage of the ElasticPool update allowing to specify maintenanceConfigurationId. */ + interface WithMaintenanceConfigurationId { + /** + * Specifies the maintenanceConfigurationId property: Maintenance configuration id assigned to the elastic + * pool. This configuration defines the period when the maintenance updates will will occur.. + * + * @param maintenanceConfigurationId Maintenance configuration id assigned to the elastic pool. This + * configuration defines the period when the maintenance updates will will occur. + * @return the next definition stage. + */ + Update withMaintenanceConfigurationId(String maintenanceConfigurationId); + } + /** The stage of the ElasticPool update allowing to specify highAvailabilityReplicaCount. */ + interface WithHighAvailabilityReplicaCount { + /** + * Specifies the highAvailabilityReplicaCount property: The number of secondary replicas associated with the + * elastic pool that are used to provide high availability. Applicable only to Hyperscale elastic pools.. + * + * @param highAvailabilityReplicaCount The number of secondary replicas associated with the elastic pool + * that are used to provide high availability. Applicable only to Hyperscale elastic pools. + * @return the next definition stage. + */ + Update withHighAvailabilityReplicaCount(Integer highAvailabilityReplicaCount); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ElasticPool refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ElasticPool refresh(Context context); + + /** + * Failovers an elastic pool. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void failover(); + + /** + * Failovers an elastic pool. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void failover(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolActivities.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolActivities.java new file mode 100644 index 0000000000000..ba52fe8a54102 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolActivities.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of ElasticPoolActivities. */ +public interface ElasticPoolActivities { + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a list elastic pool activity request as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a list elastic pool activity request as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolActivity.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolActivity.java new file mode 100644 index 0000000000000..11fc1d4ebeefa --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolActivity.java @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.ElasticPoolActivityInner; +import java.time.OffsetDateTime; +import java.util.UUID; + +/** An immutable client-side representation of ElasticPoolActivity. */ +public interface ElasticPoolActivity { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the endTime property: The time the operation finished (ISO8601 format). + * + * @return the endTime value. + */ + OffsetDateTime endTime(); + + /** + * Gets the errorCode property: The error code if available. + * + * @return the errorCode value. + */ + Integer errorCode(); + + /** + * Gets the errorMessage property: The error message if available. + * + * @return the errorMessage value. + */ + String errorMessage(); + + /** + * Gets the errorSeverity property: The error severity if available. + * + * @return the errorSeverity value. + */ + Integer errorSeverity(); + + /** + * Gets the operation property: The operation name. + * + * @return the operation value. + */ + String operation(); + + /** + * Gets the operationId property: The unique operation ID. + * + * @return the operationId value. + */ + UUID operationId(); + + /** + * Gets the percentComplete property: The percentage complete if available. + * + * @return the percentComplete value. + */ + Integer percentComplete(); + + /** + * Gets the requestedDatabaseDtuMax property: The requested max DTU per database if available. + * + * @return the requestedDatabaseDtuMax value. + */ + Integer requestedDatabaseDtuMax(); + + /** + * Gets the requestedDatabaseDtuMin property: The requested min DTU per database if available. + * + * @return the requestedDatabaseDtuMin value. + */ + Integer requestedDatabaseDtuMin(); + + /** + * Gets the requestedDtu property: The requested DTU for the pool if available. + * + * @return the requestedDtu value. + */ + Integer requestedDtu(); + + /** + * Gets the requestedElasticPoolName property: The requested name for the elastic pool if available. + * + * @return the requestedElasticPoolName value. + */ + String requestedElasticPoolName(); + + /** + * Gets the requestedStorageLimitInGB property: The requested storage limit for the pool in GB if available. + * + * @return the requestedStorageLimitInGB value. + */ + Long requestedStorageLimitInGB(); + + /** + * Gets the elasticPoolName property: The name of the elastic pool. + * + * @return the elasticPoolName value. + */ + String elasticPoolName(); + + /** + * Gets the serverName property: The name of the server the elastic pool is in. + * + * @return the serverName value. + */ + String serverName(); + + /** + * Gets the startTime property: The time the operation started (ISO8601 format). + * + * @return the startTime value. + */ + OffsetDateTime startTime(); + + /** + * Gets the state property: The current state of the operation. + * + * @return the state value. + */ + String state(); + + /** + * Gets the requestedStorageLimitInMB property: The requested storage limit in MB. + * + * @return the requestedStorageLimitInMB value. + */ + Integer requestedStorageLimitInMB(); + + /** + * Gets the requestedDatabaseDtuGuarantee property: The requested per database DTU guarantee. + * + * @return the requestedDatabaseDtuGuarantee value. + */ + Integer requestedDatabaseDtuGuarantee(); + + /** + * Gets the requestedDatabaseDtuCap property: The requested per database DTU cap. + * + * @return the requestedDatabaseDtuCap value. + */ + Integer requestedDatabaseDtuCap(); + + /** + * Gets the requestedDtuGuarantee property: The requested DTU guarantee. + * + * @return the requestedDtuGuarantee value. + */ + Integer requestedDtuGuarantee(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ElasticPoolActivityInner object. + * + * @return the inner object. + */ + ElasticPoolActivityInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolActivityListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolActivityListResult.java new file mode 100644 index 0000000000000..0ceaf56a2620e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolActivityListResult.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.ElasticPoolActivityInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Represents the response to a list elastic pool activity request. */ +@Fluent +public final class ElasticPoolActivityListResult { + /* + * The list of elastic pool activities. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /** Creates an instance of ElasticPoolActivityListResult class. */ + public ElasticPoolActivityListResult() { + } + + /** + * Get the value property: The list of elastic pool activities. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of elastic pool activities. + * + * @param value the value value to set. + * @return the ElasticPoolActivityListResult object itself. + */ + public ElasticPoolActivityListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property value in model ElasticPoolActivityListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ElasticPoolActivityListResult.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolDatabaseActivities.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolDatabaseActivities.java new file mode 100644 index 0000000000000..cea574cff6b98 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolDatabaseActivities.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of ElasticPoolDatabaseActivities. */ +public interface ElasticPoolDatabaseActivities { + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a list elastic pool database activity request as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a list elastic pool database activity request as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolDatabaseActivity.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolDatabaseActivity.java new file mode 100644 index 0000000000000..4c18ddbd87db8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolDatabaseActivity.java @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.ElasticPoolDatabaseActivityInner; +import java.time.OffsetDateTime; +import java.util.UUID; + +/** An immutable client-side representation of ElasticPoolDatabaseActivity. */ +public interface ElasticPoolDatabaseActivity { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the databaseName property: The database name. + * + * @return the databaseName value. + */ + String databaseName(); + + /** + * Gets the endTime property: The time the operation finished (ISO8601 format). + * + * @return the endTime value. + */ + OffsetDateTime endTime(); + + /** + * Gets the errorCode property: The error code if available. + * + * @return the errorCode value. + */ + Integer errorCode(); + + /** + * Gets the errorMessage property: The error message if available. + * + * @return the errorMessage value. + */ + String errorMessage(); + + /** + * Gets the errorSeverity property: The error severity if available. + * + * @return the errorSeverity value. + */ + Integer errorSeverity(); + + /** + * Gets the operation property: The operation name. + * + * @return the operation value. + */ + String operation(); + + /** + * Gets the operationId property: The unique operation ID. + * + * @return the operationId value. + */ + UUID operationId(); + + /** + * Gets the percentComplete property: The percentage complete if available. + * + * @return the percentComplete value. + */ + Integer percentComplete(); + + /** + * Gets the requestedElasticPoolName property: The name for the elastic pool the database is moving into if + * available. + * + * @return the requestedElasticPoolName value. + */ + String requestedElasticPoolName(); + + /** + * Gets the currentElasticPoolName property: The name of the current elastic pool the database is in if available. + * + * @return the currentElasticPoolName value. + */ + String currentElasticPoolName(); + + /** + * Gets the currentServiceObjective property: The name of the current service objective if available. + * + * @return the currentServiceObjective value. + */ + String currentServiceObjective(); + + /** + * Gets the requestedServiceObjective property: The name of the requested service objective if available. + * + * @return the requestedServiceObjective value. + */ + String requestedServiceObjective(); + + /** + * Gets the serverName property: The name of the server the elastic pool is in. + * + * @return the serverName value. + */ + String serverName(); + + /** + * Gets the startTime property: The time the operation started (ISO8601 format). + * + * @return the startTime value. + */ + OffsetDateTime startTime(); + + /** + * Gets the state property: The current state of the operation. + * + * @return the state value. + */ + String state(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ElasticPoolDatabaseActivityInner object. + * + * @return the inner object. + */ + ElasticPoolDatabaseActivityInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolDatabaseActivityListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolDatabaseActivityListResult.java new file mode 100644 index 0000000000000..5cd6db3152758 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolDatabaseActivityListResult.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.ElasticPoolDatabaseActivityInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Represents the response to a list elastic pool database activity request. */ +@Fluent +public final class ElasticPoolDatabaseActivityListResult { + /* + * The list of elastic pool database activities. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /** Creates an instance of ElasticPoolDatabaseActivityListResult class. */ + public ElasticPoolDatabaseActivityListResult() { + } + + /** + * Get the value property: The list of elastic pool database activities. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of elastic pool database activities. + * + * @param value the value value to set. + * @return the ElasticPoolDatabaseActivityListResult object itself. + */ + public ElasticPoolDatabaseActivityListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property value in model ElasticPoolDatabaseActivityListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ElasticPoolDatabaseActivityListResult.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolEditionCapability.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolEditionCapability.java new file mode 100644 index 0000000000000..abe2cf923ef2d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolEditionCapability.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The elastic pool edition capability. */ +@Fluent +public final 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. + */ + @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; + + /** Creates an instance of ElasticPoolEditionCapability class. */ + public ElasticPoolEditionCapability() { + } + + /** + * Get the name property: The elastic pool edition name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the supportedElasticPoolPerformanceLevels property: The list of supported elastic pool DTU levels for the + * edition. + * + * @return the supportedElasticPoolPerformanceLevels value. + */ + public List supportedElasticPoolPerformanceLevels() { + return this.supportedElasticPoolPerformanceLevels; + } + + /** + * Get the zoneRedundant property: Whether or not zone redundancy is supported for the edition. + * + * @return the zoneRedundant value. + */ + public Boolean zoneRedundant() { + return this.zoneRedundant; + } + + /** + * Get the status property: The status of the capability. + * + * @return the status value. + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason property: The reason for the capability not being available. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (supportedElasticPoolPerformanceLevels() != null) { + supportedElasticPoolPerformanceLevels().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolLicenseType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolLicenseType.java new file mode 100644 index 0000000000000..ea8b003c208d3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolLicenseType.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The license type to apply for this elastic pool. */ +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); + } + + /** + * Gets known ElasticPoolLicenseType values. + * + * @return known ElasticPoolLicenseType values. + */ + public static Collection values() { + return values(ElasticPoolLicenseType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolListResult.java new file mode 100644 index 0000000000000..a873cc0ec5fca --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.ElasticPoolInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The result of an elastic pool list request. */ +@Immutable +public final class ElasticPoolListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of ElasticPoolListResult class. */ + public ElasticPoolListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolOperation.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolOperation.java new file mode 100644 index 0000000000000..5d7553460d20e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolOperation.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.ElasticPoolOperationInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of ElasticPoolOperation. */ +public interface ElasticPoolOperation { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the elasticPoolName property: The name of the elastic pool the operation is being performed on. + * + * @return the elasticPoolName value. + */ + String elasticPoolName(); + + /** + * Gets the operation property: The name of operation. + * + * @return the operation value. + */ + String operation(); + + /** + * Gets the operationFriendlyName property: The friendly name of operation. + * + * @return the operationFriendlyName value. + */ + String operationFriendlyName(); + + /** + * Gets the percentComplete property: The percentage of the operation completed. + * + * @return the percentComplete value. + */ + Integer percentComplete(); + + /** + * Gets the serverName property: The name of the server. + * + * @return the serverName value. + */ + String serverName(); + + /** + * Gets the startTime property: The operation start time. + * + * @return the startTime value. + */ + OffsetDateTime startTime(); + + /** + * Gets the state property: The operation state. + * + * @return the state value. + */ + String state(); + + /** + * Gets the errorCode property: The operation error code. + * + * @return the errorCode value. + */ + Integer errorCode(); + + /** + * Gets the errorDescription property: The operation error description. + * + * @return the errorDescription value. + */ + String errorDescription(); + + /** + * Gets the errorSeverity property: The operation error severity. + * + * @return the errorSeverity value. + */ + Integer errorSeverity(); + + /** + * Gets the isUserError property: Whether or not the error is a user error. + * + * @return the isUserError value. + */ + Boolean isUserError(); + + /** + * Gets the estimatedCompletionTime property: The estimated completion time of the operation. + * + * @return the estimatedCompletionTime value. + */ + OffsetDateTime estimatedCompletionTime(); + + /** + * Gets the description property: The operation description. + * + * @return the description value. + */ + String description(); + + /** + * Gets the isCancellable property: Whether the operation can be cancelled. + * + * @return the isCancellable value. + */ + Boolean isCancellable(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ElasticPoolOperationInner object. + * + * @return the inner object. + */ + ElasticPoolOperationInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolOperationListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolOperationListResult.java new file mode 100644 index 0000000000000..754757c37617f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolOperationListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.ElasticPoolOperationInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response to a list elastic pool operations request. */ +@Immutable +public final class ElasticPoolOperationListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of ElasticPoolOperationListResult class. */ + public ElasticPoolOperationListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolOperations.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolOperations.java new file mode 100644 index 0000000000000..d9d463b4e684e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolOperations.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import java.util.UUID; + +/** Resource collection API of ElasticPoolOperations. */ +public interface ElasticPoolOperations { + /** + * 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 elasticPoolName parameter. + * @param operationId The operation identifier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response cancelWithResponse( + String resourceGroupName, String serverName, String elasticPoolName, UUID operationId, Context context); + + /** + * 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 elasticPoolName parameter. + * @param operationId The operation identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void cancel(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 elasticPoolName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of operations performed on the elastic pool as paginated response with {@link PagedIterable}. + */ + PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName); + + /** + * 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 elasticPoolName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of operations performed on the elastic pool as paginated response with {@link PagedIterable}. + */ + PagedIterable listByElasticPool( + String resourceGroupName, String serverName, String elasticPoolName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolPerDatabaseMaxPerformanceLevelCapability.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolPerDatabaseMaxPerformanceLevelCapability.java new file mode 100644 index 0000000000000..912f41ecbb6a4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolPerDatabaseMaxPerformanceLevelCapability.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The max per-database performance level capability. */ +@Fluent +public final 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. + */ + @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. + */ + @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; + + /** Creates an instance of ElasticPoolPerDatabaseMaxPerformanceLevelCapability class. */ + public ElasticPoolPerDatabaseMaxPerformanceLevelCapability() { + } + + /** + * Get the limit property: The maximum performance level per database. + * + * @return the limit value. + */ + public Double limit() { + return this.limit; + } + + /** + * Get the unit property: Unit type used to measure performance level. + * + * @return the unit value. + */ + public PerformanceLevelUnit unit() { + return this.unit; + } + + /** + * Get the supportedPerDatabaseMinPerformanceLevels property: The list of supported min database performance levels. + * + * @return the supportedPerDatabaseMinPerformanceLevels value. + */ + public List supportedPerDatabaseMinPerformanceLevels() { + return this.supportedPerDatabaseMinPerformanceLevels; + } + + /** + * Get the status property: The status of the capability. + * + * @return the status value. + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason property: The reason for the capability not being available. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (supportedPerDatabaseMinPerformanceLevels() != null) { + supportedPerDatabaseMinPerformanceLevels().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolPerDatabaseMinPerformanceLevelCapability.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolPerDatabaseMinPerformanceLevelCapability.java new file mode 100644 index 0000000000000..8cf1cc67a7da2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolPerDatabaseMinPerformanceLevelCapability.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The minimum per-database performance level capability. */ +@Fluent +public final 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. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private PerformanceLevelUnit unit; + + /* + * The status of the capability. + */ + @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; + + /** Creates an instance of ElasticPoolPerDatabaseMinPerformanceLevelCapability class. */ + public ElasticPoolPerDatabaseMinPerformanceLevelCapability() { + } + + /** + * Get the limit property: The minimum performance level per database. + * + * @return the limit value. + */ + public Double limit() { + return this.limit; + } + + /** + * Get the unit property: Unit type used to measure performance level. + * + * @return the unit value. + */ + public PerformanceLevelUnit unit() { + return this.unit; + } + + /** + * Get the status property: The status of the capability. + * + * @return the status value. + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason property: The reason for the capability not being available. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolPerDatabaseSettings.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolPerDatabaseSettings.java new file mode 100644 index 0000000000000..5bdadd1dadc2f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolPerDatabaseSettings.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Per database settings of an elastic pool. */ +@Fluent +public final 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; + + /** Creates an instance of ElasticPoolPerDatabaseSettings class. */ + public ElasticPoolPerDatabaseSettings() { + } + + /** + * Get the minCapacity property: The minimum capacity all databases are guaranteed. + * + * @return the minCapacity value. + */ + public Double minCapacity() { + return this.minCapacity; + } + + /** + * Set the minCapacity property: 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 maxCapacity property: The maximum capacity any one database can consume. + * + * @return the maxCapacity value. + */ + public Double maxCapacity() { + return this.maxCapacity; + } + + /** + * Set the maxCapacity property: 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolPerformanceLevelCapability.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolPerformanceLevelCapability.java new file mode 100644 index 0000000000000..5294d8716e9ad --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolPerformanceLevelCapability.java @@ -0,0 +1,241 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The Elastic Pool performance level capability. */ +@Fluent +public final 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; + + /* + * Whether or not zone redundancy is supported for the performance level. + */ + @JsonProperty(value = "zoneRedundant", access = JsonProperty.Access.WRITE_ONLY) + private Boolean zoneRedundant; + + /* + * List of supported maintenance configurations + */ + @JsonProperty(value = "supportedMaintenanceConfigurations", access = JsonProperty.Access.WRITE_ONLY) + private List supportedMaintenanceConfigurations; + + /* + * The status of the capability. + */ + @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; + + /** Creates an instance of ElasticPoolPerformanceLevelCapability class. */ + public ElasticPoolPerformanceLevelCapability() { + } + + /** + * Get the performanceLevel property: The performance level for the pool. + * + * @return the performanceLevel value. + */ + public PerformanceLevelCapability performanceLevel() { + return this.performanceLevel; + } + + /** + * Get the sku property: The sku. + * + * @return the sku value. + */ + public Sku sku() { + return this.sku; + } + + /** + * Get the supportedLicenseTypes property: List of supported license types. + * + * @return the supportedLicenseTypes value. + */ + public List supportedLicenseTypes() { + return this.supportedLicenseTypes; + } + + /** + * Get the maxDatabaseCount property: The maximum number of databases supported. + * + * @return the maxDatabaseCount value. + */ + public Integer maxDatabaseCount() { + return this.maxDatabaseCount; + } + + /** + * Get the includedMaxSize property: The included (free) max size for this performance level. + * + * @return the includedMaxSize value. + */ + public MaxSizeCapability includedMaxSize() { + return this.includedMaxSize; + } + + /** + * Get the supportedMaxSizes property: The list of supported max sizes. + * + * @return the supportedMaxSizes value. + */ + public List supportedMaxSizes() { + return this.supportedMaxSizes; + } + + /** + * Get the supportedPerDatabaseMaxSizes property: The list of supported per database max sizes. + * + * @return the supportedPerDatabaseMaxSizes value. + */ + public List supportedPerDatabaseMaxSizes() { + return this.supportedPerDatabaseMaxSizes; + } + + /** + * Get the supportedPerDatabaseMaxPerformanceLevels property: The list of supported per database max performance + * levels. + * + * @return the supportedPerDatabaseMaxPerformanceLevels value. + */ + public List supportedPerDatabaseMaxPerformanceLevels() { + return this.supportedPerDatabaseMaxPerformanceLevels; + } + + /** + * Get the zoneRedundant property: Whether or not zone redundancy is supported for the performance level. + * + * @return the zoneRedundant value. + */ + public Boolean zoneRedundant() { + return this.zoneRedundant; + } + + /** + * Get the supportedMaintenanceConfigurations property: List of supported maintenance configurations. + * + * @return the supportedMaintenanceConfigurations value. + */ + public List supportedMaintenanceConfigurations() { + return this.supportedMaintenanceConfigurations; + } + + /** + * Get the status property: The status of the capability. + * + * @return the status value. + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason property: The reason for the capability not being available. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (performanceLevel() != null) { + performanceLevel().validate(); + } + if (sku() != null) { + sku().validate(); + } + if (supportedLicenseTypes() != null) { + supportedLicenseTypes().forEach(e -> e.validate()); + } + if (includedMaxSize() != null) { + includedMaxSize().validate(); + } + if (supportedMaxSizes() != null) { + supportedMaxSizes().forEach(e -> e.validate()); + } + if (supportedPerDatabaseMaxSizes() != null) { + supportedPerDatabaseMaxSizes().forEach(e -> e.validate()); + } + if (supportedPerDatabaseMaxPerformanceLevels() != null) { + supportedPerDatabaseMaxPerformanceLevels().forEach(e -> e.validate()); + } + if (supportedMaintenanceConfigurations() != null) { + supportedMaintenanceConfigurations().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolState.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolState.java new file mode 100644 index 0000000000000..ad5d2736a0156 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolState.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The state of the elastic pool. */ +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); + } + + /** + * Gets known ElasticPoolState values. + * + * @return known ElasticPoolState values. + */ + public static Collection values() { + return values(ElasticPoolState.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolUpdate.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolUpdate.java new file mode 100644 index 0000000000000..06177b095ca96 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPoolUpdate.java @@ -0,0 +1,245 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.fluent.models.ElasticPoolUpdateProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An elastic pool update. */ +@Fluent +public final class ElasticPoolUpdate { + /* + * An ARM Resource SKU. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ElasticPoolUpdateProperties innerProperties; + + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** Creates an instance of ElasticPoolUpdate class. */ + public ElasticPoolUpdate() { + } + + /** + * Get the sku property: An ARM Resource SKU. + * + * @return the sku value. + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku property: An ARM Resource SKU. + * + * @param sku the sku value to set. + * @return the ElasticPoolUpdate object itself. + */ + public ElasticPoolUpdate withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ElasticPoolUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the ElasticPoolUpdate object itself. + */ + public ElasticPoolUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the maxSizeBytes property: The storage limit for the database elastic pool in bytes. + * + * @return the maxSizeBytes value. + */ + public Long maxSizeBytes() { + return this.innerProperties() == null ? null : this.innerProperties().maxSizeBytes(); + } + + /** + * Set the maxSizeBytes property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new ElasticPoolUpdateProperties(); + } + this.innerProperties().withMaxSizeBytes(maxSizeBytes); + return this; + } + + /** + * Get the perDatabaseSettings property: The per database settings for the elastic pool. + * + * @return the perDatabaseSettings value. + */ + public ElasticPoolPerDatabaseSettings perDatabaseSettings() { + return this.innerProperties() == null ? null : this.innerProperties().perDatabaseSettings(); + } + + /** + * Set the perDatabaseSettings property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new ElasticPoolUpdateProperties(); + } + this.innerProperties().withPerDatabaseSettings(perDatabaseSettings); + return this; + } + + /** + * Get the zoneRedundant property: 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.innerProperties() == null ? null : this.innerProperties().zoneRedundant(); + } + + /** + * Set the zoneRedundant property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new ElasticPoolUpdateProperties(); + } + this.innerProperties().withZoneRedundant(zoneRedundant); + return this; + } + + /** + * Get the licenseType property: The license type to apply for this elastic pool. + * + * @return the licenseType value. + */ + public ElasticPoolLicenseType licenseType() { + return this.innerProperties() == null ? null : this.innerProperties().licenseType(); + } + + /** + * Set the licenseType property: The license type to apply for this elastic pool. + * + * @param licenseType the licenseType value to set. + * @return the ElasticPoolUpdate object itself. + */ + public ElasticPoolUpdate withLicenseType(ElasticPoolLicenseType licenseType) { + if (this.innerProperties() == null) { + this.innerProperties = new ElasticPoolUpdateProperties(); + } + this.innerProperties().withLicenseType(licenseType); + return this; + } + + /** + * Get the maintenanceConfigurationId property: Maintenance configuration id assigned to the elastic pool. This + * configuration defines the period when the maintenance updates will will occur. + * + * @return the maintenanceConfigurationId value. + */ + public String maintenanceConfigurationId() { + return this.innerProperties() == null ? null : this.innerProperties().maintenanceConfigurationId(); + } + + /** + * Set the maintenanceConfigurationId property: Maintenance configuration id assigned to the elastic pool. This + * configuration defines the period when the maintenance updates will will occur. + * + * @param maintenanceConfigurationId the maintenanceConfigurationId value to set. + * @return the ElasticPoolUpdate object itself. + */ + public ElasticPoolUpdate withMaintenanceConfigurationId(String maintenanceConfigurationId) { + if (this.innerProperties() == null) { + this.innerProperties = new ElasticPoolUpdateProperties(); + } + this.innerProperties().withMaintenanceConfigurationId(maintenanceConfigurationId); + return this; + } + + /** + * Get the highAvailabilityReplicaCount property: The number of secondary replicas associated with the elastic pool + * that are used to provide high availability. Applicable only to Hyperscale elastic pools. + * + * @return the highAvailabilityReplicaCount value. + */ + public Integer highAvailabilityReplicaCount() { + return this.innerProperties() == null ? null : this.innerProperties().highAvailabilityReplicaCount(); + } + + /** + * Set the highAvailabilityReplicaCount property: The number of secondary replicas associated with the elastic pool + * that are used to provide high availability. Applicable only to Hyperscale elastic pools. + * + * @param highAvailabilityReplicaCount the highAvailabilityReplicaCount value to set. + * @return the ElasticPoolUpdate object itself. + */ + public ElasticPoolUpdate withHighAvailabilityReplicaCount(Integer highAvailabilityReplicaCount) { + if (this.innerProperties() == null) { + this.innerProperties = new ElasticPoolUpdateProperties(); + } + this.innerProperties().withHighAvailabilityReplicaCount(highAvailabilityReplicaCount); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPools.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPools.java new file mode 100644 index 0000000000000..6b704623d7b06 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ElasticPools.java @@ -0,0 +1,242 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of 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. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list database metrics request as paginated response with {@link PagedIterable}. + */ + PagedIterable listMetrics( + String resourceGroupName, String serverName, String elasticPoolName, String filter); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list database metrics request as paginated response with {@link PagedIterable}. + */ + PagedIterable listMetrics( + String resourceGroupName, String serverName, String elasticPoolName, String filter, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list database metric definitions request as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listMetricDefinitions( + String resourceGroupName, String serverName, String elasticPoolName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list database metric definitions request as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listMetricDefinitions( + String resourceGroupName, String serverName, String elasticPoolName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all elastic pools in a server as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all elastic pools in a server as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Long skip, Context context); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String elasticPoolName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool. + */ + ElasticPool get(String resourceGroupName, String serverName, String elasticPoolName); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, String elasticPoolName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, String elasticPoolName, Context context); + + /** + * Failovers an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool to failover. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void failover(String resourceGroupName, String serverName, String elasticPoolName); + + /** + * Failovers an elastic pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param elasticPoolName The name of the elastic pool to failover. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void failover(String resourceGroupName, String serverName, String elasticPoolName, Context context); + + /** + * Gets an elastic pool. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool along with {@link Response}. + */ + ElasticPool getById(String id); + + /** + * Gets an elastic pool. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an elastic pool along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes an elastic pool. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes an elastic pool. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ElasticPool resource. + * + * @param name resource name. + * @return the first stage of the new ElasticPool definition. + */ + ElasticPool.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/EncryptionProtector.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/EncryptionProtector.java new file mode 100644 index 0000000000000..f50b4cb5f49b1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/EncryptionProtector.java @@ -0,0 +1,285 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.EncryptionProtectorInner; + +/** An immutable client-side representation of EncryptionProtector. */ +public interface EncryptionProtector { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the kind property: Kind of encryption protector. This is metadata used for the Azure portal experience. + * + * @return the kind value. + */ + String kind(); + + /** + * Gets the location property: Resource location. + * + * @return the location value. + */ + String location(); + + /** + * Gets the subregion property: Subregion of the encryption protector. + * + * @return the subregion value. + */ + String subregion(); + + /** + * Gets the serverKeyName property: The name of the server key. + * + * @return the serverKeyName value. + */ + String serverKeyName(); + + /** + * Gets the serverKeyType property: The encryption protector type like 'ServiceManaged', 'AzureKeyVault'. + * + * @return the serverKeyType value. + */ + ServerKeyType serverKeyType(); + + /** + * Gets the uri property: The URI of the server key. + * + * @return the uri value. + */ + String uri(); + + /** + * Gets the thumbprint property: Thumbprint of the server key. + * + * @return the thumbprint value. + */ + String thumbprint(); + + /** + * Gets the autoRotationEnabled property: Key auto rotation opt-in flag. Either true or false. + * + * @return the autoRotationEnabled value. + */ + Boolean autoRotationEnabled(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.EncryptionProtectorInner object. + * + * @return the inner object. + */ + EncryptionProtectorInner innerModel(); + + /** The entirety of the EncryptionProtector definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The EncryptionProtector definition stages. */ + interface DefinitionStages { + /** The first stage of the EncryptionProtector definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the EncryptionProtector definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @return the next definition stage. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + /** + * The stage of the EncryptionProtector definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithServerKeyName, + DefinitionStages.WithServerKeyType, + DefinitionStages.WithAutoRotationEnabled { + /** + * Executes the create request. + * + * @return the created resource. + */ + EncryptionProtector create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + EncryptionProtector create(Context context); + } + /** The stage of the EncryptionProtector definition allowing to specify serverKeyName. */ + interface WithServerKeyName { + /** + * Specifies the serverKeyName property: The name of the server key.. + * + * @param serverKeyName The name of the server key. + * @return the next definition stage. + */ + WithCreate withServerKeyName(String serverKeyName); + } + /** The stage of the EncryptionProtector definition allowing to specify serverKeyType. */ + interface WithServerKeyType { + /** + * Specifies the serverKeyType property: The encryption protector type like 'ServiceManaged', + * 'AzureKeyVault'.. + * + * @param serverKeyType The encryption protector type like 'ServiceManaged', 'AzureKeyVault'. + * @return the next definition stage. + */ + WithCreate withServerKeyType(ServerKeyType serverKeyType); + } + /** The stage of the EncryptionProtector definition allowing to specify autoRotationEnabled. */ + interface WithAutoRotationEnabled { + /** + * Specifies the autoRotationEnabled property: Key auto rotation opt-in flag. Either true or false.. + * + * @param autoRotationEnabled Key auto rotation opt-in flag. Either true or false. + * @return the next definition stage. + */ + WithCreate withAutoRotationEnabled(Boolean autoRotationEnabled); + } + } + /** + * Begins update for the EncryptionProtector resource. + * + * @return the stage of resource update. + */ + EncryptionProtector.Update update(); + + /** The template for EncryptionProtector update. */ + interface Update + extends UpdateStages.WithServerKeyName, UpdateStages.WithServerKeyType, UpdateStages.WithAutoRotationEnabled { + /** + * Executes the update request. + * + * @return the updated resource. + */ + EncryptionProtector apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + EncryptionProtector apply(Context context); + } + /** The EncryptionProtector update stages. */ + interface UpdateStages { + /** The stage of the EncryptionProtector update allowing to specify serverKeyName. */ + interface WithServerKeyName { + /** + * Specifies the serverKeyName property: The name of the server key.. + * + * @param serverKeyName The name of the server key. + * @return the next definition stage. + */ + Update withServerKeyName(String serverKeyName); + } + /** The stage of the EncryptionProtector update allowing to specify serverKeyType. */ + interface WithServerKeyType { + /** + * Specifies the serverKeyType property: The encryption protector type like 'ServiceManaged', + * 'AzureKeyVault'.. + * + * @param serverKeyType The encryption protector type like 'ServiceManaged', 'AzureKeyVault'. + * @return the next definition stage. + */ + Update withServerKeyType(ServerKeyType serverKeyType); + } + /** The stage of the EncryptionProtector update allowing to specify autoRotationEnabled. */ + interface WithAutoRotationEnabled { + /** + * Specifies the autoRotationEnabled property: Key auto rotation opt-in flag. Either true or false.. + * + * @param autoRotationEnabled Key auto rotation opt-in flag. Either true or false. + * @return the next definition stage. + */ + Update withAutoRotationEnabled(Boolean autoRotationEnabled); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + EncryptionProtector refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + EncryptionProtector refresh(Context context); + + /** + * Revalidates an existing encryption protector. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void revalidate(); + + /** + * Revalidates an existing encryption protector. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void revalidate(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/EncryptionProtectorListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/EncryptionProtectorListResult.java new file mode 100644 index 0000000000000..24f1f244ce9fb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/EncryptionProtectorListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.EncryptionProtectorInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of server encryption protectors. */ +@Immutable +public final class EncryptionProtectorListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of EncryptionProtectorListResult class. */ + public EncryptionProtectorListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/EncryptionProtectorName.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/EncryptionProtectorName.java new file mode 100644 index 0000000000000..5137dd7540d57 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/EncryptionProtectorName.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for EncryptionProtectorName. */ +public final class EncryptionProtectorName extends ExpandableStringEnum { + /** Static value current for EncryptionProtectorName. */ + public static final EncryptionProtectorName CURRENT = fromString("current"); + + /** + * Creates or finds a EncryptionProtectorName from its string representation. + * + * @param name a name to look for. + * @return the corresponding EncryptionProtectorName. + */ + @JsonCreator + public static EncryptionProtectorName fromString(String name) { + return fromString(name, EncryptionProtectorName.class); + } + + /** + * Gets known EncryptionProtectorName values. + * + * @return known EncryptionProtectorName values. + */ + public static Collection values() { + return values(EncryptionProtectorName.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/EncryptionProtectors.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/EncryptionProtectors.java new file mode 100644 index 0000000000000..0202df8dec841 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/EncryptionProtectors.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of EncryptionProtectors. */ +public interface EncryptionProtectors { + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server encryption protectors as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server encryption protectors as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * 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 encryptionProtectorName The name of the encryption protector to be retrieved. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server encryption protector along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, EncryptionProtectorName encryptionProtectorName, Context context); + + /** + * 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 encryptionProtectorName The name of the encryption protector to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server encryption protector. + */ + EncryptionProtector get( + String resourceGroupName, String serverName, EncryptionProtectorName encryptionProtectorName); + + /** + * Revalidates 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 encryptionProtectorName The name of the encryption protector to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void revalidate(String resourceGroupName, String serverName, EncryptionProtectorName encryptionProtectorName); + + /** + * Revalidates 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 encryptionProtectorName The name of the encryption protector to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void revalidate( + String resourceGroupName, String serverName, EncryptionProtectorName encryptionProtectorName, Context context); + + /** + * Gets a server encryption protector. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server encryption protector along with {@link Response}. + */ + EncryptionProtector getById(String id); + + /** + * Gets a server encryption protector. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server encryption protector along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new EncryptionProtector resource. + * + * @param name resource name. + * @return the first stage of the new EncryptionProtector definition. + */ + EncryptionProtector.DefinitionStages.Blank define(EncryptionProtectorName name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/EndpointCertificate.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/EndpointCertificate.java new file mode 100644 index 0000000000000..d689b39bde084 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/EndpointCertificate.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.EndpointCertificateInner; + +/** An immutable client-side representation of EndpointCertificate. */ +public interface EndpointCertificate { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the publicBlob property: The certificate public blob. + * + * @return the publicBlob value. + */ + String publicBlob(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.EndpointCertificateInner object. + * + * @return the inner object. + */ + EndpointCertificateInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/EndpointCertificateListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/EndpointCertificateListResult.java new file mode 100644 index 0000000000000..17c14f37ce211 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/EndpointCertificateListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.EndpointCertificateInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of endpoint certificates on the target instance. */ +@Immutable +public final class EndpointCertificateListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of EndpointCertificateListResult class. */ + public EndpointCertificateListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/EndpointCertificates.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/EndpointCertificates.java new file mode 100644 index 0000000000000..e40db7d8b3175 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/EndpointCertificates.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of EndpointCertificates. */ +public interface EndpointCertificates { + /** + * List certificates used on endpoints on the target 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of endpoint certificates on the target instance as paginated response with {@link PagedIterable}. + */ + PagedIterable listByInstance(String resourceGroupName, String managedInstanceName); + + /** + * List certificates used on endpoints on the target 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of endpoint certificates on the target instance as paginated response with {@link PagedIterable}. + */ + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * Gets a certificate used on the endpoint with the given id. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param endpointType Type of the endpoint whose certificate the customer is looking for. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a certificate used on the endpoint with the given id along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String managedInstanceName, String endpointType, Context context); + + /** + * Gets a certificate used on the endpoint with the given id. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param endpointType Type of the endpoint whose certificate the customer is looking for. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a certificate used on the endpoint with the given id. + */ + EndpointCertificate get(String resourceGroupName, String managedInstanceName, String endpointType); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ExportDatabaseDefinition.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ExportDatabaseDefinition.java new file mode 100644 index 0000000000000..62a8eade6da4f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ExportDatabaseDefinition.java @@ -0,0 +1,242 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Contains the information necessary to perform export database operation. */ +@Fluent +public final class ExportDatabaseDefinition { + /* + * Storage key type. + */ + @JsonProperty(value = "storageKeyType", required = true) + private StorageKeyType 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; + + /* + * Optional resource information to enable network isolation for request. + */ + @JsonProperty(value = "networkIsolation") + private NetworkIsolationSettings networkIsolation; + + /** Creates an instance of ExportDatabaseDefinition class. */ + public ExportDatabaseDefinition() { + } + + /** + * Get the storageKeyType property: Storage key type. + * + * @return the storageKeyType value. + */ + public StorageKeyType storageKeyType() { + return this.storageKeyType; + } + + /** + * Set the storageKeyType property: Storage key type. + * + * @param storageKeyType the storageKeyType value to set. + * @return the ExportDatabaseDefinition object itself. + */ + public ExportDatabaseDefinition withStorageKeyType(StorageKeyType storageKeyType) { + this.storageKeyType = storageKeyType; + return this; + } + + /** + * Get the storageKey property: Storage key. + * + * @return the storageKey value. + */ + public String storageKey() { + return this.storageKey; + } + + /** + * Set the storageKey property: Storage key. + * + * @param storageKey the storageKey value to set. + * @return the ExportDatabaseDefinition object itself. + */ + public ExportDatabaseDefinition withStorageKey(String storageKey) { + this.storageKey = storageKey; + return this; + } + + /** + * Get the storageUri property: Storage Uri. + * + * @return the storageUri value. + */ + public String storageUri() { + return this.storageUri; + } + + /** + * Set the storageUri property: Storage Uri. + * + * @param storageUri the storageUri value to set. + * @return the ExportDatabaseDefinition object itself. + */ + public ExportDatabaseDefinition withStorageUri(String storageUri) { + this.storageUri = storageUri; + return this; + } + + /** + * Get the administratorLogin property: Administrator login name. + * + * @return the administratorLogin value. + */ + public String administratorLogin() { + return this.administratorLogin; + } + + /** + * Set the administratorLogin property: Administrator login name. + * + * @param administratorLogin the administratorLogin value to set. + * @return the ExportDatabaseDefinition object itself. + */ + public ExportDatabaseDefinition withAdministratorLogin(String administratorLogin) { + this.administratorLogin = administratorLogin; + return this; + } + + /** + * Get the administratorLoginPassword property: Administrator login password. + * + * @return the administratorLoginPassword value. + */ + public String administratorLoginPassword() { + return this.administratorLoginPassword; + } + + /** + * Set the administratorLoginPassword property: Administrator login password. + * + * @param administratorLoginPassword the administratorLoginPassword value to set. + * @return the ExportDatabaseDefinition object itself. + */ + public ExportDatabaseDefinition withAdministratorLoginPassword(String administratorLoginPassword) { + this.administratorLoginPassword = administratorLoginPassword; + return this; + } + + /** + * Get the authenticationType property: Authentication type. + * + * @return the authenticationType value. + */ + public String authenticationType() { + return this.authenticationType; + } + + /** + * Set the authenticationType property: Authentication type. + * + * @param authenticationType the authenticationType value to set. + * @return the ExportDatabaseDefinition object itself. + */ + public ExportDatabaseDefinition withAuthenticationType(String authenticationType) { + this.authenticationType = authenticationType; + return this; + } + + /** + * Get the networkIsolation property: Optional resource information to enable network isolation for request. + * + * @return the networkIsolation value. + */ + public NetworkIsolationSettings networkIsolation() { + return this.networkIsolation; + } + + /** + * Set the networkIsolation property: Optional resource information to enable network isolation for request. + * + * @param networkIsolation the networkIsolation value to set. + * @return the ExportDatabaseDefinition object itself. + */ + public ExportDatabaseDefinition withNetworkIsolation(NetworkIsolationSettings networkIsolation) { + this.networkIsolation = networkIsolation; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (storageKeyType() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property storageKeyType in model ExportDatabaseDefinition")); + } + if (storageKey() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property storageKey in model ExportDatabaseDefinition")); + } + if (storageUri() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property storageUri in model ExportDatabaseDefinition")); + } + if (administratorLogin() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property administratorLogin in model ExportDatabaseDefinition")); + } + if (administratorLoginPassword() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property administratorLoginPassword in model ExportDatabaseDefinition")); + } + if (networkIsolation() != null) { + networkIsolation().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ExportDatabaseDefinition.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ExtendedDatabaseBlobAuditingPolicies.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ExtendedDatabaseBlobAuditingPolicies.java new file mode 100644 index 0000000000000..19cbc6b2cdf3e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ExtendedDatabaseBlobAuditingPolicies.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ExtendedDatabaseBlobAuditingPolicies. */ +public interface ExtendedDatabaseBlobAuditingPolicies { + /** + * Lists extended auditing settings 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database extended auditing settings as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName); + + /** + * Lists extended auditing settings 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database extended auditing settings as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an extended database's blob auditing policy along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an extended database's blob auditing policy. + */ + ExtendedDatabaseBlobAuditingPolicy get(String resourceGroupName, String serverName, String databaseName); + + /** + * Gets an extended database's blob auditing policy. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an extended database's blob auditing policy along with {@link Response}. + */ + ExtendedDatabaseBlobAuditingPolicy getById(String id); + + /** + * Gets an extended database's blob auditing policy. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an extended database's blob auditing policy along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ExtendedDatabaseBlobAuditingPolicy resource. + * + * @return the first stage of the new ExtendedDatabaseBlobAuditingPolicy definition. + */ + ExtendedDatabaseBlobAuditingPolicy.DefinitionStages.Blank define(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ExtendedDatabaseBlobAuditingPolicy.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ExtendedDatabaseBlobAuditingPolicy.java new file mode 100644 index 0000000000000..bf38fc22b26aa --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ExtendedDatabaseBlobAuditingPolicy.java @@ -0,0 +1,783 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ExtendedDatabaseBlobAuditingPolicyInner; +import java.util.List; +import java.util.UUID; + +/** An immutable client-side representation of ExtendedDatabaseBlobAuditingPolicy. */ +public interface ExtendedDatabaseBlobAuditingPolicy { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the predicateExpression property: Specifies condition of where clause when creating an audit. + * + * @return the predicateExpression value. + */ + String predicateExpression(); + + /** + * Gets the retentionDays property: Specifies the number of days to keep in the audit logs in the storage account. + * + * @return the retentionDays value. + */ + Integer retentionDays(); + + /** + * Gets the auditActionsAndGroups property: 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 + * DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP LEDGER_OPERATION_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. + */ + List auditActionsAndGroups(); + + /** + * Gets the isStorageSecondaryKeyInUse property: Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + * + * @return the isStorageSecondaryKeyInUse value. + */ + Boolean isStorageSecondaryKeyInUse(); + + /** + * Gets the isAzureMonitorTargetEnabled property: 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. + */ + Boolean isAzureMonitorTargetEnabled(); + + /** + * Gets the queueDelayMs property: Specifies the amount of time in milliseconds that can elapse before audit actions + * are forced to be processed. The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + * + * @return the queueDelayMs value. + */ + Integer queueDelayMs(); + + /** + * Gets the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob storage. + * + * @return the isManagedIdentityInUse value. + */ + Boolean isManagedIdentityInUse(); + + /** + * Gets the state property: Specifies the state of the audit. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * + * @return the state value. + */ + BlobAuditingPolicyState state(); + + /** + * Gets the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is + * required. + * + * @return the storageEndpoint value. + */ + String storageEndpoint(); + + /** + * Gets the storageAccountAccessKey property: Specifies the identifier key of the auditing storage account. If state + * is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server + * system-assigned managed identity to access the storage. Prerequisites for using managed identity authentication: + * 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). 2. Grant SQL Server + * identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server + * identity. For more information, see [Auditing to storage using Managed Identity + * authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @return the storageAccountAccessKey value. + */ + String storageAccountAccessKey(); + + /** + * Gets the storageAccountSubscriptionId property: Specifies the blob storage subscription Id. + * + * @return the storageAccountSubscriptionId value. + */ + UUID storageAccountSubscriptionId(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ExtendedDatabaseBlobAuditingPolicyInner + * object. + * + * @return the inner object. + */ + ExtendedDatabaseBlobAuditingPolicyInner innerModel(); + + /** The entirety of the ExtendedDatabaseBlobAuditingPolicy definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ExtendedDatabaseBlobAuditingPolicy definition stages. */ + interface DefinitionStages { + /** The first stage of the ExtendedDatabaseBlobAuditingPolicy definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ExtendedDatabaseBlobAuditingPolicy definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName, databaseName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @return the next definition stage. + */ + WithCreate withExistingDatabase(String resourceGroupName, String serverName, String databaseName); + } + /** + * The stage of the ExtendedDatabaseBlobAuditingPolicy definition which contains all the minimum required + * properties for the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithPredicateExpression, + DefinitionStages.WithRetentionDays, + DefinitionStages.WithAuditActionsAndGroups, + DefinitionStages.WithIsStorageSecondaryKeyInUse, + DefinitionStages.WithIsAzureMonitorTargetEnabled, + DefinitionStages.WithQueueDelayMs, + DefinitionStages.WithIsManagedIdentityInUse, + DefinitionStages.WithState, + DefinitionStages.WithStorageEndpoint, + DefinitionStages.WithStorageAccountAccessKey, + DefinitionStages.WithStorageAccountSubscriptionId { + /** + * Executes the create request. + * + * @return the created resource. + */ + ExtendedDatabaseBlobAuditingPolicy create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ExtendedDatabaseBlobAuditingPolicy create(Context context); + } + /** The stage of the ExtendedDatabaseBlobAuditingPolicy definition allowing to specify predicateExpression. */ + interface WithPredicateExpression { + /** + * Specifies the predicateExpression property: Specifies condition of where clause when creating an audit.. + * + * @param predicateExpression Specifies condition of where clause when creating an audit. + * @return the next definition stage. + */ + WithCreate withPredicateExpression(String predicateExpression); + } + /** The stage of the ExtendedDatabaseBlobAuditingPolicy definition allowing to specify retentionDays. */ + interface WithRetentionDays { + /** + * Specifies the retentionDays property: Specifies the number of days to keep in the audit logs in the + * storage account.. + * + * @param retentionDays Specifies the number of days to keep in the audit logs in the storage account. + * @return the next definition stage. + */ + WithCreate withRetentionDays(Integer retentionDays); + } + /** The stage of the ExtendedDatabaseBlobAuditingPolicy definition allowing to specify auditActionsAndGroups. */ + interface WithAuditActionsAndGroups { + /** + * Specifies the auditActionsAndGroups property: 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 DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP + * LEDGER_OPERATION_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 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 DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP + * LEDGER_OPERATION_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 next definition stage. + */ + WithCreate withAuditActionsAndGroups(List auditActionsAndGroups); + } + /** + * The stage of the ExtendedDatabaseBlobAuditingPolicy definition allowing to specify + * isStorageSecondaryKeyInUse. + */ + interface WithIsStorageSecondaryKeyInUse { + /** + * Specifies the isStorageSecondaryKeyInUse property: Specifies whether storageAccountAccessKey value is the + * storage's secondary key.. + * + * @param isStorageSecondaryKeyInUse Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + * @return the next definition stage. + */ + WithCreate withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse); + } + /** + * The stage of the ExtendedDatabaseBlobAuditingPolicy definition allowing to specify + * isAzureMonitorTargetEnabled. + */ + interface WithIsAzureMonitorTargetEnabled { + /** + * Specifies the isAzureMonitorTargetEnabled property: 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 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 next definition stage. + */ + WithCreate withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled); + } + /** The stage of the ExtendedDatabaseBlobAuditingPolicy definition allowing to specify queueDelayMs. */ + interface WithQueueDelayMs { + /** + * Specifies the queueDelayMs property: Specifies the amount of time in milliseconds that can elapse before + * audit actions are forced to be processed. The default minimum value is 1000 (1 second). The maximum is + * 2,147,483,647.. + * + * @param queueDelayMs Specifies the amount of time in milliseconds that can elapse before audit actions are + * forced to be processed. The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + * @return the next definition stage. + */ + WithCreate withQueueDelayMs(Integer queueDelayMs); + } + /** + * The stage of the ExtendedDatabaseBlobAuditingPolicy definition allowing to specify isManagedIdentityInUse. + */ + interface WithIsManagedIdentityInUse { + /** + * Specifies the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob + * storage. + * + * @param isManagedIdentityInUse Specifies whether Managed Identity is used to access blob storage. + * @return the next definition stage. + */ + WithCreate withIsManagedIdentityInUse(Boolean isManagedIdentityInUse); + } + /** The stage of the ExtendedDatabaseBlobAuditingPolicy definition allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the audit. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required.. + * + * @param state Specifies the state of the audit. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * @return the next definition stage. + */ + WithCreate withState(BlobAuditingPolicyState state); + } + /** The stage of the ExtendedDatabaseBlobAuditingPolicy definition allowing to specify storageEndpoint. */ + interface WithStorageEndpoint { + /** + * Specifies the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled is required.. + * + * @param storageEndpoint Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled is required. + * @return the next definition stage. + */ + WithCreate withStorageEndpoint(String storageEndpoint); + } + /** + * The stage of the ExtendedDatabaseBlobAuditingPolicy definition allowing to specify storageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies the storageAccountAccessKey property: Specifies the identifier key of the auditing storage + * account. If state is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey + * will use SQL server system-assigned managed identity to access the storage. Prerequisites for using + * managed identity authentication: 1. Assign SQL Server a system-assigned managed identity in Azure Active + * Directory (AAD). 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data + * Contributor' RBAC role to the server identity. For more information, see [Auditing to storage using + * Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @param storageAccountAccessKey Specifies the identifier key of the auditing storage account. If state is + * Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL + * server system-assigned managed identity to access the storage. Prerequisites for using managed + * identity authentication: 1. Assign SQL Server a system-assigned managed identity in Azure Active + * Directory (AAD). 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob + * Data Contributor' RBAC role to the server identity. For more information, see [Auditing to storage + * using Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * @return the next definition stage. + */ + WithCreate withStorageAccountAccessKey(String storageAccountAccessKey); + } + /** + * The stage of the ExtendedDatabaseBlobAuditingPolicy definition allowing to specify + * storageAccountSubscriptionId. + */ + interface WithStorageAccountSubscriptionId { + /** + * Specifies the storageAccountSubscriptionId property: Specifies the blob storage subscription Id.. + * + * @param storageAccountSubscriptionId Specifies the blob storage subscription Id. + * @return the next definition stage. + */ + WithCreate withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId); + } + } + /** + * Begins update for the ExtendedDatabaseBlobAuditingPolicy resource. + * + * @return the stage of resource update. + */ + ExtendedDatabaseBlobAuditingPolicy.Update update(); + + /** The template for ExtendedDatabaseBlobAuditingPolicy update. */ + interface Update + extends UpdateStages.WithPredicateExpression, + UpdateStages.WithRetentionDays, + UpdateStages.WithAuditActionsAndGroups, + UpdateStages.WithIsStorageSecondaryKeyInUse, + UpdateStages.WithIsAzureMonitorTargetEnabled, + UpdateStages.WithQueueDelayMs, + UpdateStages.WithIsManagedIdentityInUse, + UpdateStages.WithState, + UpdateStages.WithStorageEndpoint, + UpdateStages.WithStorageAccountAccessKey, + UpdateStages.WithStorageAccountSubscriptionId { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ExtendedDatabaseBlobAuditingPolicy apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ExtendedDatabaseBlobAuditingPolicy apply(Context context); + } + /** The ExtendedDatabaseBlobAuditingPolicy update stages. */ + interface UpdateStages { + /** The stage of the ExtendedDatabaseBlobAuditingPolicy update allowing to specify predicateExpression. */ + interface WithPredicateExpression { + /** + * Specifies the predicateExpression property: Specifies condition of where clause when creating an audit.. + * + * @param predicateExpression Specifies condition of where clause when creating an audit. + * @return the next definition stage. + */ + Update withPredicateExpression(String predicateExpression); + } + /** The stage of the ExtendedDatabaseBlobAuditingPolicy update allowing to specify retentionDays. */ + interface WithRetentionDays { + /** + * Specifies the retentionDays property: Specifies the number of days to keep in the audit logs in the + * storage account.. + * + * @param retentionDays Specifies the number of days to keep in the audit logs in the storage account. + * @return the next definition stage. + */ + Update withRetentionDays(Integer retentionDays); + } + /** The stage of the ExtendedDatabaseBlobAuditingPolicy update allowing to specify auditActionsAndGroups. */ + interface WithAuditActionsAndGroups { + /** + * Specifies the auditActionsAndGroups property: 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 DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP + * LEDGER_OPERATION_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 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 DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP + * LEDGER_OPERATION_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 next definition stage. + */ + Update withAuditActionsAndGroups(List auditActionsAndGroups); + } + /** + * The stage of the ExtendedDatabaseBlobAuditingPolicy update allowing to specify isStorageSecondaryKeyInUse. + */ + interface WithIsStorageSecondaryKeyInUse { + /** + * Specifies the isStorageSecondaryKeyInUse property: Specifies whether storageAccountAccessKey value is the + * storage's secondary key.. + * + * @param isStorageSecondaryKeyInUse Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + * @return the next definition stage. + */ + Update withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse); + } + /** + * The stage of the ExtendedDatabaseBlobAuditingPolicy update allowing to specify isAzureMonitorTargetEnabled. + */ + interface WithIsAzureMonitorTargetEnabled { + /** + * Specifies the isAzureMonitorTargetEnabled property: 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 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 next definition stage. + */ + Update withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled); + } + /** The stage of the ExtendedDatabaseBlobAuditingPolicy update allowing to specify queueDelayMs. */ + interface WithQueueDelayMs { + /** + * Specifies the queueDelayMs property: Specifies the amount of time in milliseconds that can elapse before + * audit actions are forced to be processed. The default minimum value is 1000 (1 second). The maximum is + * 2,147,483,647.. + * + * @param queueDelayMs Specifies the amount of time in milliseconds that can elapse before audit actions are + * forced to be processed. The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + * @return the next definition stage. + */ + Update withQueueDelayMs(Integer queueDelayMs); + } + /** The stage of the ExtendedDatabaseBlobAuditingPolicy update allowing to specify isManagedIdentityInUse. */ + interface WithIsManagedIdentityInUse { + /** + * Specifies the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob + * storage. + * + * @param isManagedIdentityInUse Specifies whether Managed Identity is used to access blob storage. + * @return the next definition stage. + */ + Update withIsManagedIdentityInUse(Boolean isManagedIdentityInUse); + } + /** The stage of the ExtendedDatabaseBlobAuditingPolicy update allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the audit. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required.. + * + * @param state Specifies the state of the audit. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * @return the next definition stage. + */ + Update withState(BlobAuditingPolicyState state); + } + /** The stage of the ExtendedDatabaseBlobAuditingPolicy update allowing to specify storageEndpoint. */ + interface WithStorageEndpoint { + /** + * Specifies the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled is required.. + * + * @param storageEndpoint Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled is required. + * @return the next definition stage. + */ + Update withStorageEndpoint(String storageEndpoint); + } + /** The stage of the ExtendedDatabaseBlobAuditingPolicy update allowing to specify storageAccountAccessKey. */ + interface WithStorageAccountAccessKey { + /** + * Specifies the storageAccountAccessKey property: Specifies the identifier key of the auditing storage + * account. If state is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey + * will use SQL server system-assigned managed identity to access the storage. Prerequisites for using + * managed identity authentication: 1. Assign SQL Server a system-assigned managed identity in Azure Active + * Directory (AAD). 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data + * Contributor' RBAC role to the server identity. For more information, see [Auditing to storage using + * Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @param storageAccountAccessKey Specifies the identifier key of the auditing storage account. If state is + * Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL + * server system-assigned managed identity to access the storage. Prerequisites for using managed + * identity authentication: 1. Assign SQL Server a system-assigned managed identity in Azure Active + * Directory (AAD). 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob + * Data Contributor' RBAC role to the server identity. For more information, see [Auditing to storage + * using Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * @return the next definition stage. + */ + Update withStorageAccountAccessKey(String storageAccountAccessKey); + } + /** + * The stage of the ExtendedDatabaseBlobAuditingPolicy update allowing to specify storageAccountSubscriptionId. + */ + interface WithStorageAccountSubscriptionId { + /** + * Specifies the storageAccountSubscriptionId property: Specifies the blob storage subscription Id.. + * + * @param storageAccountSubscriptionId Specifies the blob storage subscription Id. + * @return the next definition stage. + */ + Update withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ExtendedDatabaseBlobAuditingPolicy refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ExtendedDatabaseBlobAuditingPolicy refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ExtendedDatabaseBlobAuditingPolicyListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ExtendedDatabaseBlobAuditingPolicyListResult.java new file mode 100644 index 0000000000000..42884602f1f40 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ExtendedDatabaseBlobAuditingPolicyListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.ExtendedDatabaseBlobAuditingPolicyInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of database extended auditing settings. */ +@Immutable +public final class ExtendedDatabaseBlobAuditingPolicyListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of ExtendedDatabaseBlobAuditingPolicyListResult class. */ + public ExtendedDatabaseBlobAuditingPolicyListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ExtendedServerBlobAuditingPolicies.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ExtendedServerBlobAuditingPolicies.java new file mode 100644 index 0000000000000..d96bcec5ccbf3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ExtendedServerBlobAuditingPolicies.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ExtendedServerBlobAuditingPolicies. */ +public interface ExtendedServerBlobAuditingPolicies { + /** + * Lists extended auditing settings of 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server extended auditing settings as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Lists extended auditing settings of 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server extended auditing settings as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer( + String resourceGroupName, String serverName, Context context); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an extended server's blob auditing policy along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an extended server's blob auditing policy. + */ + ExtendedServerBlobAuditingPolicy get(String resourceGroupName, String serverName); + + /** + * Gets an extended server's blob auditing policy. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an extended server's blob auditing policy along with {@link Response}. + */ + ExtendedServerBlobAuditingPolicy getById(String id); + + /** + * Gets an extended server's blob auditing policy. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an extended server's blob auditing policy along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ExtendedServerBlobAuditingPolicy resource. + * + * @return the first stage of the new ExtendedServerBlobAuditingPolicy definition. + */ + ExtendedServerBlobAuditingPolicy.DefinitionStages.Blank define(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ExtendedServerBlobAuditingPolicy.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ExtendedServerBlobAuditingPolicy.java new file mode 100644 index 0000000000000..2901906239bf7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ExtendedServerBlobAuditingPolicy.java @@ -0,0 +1,854 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ExtendedServerBlobAuditingPolicyInner; +import java.util.List; +import java.util.UUID; + +/** An immutable client-side representation of ExtendedServerBlobAuditingPolicy. */ +public interface ExtendedServerBlobAuditingPolicy { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the isDevopsAuditEnabled property: Specifies the state of devops audit. If state is Enabled, devops logs + * will be sent to Azure Monitor. In order to send the events to Azure Monitor, specify 'State' as 'Enabled', + * 'IsAzureMonitorTargetEnabled' as true and 'IsDevopsAuditEnabled' as true + * + *

When using REST API to configure auditing, Diagnostic Settings with 'DevOpsOperationsAudit' diagnostic logs + * category on the master database should also be created. + * + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/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 isDevopsAuditEnabled value. + */ + Boolean isDevopsAuditEnabled(); + + /** + * Gets the predicateExpression property: Specifies condition of where clause when creating an audit. + * + * @return the predicateExpression value. + */ + String predicateExpression(); + + /** + * Gets the retentionDays property: Specifies the number of days to keep in the audit logs in the storage account. + * + * @return the retentionDays value. + */ + Integer retentionDays(); + + /** + * Gets the auditActionsAndGroups property: 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 + * DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP LEDGER_OPERATION_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. + */ + List auditActionsAndGroups(); + + /** + * Gets the isStorageSecondaryKeyInUse property: Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + * + * @return the isStorageSecondaryKeyInUse value. + */ + Boolean isStorageSecondaryKeyInUse(); + + /** + * Gets the isAzureMonitorTargetEnabled property: 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. + */ + Boolean isAzureMonitorTargetEnabled(); + + /** + * Gets the queueDelayMs property: Specifies the amount of time in milliseconds that can elapse before audit actions + * are forced to be processed. The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + * + * @return the queueDelayMs value. + */ + Integer queueDelayMs(); + + /** + * Gets the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob storage. + * + * @return the isManagedIdentityInUse value. + */ + Boolean isManagedIdentityInUse(); + + /** + * Gets the state property: Specifies the state of the audit. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * + * @return the state value. + */ + BlobAuditingPolicyState state(); + + /** + * Gets the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is + * required. + * + * @return the storageEndpoint value. + */ + String storageEndpoint(); + + /** + * Gets the storageAccountAccessKey property: Specifies the identifier key of the auditing storage account. If state + * is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server + * system-assigned managed identity to access the storage. Prerequisites for using managed identity authentication: + * 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). 2. Grant SQL Server + * identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server + * identity. For more information, see [Auditing to storage using Managed Identity + * authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @return the storageAccountAccessKey value. + */ + String storageAccountAccessKey(); + + /** + * Gets the storageAccountSubscriptionId property: Specifies the blob storage subscription Id. + * + * @return the storageAccountSubscriptionId value. + */ + UUID storageAccountSubscriptionId(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ExtendedServerBlobAuditingPolicyInner + * object. + * + * @return the inner object. + */ + ExtendedServerBlobAuditingPolicyInner innerModel(); + + /** The entirety of the ExtendedServerBlobAuditingPolicy definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ExtendedServerBlobAuditingPolicy definition stages. */ + interface DefinitionStages { + /** The first stage of the ExtendedServerBlobAuditingPolicy definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ExtendedServerBlobAuditingPolicy definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @return the next definition stage. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + /** + * The stage of the ExtendedServerBlobAuditingPolicy definition which contains all the minimum required + * properties for the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithIsDevopsAuditEnabled, + DefinitionStages.WithPredicateExpression, + DefinitionStages.WithRetentionDays, + DefinitionStages.WithAuditActionsAndGroups, + DefinitionStages.WithIsStorageSecondaryKeyInUse, + DefinitionStages.WithIsAzureMonitorTargetEnabled, + DefinitionStages.WithQueueDelayMs, + DefinitionStages.WithIsManagedIdentityInUse, + DefinitionStages.WithState, + DefinitionStages.WithStorageEndpoint, + DefinitionStages.WithStorageAccountAccessKey, + DefinitionStages.WithStorageAccountSubscriptionId { + /** + * Executes the create request. + * + * @return the created resource. + */ + ExtendedServerBlobAuditingPolicy create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ExtendedServerBlobAuditingPolicy create(Context context); + } + /** The stage of the ExtendedServerBlobAuditingPolicy definition allowing to specify isDevopsAuditEnabled. */ + interface WithIsDevopsAuditEnabled { + /** + * Specifies the isDevopsAuditEnabled property: Specifies the state of devops audit. If state is Enabled, + * devops logs will be sent to Azure Monitor. In order to send the events to Azure Monitor, specify 'State' + * as 'Enabled', 'IsAzureMonitorTargetEnabled' as true and 'IsDevopsAuditEnabled' as true + * + *

When using REST API to configure auditing, Diagnostic Settings with 'DevOpsOperationsAudit' diagnostic + * logs category on the master database should also be created. + * + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/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 isDevopsAuditEnabled Specifies the state of devops audit. If state is Enabled, devops logs will be + * sent to Azure Monitor. In order to send the events to Azure Monitor, specify 'State' as 'Enabled', + * 'IsAzureMonitorTargetEnabled' as true and 'IsDevopsAuditEnabled' as true + *

When using REST API to configure auditing, Diagnostic Settings with 'DevOpsOperationsAudit' + * diagnostic logs category on the master database should also be created. + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/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 next definition stage. + */ + WithCreate withIsDevopsAuditEnabled(Boolean isDevopsAuditEnabled); + } + /** The stage of the ExtendedServerBlobAuditingPolicy definition allowing to specify predicateExpression. */ + interface WithPredicateExpression { + /** + * Specifies the predicateExpression property: Specifies condition of where clause when creating an audit.. + * + * @param predicateExpression Specifies condition of where clause when creating an audit. + * @return the next definition stage. + */ + WithCreate withPredicateExpression(String predicateExpression); + } + /** The stage of the ExtendedServerBlobAuditingPolicy definition allowing to specify retentionDays. */ + interface WithRetentionDays { + /** + * Specifies the retentionDays property: Specifies the number of days to keep in the audit logs in the + * storage account.. + * + * @param retentionDays Specifies the number of days to keep in the audit logs in the storage account. + * @return the next definition stage. + */ + WithCreate withRetentionDays(Integer retentionDays); + } + /** The stage of the ExtendedServerBlobAuditingPolicy definition allowing to specify auditActionsAndGroups. */ + interface WithAuditActionsAndGroups { + /** + * Specifies the auditActionsAndGroups property: 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 DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP + * LEDGER_OPERATION_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 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 DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP + * LEDGER_OPERATION_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 next definition stage. + */ + WithCreate withAuditActionsAndGroups(List auditActionsAndGroups); + } + /** + * The stage of the ExtendedServerBlobAuditingPolicy definition allowing to specify isStorageSecondaryKeyInUse. + */ + interface WithIsStorageSecondaryKeyInUse { + /** + * Specifies the isStorageSecondaryKeyInUse property: Specifies whether storageAccountAccessKey value is the + * storage's secondary key.. + * + * @param isStorageSecondaryKeyInUse Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + * @return the next definition stage. + */ + WithCreate withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse); + } + /** + * The stage of the ExtendedServerBlobAuditingPolicy definition allowing to specify isAzureMonitorTargetEnabled. + */ + interface WithIsAzureMonitorTargetEnabled { + /** + * Specifies the isAzureMonitorTargetEnabled property: 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 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 next definition stage. + */ + WithCreate withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled); + } + /** The stage of the ExtendedServerBlobAuditingPolicy definition allowing to specify queueDelayMs. */ + interface WithQueueDelayMs { + /** + * Specifies the queueDelayMs property: Specifies the amount of time in milliseconds that can elapse before + * audit actions are forced to be processed. The default minimum value is 1000 (1 second). The maximum is + * 2,147,483,647.. + * + * @param queueDelayMs Specifies the amount of time in milliseconds that can elapse before audit actions are + * forced to be processed. The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + * @return the next definition stage. + */ + WithCreate withQueueDelayMs(Integer queueDelayMs); + } + /** The stage of the ExtendedServerBlobAuditingPolicy definition allowing to specify isManagedIdentityInUse. */ + interface WithIsManagedIdentityInUse { + /** + * Specifies the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob + * storage. + * + * @param isManagedIdentityInUse Specifies whether Managed Identity is used to access blob storage. + * @return the next definition stage. + */ + WithCreate withIsManagedIdentityInUse(Boolean isManagedIdentityInUse); + } + /** The stage of the ExtendedServerBlobAuditingPolicy definition allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the audit. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required.. + * + * @param state Specifies the state of the audit. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * @return the next definition stage. + */ + WithCreate withState(BlobAuditingPolicyState state); + } + /** The stage of the ExtendedServerBlobAuditingPolicy definition allowing to specify storageEndpoint. */ + interface WithStorageEndpoint { + /** + * Specifies the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled is required.. + * + * @param storageEndpoint Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled is required. + * @return the next definition stage. + */ + WithCreate withStorageEndpoint(String storageEndpoint); + } + /** The stage of the ExtendedServerBlobAuditingPolicy definition allowing to specify storageAccountAccessKey. */ + interface WithStorageAccountAccessKey { + /** + * Specifies the storageAccountAccessKey property: Specifies the identifier key of the auditing storage + * account. If state is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey + * will use SQL server system-assigned managed identity to access the storage. Prerequisites for using + * managed identity authentication: 1. Assign SQL Server a system-assigned managed identity in Azure Active + * Directory (AAD). 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data + * Contributor' RBAC role to the server identity. For more information, see [Auditing to storage using + * Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @param storageAccountAccessKey Specifies the identifier key of the auditing storage account. If state is + * Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL + * server system-assigned managed identity to access the storage. Prerequisites for using managed + * identity authentication: 1. Assign SQL Server a system-assigned managed identity in Azure Active + * Directory (AAD). 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob + * Data Contributor' RBAC role to the server identity. For more information, see [Auditing to storage + * using Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * @return the next definition stage. + */ + WithCreate withStorageAccountAccessKey(String storageAccountAccessKey); + } + /** + * The stage of the ExtendedServerBlobAuditingPolicy definition allowing to specify + * storageAccountSubscriptionId. + */ + interface WithStorageAccountSubscriptionId { + /** + * Specifies the storageAccountSubscriptionId property: Specifies the blob storage subscription Id.. + * + * @param storageAccountSubscriptionId Specifies the blob storage subscription Id. + * @return the next definition stage. + */ + WithCreate withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId); + } + } + /** + * Begins update for the ExtendedServerBlobAuditingPolicy resource. + * + * @return the stage of resource update. + */ + ExtendedServerBlobAuditingPolicy.Update update(); + + /** The template for ExtendedServerBlobAuditingPolicy update. */ + interface Update + extends UpdateStages.WithIsDevopsAuditEnabled, + UpdateStages.WithPredicateExpression, + UpdateStages.WithRetentionDays, + UpdateStages.WithAuditActionsAndGroups, + UpdateStages.WithIsStorageSecondaryKeyInUse, + UpdateStages.WithIsAzureMonitorTargetEnabled, + UpdateStages.WithQueueDelayMs, + UpdateStages.WithIsManagedIdentityInUse, + UpdateStages.WithState, + UpdateStages.WithStorageEndpoint, + UpdateStages.WithStorageAccountAccessKey, + UpdateStages.WithStorageAccountSubscriptionId { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ExtendedServerBlobAuditingPolicy apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ExtendedServerBlobAuditingPolicy apply(Context context); + } + /** The ExtendedServerBlobAuditingPolicy update stages. */ + interface UpdateStages { + /** The stage of the ExtendedServerBlobAuditingPolicy update allowing to specify isDevopsAuditEnabled. */ + interface WithIsDevopsAuditEnabled { + /** + * Specifies the isDevopsAuditEnabled property: Specifies the state of devops audit. If state is Enabled, + * devops logs will be sent to Azure Monitor. In order to send the events to Azure Monitor, specify 'State' + * as 'Enabled', 'IsAzureMonitorTargetEnabled' as true and 'IsDevopsAuditEnabled' as true + * + *

When using REST API to configure auditing, Diagnostic Settings with 'DevOpsOperationsAudit' diagnostic + * logs category on the master database should also be created. + * + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/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 isDevopsAuditEnabled Specifies the state of devops audit. If state is Enabled, devops logs will be + * sent to Azure Monitor. In order to send the events to Azure Monitor, specify 'State' as 'Enabled', + * 'IsAzureMonitorTargetEnabled' as true and 'IsDevopsAuditEnabled' as true + *

When using REST API to configure auditing, Diagnostic Settings with 'DevOpsOperationsAudit' + * diagnostic logs category on the master database should also be created. + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/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 next definition stage. + */ + Update withIsDevopsAuditEnabled(Boolean isDevopsAuditEnabled); + } + /** The stage of the ExtendedServerBlobAuditingPolicy update allowing to specify predicateExpression. */ + interface WithPredicateExpression { + /** + * Specifies the predicateExpression property: Specifies condition of where clause when creating an audit.. + * + * @param predicateExpression Specifies condition of where clause when creating an audit. + * @return the next definition stage. + */ + Update withPredicateExpression(String predicateExpression); + } + /** The stage of the ExtendedServerBlobAuditingPolicy update allowing to specify retentionDays. */ + interface WithRetentionDays { + /** + * Specifies the retentionDays property: Specifies the number of days to keep in the audit logs in the + * storage account.. + * + * @param retentionDays Specifies the number of days to keep in the audit logs in the storage account. + * @return the next definition stage. + */ + Update withRetentionDays(Integer retentionDays); + } + /** The stage of the ExtendedServerBlobAuditingPolicy update allowing to specify auditActionsAndGroups. */ + interface WithAuditActionsAndGroups { + /** + * Specifies the auditActionsAndGroups property: 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 DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP + * LEDGER_OPERATION_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 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 DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP + * LEDGER_OPERATION_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 next definition stage. + */ + Update withAuditActionsAndGroups(List auditActionsAndGroups); + } + /** The stage of the ExtendedServerBlobAuditingPolicy update allowing to specify isStorageSecondaryKeyInUse. */ + interface WithIsStorageSecondaryKeyInUse { + /** + * Specifies the isStorageSecondaryKeyInUse property: Specifies whether storageAccountAccessKey value is the + * storage's secondary key.. + * + * @param isStorageSecondaryKeyInUse Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + * @return the next definition stage. + */ + Update withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse); + } + /** The stage of the ExtendedServerBlobAuditingPolicy update allowing to specify isAzureMonitorTargetEnabled. */ + interface WithIsAzureMonitorTargetEnabled { + /** + * Specifies the isAzureMonitorTargetEnabled property: 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 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 next definition stage. + */ + Update withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled); + } + /** The stage of the ExtendedServerBlobAuditingPolicy update allowing to specify queueDelayMs. */ + interface WithQueueDelayMs { + /** + * Specifies the queueDelayMs property: Specifies the amount of time in milliseconds that can elapse before + * audit actions are forced to be processed. The default minimum value is 1000 (1 second). The maximum is + * 2,147,483,647.. + * + * @param queueDelayMs Specifies the amount of time in milliseconds that can elapse before audit actions are + * forced to be processed. The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + * @return the next definition stage. + */ + Update withQueueDelayMs(Integer queueDelayMs); + } + /** The stage of the ExtendedServerBlobAuditingPolicy update allowing to specify isManagedIdentityInUse. */ + interface WithIsManagedIdentityInUse { + /** + * Specifies the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob + * storage. + * + * @param isManagedIdentityInUse Specifies whether Managed Identity is used to access blob storage. + * @return the next definition stage. + */ + Update withIsManagedIdentityInUse(Boolean isManagedIdentityInUse); + } + /** The stage of the ExtendedServerBlobAuditingPolicy update allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the audit. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required.. + * + * @param state Specifies the state of the audit. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * @return the next definition stage. + */ + Update withState(BlobAuditingPolicyState state); + } + /** The stage of the ExtendedServerBlobAuditingPolicy update allowing to specify storageEndpoint. */ + interface WithStorageEndpoint { + /** + * Specifies the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled is required.. + * + * @param storageEndpoint Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled is required. + * @return the next definition stage. + */ + Update withStorageEndpoint(String storageEndpoint); + } + /** The stage of the ExtendedServerBlobAuditingPolicy update allowing to specify storageAccountAccessKey. */ + interface WithStorageAccountAccessKey { + /** + * Specifies the storageAccountAccessKey property: Specifies the identifier key of the auditing storage + * account. If state is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey + * will use SQL server system-assigned managed identity to access the storage. Prerequisites for using + * managed identity authentication: 1. Assign SQL Server a system-assigned managed identity in Azure Active + * Directory (AAD). 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data + * Contributor' RBAC role to the server identity. For more information, see [Auditing to storage using + * Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @param storageAccountAccessKey Specifies the identifier key of the auditing storage account. If state is + * Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL + * server system-assigned managed identity to access the storage. Prerequisites for using managed + * identity authentication: 1. Assign SQL Server a system-assigned managed identity in Azure Active + * Directory (AAD). 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob + * Data Contributor' RBAC role to the server identity. For more information, see [Auditing to storage + * using Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * @return the next definition stage. + */ + Update withStorageAccountAccessKey(String storageAccountAccessKey); + } + /** + * The stage of the ExtendedServerBlobAuditingPolicy update allowing to specify storageAccountSubscriptionId. + */ + interface WithStorageAccountSubscriptionId { + /** + * Specifies the storageAccountSubscriptionId property: Specifies the blob storage subscription Id.. + * + * @param storageAccountSubscriptionId Specifies the blob storage subscription Id. + * @return the next definition stage. + */ + Update withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ExtendedServerBlobAuditingPolicy refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ExtendedServerBlobAuditingPolicy refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ExtendedServerBlobAuditingPolicyListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ExtendedServerBlobAuditingPolicyListResult.java new file mode 100644 index 0000000000000..ceec51907945b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ExtendedServerBlobAuditingPolicyListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.ExtendedServerBlobAuditingPolicyInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of server extended auditing settings. */ +@Immutable +public final class ExtendedServerBlobAuditingPolicyListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of ExtendedServerBlobAuditingPolicyListResult class. */ + public ExtendedServerBlobAuditingPolicyListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FailoverGroup.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FailoverGroup.java new file mode 100644 index 0000000000000..3ec743d2220ad --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FailoverGroup.java @@ -0,0 +1,342 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.FailoverGroupInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of FailoverGroup. */ +public interface FailoverGroup { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: Resource location. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the readWriteEndpoint property: Read-write endpoint of the failover group instance. + * + * @return the readWriteEndpoint value. + */ + FailoverGroupReadWriteEndpoint readWriteEndpoint(); + + /** + * Gets the readOnlyEndpoint property: Read-only endpoint of the failover group instance. + * + * @return the readOnlyEndpoint value. + */ + FailoverGroupReadOnlyEndpoint readOnlyEndpoint(); + + /** + * Gets the replicationRole property: Local replication role of the failover group instance. + * + * @return the replicationRole value. + */ + FailoverGroupReplicationRole replicationRole(); + + /** + * Gets the replicationState property: Replication state of the failover group instance. + * + * @return the replicationState value. + */ + String replicationState(); + + /** + * Gets the partnerServers property: List of partner server information for the failover group. + * + * @return the partnerServers value. + */ + List partnerServers(); + + /** + * Gets the databases property: List of databases in the failover group. + * + * @return the databases value. + */ + List databases(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.FailoverGroupInner object. + * + * @return the inner object. + */ + FailoverGroupInner innerModel(); + + /** The entirety of the FailoverGroup definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The FailoverGroup definition stages. */ + interface DefinitionStages { + /** The first stage of the FailoverGroup definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the FailoverGroup definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server containing the failover group. + * @return the next definition stage. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + /** + * The stage of the FailoverGroup definition which contains all the minimum required properties for the resource + * to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithReadWriteEndpoint, + DefinitionStages.WithReadOnlyEndpoint, + DefinitionStages.WithPartnerServers, + DefinitionStages.WithDatabases { + /** + * Executes the create request. + * + * @return the created resource. + */ + FailoverGroup create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + FailoverGroup create(Context context); + } + /** The stage of the FailoverGroup definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the FailoverGroup definition allowing to specify readWriteEndpoint. */ + interface WithReadWriteEndpoint { + /** + * Specifies the readWriteEndpoint property: Read-write endpoint of the failover group instance.. + * + * @param readWriteEndpoint Read-write endpoint of the failover group instance. + * @return the next definition stage. + */ + WithCreate withReadWriteEndpoint(FailoverGroupReadWriteEndpoint readWriteEndpoint); + } + /** The stage of the FailoverGroup definition allowing to specify readOnlyEndpoint. */ + interface WithReadOnlyEndpoint { + /** + * Specifies the readOnlyEndpoint property: Read-only endpoint of the failover group instance.. + * + * @param readOnlyEndpoint Read-only endpoint of the failover group instance. + * @return the next definition stage. + */ + WithCreate withReadOnlyEndpoint(FailoverGroupReadOnlyEndpoint readOnlyEndpoint); + } + /** The stage of the FailoverGroup definition allowing to specify partnerServers. */ + interface WithPartnerServers { + /** + * Specifies the partnerServers property: List of partner server information for the failover group.. + * + * @param partnerServers List of partner server information for the failover group. + * @return the next definition stage. + */ + WithCreate withPartnerServers(List partnerServers); + } + /** The stage of the FailoverGroup definition allowing to specify databases. */ + interface WithDatabases { + /** + * Specifies the databases property: List of databases in the failover group.. + * + * @param databases List of databases in the failover group. + * @return the next definition stage. + */ + WithCreate withDatabases(List databases); + } + } + /** + * Begins update for the FailoverGroup resource. + * + * @return the stage of resource update. + */ + FailoverGroup.Update update(); + + /** The template for FailoverGroup update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithReadWriteEndpoint, + UpdateStages.WithReadOnlyEndpoint, + UpdateStages.WithDatabases { + /** + * Executes the update request. + * + * @return the updated resource. + */ + FailoverGroup apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + FailoverGroup apply(Context context); + } + /** The FailoverGroup update stages. */ + interface UpdateStages { + /** The stage of the FailoverGroup update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the FailoverGroup update allowing to specify readWriteEndpoint. */ + interface WithReadWriteEndpoint { + /** + * Specifies the readWriteEndpoint property: Read-write endpoint of the failover group instance.. + * + * @param readWriteEndpoint Read-write endpoint of the failover group instance. + * @return the next definition stage. + */ + Update withReadWriteEndpoint(FailoverGroupReadWriteEndpoint readWriteEndpoint); + } + /** The stage of the FailoverGroup update allowing to specify readOnlyEndpoint. */ + interface WithReadOnlyEndpoint { + /** + * Specifies the readOnlyEndpoint property: Read-only endpoint of the failover group instance.. + * + * @param readOnlyEndpoint Read-only endpoint of the failover group instance. + * @return the next definition stage. + */ + Update withReadOnlyEndpoint(FailoverGroupReadOnlyEndpoint readOnlyEndpoint); + } + /** The stage of the FailoverGroup update allowing to specify databases. */ + interface WithDatabases { + /** + * Specifies the databases property: List of databases in the failover group.. + * + * @param databases List of databases in the failover group. + * @return the next definition stage. + */ + Update withDatabases(List databases); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + FailoverGroup refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + FailoverGroup refresh(Context context); + + /** + * Fails over from the current primary server to this server. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + FailoverGroup failover(); + + /** + * Fails over from the current primary server to this server. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + FailoverGroup failover(Context context); + + /** + * Fails over from the current primary server to this server. This operation might result in data loss. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + FailoverGroup forceFailoverAllowDataLoss(); + + /** + * Fails over from the current primary server to this server. This operation might result in data loss. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + FailoverGroup forceFailoverAllowDataLoss(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FailoverGroupListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FailoverGroupListResult.java new file mode 100644 index 0000000000000..d82a0c51eb000 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FailoverGroupListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.FailoverGroupInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of failover groups. */ +@Immutable +public final class FailoverGroupListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of FailoverGroupListResult class. */ + public FailoverGroupListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FailoverGroupReadOnlyEndpoint.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FailoverGroupReadOnlyEndpoint.java new file mode 100644 index 0000000000000..c64018d210878 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FailoverGroupReadOnlyEndpoint.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Read-only endpoint of the failover group instance. */ +@Fluent +public final class FailoverGroupReadOnlyEndpoint { + /* + * Failover policy of the read-only endpoint for the failover group. + */ + @JsonProperty(value = "failoverPolicy") + private ReadOnlyEndpointFailoverPolicy failoverPolicy; + + /** Creates an instance of FailoverGroupReadOnlyEndpoint class. */ + public FailoverGroupReadOnlyEndpoint() { + } + + /** + * Get the failoverPolicy property: Failover policy of the read-only endpoint for the failover group. + * + * @return the failoverPolicy value. + */ + public ReadOnlyEndpointFailoverPolicy failoverPolicy() { + return this.failoverPolicy; + } + + /** + * Set the failoverPolicy property: Failover policy of the read-only endpoint for the failover group. + * + * @param failoverPolicy the failoverPolicy value to set. + * @return the FailoverGroupReadOnlyEndpoint object itself. + */ + public FailoverGroupReadOnlyEndpoint withFailoverPolicy(ReadOnlyEndpointFailoverPolicy failoverPolicy) { + this.failoverPolicy = failoverPolicy; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FailoverGroupReadWriteEndpoint.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FailoverGroupReadWriteEndpoint.java new file mode 100644 index 0000000000000..180ce93fbeaee --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FailoverGroupReadWriteEndpoint.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Read-write endpoint of the failover group instance. */ +@Fluent +public final class FailoverGroupReadWriteEndpoint { + /* + * Failover policy of the read-write endpoint for the failover group. If failoverPolicy is Automatic then + * failoverWithDataLossGracePeriodMinutes is required. + */ + @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; + + /** Creates an instance of FailoverGroupReadWriteEndpoint class. */ + public FailoverGroupReadWriteEndpoint() { + } + + /** + * Get the failoverPolicy property: Failover policy of the read-write endpoint for the failover group. If + * failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is required. + * + * @return the failoverPolicy value. + */ + public ReadWriteEndpointFailoverPolicy failoverPolicy() { + return this.failoverPolicy; + } + + /** + * Set the failoverPolicy property: Failover policy of the read-write endpoint for the failover group. If + * failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is required. + * + * @param failoverPolicy the failoverPolicy value to set. + * @return the FailoverGroupReadWriteEndpoint object itself. + */ + public FailoverGroupReadWriteEndpoint withFailoverPolicy(ReadWriteEndpointFailoverPolicy failoverPolicy) { + this.failoverPolicy = failoverPolicy; + return this; + } + + /** + * Get the failoverWithDataLossGracePeriodMinutes property: 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 the failoverWithDataLossGracePeriodMinutes property: 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (failoverPolicy() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property failoverPolicy in model FailoverGroupReadWriteEndpoint")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(FailoverGroupReadWriteEndpoint.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FailoverGroupReplicationRole.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FailoverGroupReplicationRole.java new file mode 100644 index 0000000000000..c17626b9b5a86 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FailoverGroupReplicationRole.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Local replication role of the failover group instance. */ +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); + } + + /** + * Gets known FailoverGroupReplicationRole values. + * + * @return known FailoverGroupReplicationRole values. + */ + public static Collection values() { + return values(FailoverGroupReplicationRole.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FailoverGroupUpdate.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FailoverGroupUpdate.java new file mode 100644 index 0000000000000..a8d65227cabfe --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FailoverGroupUpdate.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.fluent.models.FailoverGroupUpdateProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** A failover group update request. */ +@Fluent +public final class FailoverGroupUpdate { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private FailoverGroupUpdateProperties innerProperties; + + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** Creates an instance of FailoverGroupUpdate class. */ + public FailoverGroupUpdate() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private FailoverGroupUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the FailoverGroupUpdate object itself. + */ + public FailoverGroupUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the readWriteEndpoint property: Read-write endpoint of the failover group instance. + * + * @return the readWriteEndpoint value. + */ + public FailoverGroupReadWriteEndpoint readWriteEndpoint() { + return this.innerProperties() == null ? null : this.innerProperties().readWriteEndpoint(); + } + + /** + * Set the readWriteEndpoint property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new FailoverGroupUpdateProperties(); + } + this.innerProperties().withReadWriteEndpoint(readWriteEndpoint); + return this; + } + + /** + * Get the readOnlyEndpoint property: Read-only endpoint of the failover group instance. + * + * @return the readOnlyEndpoint value. + */ + public FailoverGroupReadOnlyEndpoint readOnlyEndpoint() { + return this.innerProperties() == null ? null : this.innerProperties().readOnlyEndpoint(); + } + + /** + * Set the readOnlyEndpoint property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new FailoverGroupUpdateProperties(); + } + this.innerProperties().withReadOnlyEndpoint(readOnlyEndpoint); + return this; + } + + /** + * Get the databases property: List of databases in the failover group. + * + * @return the databases value. + */ + public List databases() { + return this.innerProperties() == null ? null : this.innerProperties().databases(); + } + + /** + * Set the databases property: List of databases in the failover group. + * + * @param databases the databases value to set. + * @return the FailoverGroupUpdate object itself. + */ + public FailoverGroupUpdate withDatabases(List databases) { + if (this.innerProperties() == null) { + this.innerProperties = new FailoverGroupUpdateProperties(); + } + this.innerProperties().withDatabases(databases); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FailoverGroups.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FailoverGroups.java new file mode 100644 index 0000000000000..dd8d1da5afe62 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FailoverGroups.java @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of FailoverGroups. */ +public interface FailoverGroups { + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String failoverGroupName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + FailoverGroup get(String resourceGroupName, String serverName, String failoverGroupName); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, String failoverGroupName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, String failoverGroupName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of failover groups as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of failover groups as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + FailoverGroup failover(String resourceGroupName, String serverName, String failoverGroupName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + FailoverGroup failover(String resourceGroupName, String serverName, String failoverGroupName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + FailoverGroup forceFailoverAllowDataLoss(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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + FailoverGroup forceFailoverAllowDataLoss( + String resourceGroupName, String serverName, String failoverGroupName, Context context); + + /** + * Gets a failover group. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group along with {@link Response}. + */ + FailoverGroup getById(String id); + + /** + * Gets a failover group. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a failover group. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a failover group. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new FailoverGroup resource. + * + * @param name resource name. + * @return the first stage of the new FailoverGroup definition. + */ + FailoverGroup.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FirewallRule.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FirewallRule.java new file mode 100644 index 0000000000000..8b4afefde6620 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FirewallRule.java @@ -0,0 +1,215 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.FirewallRuleInner; + +/** An immutable client-side representation of FirewallRule. */ +public interface FirewallRule { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the name property: Resource name. + * + * @return the name value. + */ + String name(); + + /** + * Gets the startIpAddress property: 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. + */ + String startIpAddress(); + + /** + * Gets the endIpAddress property: 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. + */ + String endIpAddress(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.FirewallRuleInner object. + * + * @return the inner object. + */ + FirewallRuleInner innerModel(); + + /** The entirety of the FirewallRule definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The FirewallRule definition stages. */ + interface DefinitionStages { + /** The first stage of the FirewallRule definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the FirewallRule definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @return the next definition stage. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + /** + * The stage of the FirewallRule definition which contains all the minimum required properties for the resource + * to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithName, DefinitionStages.WithStartIpAddress, DefinitionStages.WithEndIpAddress { + /** + * Executes the create request. + * + * @return the created resource. + */ + FirewallRule create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + FirewallRule create(Context context); + } + /** The stage of the FirewallRule definition allowing to specify name. */ + interface WithName { + /** + * Specifies the name property: Resource name.. + * + * @param name Resource name. + * @return the next definition stage. + */ + WithCreate withName(String name); + } + /** The stage of the FirewallRule definition allowing to specify startIpAddress. */ + interface WithStartIpAddress { + /** + * Specifies the startIpAddress property: 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 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 next definition stage. + */ + WithCreate withStartIpAddress(String startIpAddress); + } + /** The stage of the FirewallRule definition allowing to specify endIpAddress. */ + interface WithEndIpAddress { + /** + * Specifies the endIpAddress property: 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 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 next definition stage. + */ + WithCreate withEndIpAddress(String endIpAddress); + } + } + /** + * Begins update for the FirewallRule resource. + * + * @return the stage of resource update. + */ + FirewallRule.Update update(); + + /** The template for FirewallRule update. */ + interface Update extends UpdateStages.WithName, UpdateStages.WithStartIpAddress, UpdateStages.WithEndIpAddress { + /** + * Executes the update request. + * + * @return the updated resource. + */ + FirewallRule apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + FirewallRule apply(Context context); + } + /** The FirewallRule update stages. */ + interface UpdateStages { + /** The stage of the FirewallRule update allowing to specify name. */ + interface WithName { + /** + * Specifies the name property: Resource name.. + * + * @param name Resource name. + * @return the next definition stage. + */ + Update withName(String name); + } + /** The stage of the FirewallRule update allowing to specify startIpAddress. */ + interface WithStartIpAddress { + /** + * Specifies the startIpAddress property: 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 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 next definition stage. + */ + Update withStartIpAddress(String startIpAddress); + } + /** The stage of the FirewallRule update allowing to specify endIpAddress. */ + interface WithEndIpAddress { + /** + * Specifies the endIpAddress property: 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 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 next definition stage. + */ + Update withEndIpAddress(String endIpAddress); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + FirewallRule refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + FirewallRule refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FirewallRuleList.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FirewallRuleList.java new file mode 100644 index 0000000000000..771e8f0cd9373 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FirewallRuleList.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.fluent.models.FirewallRuleInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of server firewall rules. */ +@Fluent +public final class FirewallRuleList { + /* + * The values property. + */ + @JsonProperty(value = "values") + private List values; + + /** Creates an instance of FirewallRuleList class. */ + public FirewallRuleList() { + } + + /** + * Get the values property: The values property. + * + * @return the values value. + */ + public List values() { + return this.values; + } + + /** + * Set the values property: The values property. + * + * @param values the values value to set. + * @return the FirewallRuleList object itself. + */ + public FirewallRuleList withValues(List values) { + this.values = values; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (values() != null) { + values().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FirewallRuleListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FirewallRuleListResult.java new file mode 100644 index 0000000000000..17c090280ce11 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FirewallRuleListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.FirewallRuleInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response to a list firewall rules request. */ +@Immutable +public final class FirewallRuleListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of FirewallRuleListResult class. */ + public FirewallRuleListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FirewallRules.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FirewallRules.java new file mode 100644 index 0000000000000..281906210fe2e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/FirewallRules.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of FirewallRules. */ +public interface FirewallRules { + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a firewall rule along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String firewallRuleName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a firewall rule. + */ + FirewallRule get(String resourceGroupName, String serverName, String firewallRuleName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse( + String resourceGroupName, String serverName, String firewallRuleName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String 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. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of firewall rules as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of firewall rules as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * 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 parameters A list of server firewall rules. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server firewall rule along with {@link Response}. + */ + Response replaceWithResponse( + String resourceGroupName, String serverName, FirewallRuleList parameters, Context context); + + /** + * 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 parameters A list of server firewall rules. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server firewall rule. + */ + FirewallRule replace(String resourceGroupName, String serverName, FirewallRuleList parameters); + + /** + * Gets a firewall rule. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a firewall rule along with {@link Response}. + */ + FirewallRule getById(String id); + + /** + * Gets a firewall rule. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a firewall rule along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a firewall rule. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a firewall rule. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new FirewallRule resource. + * + * @param name resource name. + * @return the first stage of the new FirewallRule definition. + */ + FirewallRule.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/GeoBackupPolicies.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/GeoBackupPolicies.java new file mode 100644 index 0000000000000..47804c82e1c8f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/GeoBackupPolicies.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of GeoBackupPolicies. */ +public interface GeoBackupPolicies { + /** + * 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 geoBackupPolicyName The name of the geo backup policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a geo backup policy along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + GeoBackupPolicyName geoBackupPolicyName, + Context context); + + /** + * 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 geoBackupPolicyName The name of the geo backup policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a geo backup policy. + */ + GeoBackupPolicy get( + String resourceGroupName, String serverName, String databaseName, GeoBackupPolicyName geoBackupPolicyName); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list geo backup policies request as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase(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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a list geo backup policies request as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Gets a geo backup policy. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a geo backup policy along with {@link Response}. + */ + GeoBackupPolicy getById(String id); + + /** + * Gets a geo backup policy. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a geo backup policy along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new GeoBackupPolicy resource. + * + * @param name resource name. + * @return the first stage of the new GeoBackupPolicy definition. + */ + GeoBackupPolicy.DefinitionStages.Blank define(GeoBackupPolicyName name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/GeoBackupPolicy.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/GeoBackupPolicy.java new file mode 100644 index 0000000000000..d045d1f5d32ca --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/GeoBackupPolicy.java @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.GeoBackupPolicyInner; + +/** An immutable client-side representation of GeoBackupPolicy. */ +public interface GeoBackupPolicy { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the kind property: Kind of geo backup policy. This is metadata used for the Azure portal experience. + * + * @return the kind value. + */ + String kind(); + + /** + * Gets the location property: Backup policy location. + * + * @return the location value. + */ + String location(); + + /** + * Gets the state property: The state of the geo backup policy. + * + * @return the state value. + */ + GeoBackupPolicyState state(); + + /** + * Gets the storageType property: The storage type of the geo backup policy. + * + * @return the storageType value. + */ + String storageType(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.GeoBackupPolicyInner object. + * + * @return the inner object. + */ + GeoBackupPolicyInner innerModel(); + + /** The entirety of the GeoBackupPolicy definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithParentResource, + DefinitionStages.WithState, + DefinitionStages.WithCreate { + } + /** The GeoBackupPolicy definition stages. */ + interface DefinitionStages { + /** The first stage of the GeoBackupPolicy definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the GeoBackupPolicy definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName, databaseName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @return the next definition stage. + */ + WithState withExistingDatabase(String resourceGroupName, String serverName, String databaseName); + } + /** The stage of the GeoBackupPolicy definition allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: The state of the geo backup policy.. + * + * @param state The state of the geo backup policy. + * @return the next definition stage. + */ + WithCreate withState(GeoBackupPolicyState state); + } + /** + * The stage of the GeoBackupPolicy definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate { + /** + * Executes the create request. + * + * @return the created resource. + */ + GeoBackupPolicy create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + GeoBackupPolicy create(Context context); + } + } + /** + * Begins update for the GeoBackupPolicy resource. + * + * @return the stage of resource update. + */ + GeoBackupPolicy.Update update(); + + /** The template for GeoBackupPolicy update. */ + interface Update extends UpdateStages.WithState { + /** + * Executes the update request. + * + * @return the updated resource. + */ + GeoBackupPolicy apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + GeoBackupPolicy apply(Context context); + } + /** The GeoBackupPolicy update stages. */ + interface UpdateStages { + /** The stage of the GeoBackupPolicy update allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: The state of the geo backup policy.. + * + * @param state The state of the geo backup policy. + * @return the next definition stage. + */ + Update withState(GeoBackupPolicyState state); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + GeoBackupPolicy refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + GeoBackupPolicy refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/GeoBackupPolicyListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/GeoBackupPolicyListResult.java new file mode 100644 index 0000000000000..74e27db8d3793 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/GeoBackupPolicyListResult.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.fluent.models.GeoBackupPolicyInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response to a list geo backup policies request. */ +@Fluent +public final class GeoBackupPolicyListResult { + /* + * The list of geo backup policies. + */ + @JsonProperty(value = "value") + private List value; + + /** Creates an instance of GeoBackupPolicyListResult class. */ + public GeoBackupPolicyListResult() { + } + + /** + * Get the value property: The list of geo backup policies. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of geo backup policies. + * + * @param value the value value to set. + * @return the GeoBackupPolicyListResult object itself. + */ + public GeoBackupPolicyListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/GeoBackupPolicyName.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/GeoBackupPolicyName.java new file mode 100644 index 0000000000000..5986e472939f3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/GeoBackupPolicyName.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for GeoBackupPolicyName. */ +public final class GeoBackupPolicyName extends ExpandableStringEnum { + /** Static value Default for GeoBackupPolicyName. */ + public static final GeoBackupPolicyName DEFAULT = fromString("Default"); + + /** + * Creates or finds a GeoBackupPolicyName from its string representation. + * + * @param name a name to look for. + * @return the corresponding GeoBackupPolicyName. + */ + @JsonCreator + public static GeoBackupPolicyName fromString(String name) { + return fromString(name, GeoBackupPolicyName.class); + } + + /** + * Gets known GeoBackupPolicyName values. + * + * @return known GeoBackupPolicyName values. + */ + public static Collection values() { + return values(GeoBackupPolicyName.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/GeoBackupPolicyState.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/GeoBackupPolicyState.java new file mode 100644 index 0000000000000..f71f480b896a2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/GeoBackupPolicyState.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** The state of the geo backup policy. */ +public enum GeoBackupPolicyState { + /** Enum value Disabled. */ + DISABLED("Disabled"), + + /** Enum value Enabled. */ + ENABLED("Enabled"); + + /** The actual serialized value for a GeoBackupPolicyState instance. */ + private final 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) { + if (value == null) { + return null; + } + GeoBackupPolicyState[] items = GeoBackupPolicyState.values(); + for (GeoBackupPolicyState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/IPv6FirewallRule.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/IPv6FirewallRule.java new file mode 100644 index 0000000000000..b0808b24b4cae --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/IPv6FirewallRule.java @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.IPv6FirewallRuleInner; + +/** An immutable client-side representation of IPv6FirewallRule. */ +public interface IPv6FirewallRule { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the name property: Resource name. + * + * @return the name value. + */ + String name(); + + /** + * Gets the startIPv6Address property: The start IP address of the firewall rule. Must be IPv6 format. + * + * @return the startIPv6Address value. + */ + String startIPv6Address(); + + /** + * Gets the endIPv6Address property: The end IP address of the firewall rule. Must be IPv6 format. Must be greater + * than or equal to startIpAddress. + * + * @return the endIPv6Address value. + */ + String endIPv6Address(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.IPv6FirewallRuleInner object. + * + * @return the inner object. + */ + IPv6FirewallRuleInner innerModel(); + + /** The entirety of the IPv6FirewallRule definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The IPv6FirewallRule definition stages. */ + interface DefinitionStages { + /** The first stage of the IPv6FirewallRule definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the IPv6FirewallRule definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @return the next definition stage. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + /** + * The stage of the IPv6FirewallRule definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithName, + DefinitionStages.WithStartIPv6Address, + DefinitionStages.WithEndIPv6Address { + /** + * Executes the create request. + * + * @return the created resource. + */ + IPv6FirewallRule create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + IPv6FirewallRule create(Context context); + } + /** The stage of the IPv6FirewallRule definition allowing to specify name. */ + interface WithName { + /** + * Specifies the name property: Resource name.. + * + * @param name Resource name. + * @return the next definition stage. + */ + WithCreate withName(String name); + } + /** The stage of the IPv6FirewallRule definition allowing to specify startIPv6Address. */ + interface WithStartIPv6Address { + /** + * Specifies the startIPv6Address property: The start IP address of the firewall rule. Must be IPv6 format.. + * + * @param startIPv6Address The start IP address of the firewall rule. Must be IPv6 format. + * @return the next definition stage. + */ + WithCreate withStartIPv6Address(String startIPv6Address); + } + /** The stage of the IPv6FirewallRule definition allowing to specify endIPv6Address. */ + interface WithEndIPv6Address { + /** + * Specifies the endIPv6Address property: The end IP address of the firewall rule. Must be IPv6 format. Must + * be greater than or equal to startIpAddress.. + * + * @param endIPv6Address The end IP address of the firewall rule. Must be IPv6 format. Must be greater than + * or equal to startIpAddress. + * @return the next definition stage. + */ + WithCreate withEndIPv6Address(String endIPv6Address); + } + } + /** + * Begins update for the IPv6FirewallRule resource. + * + * @return the stage of resource update. + */ + IPv6FirewallRule.Update update(); + + /** The template for IPv6FirewallRule update. */ + interface Update extends UpdateStages.WithName, UpdateStages.WithStartIPv6Address, UpdateStages.WithEndIPv6Address { + /** + * Executes the update request. + * + * @return the updated resource. + */ + IPv6FirewallRule apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + IPv6FirewallRule apply(Context context); + } + /** The IPv6FirewallRule update stages. */ + interface UpdateStages { + /** The stage of the IPv6FirewallRule update allowing to specify name. */ + interface WithName { + /** + * Specifies the name property: Resource name.. + * + * @param name Resource name. + * @return the next definition stage. + */ + Update withName(String name); + } + /** The stage of the IPv6FirewallRule update allowing to specify startIPv6Address. */ + interface WithStartIPv6Address { + /** + * Specifies the startIPv6Address property: The start IP address of the firewall rule. Must be IPv6 format.. + * + * @param startIPv6Address The start IP address of the firewall rule. Must be IPv6 format. + * @return the next definition stage. + */ + Update withStartIPv6Address(String startIPv6Address); + } + /** The stage of the IPv6FirewallRule update allowing to specify endIPv6Address. */ + interface WithEndIPv6Address { + /** + * Specifies the endIPv6Address property: The end IP address of the firewall rule. Must be IPv6 format. Must + * be greater than or equal to startIpAddress.. + * + * @param endIPv6Address The end IP address of the firewall rule. Must be IPv6 format. Must be greater than + * or equal to startIpAddress. + * @return the next definition stage. + */ + Update withEndIPv6Address(String endIPv6Address); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + IPv6FirewallRule refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + IPv6FirewallRule refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/IPv6FirewallRuleListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/IPv6FirewallRuleListResult.java new file mode 100644 index 0000000000000..532c2a2e3ea77 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/IPv6FirewallRuleListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.IPv6FirewallRuleInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response to a list IPv6 firewall rules request. */ +@Immutable +public final class IPv6FirewallRuleListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of IPv6FirewallRuleListResult class. */ + public IPv6FirewallRuleListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/IPv6FirewallRules.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/IPv6FirewallRules.java new file mode 100644 index 0000000000000..276670883f43e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/IPv6FirewallRules.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of IPv6FirewallRules. */ +public interface IPv6FirewallRules { + /** + * Gets a list of IPv6 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of IPv6 firewall rules as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets a list of IPv6 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of IPv6 firewall rules as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * Gets an IPv6 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an IPv6 firewall rule along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String firewallRuleName, Context context); + + /** + * Gets an IPv6 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an IPv6 firewall rule. + */ + IPv6FirewallRule get(String resourceGroupName, String serverName, String firewallRuleName); + + /** + * Deletes an IPv6 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse( + String resourceGroupName, String serverName, String firewallRuleName, Context context); + + /** + * Deletes an IPv6 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, String firewallRuleName); + + /** + * Gets an IPv6 firewall rule. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an IPv6 firewall rule along with {@link Response}. + */ + IPv6FirewallRule getById(String id); + + /** + * Gets an IPv6 firewall rule. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an IPv6 firewall rule along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes an IPv6 firewall rule. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes an IPv6 firewall rule. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new IPv6FirewallRule resource. + * + * @param name resource name. + * @return the first stage of the new IPv6FirewallRule definition. + */ + IPv6FirewallRule.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/IdentityType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/IdentityType.java new file mode 100644 index 0000000000000..ef3f8e101522f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/IdentityType.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * The identity type. Set this to 'SystemAssigned' in order to automatically create and assign an Azure Active Directory + * principal for the resource. + */ +public final class IdentityType extends ExpandableStringEnum { + /** Static value None for IdentityType. */ + public static final IdentityType NONE = fromString("None"); + + /** Static value SystemAssigned for IdentityType. */ + public static final IdentityType SYSTEM_ASSIGNED = fromString("SystemAssigned"); + + /** Static value UserAssigned for IdentityType. */ + public static final IdentityType USER_ASSIGNED = fromString("UserAssigned"); + + /** Static value SystemAssigned,UserAssigned for IdentityType. */ + public static final IdentityType SYSTEM_ASSIGNED_USER_ASSIGNED = fromString("SystemAssigned,UserAssigned"); + + /** + * 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); + } + + /** + * Gets known IdentityType values. + * + * @return known IdentityType values. + */ + public static Collection values() { + return values(IdentityType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ImplementationMethod.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ImplementationMethod.java new file mode 100644 index 0000000000000..3734b6f6aff39 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ImplementationMethod.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Gets the method in which this recommended action can be manually implemented. e.g., TSql, AzurePowerShell. */ +public enum ImplementationMethod { + /** Enum value TSql. */ + TSQL("TSql"), + + /** Enum value AzurePowerShell. */ + AZURE_POWER_SHELL("AzurePowerShell"); + + /** The actual serialized value for a ImplementationMethod instance. */ + private final 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) { + if (value == null) { + return null; + } + ImplementationMethod[] items = ImplementationMethod.values(); + for (ImplementationMethod item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ImportExistingDatabaseDefinition.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ImportExistingDatabaseDefinition.java new file mode 100644 index 0000000000000..6058260fecad9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ImportExistingDatabaseDefinition.java @@ -0,0 +1,243 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Contains the information necessary to perform import operation for existing database. */ +@Fluent +public final class ImportExistingDatabaseDefinition { + /* + * Storage key type. + */ + @JsonProperty(value = "storageKeyType", required = true) + private StorageKeyType 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; + + /* + * Optional resource information to enable network isolation for request. + */ + @JsonProperty(value = "networkIsolation") + private NetworkIsolationSettings networkIsolation; + + /** Creates an instance of ImportExistingDatabaseDefinition class. */ + public ImportExistingDatabaseDefinition() { + } + + /** + * Get the storageKeyType property: Storage key type. + * + * @return the storageKeyType value. + */ + public StorageKeyType storageKeyType() { + return this.storageKeyType; + } + + /** + * Set the storageKeyType property: Storage key type. + * + * @param storageKeyType the storageKeyType value to set. + * @return the ImportExistingDatabaseDefinition object itself. + */ + public ImportExistingDatabaseDefinition withStorageKeyType(StorageKeyType storageKeyType) { + this.storageKeyType = storageKeyType; + return this; + } + + /** + * Get the storageKey property: Storage key. + * + * @return the storageKey value. + */ + public String storageKey() { + return this.storageKey; + } + + /** + * Set the storageKey property: Storage key. + * + * @param storageKey the storageKey value to set. + * @return the ImportExistingDatabaseDefinition object itself. + */ + public ImportExistingDatabaseDefinition withStorageKey(String storageKey) { + this.storageKey = storageKey; + return this; + } + + /** + * Get the storageUri property: Storage Uri. + * + * @return the storageUri value. + */ + public String storageUri() { + return this.storageUri; + } + + /** + * Set the storageUri property: Storage Uri. + * + * @param storageUri the storageUri value to set. + * @return the ImportExistingDatabaseDefinition object itself. + */ + public ImportExistingDatabaseDefinition withStorageUri(String storageUri) { + this.storageUri = storageUri; + return this; + } + + /** + * Get the administratorLogin property: Administrator login name. + * + * @return the administratorLogin value. + */ + public String administratorLogin() { + return this.administratorLogin; + } + + /** + * Set the administratorLogin property: Administrator login name. + * + * @param administratorLogin the administratorLogin value to set. + * @return the ImportExistingDatabaseDefinition object itself. + */ + public ImportExistingDatabaseDefinition withAdministratorLogin(String administratorLogin) { + this.administratorLogin = administratorLogin; + return this; + } + + /** + * Get the administratorLoginPassword property: Administrator login password. + * + * @return the administratorLoginPassword value. + */ + public String administratorLoginPassword() { + return this.administratorLoginPassword; + } + + /** + * Set the administratorLoginPassword property: Administrator login password. + * + * @param administratorLoginPassword the administratorLoginPassword value to set. + * @return the ImportExistingDatabaseDefinition object itself. + */ + public ImportExistingDatabaseDefinition withAdministratorLoginPassword(String administratorLoginPassword) { + this.administratorLoginPassword = administratorLoginPassword; + return this; + } + + /** + * Get the authenticationType property: Authentication type. + * + * @return the authenticationType value. + */ + public String authenticationType() { + return this.authenticationType; + } + + /** + * Set the authenticationType property: Authentication type. + * + * @param authenticationType the authenticationType value to set. + * @return the ImportExistingDatabaseDefinition object itself. + */ + public ImportExistingDatabaseDefinition withAuthenticationType(String authenticationType) { + this.authenticationType = authenticationType; + return this; + } + + /** + * Get the networkIsolation property: Optional resource information to enable network isolation for request. + * + * @return the networkIsolation value. + */ + public NetworkIsolationSettings networkIsolation() { + return this.networkIsolation; + } + + /** + * Set the networkIsolation property: Optional resource information to enable network isolation for request. + * + * @param networkIsolation the networkIsolation value to set. + * @return the ImportExistingDatabaseDefinition object itself. + */ + public ImportExistingDatabaseDefinition withNetworkIsolation(NetworkIsolationSettings networkIsolation) { + this.networkIsolation = networkIsolation; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (storageKeyType() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property storageKeyType in model ImportExistingDatabaseDefinition")); + } + if (storageKey() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property storageKey in model ImportExistingDatabaseDefinition")); + } + if (storageUri() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property storageUri in model ImportExistingDatabaseDefinition")); + } + if (administratorLogin() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property administratorLogin in model ImportExistingDatabaseDefinition")); + } + if (administratorLoginPassword() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property administratorLoginPassword in model" + + " ImportExistingDatabaseDefinition")); + } + if (networkIsolation() != null) { + networkIsolation().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ImportExistingDatabaseDefinition.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ImportExportExtensionsOperationListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ImportExportExtensionsOperationListResult.java new file mode 100644 index 0000000000000..c478e1822574d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ImportExportExtensionsOperationListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.ImportExportExtensionsOperationResultInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Import export operation extensions list. */ +@Immutable +public final class ImportExportExtensionsOperationListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of ImportExportExtensionsOperationListResult class. */ + public ImportExportExtensionsOperationListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ImportExportExtensionsOperationResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ImportExportExtensionsOperationResult.java new file mode 100644 index 0000000000000..c8ffe2e92c6c3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ImportExportExtensionsOperationResult.java @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ImportExportExtensionsOperationResultInner; +import java.util.UUID; + +/** An immutable client-side representation of ImportExportExtensionsOperationResult. */ +public interface ImportExportExtensionsOperationResult { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the requestId property: Request Id. + * + * @return the requestId value. + */ + UUID requestId(); + + /** + * Gets the requestType property: Request type. + * + * @return the requestType value. + */ + String requestType(); + + /** + * Gets the lastModifiedTime property: Last modified time. + * + * @return the lastModifiedTime value. + */ + String lastModifiedTime(); + + /** + * Gets the serverName property: Server name. + * + * @return the serverName value. + */ + String serverName(); + + /** + * Gets the databaseName property: Database name. + * + * @return the databaseName value. + */ + String databaseName(); + + /** + * Gets the status property: Operation status. + * + * @return the status value. + */ + String status(); + + /** + * Gets the errorMessage property: Error message. + * + * @return the errorMessage value. + */ + String errorMessage(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ImportExportExtensionsOperationResultInner + * object. + * + * @return the inner object. + */ + ImportExportExtensionsOperationResultInner innerModel(); + + /** The entirety of the ImportExportExtensionsOperationResult definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ImportExportExtensionsOperationResult definition stages. */ + interface DefinitionStages { + /** The first stage of the ImportExportExtensionsOperationResult definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ImportExportExtensionsOperationResult definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName, databaseName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @return the next definition stage. + */ + WithCreate withExistingDatabase(String resourceGroupName, String serverName, String databaseName); + } + /** + * The stage of the ImportExportExtensionsOperationResult definition which contains all the minimum required + * properties for the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithOperationMode, + DefinitionStages.WithStorageKeyType, + DefinitionStages.WithStorageKey, + DefinitionStages.WithStorageUri { + /** + * Executes the create request. + * + * @return the created resource. + */ + ImportExportExtensionsOperationResult create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ImportExportExtensionsOperationResult create(Context context); + } + /** The stage of the ImportExportExtensionsOperationResult definition allowing to specify operationMode. */ + interface WithOperationMode { + /** + * Specifies the operationMode property: Operation Mode.. + * + * @param operationMode Operation Mode. + * @return the next definition stage. + */ + WithCreate withOperationMode(OperationMode operationMode); + } + /** The stage of the ImportExportExtensionsOperationResult definition allowing to specify storageKeyType. */ + interface WithStorageKeyType { + /** + * Specifies the storageKeyType property: Storage key type.. + * + * @param storageKeyType Storage key type. + * @return the next definition stage. + */ + WithCreate withStorageKeyType(StorageKeyType storageKeyType); + } + /** The stage of the ImportExportExtensionsOperationResult definition allowing to specify storageKey. */ + interface WithStorageKey { + /** + * Specifies the storageKey property: Storage key.. + * + * @param storageKey Storage key. + * @return the next definition stage. + */ + WithCreate withStorageKey(String storageKey); + } + /** The stage of the ImportExportExtensionsOperationResult definition allowing to specify storageUri. */ + interface WithStorageUri { + /** + * Specifies the storageUri property: Storage Uri.. + * + * @param storageUri Storage Uri. + * @return the next definition stage. + */ + WithCreate withStorageUri(String storageUri); + } + } + /** + * Begins update for the ImportExportExtensionsOperationResult resource. + * + * @return the stage of resource update. + */ + ImportExportExtensionsOperationResult.Update update(); + + /** The template for ImportExportExtensionsOperationResult update. */ + interface Update { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ImportExportExtensionsOperationResult apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ImportExportExtensionsOperationResult apply(Context context); + } + /** The ImportExportExtensionsOperationResult update stages. */ + interface UpdateStages { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ImportExportOperationResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ImportExportOperationResult.java new file mode 100644 index 0000000000000..3418905413bf4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ImportExportOperationResult.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.ImportExportOperationResultInner; +import java.util.List; +import java.util.UUID; + +/** An immutable client-side representation of ImportExportOperationResult. */ +public interface ImportExportOperationResult { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the requestId property: Request Id. + * + * @return the requestId value. + */ + UUID requestId(); + + /** + * Gets the requestType property: Request type. + * + * @return the requestType value. + */ + String requestType(); + + /** + * Gets the queuedTime property: Queued time. + * + * @return the queuedTime value. + */ + String queuedTime(); + + /** + * Gets the lastModifiedTime property: Last modified time. + * + * @return the lastModifiedTime value. + */ + String lastModifiedTime(); + + /** + * Gets the blobUri property: Blob Uri. + * + * @return the blobUri value. + */ + String blobUri(); + + /** + * Gets the serverName property: Server name. + * + * @return the serverName value. + */ + String serverName(); + + /** + * Gets the databaseName property: Database name. + * + * @return the databaseName value. + */ + String databaseName(); + + /** + * Gets the status property: Operation status. + * + * @return the status value. + */ + String status(); + + /** + * Gets the errorMessage property: Error message. + * + * @return the errorMessage value. + */ + String errorMessage(); + + /** + * Gets the privateEndpointConnections property: Gets the status of private endpoints associated with this request. + * + * @return the privateEndpointConnections value. + */ + List privateEndpointConnections(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ImportExportOperationResultInner object. + * + * @return the inner object. + */ + ImportExportOperationResultInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ImportNewDatabaseDefinition.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ImportNewDatabaseDefinition.java new file mode 100644 index 0000000000000..0d8b61ad72913 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ImportNewDatabaseDefinition.java @@ -0,0 +1,346 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Contains the information necessary to perform import operation for new database. */ +@Fluent +public final class ImportNewDatabaseDefinition { + /* + * 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 StorageKeyType 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; + + /* + * Optional resource information to enable network isolation for request. + */ + @JsonProperty(value = "networkIsolation") + private NetworkIsolationSettings networkIsolation; + + /** Creates an instance of ImportNewDatabaseDefinition class. */ + public ImportNewDatabaseDefinition() { + } + + /** + * Get the databaseName property: Name of the import database. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Set the databaseName property: Name of the import database. + * + * @param databaseName the databaseName value to set. + * @return the ImportNewDatabaseDefinition object itself. + */ + public ImportNewDatabaseDefinition withDatabaseName(String databaseName) { + this.databaseName = databaseName; + return this; + } + + /** + * Get the edition property: Edition of the import database. + * + * @return the edition value. + */ + public String edition() { + return this.edition; + } + + /** + * Set the edition property: Edition of the import database. + * + * @param edition the edition value to set. + * @return the ImportNewDatabaseDefinition object itself. + */ + public ImportNewDatabaseDefinition withEdition(String edition) { + this.edition = edition; + return this; + } + + /** + * Get the serviceObjectiveName property: Service level objective name of the import database. + * + * @return the serviceObjectiveName value. + */ + public String serviceObjectiveName() { + return this.serviceObjectiveName; + } + + /** + * Set the serviceObjectiveName property: Service level objective name of the import database. + * + * @param serviceObjectiveName the serviceObjectiveName value to set. + * @return the ImportNewDatabaseDefinition object itself. + */ + public ImportNewDatabaseDefinition withServiceObjectiveName(String serviceObjectiveName) { + this.serviceObjectiveName = serviceObjectiveName; + return this; + } + + /** + * Get the maxSizeBytes property: Max size in bytes for the import database. + * + * @return the maxSizeBytes value. + */ + public String maxSizeBytes() { + return this.maxSizeBytes; + } + + /** + * Set the maxSizeBytes property: Max size in bytes for the import database. + * + * @param maxSizeBytes the maxSizeBytes value to set. + * @return the ImportNewDatabaseDefinition object itself. + */ + public ImportNewDatabaseDefinition withMaxSizeBytes(String maxSizeBytes) { + this.maxSizeBytes = maxSizeBytes; + return this; + } + + /** + * Get the storageKeyType property: Storage key type. + * + * @return the storageKeyType value. + */ + public StorageKeyType storageKeyType() { + return this.storageKeyType; + } + + /** + * Set the storageKeyType property: Storage key type. + * + * @param storageKeyType the storageKeyType value to set. + * @return the ImportNewDatabaseDefinition object itself. + */ + public ImportNewDatabaseDefinition withStorageKeyType(StorageKeyType storageKeyType) { + this.storageKeyType = storageKeyType; + return this; + } + + /** + * Get the storageKey property: Storage key. + * + * @return the storageKey value. + */ + public String storageKey() { + return this.storageKey; + } + + /** + * Set the storageKey property: Storage key. + * + * @param storageKey the storageKey value to set. + * @return the ImportNewDatabaseDefinition object itself. + */ + public ImportNewDatabaseDefinition withStorageKey(String storageKey) { + this.storageKey = storageKey; + return this; + } + + /** + * Get the storageUri property: Storage Uri. + * + * @return the storageUri value. + */ + public String storageUri() { + return this.storageUri; + } + + /** + * Set the storageUri property: Storage Uri. + * + * @param storageUri the storageUri value to set. + * @return the ImportNewDatabaseDefinition object itself. + */ + public ImportNewDatabaseDefinition withStorageUri(String storageUri) { + this.storageUri = storageUri; + return this; + } + + /** + * Get the administratorLogin property: Administrator login name. + * + * @return the administratorLogin value. + */ + public String administratorLogin() { + return this.administratorLogin; + } + + /** + * Set the administratorLogin property: Administrator login name. + * + * @param administratorLogin the administratorLogin value to set. + * @return the ImportNewDatabaseDefinition object itself. + */ + public ImportNewDatabaseDefinition withAdministratorLogin(String administratorLogin) { + this.administratorLogin = administratorLogin; + return this; + } + + /** + * Get the administratorLoginPassword property: Administrator login password. + * + * @return the administratorLoginPassword value. + */ + public String administratorLoginPassword() { + return this.administratorLoginPassword; + } + + /** + * Set the administratorLoginPassword property: Administrator login password. + * + * @param administratorLoginPassword the administratorLoginPassword value to set. + * @return the ImportNewDatabaseDefinition object itself. + */ + public ImportNewDatabaseDefinition withAdministratorLoginPassword(String administratorLoginPassword) { + this.administratorLoginPassword = administratorLoginPassword; + return this; + } + + /** + * Get the authenticationType property: Authentication type. + * + * @return the authenticationType value. + */ + public String authenticationType() { + return this.authenticationType; + } + + /** + * Set the authenticationType property: Authentication type. + * + * @param authenticationType the authenticationType value to set. + * @return the ImportNewDatabaseDefinition object itself. + */ + public ImportNewDatabaseDefinition withAuthenticationType(String authenticationType) { + this.authenticationType = authenticationType; + return this; + } + + /** + * Get the networkIsolation property: Optional resource information to enable network isolation for request. + * + * @return the networkIsolation value. + */ + public NetworkIsolationSettings networkIsolation() { + return this.networkIsolation; + } + + /** + * Set the networkIsolation property: Optional resource information to enable network isolation for request. + * + * @param networkIsolation the networkIsolation value to set. + * @return the ImportNewDatabaseDefinition object itself. + */ + public ImportNewDatabaseDefinition withNetworkIsolation(NetworkIsolationSettings networkIsolation) { + this.networkIsolation = networkIsolation; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (storageKeyType() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property storageKeyType in model ImportNewDatabaseDefinition")); + } + if (storageKey() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property storageKey in model ImportNewDatabaseDefinition")); + } + if (storageUri() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property storageUri in model ImportNewDatabaseDefinition")); + } + if (administratorLogin() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property administratorLogin in model ImportNewDatabaseDefinition")); + } + if (administratorLoginPassword() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property administratorLoginPassword in model ImportNewDatabaseDefinition")); + } + if (networkIsolation() != null) { + networkIsolation().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ImportNewDatabaseDefinition.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstanceFailoverGroup.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstanceFailoverGroup.java new file mode 100644 index 0000000000000..4cb5e15fe261e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstanceFailoverGroup.java @@ -0,0 +1,292 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.InstanceFailoverGroupInner; +import java.util.List; + +/** An immutable client-side representation of InstanceFailoverGroup. */ +public interface InstanceFailoverGroup { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the readWriteEndpoint property: Read-write endpoint of the failover group instance. + * + * @return the readWriteEndpoint value. + */ + InstanceFailoverGroupReadWriteEndpoint readWriteEndpoint(); + + /** + * Gets the readOnlyEndpoint property: Read-only endpoint of the failover group instance. + * + * @return the readOnlyEndpoint value. + */ + InstanceFailoverGroupReadOnlyEndpoint readOnlyEndpoint(); + + /** + * Gets the replicationRole property: Local replication role of the failover group instance. + * + * @return the replicationRole value. + */ + InstanceFailoverGroupReplicationRole replicationRole(); + + /** + * Gets the replicationState property: Replication state of the failover group instance. + * + * @return the replicationState value. + */ + String replicationState(); + + /** + * Gets the partnerRegions property: Partner region information for the failover group. + * + * @return the partnerRegions value. + */ + List partnerRegions(); + + /** + * Gets the managedInstancePairs property: List of managed instance pairs in the failover group. + * + * @return the managedInstancePairs value. + */ + List managedInstancePairs(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.InstanceFailoverGroupInner object. + * + * @return the inner object. + */ + InstanceFailoverGroupInner innerModel(); + + /** The entirety of the InstanceFailoverGroup definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The InstanceFailoverGroup definition stages. */ + interface DefinitionStages { + /** The first stage of the InstanceFailoverGroup definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the InstanceFailoverGroup definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, locationName. + * + * @param resourceGroupName The 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. + * @return the next definition stage. + */ + WithCreate withExistingLocation(String resourceGroupName, String locationName); + } + /** + * The stage of the InstanceFailoverGroup definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithReadWriteEndpoint, + DefinitionStages.WithReadOnlyEndpoint, + DefinitionStages.WithPartnerRegions, + DefinitionStages.WithManagedInstancePairs { + /** + * Executes the create request. + * + * @return the created resource. + */ + InstanceFailoverGroup create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + InstanceFailoverGroup create(Context context); + } + /** The stage of the InstanceFailoverGroup definition allowing to specify readWriteEndpoint. */ + interface WithReadWriteEndpoint { + /** + * Specifies the readWriteEndpoint property: Read-write endpoint of the failover group instance.. + * + * @param readWriteEndpoint Read-write endpoint of the failover group instance. + * @return the next definition stage. + */ + WithCreate withReadWriteEndpoint(InstanceFailoverGroupReadWriteEndpoint readWriteEndpoint); + } + /** The stage of the InstanceFailoverGroup definition allowing to specify readOnlyEndpoint. */ + interface WithReadOnlyEndpoint { + /** + * Specifies the readOnlyEndpoint property: Read-only endpoint of the failover group instance.. + * + * @param readOnlyEndpoint Read-only endpoint of the failover group instance. + * @return the next definition stage. + */ + WithCreate withReadOnlyEndpoint(InstanceFailoverGroupReadOnlyEndpoint readOnlyEndpoint); + } + /** The stage of the InstanceFailoverGroup definition allowing to specify partnerRegions. */ + interface WithPartnerRegions { + /** + * Specifies the partnerRegions property: Partner region information for the failover group.. + * + * @param partnerRegions Partner region information for the failover group. + * @return the next definition stage. + */ + WithCreate withPartnerRegions(List partnerRegions); + } + /** The stage of the InstanceFailoverGroup definition allowing to specify managedInstancePairs. */ + interface WithManagedInstancePairs { + /** + * Specifies the managedInstancePairs property: List of managed instance pairs in the failover group.. + * + * @param managedInstancePairs List of managed instance pairs in the failover group. + * @return the next definition stage. + */ + WithCreate withManagedInstancePairs(List managedInstancePairs); + } + } + /** + * Begins update for the InstanceFailoverGroup resource. + * + * @return the stage of resource update. + */ + InstanceFailoverGroup.Update update(); + + /** The template for InstanceFailoverGroup update. */ + interface Update + extends UpdateStages.WithReadWriteEndpoint, + UpdateStages.WithReadOnlyEndpoint, + UpdateStages.WithManagedInstancePairs { + /** + * Executes the update request. + * + * @return the updated resource. + */ + InstanceFailoverGroup apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + InstanceFailoverGroup apply(Context context); + } + /** The InstanceFailoverGroup update stages. */ + interface UpdateStages { + /** The stage of the InstanceFailoverGroup update allowing to specify readWriteEndpoint. */ + interface WithReadWriteEndpoint { + /** + * Specifies the readWriteEndpoint property: Read-write endpoint of the failover group instance.. + * + * @param readWriteEndpoint Read-write endpoint of the failover group instance. + * @return the next definition stage. + */ + Update withReadWriteEndpoint(InstanceFailoverGroupReadWriteEndpoint readWriteEndpoint); + } + /** The stage of the InstanceFailoverGroup update allowing to specify readOnlyEndpoint. */ + interface WithReadOnlyEndpoint { + /** + * Specifies the readOnlyEndpoint property: Read-only endpoint of the failover group instance.. + * + * @param readOnlyEndpoint Read-only endpoint of the failover group instance. + * @return the next definition stage. + */ + Update withReadOnlyEndpoint(InstanceFailoverGroupReadOnlyEndpoint readOnlyEndpoint); + } + /** The stage of the InstanceFailoverGroup update allowing to specify managedInstancePairs. */ + interface WithManagedInstancePairs { + /** + * Specifies the managedInstancePairs property: List of managed instance pairs in the failover group.. + * + * @param managedInstancePairs List of managed instance pairs in the failover group. + * @return the next definition stage. + */ + Update withManagedInstancePairs(List managedInstancePairs); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + InstanceFailoverGroup refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + InstanceFailoverGroup refresh(Context context); + + /** + * Fails over from the current primary managed instance to this managed instance. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + InstanceFailoverGroup failover(); + + /** + * Fails over from the current primary managed instance to this managed instance. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + InstanceFailoverGroup failover(Context context); + + /** + * Fails over from the current primary managed instance to this managed instance. This operation might result in + * data loss. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + InstanceFailoverGroup forceFailoverAllowDataLoss(); + + /** + * Fails over from the current primary managed instance to this managed instance. This operation might result in + * data loss. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + InstanceFailoverGroup forceFailoverAllowDataLoss(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstanceFailoverGroupListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstanceFailoverGroupListResult.java new file mode 100644 index 0000000000000..bf4ced2eb815f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstanceFailoverGroupListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.InstanceFailoverGroupInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of instance failover groups. */ +@Immutable +public final class InstanceFailoverGroupListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of InstanceFailoverGroupListResult class. */ + public InstanceFailoverGroupListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstanceFailoverGroupReadOnlyEndpoint.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstanceFailoverGroupReadOnlyEndpoint.java new file mode 100644 index 0000000000000..b62cadab52ba4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstanceFailoverGroupReadOnlyEndpoint.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Read-only endpoint of the failover group instance. */ +@Fluent +public final class InstanceFailoverGroupReadOnlyEndpoint { + /* + * Failover policy of the read-only endpoint for the failover group. + */ + @JsonProperty(value = "failoverPolicy") + private ReadOnlyEndpointFailoverPolicy failoverPolicy; + + /** Creates an instance of InstanceFailoverGroupReadOnlyEndpoint class. */ + public InstanceFailoverGroupReadOnlyEndpoint() { + } + + /** + * Get the failoverPolicy property: Failover policy of the read-only endpoint for the failover group. + * + * @return the failoverPolicy value. + */ + public ReadOnlyEndpointFailoverPolicy failoverPolicy() { + return this.failoverPolicy; + } + + /** + * Set the failoverPolicy property: Failover policy of the read-only endpoint for the failover group. + * + * @param failoverPolicy the failoverPolicy value to set. + * @return the InstanceFailoverGroupReadOnlyEndpoint object itself. + */ + public InstanceFailoverGroupReadOnlyEndpoint withFailoverPolicy(ReadOnlyEndpointFailoverPolicy failoverPolicy) { + this.failoverPolicy = failoverPolicy; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstanceFailoverGroupReadWriteEndpoint.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstanceFailoverGroupReadWriteEndpoint.java new file mode 100644 index 0000000000000..cb2820ce61820 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstanceFailoverGroupReadWriteEndpoint.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Read-write endpoint of the failover group instance. */ +@Fluent +public final class InstanceFailoverGroupReadWriteEndpoint { + /* + * Failover policy of the read-write endpoint for the failover group. If failoverPolicy is Automatic then + * failoverWithDataLossGracePeriodMinutes is required. + */ + @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; + + /** Creates an instance of InstanceFailoverGroupReadWriteEndpoint class. */ + public InstanceFailoverGroupReadWriteEndpoint() { + } + + /** + * Get the failoverPolicy property: Failover policy of the read-write endpoint for the failover group. If + * failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is required. + * + * @return the failoverPolicy value. + */ + public ReadWriteEndpointFailoverPolicy failoverPolicy() { + return this.failoverPolicy; + } + + /** + * Set the failoverPolicy property: Failover policy of the read-write endpoint for the failover group. If + * failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is required. + * + * @param failoverPolicy the failoverPolicy value to set. + * @return the InstanceFailoverGroupReadWriteEndpoint object itself. + */ + public InstanceFailoverGroupReadWriteEndpoint withFailoverPolicy(ReadWriteEndpointFailoverPolicy failoverPolicy) { + this.failoverPolicy = failoverPolicy; + return this; + } + + /** + * Get the failoverWithDataLossGracePeriodMinutes property: 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 the failoverWithDataLossGracePeriodMinutes property: 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (failoverPolicy() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property failoverPolicy in model InstanceFailoverGroupReadWriteEndpoint")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(InstanceFailoverGroupReadWriteEndpoint.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstanceFailoverGroupReplicationRole.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstanceFailoverGroupReplicationRole.java new file mode 100644 index 0000000000000..ee3878b45d40c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstanceFailoverGroupReplicationRole.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Local replication role of the failover group instance. */ +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); + } + + /** + * Gets known InstanceFailoverGroupReplicationRole values. + * + * @return known InstanceFailoverGroupReplicationRole values. + */ + public static Collection values() { + return values(InstanceFailoverGroupReplicationRole.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstanceFailoverGroups.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstanceFailoverGroups.java new file mode 100644 index 0000000000000..5e1796ae4ef85 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstanceFailoverGroups.java @@ -0,0 +1,211 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of InstanceFailoverGroups. */ +public interface InstanceFailoverGroups { + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String locationName, String failoverGroupName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group. + */ + InstanceFailoverGroup get(String resourceGroupName, String locationName, String failoverGroupName); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String locationName, String failoverGroupName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String locationName, String failoverGroupName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of instance failover groups as paginated response with {@link PagedIterable}. + */ + PagedIterable listByLocation(String resourceGroupName, String locationName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of instance failover groups as paginated response with {@link PagedIterable}. + */ + PagedIterable listByLocation(String resourceGroupName, String locationName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + InstanceFailoverGroup failover(String resourceGroupName, String locationName, String failoverGroupName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + InstanceFailoverGroup failover( + String resourceGroupName, String locationName, String failoverGroupName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + InstanceFailoverGroup forceFailoverAllowDataLoss( + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance failover group. + */ + InstanceFailoverGroup forceFailoverAllowDataLoss( + String resourceGroupName, String locationName, String failoverGroupName, Context context); + + /** + * Gets a failover group. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group along with {@link Response}. + */ + InstanceFailoverGroup getById(String id); + + /** + * Gets a failover group. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a failover group along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a failover group. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a failover group. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new InstanceFailoverGroup resource. + * + * @param name resource name. + * @return the first stage of the new InstanceFailoverGroup definition. + */ + InstanceFailoverGroup.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePool.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePool.java new file mode 100644 index 0000000000000..3532a259bb866 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePool.java @@ -0,0 +1,276 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.InstancePoolInner; +import java.util.Map; + +/** An immutable client-side representation of InstancePool. */ +public interface InstancePool { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the sku property: The name and tier of the SKU. + * + * @return the sku value. + */ + Sku sku(); + + /** + * Gets the subnetId property: Resource ID of the subnet to place this instance pool in. + * + * @return the subnetId value. + */ + String subnetId(); + + /** + * Gets the vCores property: Count of vCores belonging to this instance pool. + * + * @return the vCores value. + */ + int vCores(); + + /** + * Gets the licenseType property: The license type. Possible values are 'LicenseIncluded' (price for SQL license is + * included) and 'BasePrice' (without SQL license price). + * + * @return the licenseType value. + */ + InstancePoolLicenseType licenseType(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.InstancePoolInner object. + * + * @return the inner object. + */ + InstancePoolInner innerModel(); + + /** The entirety of the InstancePool definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The InstancePool definition stages. */ + interface DefinitionStages { + /** The first stage of the InstancePool definition. */ + interface Blank extends WithLocation { + } + /** The stage of the InstancePool definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the InstancePool definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the InstancePool definition which contains all the minimum required properties for the resource + * to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithSku, + DefinitionStages.WithSubnetId, + DefinitionStages.WithVCores, + DefinitionStages.WithLicenseType { + /** + * Executes the create request. + * + * @return the created resource. + */ + InstancePool create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + InstancePool create(Context context); + } + /** The stage of the InstancePool definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the InstancePool definition allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: The name and tier of the SKU.. + * + * @param sku The name and tier of the SKU. + * @return the next definition stage. + */ + WithCreate withSku(Sku sku); + } + /** The stage of the InstancePool definition allowing to specify subnetId. */ + interface WithSubnetId { + /** + * Specifies the subnetId property: Resource ID of the subnet to place this instance pool in.. + * + * @param subnetId Resource ID of the subnet to place this instance pool in. + * @return the next definition stage. + */ + WithCreate withSubnetId(String subnetId); + } + /** The stage of the InstancePool definition allowing to specify vCores. */ + interface WithVCores { + /** + * Specifies the vCores property: Count of vCores belonging to this instance pool.. + * + * @param vCores Count of vCores belonging to this instance pool. + * @return the next definition stage. + */ + WithCreate withVCores(int vCores); + } + /** The stage of the InstancePool definition allowing to specify licenseType. */ + interface WithLicenseType { + /** + * Specifies the licenseType property: The license type. Possible values are 'LicenseIncluded' (price for + * SQL license is included) and 'BasePrice' (without SQL license price).. + * + * @param licenseType The license type. Possible values are 'LicenseIncluded' (price for SQL license is + * included) and 'BasePrice' (without SQL license price). + * @return the next definition stage. + */ + WithCreate withLicenseType(InstancePoolLicenseType licenseType); + } + } + /** + * Begins update for the InstancePool resource. + * + * @return the stage of resource update. + */ + InstancePool.Update update(); + + /** The template for InstancePool update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + InstancePool apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + InstancePool apply(Context context); + } + /** The InstancePool update stages. */ + interface UpdateStages { + /** The stage of the InstancePool update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + InstancePool refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + InstancePool refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePoolEditionCapability.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePoolEditionCapability.java new file mode 100644 index 0000000000000..32be3c9fe22b3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePoolEditionCapability.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The instance pool capability. */ +@Fluent +public final class InstancePoolEditionCapability { + /* + * The instance pool 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. + */ + @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; + + /** Creates an instance of InstancePoolEditionCapability class. */ + public InstancePoolEditionCapability() { + } + + /** + * Get the name property: The instance pool version name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the supportedFamilies property: The supported families. + * + * @return the supportedFamilies value. + */ + public List supportedFamilies() { + return this.supportedFamilies; + } + + /** + * Get the status property: The status of the capability. + * + * @return the status value. + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason property: The reason for the capability not being available. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: The reason for the capability not being available. + * + * @param reason the reason value to set. + * @return the InstancePoolEditionCapability object itself. + */ + public InstancePoolEditionCapability withReason(String reason) { + this.reason = reason; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (supportedFamilies() != null) { + supportedFamilies().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePoolFamilyCapability.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePoolFamilyCapability.java new file mode 100644 index 0000000000000..832858e2cf870 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePoolFamilyCapability.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The instance pool family capability. */ +@Fluent +public final class InstancePoolFamilyCapability { + /* + * Family name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * 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; + + /* + * The status of the capability. + */ + @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; + + /** Creates an instance of InstancePoolFamilyCapability class. */ + public InstancePoolFamilyCapability() { + } + + /** + * Get the name property: Family name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the supportedLicenseTypes property: List of supported license types. + * + * @return the supportedLicenseTypes value. + */ + public List supportedLicenseTypes() { + return this.supportedLicenseTypes; + } + + /** + * Get the supportedVcoresValues property: List of supported virtual cores values. + * + * @return the supportedVcoresValues value. + */ + public List supportedVcoresValues() { + return this.supportedVcoresValues; + } + + /** + * Get the status property: The status of the capability. + * + * @return the status value. + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason property: The reason for the capability not being available. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: The reason for the capability not being available. + * + * @param reason the reason value to set. + * @return the InstancePoolFamilyCapability object itself. + */ + public InstancePoolFamilyCapability withReason(String reason) { + this.reason = reason; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (supportedLicenseTypes() != null) { + supportedLicenseTypes().forEach(e -> e.validate()); + } + if (supportedVcoresValues() != null) { + supportedVcoresValues().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePoolLicenseType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePoolLicenseType.java new file mode 100644 index 0000000000000..d44025b6bceb8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePoolLicenseType.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * The license type. Possible values are 'LicenseIncluded' (price for SQL license is included) and 'BasePrice' (without + * SQL license price). + */ +public final class InstancePoolLicenseType extends ExpandableStringEnum { + /** Static value LicenseIncluded for InstancePoolLicenseType. */ + public static final InstancePoolLicenseType LICENSE_INCLUDED = fromString("LicenseIncluded"); + + /** Static value BasePrice for InstancePoolLicenseType. */ + public static final InstancePoolLicenseType BASE_PRICE = fromString("BasePrice"); + + /** + * Creates or finds a InstancePoolLicenseType from its string representation. + * + * @param name a name to look for. + * @return the corresponding InstancePoolLicenseType. + */ + @JsonCreator + public static InstancePoolLicenseType fromString(String name) { + return fromString(name, InstancePoolLicenseType.class); + } + + /** + * Gets known InstancePoolLicenseType values. + * + * @return known InstancePoolLicenseType values. + */ + public static Collection values() { + return values(InstancePoolLicenseType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePoolListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePoolListResult.java new file mode 100644 index 0000000000000..21bad653e57c1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePoolListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.InstancePoolInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of Azure SQL instance pools. */ +@Immutable +public final class InstancePoolListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of InstancePoolListResult class. */ + public InstancePoolListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePoolUpdate.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePoolUpdate.java new file mode 100644 index 0000000000000..8909f0ac87c56 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePoolUpdate.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An update to an Instance pool. */ +@Fluent +public final class InstancePoolUpdate { + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** Creates an instance of InstancePoolUpdate class. */ + public InstancePoolUpdate() { + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the InstancePoolUpdate object itself. + */ + public InstancePoolUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePoolVcoresCapability.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePoolVcoresCapability.java new file mode 100644 index 0000000000000..8f977f6500564 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePoolVcoresCapability.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The managed instance virtual cores capability. */ +@Fluent +public final class InstancePoolVcoresCapability { + /* + * 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; + + /* + * Storage limit. + */ + @JsonProperty(value = "storageLimit", access = JsonProperty.Access.WRITE_ONLY) + private MaxSizeCapability storageLimit; + + /* + * The status of the capability. + */ + @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; + + /** Creates an instance of InstancePoolVcoresCapability class. */ + public InstancePoolVcoresCapability() { + } + + /** + * Get the name property: The virtual cores identifier. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the value property: The virtual cores value. + * + * @return the value value. + */ + public Integer value() { + return this.value; + } + + /** + * Get the storageLimit property: Storage limit. + * + * @return the storageLimit value. + */ + public MaxSizeCapability storageLimit() { + return this.storageLimit; + } + + /** + * Get the status property: The status of the capability. + * + * @return the status value. + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason property: The reason for the capability not being available. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: The reason for the capability not being available. + * + * @param reason the reason value to set. + * @return the InstancePoolVcoresCapability object itself. + */ + public InstancePoolVcoresCapability withReason(String reason) { + this.reason = reason; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (storageLimit() != null) { + storageLimit().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePools.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePools.java new file mode 100644 index 0000000000000..22aa6d81d2d55 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/InstancePools.java @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of InstancePools. */ +public interface InstancePools { + /** + * Gets an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance pool along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String instancePoolName, Context context); + + /** + * Gets an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance pool. + */ + InstancePool getByResourceGroup(String resourceGroupName, String instancePoolName); + + /** + * Deletes an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be deleted. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String instancePoolName); + + /** + * Deletes an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be deleted. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String instancePoolName, Context context); + + /** + * Gets a list of instance pools in the resource group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of instance pools in the resource group as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets a list of instance pools in the resource group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of instance pools in the resource group as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets a list of all instance pools in the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all instance pools in the subscription as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Gets a list of all instance pools in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all instance pools in the subscription as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Gets an instance pool. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance pool along with {@link Response}. + */ + InstancePool getById(String id); + + /** + * Gets an instance pool. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instance pool along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes an instance pool. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes an instance pool. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new InstancePool resource. + * + * @param name resource name. + * @return the first stage of the new InstancePool definition. + */ + InstancePool.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/IsRetryable.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/IsRetryable.java new file mode 100644 index 0000000000000..8d7cb38515d69 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/IsRetryable.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Gets whether the error could be ignored and recommended action could be retried. Possible values are: Yes/No. */ +public enum IsRetryable { + /** Enum value Yes. */ + YES("Yes"), + + /** Enum value No. */ + NO("No"); + + /** The actual serialized value for a IsRetryable instance. */ + private final 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) { + if (value == null) { + return null; + } + IsRetryable[] items = IsRetryable.values(); + for (IsRetryable item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Job.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Job.java new file mode 100644 index 0000000000000..0d8d3d4e810ac --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Job.java @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.JobInner; + +/** An immutable client-side representation of Job. */ +public interface Job { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the description property: User-defined description of the job. + * + * @return the description value. + */ + String description(); + + /** + * Gets the version property: The job version number. + * + * @return the version value. + */ + Integer version(); + + /** + * Gets the schedule property: Schedule properties of the job. + * + * @return the schedule value. + */ + JobSchedule schedule(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.JobInner object. + * + * @return the inner object. + */ + JobInner innerModel(); + + /** The entirety of the Job definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The Job definition stages. */ + interface DefinitionStages { + /** The first stage of the Job definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the Job definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName, jobAgentName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @return the next definition stage. + */ + WithCreate withExistingJobAgent(String resourceGroupName, String serverName, String jobAgentName); + } + /** + * The stage of the Job definition which contains all the minimum required properties for the resource to be + * created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithDescription, DefinitionStages.WithSchedule { + /** + * Executes the create request. + * + * @return the created resource. + */ + Job create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Job create(Context context); + } + /** The stage of the Job definition allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: User-defined description of the job.. + * + * @param description User-defined description of the job. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + /** The stage of the Job definition allowing to specify schedule. */ + interface WithSchedule { + /** + * Specifies the schedule property: Schedule properties of the job.. + * + * @param schedule Schedule properties of the job. + * @return the next definition stage. + */ + WithCreate withSchedule(JobSchedule schedule); + } + } + /** + * Begins update for the Job resource. + * + * @return the stage of resource update. + */ + Job.Update update(); + + /** The template for Job update. */ + interface Update extends UpdateStages.WithDescription, UpdateStages.WithSchedule { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Job apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Job apply(Context context); + } + /** The Job update stages. */ + interface UpdateStages { + /** The stage of the Job update allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: User-defined description of the job.. + * + * @param description User-defined description of the job. + * @return the next definition stage. + */ + Update withDescription(String description); + } + /** The stage of the Job update allowing to specify schedule. */ + interface WithSchedule { + /** + * Specifies the schedule property: Schedule properties of the job.. + * + * @param schedule Schedule properties of the job. + * @return the next definition stage. + */ + Update withSchedule(JobSchedule schedule); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Job refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Job refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobAgent.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobAgent.java new file mode 100644 index 0000000000000..6909b41ee9cd7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobAgent.java @@ -0,0 +1,243 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.JobAgentInner; +import java.util.Map; + +/** An immutable client-side representation of JobAgent. */ +public interface JobAgent { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the sku property: The name and tier of the SKU. + * + * @return the sku value. + */ + Sku sku(); + + /** + * Gets the databaseId property: Resource ID of the database to store job metadata in. + * + * @return the databaseId value. + */ + String databaseId(); + + /** + * Gets the state property: The state of the job agent. + * + * @return the state value. + */ + JobAgentState state(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.JobAgentInner object. + * + * @return the inner object. + */ + JobAgentInner innerModel(); + + /** The entirety of the JobAgent definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, + DefinitionStages.WithCreate { + } + /** The JobAgent definition stages. */ + interface DefinitionStages { + /** The first stage of the JobAgent definition. */ + interface Blank extends WithLocation { + } + /** The stage of the JobAgent definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + /** The stage of the JobAgent definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @return the next definition stage. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + /** + * The stage of the JobAgent definition which contains all the minimum required properties for the resource to + * be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, DefinitionStages.WithSku, DefinitionStages.WithDatabaseId { + /** + * Executes the create request. + * + * @return the created resource. + */ + JobAgent create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + JobAgent create(Context context); + } + /** The stage of the JobAgent definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the JobAgent definition allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: The name and tier of the SKU.. + * + * @param sku The name and tier of the SKU. + * @return the next definition stage. + */ + WithCreate withSku(Sku sku); + } + /** The stage of the JobAgent definition allowing to specify databaseId. */ + interface WithDatabaseId { + /** + * Specifies the databaseId property: Resource ID of the database to store job metadata in.. + * + * @param databaseId Resource ID of the database to store job metadata in. + * @return the next definition stage. + */ + WithCreate withDatabaseId(String databaseId); + } + } + /** + * Begins update for the JobAgent resource. + * + * @return the stage of resource update. + */ + JobAgent.Update update(); + + /** The template for JobAgent update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + JobAgent apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + JobAgent apply(Context context); + } + /** The JobAgent update stages. */ + interface UpdateStages { + /** The stage of the JobAgent update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + JobAgent refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + JobAgent refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobAgentListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobAgentListResult.java new file mode 100644 index 0000000000000..618853a41dc43 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobAgentListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.JobAgentInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of Azure SQL job agents. */ +@Immutable +public final class JobAgentListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of JobAgentListResult class. */ + public JobAgentListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobAgentState.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobAgentState.java new file mode 100644 index 0000000000000..6dc3e02791933 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobAgentState.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The state of the job agent. */ +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); + } + + /** + * Gets known JobAgentState values. + * + * @return known JobAgentState values. + */ + public static Collection values() { + return values(JobAgentState.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobAgentUpdate.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobAgentUpdate.java new file mode 100644 index 0000000000000..f27108483bb01 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobAgentUpdate.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An update to an Azure SQL job agent. */ +@Fluent +public final class JobAgentUpdate { + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** Creates an instance of JobAgentUpdate class. */ + public JobAgentUpdate() { + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the JobAgentUpdate object itself. + */ + public JobAgentUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobAgents.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobAgents.java new file mode 100644 index 0000000000000..73737891b6619 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobAgents.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of JobAgents. */ +public interface JobAgents { + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job agents in a server as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job agents in a server as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job agent along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String jobAgentName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job agent. + */ + JobAgent get(String resourceGroupName, String serverName, String jobAgentName); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, String jobAgentName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, String jobAgentName, Context context); + + /** + * Gets a job agent. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job agent along with {@link Response}. + */ + JobAgent getById(String id); + + /** + * Gets a job agent. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job agent along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a job agent. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a job agent. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new JobAgent resource. + * + * @param name resource name. + * @return the first stage of the new JobAgent definition. + */ + JobAgent.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobCredential.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobCredential.java new file mode 100644 index 0000000000000..097a204a564d9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobCredential.java @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.JobCredentialInner; + +/** An immutable client-side representation of JobCredential. */ +public interface JobCredential { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the username property: The credential user name. + * + * @return the username value. + */ + String username(); + + /** + * Gets the password property: The credential password. + * + * @return the password value. + */ + String password(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.JobCredentialInner object. + * + * @return the inner object. + */ + JobCredentialInner innerModel(); + + /** The entirety of the JobCredential definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The JobCredential definition stages. */ + interface DefinitionStages { + /** The first stage of the JobCredential definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the JobCredential definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName, jobAgentName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @return the next definition stage. + */ + WithCreate withExistingJobAgent(String resourceGroupName, String serverName, String jobAgentName); + } + /** + * The stage of the JobCredential definition which contains all the minimum required properties for the resource + * to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithUsername, DefinitionStages.WithPassword { + /** + * Executes the create request. + * + * @return the created resource. + */ + JobCredential create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + JobCredential create(Context context); + } + /** The stage of the JobCredential definition allowing to specify username. */ + interface WithUsername { + /** + * Specifies the username property: The credential user name.. + * + * @param username The credential user name. + * @return the next definition stage. + */ + WithCreate withUsername(String username); + } + /** The stage of the JobCredential definition allowing to specify password. */ + interface WithPassword { + /** + * Specifies the password property: The credential password.. + * + * @param password The credential password. + * @return the next definition stage. + */ + WithCreate withPassword(String password); + } + } + /** + * Begins update for the JobCredential resource. + * + * @return the stage of resource update. + */ + JobCredential.Update update(); + + /** The template for JobCredential update. */ + interface Update extends UpdateStages.WithUsername, UpdateStages.WithPassword { + /** + * Executes the update request. + * + * @return the updated resource. + */ + JobCredential apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + JobCredential apply(Context context); + } + /** The JobCredential update stages. */ + interface UpdateStages { + /** The stage of the JobCredential update allowing to specify username. */ + interface WithUsername { + /** + * Specifies the username property: The credential user name.. + * + * @param username The credential user name. + * @return the next definition stage. + */ + Update withUsername(String username); + } + /** The stage of the JobCredential update allowing to specify password. */ + interface WithPassword { + /** + * Specifies the password property: The credential password.. + * + * @param password The credential password. + * @return the next definition stage. + */ + Update withPassword(String password); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + JobCredential refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + JobCredential refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobCredentialListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobCredentialListResult.java new file mode 100644 index 0000000000000..190fb8fef9967 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobCredentialListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.JobCredentialInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of job credentials. */ +@Immutable +public final class JobCredentialListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of JobCredentialListResult class. */ + public JobCredentialListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobCredentials.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobCredentials.java new file mode 100644 index 0000000000000..4bd5d1248770b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobCredentials.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of JobCredentials. */ +public interface JobCredentials { + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of jobs credentials as paginated response with {@link PagedIterable}. + */ + PagedIterable listByAgent(String resourceGroupName, String serverName, String jobAgentName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of jobs credentials as paginated response with {@link PagedIterable}. + */ + PagedIterable listByAgent( + String resourceGroupName, String serverName, String jobAgentName, Context context); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a jobs credential along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String jobAgentName, String credentialName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a jobs credential. + */ + JobCredential get(String resourceGroupName, String serverName, String jobAgentName, String credentialName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse( + String resourceGroupName, String serverName, String jobAgentName, String credentialName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, String jobAgentName, String credentialName); + + /** + * Gets a jobs credential. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a jobs credential along with {@link Response}. + */ + JobCredential getById(String id); + + /** + * Gets a jobs credential. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a jobs credential along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a job credential. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a job credential. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new JobCredential resource. + * + * @param name resource name. + * @return the first stage of the new JobCredential definition. + */ + JobCredential.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobExecution.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobExecution.java new file mode 100644 index 0000000000000..6723a98eae36a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobExecution.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.JobExecutionInner; +import java.time.OffsetDateTime; +import java.util.UUID; + +/** An immutable client-side representation of JobExecution. */ +public interface JobExecution { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the jobVersion property: The job version number. + * + * @return the jobVersion value. + */ + Integer jobVersion(); + + /** + * Gets the stepName property: The job step name. + * + * @return the stepName value. + */ + String stepName(); + + /** + * Gets the stepId property: The job step id. + * + * @return the stepId value. + */ + Integer stepId(); + + /** + * Gets the jobExecutionId property: The unique identifier of the job execution. + * + * @return the jobExecutionId value. + */ + UUID jobExecutionId(); + + /** + * Gets the lifecycle property: The detailed state of the job execution. + * + * @return the lifecycle value. + */ + JobExecutionLifecycle lifecycle(); + + /** + * Gets the provisioningState property: The ARM provisioning state of the job execution. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the createTime property: The time that the job execution was created. + * + * @return the createTime value. + */ + OffsetDateTime createTime(); + + /** + * Gets the startTime property: The time that the job execution started. + * + * @return the startTime value. + */ + OffsetDateTime startTime(); + + /** + * Gets the endTime property: The time that the job execution completed. + * + * @return the endTime value. + */ + OffsetDateTime endTime(); + + /** + * Gets the currentAttempts property: Number of times the job execution has been attempted. + * + * @return the currentAttempts value. + */ + Integer currentAttempts(); + + /** + * Gets the currentAttemptStartTime property: Start time of the current attempt. + * + * @return the currentAttemptStartTime value. + */ + OffsetDateTime currentAttemptStartTime(); + + /** + * Gets the lastMessage property: The last status or error message. + * + * @return the lastMessage value. + */ + String lastMessage(); + + /** + * Gets the target property: The target that this execution is executed on. + * + * @return the target value. + */ + JobExecutionTarget target(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.JobExecutionInner object. + * + * @return the inner object. + */ + JobExecutionInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobExecutionLifecycle.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobExecutionLifecycle.java new file mode 100644 index 0000000000000..6b58ea7cbe6bc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobExecutionLifecycle.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The detailed state of the job execution. */ +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); + } + + /** + * Gets known JobExecutionLifecycle values. + * + * @return known JobExecutionLifecycle values. + */ + public static Collection values() { + return values(JobExecutionLifecycle.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobExecutionListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobExecutionListResult.java new file mode 100644 index 0000000000000..3a158ac132882 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobExecutionListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.JobExecutionInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of job executions. */ +@Immutable +public final class JobExecutionListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of JobExecutionListResult class. */ + public JobExecutionListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobExecutionTarget.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobExecutionTarget.java new file mode 100644 index 0000000000000..6c0c3fb5fcc8d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobExecutionTarget.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The target that a job execution is executed on. */ +@Immutable +public final class JobExecutionTarget { + /* + * The type of the target. + */ + @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; + + /** Creates an instance of JobExecutionTarget class. */ + public JobExecutionTarget() { + } + + /** + * Get the type property: The type of the target. + * + * @return the type value. + */ + public JobTargetType type() { + return this.type; + } + + /** + * Get the serverName property: The server name. + * + * @return the serverName value. + */ + public String serverName() { + return this.serverName; + } + + /** + * Get the databaseName property: The database name. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobExecutions.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobExecutions.java new file mode 100644 index 0000000000000..10613e539c648 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobExecutions.java @@ -0,0 +1,262 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import java.time.OffsetDateTime; +import java.util.UUID; + +/** Resource collection API of JobExecutions. */ +public interface JobExecutions { + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions as paginated response with {@link PagedIterable}. + */ + PagedIterable listByAgent(String resourceGroupName, String serverName, String jobAgentName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions as paginated response with {@link PagedIterable}. + */ + PagedIterable listByAgent( + String resourceGroupName, + String serverName, + String jobAgentName, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + Context context); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response cancelWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void cancel(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. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an execution of a job. + */ + JobExecution create(String resourceGroupName, String serverName, String jobAgentName, String jobName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an execution of a job. + */ + JobExecution create( + String resourceGroupName, String serverName, String jobAgentName, String jobName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions as paginated response with {@link PagedIterable}. + */ + PagedIterable listByJob( + String resourceGroupName, String serverName, String jobAgentName, String jobName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions as paginated response with {@link PagedIterable}. + */ + PagedIterable listByJob( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + Context context); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job execution along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job execution. + */ + JobExecution get( + String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId); + + /** + * 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. + * @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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an execution of a job. + */ + JobExecution createOrUpdate( + String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId); + + /** + * 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. + * @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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an execution of a job. + */ + JobExecution createOrUpdate( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobListResult.java new file mode 100644 index 0000000000000..f584e96e523ee --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.JobInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of jobs. */ +@Immutable +public final class JobListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of JobListResult class. */ + public JobListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobSchedule.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobSchedule.java new file mode 100644 index 0000000000000..63dcaa45dd59f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobSchedule.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Scheduling properties of a job. */ +@Fluent +public final class JobSchedule { + /* + * Schedule start time. + */ + @JsonProperty(value = "startTime") + private OffsetDateTime startTime; + + /* + * Schedule end time. + */ + @JsonProperty(value = "endTime") + private OffsetDateTime endTime; + + /* + * Schedule interval type + */ + @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; + + /** Creates an instance of JobSchedule class. */ + public JobSchedule() { + } + + /** + * Get the startTime property: Schedule start time. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Set the startTime property: Schedule start time. + * + * @param startTime the startTime value to set. + * @return the JobSchedule object itself. + */ + public JobSchedule withStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the endTime property: Schedule end time. + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Set the endTime property: Schedule end time. + * + * @param endTime the endTime value to set. + * @return the JobSchedule object itself. + */ + public JobSchedule withEndTime(OffsetDateTime endTime) { + this.endTime = endTime; + return this; + } + + /** + * Get the type property: Schedule interval type. + * + * @return the type value. + */ + public JobScheduleType type() { + return this.type; + } + + /** + * Set the type property: Schedule interval type. + * + * @param type the type value to set. + * @return the JobSchedule object itself. + */ + public JobSchedule withType(JobScheduleType type) { + this.type = type; + return this; + } + + /** + * Get the enabled property: Whether or not the schedule is enabled. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: 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 the interval property: 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 the interval property: 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobScheduleType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobScheduleType.java new file mode 100644 index 0000000000000..06f6f358e2d9f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobScheduleType.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Schedule interval type. */ +public enum JobScheduleType { + /** Enum value Once. */ + ONCE("Once"), + + /** Enum value Recurring. */ + RECURRING("Recurring"); + + /** The actual serialized value for a JobScheduleType instance. */ + private final 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) { + if (value == null) { + return null; + } + JobScheduleType[] items = JobScheduleType.values(); + for (JobScheduleType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStep.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStep.java new file mode 100644 index 0000000000000..160b67b299a5f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStep.java @@ -0,0 +1,320 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.JobStepInner; + +/** An immutable client-side representation of JobStep. */ +public interface JobStep { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the stepId property: 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. + */ + Integer stepId(); + + /** + * Gets the targetGroup property: The resource ID of the target group that the job step will be executed on. + * + * @return the targetGroup value. + */ + String targetGroup(); + + /** + * Gets the credential property: The resource ID of the job credential that will be used to connect to the targets. + * + * @return the credential value. + */ + String credential(); + + /** + * Gets the action property: The action payload of the job step. + * + * @return the action value. + */ + JobStepAction action(); + + /** + * Gets the output property: Output destination properties of the job step. + * + * @return the output value. + */ + JobStepOutput output(); + + /** + * Gets the executionOptions property: Execution options for the job step. + * + * @return the executionOptions value. + */ + JobStepExecutionOptions executionOptions(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.JobStepInner object. + * + * @return the inner object. + */ + JobStepInner innerModel(); + + /** The entirety of the JobStep definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The JobStep definition stages. */ + interface DefinitionStages { + /** The first stage of the JobStep definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the JobStep definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName, jobAgentName, jobName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @param jobName The name of the job. + * @return the next definition stage. + */ + WithCreate withExistingJob( + String resourceGroupName, String serverName, String jobAgentName, String jobName); + } + /** + * The stage of the JobStep definition which contains all the minimum required properties for the resource to be + * created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithStepId, + DefinitionStages.WithTargetGroup, + DefinitionStages.WithCredential, + DefinitionStages.WithAction, + DefinitionStages.WithOutput, + DefinitionStages.WithExecutionOptions { + /** + * Executes the create request. + * + * @return the created resource. + */ + JobStep create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + JobStep create(Context context); + } + /** The stage of the JobStep definition allowing to specify stepId. */ + interface WithStepId { + /** + * Specifies the stepId property: 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 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 next definition stage. + */ + WithCreate withStepId(Integer stepId); + } + /** The stage of the JobStep definition allowing to specify targetGroup. */ + interface WithTargetGroup { + /** + * Specifies the targetGroup property: The resource ID of the target group that the job step will be + * executed on.. + * + * @param targetGroup The resource ID of the target group that the job step will be executed on. + * @return the next definition stage. + */ + WithCreate withTargetGroup(String targetGroup); + } + /** The stage of the JobStep definition allowing to specify credential. */ + interface WithCredential { + /** + * Specifies the credential property: The resource ID of the job credential that will be used to connect to + * the targets.. + * + * @param credential The resource ID of the job credential that will be used to connect to the targets. + * @return the next definition stage. + */ + WithCreate withCredential(String credential); + } + /** The stage of the JobStep definition allowing to specify action. */ + interface WithAction { + /** + * Specifies the action property: The action payload of the job step.. + * + * @param action The action payload of the job step. + * @return the next definition stage. + */ + WithCreate withAction(JobStepAction action); + } + /** The stage of the JobStep definition allowing to specify output. */ + interface WithOutput { + /** + * Specifies the output property: Output destination properties of the job step.. + * + * @param output Output destination properties of the job step. + * @return the next definition stage. + */ + WithCreate withOutput(JobStepOutput output); + } + /** The stage of the JobStep definition allowing to specify executionOptions. */ + interface WithExecutionOptions { + /** + * Specifies the executionOptions property: Execution options for the job step.. + * + * @param executionOptions Execution options for the job step. + * @return the next definition stage. + */ + WithCreate withExecutionOptions(JobStepExecutionOptions executionOptions); + } + } + /** + * Begins update for the JobStep resource. + * + * @return the stage of resource update. + */ + JobStep.Update update(); + + /** The template for JobStep update. */ + interface Update + extends UpdateStages.WithStepId, + UpdateStages.WithTargetGroup, + UpdateStages.WithCredential, + UpdateStages.WithAction, + UpdateStages.WithOutput, + UpdateStages.WithExecutionOptions { + /** + * Executes the update request. + * + * @return the updated resource. + */ + JobStep apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + JobStep apply(Context context); + } + /** The JobStep update stages. */ + interface UpdateStages { + /** The stage of the JobStep update allowing to specify stepId. */ + interface WithStepId { + /** + * Specifies the stepId property: 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 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 next definition stage. + */ + Update withStepId(Integer stepId); + } + /** The stage of the JobStep update allowing to specify targetGroup. */ + interface WithTargetGroup { + /** + * Specifies the targetGroup property: The resource ID of the target group that the job step will be + * executed on.. + * + * @param targetGroup The resource ID of the target group that the job step will be executed on. + * @return the next definition stage. + */ + Update withTargetGroup(String targetGroup); + } + /** The stage of the JobStep update allowing to specify credential. */ + interface WithCredential { + /** + * Specifies the credential property: The resource ID of the job credential that will be used to connect to + * the targets.. + * + * @param credential The resource ID of the job credential that will be used to connect to the targets. + * @return the next definition stage. + */ + Update withCredential(String credential); + } + /** The stage of the JobStep update allowing to specify action. */ + interface WithAction { + /** + * Specifies the action property: The action payload of the job step.. + * + * @param action The action payload of the job step. + * @return the next definition stage. + */ + Update withAction(JobStepAction action); + } + /** The stage of the JobStep update allowing to specify output. */ + interface WithOutput { + /** + * Specifies the output property: Output destination properties of the job step.. + * + * @param output Output destination properties of the job step. + * @return the next definition stage. + */ + Update withOutput(JobStepOutput output); + } + /** The stage of the JobStep update allowing to specify executionOptions. */ + interface WithExecutionOptions { + /** + * Specifies the executionOptions property: Execution options for the job step.. + * + * @param executionOptions Execution options for the job step. + * @return the next definition stage. + */ + Update withExecutionOptions(JobStepExecutionOptions executionOptions); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + JobStep refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + JobStep refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepAction.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepAction.java new file mode 100644 index 0000000000000..e1499ab8468f4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepAction.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The action to be executed by a job step. */ +@Fluent +public final class JobStepAction { + /* + * Type of action being executed by the job step. + */ + @JsonProperty(value = "type") + private JobStepActionType type; + + /* + * The source of the action to execute. + */ + @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; + + /** Creates an instance of JobStepAction class. */ + public JobStepAction() { + } + + /** + * Get the type property: Type of action being executed by the job step. + * + * @return the type value. + */ + public JobStepActionType type() { + return this.type; + } + + /** + * Set the type property: Type of action being executed by the job step. + * + * @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 property: The source of the action to execute. + * + * @return the source value. + */ + public JobStepActionSource source() { + return this.source; + } + + /** + * Set the source property: The source of the action to execute. + * + * @param source the source value to set. + * @return the JobStepAction object itself. + */ + public JobStepAction withSource(JobStepActionSource source) { + this.source = source; + return this; + } + + /** + * Get the value property: 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 value property: 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model JobStepAction")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(JobStepAction.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepActionSource.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepActionSource.java new file mode 100644 index 0000000000000..7489ce1a2582d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepActionSource.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The source of the action to execute. */ +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); + } + + /** + * Gets known JobStepActionSource values. + * + * @return known JobStepActionSource values. + */ + public static Collection values() { + return values(JobStepActionSource.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepActionType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepActionType.java new file mode 100644 index 0000000000000..4e92d76e3926e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepActionType.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Type of action being executed by the job step. */ +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); + } + + /** + * Gets known JobStepActionType values. + * + * @return known JobStepActionType values. + */ + public static Collection values() { + return values(JobStepActionType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepExecutionOptions.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepExecutionOptions.java new file mode 100644 index 0000000000000..f31058180818c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepExecutionOptions.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The execution options of a job step. */ +@Fluent +public final 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 Float retryIntervalBackoffMultiplier; + + /** Creates an instance of JobStepExecutionOptions class. */ + public JobStepExecutionOptions() { + } + + /** + * Get the timeoutSeconds property: Execution timeout for the job step. + * + * @return the timeoutSeconds value. + */ + public Integer timeoutSeconds() { + return this.timeoutSeconds; + } + + /** + * Set the timeoutSeconds property: 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 the retryAttempts property: 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 the retryAttempts property: 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 the initialRetryIntervalSeconds property: Initial delay between retries for job step execution. + * + * @return the initialRetryIntervalSeconds value. + */ + public Integer initialRetryIntervalSeconds() { + return this.initialRetryIntervalSeconds; + } + + /** + * Set the initialRetryIntervalSeconds property: 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 maximumRetryIntervalSeconds property: 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 maximumRetryIntervalSeconds property: 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 retryIntervalBackoffMultiplier property: The backoff multiplier for the time between retries. + * + * @return the retryIntervalBackoffMultiplier value. + */ + public Float retryIntervalBackoffMultiplier() { + return this.retryIntervalBackoffMultiplier; + } + + /** + * Set the retryIntervalBackoffMultiplier property: The backoff multiplier for the time between retries. + * + * @param retryIntervalBackoffMultiplier the retryIntervalBackoffMultiplier value to set. + * @return the JobStepExecutionOptions object itself. + */ + public JobStepExecutionOptions withRetryIntervalBackoffMultiplier(Float retryIntervalBackoffMultiplier) { + this.retryIntervalBackoffMultiplier = retryIntervalBackoffMultiplier; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepExecutions.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepExecutions.java new file mode 100644 index 0000000000000..a8c276bbf599b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepExecutions.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import java.time.OffsetDateTime; +import java.util.UUID; + +/** Resource collection API of JobStepExecutions. */ +public interface JobStepExecutions { + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions as paginated response with {@link PagedIterable}. + */ + PagedIterable listByJobExecution( + String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions as paginated response with {@link PagedIterable}. + */ + PagedIterable listByJobExecution( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + Context context); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a step execution of a job execution along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a step execution of a job execution. + */ + JobExecution get( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepListResult.java new file mode 100644 index 0000000000000..f669e1de7be31 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.JobStepInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of job steps. */ +@Immutable +public final class JobStepListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of JobStepListResult class. */ + public JobStepListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepOutput.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepOutput.java new file mode 100644 index 0000000000000..cea415fc19a47 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepOutput.java @@ -0,0 +1,256 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +/** The output configuration of a job step. */ +@Fluent +public final class JobStepOutput { + /* + * The output destination type. + */ + @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; + + /** Creates an instance of JobStepOutput class. */ + public JobStepOutput() { + } + + /** + * Get the type property: The output destination type. + * + * @return the type value. + */ + public JobStepOutputType type() { + return this.type; + } + + /** + * Set the type property: The output destination type. + * + * @param type the type value to set. + * @return the JobStepOutput object itself. + */ + public JobStepOutput withType(JobStepOutputType type) { + this.type = type; + return this; + } + + /** + * Get the subscriptionId property: The output destination subscription id. + * + * @return the subscriptionId value. + */ + public UUID subscriptionId() { + return this.subscriptionId; + } + + /** + * Set the subscriptionId property: 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 resourceGroupName property: The output destination resource group. + * + * @return the resourceGroupName value. + */ + public String resourceGroupName() { + return this.resourceGroupName; + } + + /** + * Set the resourceGroupName property: 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 serverName property: The output destination server name. + * + * @return the serverName value. + */ + public String serverName() { + return this.serverName; + } + + /** + * Set the serverName property: 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 databaseName property: The output destination database. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Set the databaseName property: 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 schemaName property: The output destination schema. + * + * @return the schemaName value. + */ + public String schemaName() { + return this.schemaName; + } + + /** + * Set the schemaName property: 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 tableName property: The output destination table. + * + * @return the tableName value. + */ + public String tableName() { + return this.tableName; + } + + /** + * Set the tableName property: 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 credential property: 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 credential property: 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (serverName() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property serverName in model JobStepOutput")); + } + if (databaseName() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property databaseName in model JobStepOutput")); + } + if (tableName() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property tableName in model JobStepOutput")); + } + if (credential() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property credential in model JobStepOutput")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(JobStepOutput.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepOutputType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepOutputType.java new file mode 100644 index 0000000000000..6df5f3c066159 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobStepOutputType.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The output destination type. */ +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); + } + + /** + * Gets known JobStepOutputType values. + * + * @return known JobStepOutputType values. + */ + public static Collection values() { + return values(JobStepOutputType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobSteps.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobSteps.java new file mode 100644 index 0000000000000..a66f7b6cbb3e8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobSteps.java @@ -0,0 +1,262 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of JobSteps. */ +public interface JobSteps { + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all job steps in the specified job version as paginated response with {@link PagedIterable}. + */ + PagedIterable listByVersion( + String resourceGroupName, String serverName, String jobAgentName, String jobName, int jobVersion); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all job steps in the specified job version as paginated response with {@link PagedIterable}. + */ + PagedIterable listByVersion( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + int jobVersion, + Context context); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified version of a job step along with {@link Response}. + */ + Response getByVersionWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + int jobVersion, + String stepName, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified version of a job step. + */ + JobStep getByVersion( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + int jobVersion, + String stepName); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all job steps for a job's current version as paginated response with {@link PagedIterable}. + */ + PagedIterable listByJob(String resourceGroupName, String serverName, String jobAgentName, String jobName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all job steps for a job's current version as paginated response with {@link PagedIterable}. + */ + PagedIterable listByJob( + String resourceGroupName, String serverName, String jobAgentName, String jobName, Context context); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job step in a job's current version along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + String stepName, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job step in a job's current version. + */ + JobStep get(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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + String stepName, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, String jobAgentName, String jobName, String stepName); + + /** + * Gets a job step in a job's current version. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job step in a job's current version along with {@link Response}. + */ + JobStep getById(String id); + + /** + * Gets a job step in a job's current version. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job step in a job's current version along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a job step. This will implicitly create a new job version. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a job step. This will implicitly create a new job version. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new JobStep resource. + * + * @param name resource name. + * @return the first stage of the new JobStep definition. + */ + JobStep.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobTarget.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobTarget.java new file mode 100644 index 0000000000000..faf0edd8f3252 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobTarget.java @@ -0,0 +1,216 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +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. */ +@Fluent +public final class JobTarget { + /* + * Whether the target is included or excluded from the group. + */ + @JsonProperty(value = "membershipType") + private JobTargetGroupMembershipType membershipType; + + /* + * The target type. + */ + @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; + + /** Creates an instance of JobTarget class. */ + public JobTarget() { + } + + /** + * Get the membershipType property: Whether the target is included or excluded from the group. + * + * @return the membershipType value. + */ + public JobTargetGroupMembershipType membershipType() { + return this.membershipType; + } + + /** + * Set the membershipType property: Whether the target is included or excluded from the group. + * + * @param membershipType the membershipType value to set. + * @return the JobTarget object itself. + */ + public JobTarget withMembershipType(JobTargetGroupMembershipType membershipType) { + this.membershipType = membershipType; + return this; + } + + /** + * Get the type property: The target type. + * + * @return the type value. + */ + public JobTargetType type() { + return this.type; + } + + /** + * Set the type property: The target type. + * + * @param type the type value to set. + * @return the JobTarget object itself. + */ + public JobTarget withType(JobTargetType type) { + this.type = type; + return this; + } + + /** + * Get the serverName property: The target server name. + * + * @return the serverName value. + */ + public String serverName() { + return this.serverName; + } + + /** + * Set the serverName property: 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 databaseName property: The target database name. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Set the databaseName property: 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 elasticPoolName property: The target elastic pool name. + * + * @return the elasticPoolName value. + */ + public String elasticPoolName() { + return this.elasticPoolName; + } + + /** + * Set the elasticPoolName property: 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 shardMapName property: The target shard map. + * + * @return the shardMapName value. + */ + public String shardMapName() { + return this.shardMapName; + } + + /** + * Set the shardMapName property: 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 refreshCredential property: 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 refreshCredential property: 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (type() == null) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("Missing required property type in model JobTarget")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(JobTarget.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobTargetExecutions.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobTargetExecutions.java new file mode 100644 index 0000000000000..b1f74d4223a11 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobTargetExecutions.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import java.time.OffsetDateTime; +import java.util.UUID; + +/** Resource collection API of 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. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions as paginated response with {@link PagedIterable}. + */ + PagedIterable listByJobExecution( + String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions as paginated response with {@link PagedIterable}. + */ + PagedIterable listByJobExecution( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions as paginated response with {@link PagedIterable}. + */ + PagedIterable listByStep( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of job executions as paginated response with {@link PagedIterable}. + */ + PagedIterable listByStep( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName, + OffsetDateTime createTimeMin, + OffsetDateTime createTimeMax, + OffsetDateTime endTimeMin, + OffsetDateTime endTimeMax, + Boolean isActive, + Integer skip, + Integer top, + Context context); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a target execution along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName, + UUID targetId, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a target execution. + */ + JobExecution get( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + UUID jobExecutionId, + String stepName, + UUID targetId); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobTargetGroup.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobTargetGroup.java new file mode 100644 index 0000000000000..fe0279a9f0910 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobTargetGroup.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.JobTargetGroupInner; +import java.util.List; + +/** An immutable client-side representation of JobTargetGroup. */ +public interface JobTargetGroup { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the members property: Members of the target group. + * + * @return the members value. + */ + List members(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.JobTargetGroupInner object. + * + * @return the inner object. + */ + JobTargetGroupInner innerModel(); + + /** The entirety of the JobTargetGroup definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The JobTargetGroup definition stages. */ + interface DefinitionStages { + /** The first stage of the JobTargetGroup definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the JobTargetGroup definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName, jobAgentName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param jobAgentName The name of the job agent. + * @return the next definition stage. + */ + WithCreate withExistingJobAgent(String resourceGroupName, String serverName, String jobAgentName); + } + /** + * The stage of the JobTargetGroup definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithMembers { + /** + * Executes the create request. + * + * @return the created resource. + */ + JobTargetGroup create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + JobTargetGroup create(Context context); + } + /** The stage of the JobTargetGroup definition allowing to specify members. */ + interface WithMembers { + /** + * Specifies the members property: Members of the target group.. + * + * @param members Members of the target group. + * @return the next definition stage. + */ + WithCreate withMembers(List members); + } + } + /** + * Begins update for the JobTargetGroup resource. + * + * @return the stage of resource update. + */ + JobTargetGroup.Update update(); + + /** The template for JobTargetGroup update. */ + interface Update extends UpdateStages.WithMembers { + /** + * Executes the update request. + * + * @return the updated resource. + */ + JobTargetGroup apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + JobTargetGroup apply(Context context); + } + /** The JobTargetGroup update stages. */ + interface UpdateStages { + /** The stage of the JobTargetGroup update allowing to specify members. */ + interface WithMembers { + /** + * Specifies the members property: Members of the target group.. + * + * @param members Members of the target group. + * @return the next definition stage. + */ + Update withMembers(List members); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + JobTargetGroup refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + JobTargetGroup refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobTargetGroupListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobTargetGroupListResult.java new file mode 100644 index 0000000000000..ba62b6908cac3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobTargetGroupListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.JobTargetGroupInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of target groups. */ +@Immutable +public final class JobTargetGroupListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of JobTargetGroupListResult class. */ + public JobTargetGroupListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobTargetGroupMembershipType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobTargetGroupMembershipType.java new file mode 100644 index 0000000000000..f8bcc855f89c5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobTargetGroupMembershipType.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Whether the target is included or excluded from the group. */ +public enum JobTargetGroupMembershipType { + /** Enum value Include. */ + INCLUDE("Include"), + + /** Enum value Exclude. */ + EXCLUDE("Exclude"); + + /** The actual serialized value for a JobTargetGroupMembershipType instance. */ + private final 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) { + if (value == null) { + return null; + } + JobTargetGroupMembershipType[] items = JobTargetGroupMembershipType.values(); + for (JobTargetGroupMembershipType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobTargetGroups.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobTargetGroups.java new file mode 100644 index 0000000000000..e9678021fe8d4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobTargetGroups.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of JobTargetGroups. */ +public interface JobTargetGroups { + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all target groups in an agent as paginated response with {@link PagedIterable}. + */ + PagedIterable listByAgent(String resourceGroupName, String serverName, String jobAgentName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all target groups in an agent as paginated response with {@link PagedIterable}. + */ + PagedIterable listByAgent( + String resourceGroupName, String serverName, String jobAgentName, Context context); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a target group along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String jobAgentName, String targetGroupName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a target group. + */ + JobTargetGroup get(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse( + String resourceGroupName, String serverName, String jobAgentName, String targetGroupName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, String jobAgentName, String targetGroupName); + + /** + * Gets a target group. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a target group along with {@link Response}. + */ + JobTargetGroup getById(String id); + + /** + * Gets a target group. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a target group along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a target group. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a target group. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new JobTargetGroup resource. + * + * @param name resource name. + * @return the first stage of the new JobTargetGroup definition. + */ + JobTargetGroup.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobTargetType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobTargetType.java new file mode 100644 index 0000000000000..d379a6be6b3d3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobTargetType.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The type of the target. */ +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); + } + + /** + * Gets known JobTargetType values. + * + * @return known JobTargetType values. + */ + public static Collection values() { + return values(JobTargetType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobVersion.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobVersion.java new file mode 100644 index 0000000000000..d0f44f23b99d4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobVersion.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.JobVersionInner; + +/** An immutable client-side representation of JobVersion. */ +public interface JobVersion { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.JobVersionInner object. + * + * @return the inner object. + */ + JobVersionInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobVersionListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobVersionListResult.java new file mode 100644 index 0000000000000..b8b9b951901b3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobVersionListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.JobVersionInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of job versions. */ +@Immutable +public final class JobVersionListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of JobVersionListResult class. */ + public JobVersionListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobVersions.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobVersions.java new file mode 100644 index 0000000000000..9784f34d85d99 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/JobVersions.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of JobVersions. */ +public interface JobVersions { + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all versions of a job as paginated response with {@link PagedIterable}. + */ + PagedIterable listByJob( + String resourceGroupName, String serverName, String jobAgentName, String jobName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all versions of a job as paginated response with {@link PagedIterable}. + */ + PagedIterable listByJob( + String resourceGroupName, String serverName, String jobAgentName, String jobName, Context context); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job version along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + String jobAgentName, + String jobName, + int jobVersion, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job version. + */ + JobVersion get(String resourceGroupName, String serverName, String jobAgentName, String jobName, int jobVersion); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Jobs.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Jobs.java new file mode 100644 index 0000000000000..215004ae4cd07 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Jobs.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Jobs. */ +public interface Jobs { + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of jobs as paginated response with {@link PagedIterable}. + */ + PagedIterable listByAgent(String resourceGroupName, String serverName, String jobAgentName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of jobs as paginated response with {@link PagedIterable}. + */ + PagedIterable listByAgent(String resourceGroupName, String serverName, String jobAgentName, Context context); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String jobAgentName, String jobName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job. + */ + Job get(String resourceGroupName, String serverName, String jobAgentName, String jobName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse( + String resourceGroupName, String serverName, String jobAgentName, String jobName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, String jobAgentName, String jobName); + + /** + * Gets a job. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job along with {@link Response}. + */ + Job getById(String id); + + /** + * Gets a job. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a job along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a job. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a job. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Job resource. + * + * @param name resource name. + * @return the first stage of the new Job definition. + */ + Job.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LedgerDigestUploads.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LedgerDigestUploads.java new file mode 100644 index 0000000000000..5f1f8d89d15ef --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LedgerDigestUploads.java @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.LedgerDigestUploadsInner; + +/** An immutable client-side representation of LedgerDigestUploads. */ +public interface LedgerDigestUploads { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the digestStorageEndpoint property: The digest storage endpoint, which must be either an Azure blob storage + * endpoint or an URI for Azure Confidential Ledger. + * + * @return the digestStorageEndpoint value. + */ + String digestStorageEndpoint(); + + /** + * Gets the state property: Specifies the state of ledger digest upload. + * + * @return the state value. + */ + LedgerDigestUploadsState state(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.LedgerDigestUploadsInner object. + * + * @return the inner object. + */ + LedgerDigestUploadsInner innerModel(); + + /** The entirety of the LedgerDigestUploads definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The LedgerDigestUploads definition stages. */ + interface DefinitionStages { + /** The first stage of the LedgerDigestUploads definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the LedgerDigestUploads definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName, databaseName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @return the next definition stage. + */ + WithCreate withExistingDatabase(String resourceGroupName, String serverName, String databaseName); + } + /** + * The stage of the LedgerDigestUploads definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithDigestStorageEndpoint { + /** + * Executes the create request. + * + * @return the created resource. + */ + LedgerDigestUploads create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + LedgerDigestUploads create(Context context); + } + /** The stage of the LedgerDigestUploads definition allowing to specify digestStorageEndpoint. */ + interface WithDigestStorageEndpoint { + /** + * Specifies the digestStorageEndpoint property: The digest storage endpoint, which must be either an Azure + * blob storage endpoint or an URI for Azure Confidential Ledger.. + * + * @param digestStorageEndpoint The digest storage endpoint, which must be either an Azure blob storage + * endpoint or an URI for Azure Confidential Ledger. + * @return the next definition stage. + */ + WithCreate withDigestStorageEndpoint(String digestStorageEndpoint); + } + } + /** + * Begins update for the LedgerDigestUploads resource. + * + * @return the stage of resource update. + */ + LedgerDigestUploads.Update update(); + + /** The template for LedgerDigestUploads update. */ + interface Update extends UpdateStages.WithDigestStorageEndpoint { + /** + * Executes the update request. + * + * @return the updated resource. + */ + LedgerDigestUploads apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + LedgerDigestUploads apply(Context context); + } + /** The LedgerDigestUploads update stages. */ + interface UpdateStages { + /** The stage of the LedgerDigestUploads update allowing to specify digestStorageEndpoint. */ + interface WithDigestStorageEndpoint { + /** + * Specifies the digestStorageEndpoint property: The digest storage endpoint, which must be either an Azure + * blob storage endpoint or an URI for Azure Confidential Ledger.. + * + * @param digestStorageEndpoint The digest storage endpoint, which must be either an Azure blob storage + * endpoint or an URI for Azure Confidential Ledger. + * @return the next definition stage. + */ + Update withDigestStorageEndpoint(String digestStorageEndpoint); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + LedgerDigestUploads refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + LedgerDigestUploads refresh(Context context); + + /** + * Disables uploading ledger digests to an Azure Storage account or an Azure Confidential Ledger instance. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure SQL Database ledger digest upload settings. + */ + LedgerDigestUploads disable(); + + /** + * Disables uploading ledger digests to an Azure Storage account or an Azure Confidential Ledger instance. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure SQL Database ledger digest upload settings. + */ + LedgerDigestUploads disable(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LedgerDigestUploadsListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LedgerDigestUploadsListResult.java new file mode 100644 index 0000000000000..62b63dc6bf421 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LedgerDigestUploadsListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.LedgerDigestUploadsInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of ledger digest upload settings. */ +@Immutable +public final class LedgerDigestUploadsListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of LedgerDigestUploadsListResult class. */ + public LedgerDigestUploadsListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LedgerDigestUploadsName.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LedgerDigestUploadsName.java new file mode 100644 index 0000000000000..c0f8fed5e95f3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LedgerDigestUploadsName.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for LedgerDigestUploadsName. */ +public final class LedgerDigestUploadsName extends ExpandableStringEnum { + /** Static value current for LedgerDigestUploadsName. */ + public static final LedgerDigestUploadsName CURRENT = fromString("current"); + + /** + * Creates or finds a LedgerDigestUploadsName from its string representation. + * + * @param name a name to look for. + * @return the corresponding LedgerDigestUploadsName. + */ + @JsonCreator + public static LedgerDigestUploadsName fromString(String name) { + return fromString(name, LedgerDigestUploadsName.class); + } + + /** + * Gets known LedgerDigestUploadsName values. + * + * @return known LedgerDigestUploadsName values. + */ + public static Collection values() { + return values(LedgerDigestUploadsName.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LedgerDigestUploadsOperations.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LedgerDigestUploadsOperations.java new file mode 100644 index 0000000000000..805f5c3715c9c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LedgerDigestUploadsOperations.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of LedgerDigestUploadsOperations. */ +public interface LedgerDigestUploadsOperations { + /** + * Gets the current ledger digest upload configuration for 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 ledgerDigestUploads The ledgerDigestUploads parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current ledger digest upload configuration for a database along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + LedgerDigestUploadsName ledgerDigestUploads, + Context context); + + /** + * Gets the current ledger digest upload configuration for 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 ledgerDigestUploads The ledgerDigestUploads parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current ledger digest upload configuration for a database. + */ + LedgerDigestUploads get( + String resourceGroupName, String serverName, String databaseName, LedgerDigestUploadsName ledgerDigestUploads); + + /** + * Gets all ledger digest upload settings on 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all ledger digest upload settings on a database as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase(String resourceGroupName, String serverName, String databaseName); + + /** + * Gets all ledger digest upload settings on 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all ledger digest upload settings on a database as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Disables uploading ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure SQL Database ledger digest upload settings. + */ + LedgerDigestUploads disable( + String resourceGroupName, String serverName, String databaseName, LedgerDigestUploadsName ledgerDigestUploads); + + /** + * Disables uploading ledger digests to an Azure Storage account or an Azure Confidential Ledger 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param ledgerDigestUploads The ledgerDigestUploads parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure SQL Database ledger digest upload settings. + */ + LedgerDigestUploads disable( + String resourceGroupName, + String serverName, + String databaseName, + LedgerDigestUploadsName ledgerDigestUploads, + Context context); + + /** + * Gets the current ledger digest upload configuration for a database. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current ledger digest upload configuration for a database along with {@link Response}. + */ + LedgerDigestUploads getById(String id); + + /** + * Gets the current ledger digest upload configuration for a database. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current ledger digest upload configuration for a database along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new LedgerDigestUploads resource. + * + * @param name resource name. + * @return the first stage of the new LedgerDigestUploads definition. + */ + LedgerDigestUploads.DefinitionStages.Blank define(LedgerDigestUploadsName name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LedgerDigestUploadsState.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LedgerDigestUploadsState.java new file mode 100644 index 0000000000000..53452d49f6d09 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LedgerDigestUploadsState.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Specifies the state of ledger digest upload. */ +public enum LedgerDigestUploadsState { + /** Enum value Enabled. */ + ENABLED("Enabled"), + + /** Enum value Disabled. */ + DISABLED("Disabled"); + + /** The actual serialized value for a LedgerDigestUploadsState instance. */ + private final String value; + + LedgerDigestUploadsState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a LedgerDigestUploadsState instance. + * + * @param value the serialized value to parse. + * @return the parsed LedgerDigestUploadsState object, or null if unable to parse. + */ + @JsonCreator + public static LedgerDigestUploadsState fromString(String value) { + if (value == null) { + return null; + } + LedgerDigestUploadsState[] items = LedgerDigestUploadsState.values(); + for (LedgerDigestUploadsState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LicenseTypeCapability.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LicenseTypeCapability.java new file mode 100644 index 0000000000000..2730eb41cf70c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LicenseTypeCapability.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The license type capability. */ +@Fluent +public final class LicenseTypeCapability { + /* + * License type identifier. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The status of the capability. + */ + @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; + + /** Creates an instance of LicenseTypeCapability class. */ + public LicenseTypeCapability() { + } + + /** + * Get the name property: License type identifier. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the status property: The status of the capability. + * + * @return the status value. + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason property: The reason for the capability not being available. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LocationCapabilities.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LocationCapabilities.java new file mode 100644 index 0000000000000..05a842f433498 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LocationCapabilities.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.LocationCapabilitiesInner; +import java.util.List; + +/** An immutable client-side representation of LocationCapabilities. */ +public interface LocationCapabilities { + /** + * Gets the name property: The location name. + * + * @return the name value. + */ + String name(); + + /** + * Gets the supportedServerVersions property: The list of supported server versions. + * + * @return the supportedServerVersions value. + */ + List supportedServerVersions(); + + /** + * Gets the supportedManagedInstanceVersions property: The list of supported managed instance versions. + * + * @return the supportedManagedInstanceVersions value. + */ + List supportedManagedInstanceVersions(); + + /** + * Gets the status property: The status of the capability. + * + * @return the status value. + */ + CapabilityStatus status(); + + /** + * Gets the reason property: The reason for the capability not being available. + * + * @return the reason value. + */ + String reason(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.LocationCapabilitiesInner object. + * + * @return the inner object. + */ + LocationCapabilitiesInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LogSizeCapability.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LogSizeCapability.java new file mode 100644 index 0000000000000..5a1201c814b2d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LogSizeCapability.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The log size capability. */ +@Immutable +public final 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. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private LogSizeUnit unit; + + /** Creates an instance of LogSizeCapability class. */ + public LogSizeCapability() { + } + + /** + * Get the limit property: The log size limit (see 'unit' for the units). + * + * @return the limit value. + */ + public Integer limit() { + return this.limit; + } + + /** + * Get the unit property: The units that the limit is expressed in. + * + * @return the unit value. + */ + public LogSizeUnit unit() { + return this.unit; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LogSizeUnit.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LogSizeUnit.java new file mode 100644 index 0000000000000..5a81a28f0baf4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LogSizeUnit.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The units that the limit is expressed in. */ +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); + } + + /** + * Gets known LogSizeUnit values. + * + * @return known LogSizeUnit values. + */ + public static Collection values() { + return values(LogSizeUnit.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LogicalDatabaseTransparentDataEncryption.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LogicalDatabaseTransparentDataEncryption.java new file mode 100644 index 0000000000000..4a1feba160e67 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LogicalDatabaseTransparentDataEncryption.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.LogicalDatabaseTransparentDataEncryptionInner; + +/** An immutable client-side representation of LogicalDatabaseTransparentDataEncryption. */ +public interface LogicalDatabaseTransparentDataEncryption { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the state property: Specifies the state of the transparent data encryption. + * + * @return the state value. + */ + TransparentDataEncryptionState state(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner + * com.azure.resourcemanager.sql.generated.fluent.models.LogicalDatabaseTransparentDataEncryptionInner object. + * + * @return the inner object. + */ + LogicalDatabaseTransparentDataEncryptionInner innerModel(); + + /** The entirety of the LogicalDatabaseTransparentDataEncryption definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The LogicalDatabaseTransparentDataEncryption definition stages. */ + interface DefinitionStages { + /** The first stage of the LogicalDatabaseTransparentDataEncryption definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the LogicalDatabaseTransparentDataEncryption definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName, databaseName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the logical database for which the security alert policy is defined. + * @return the next definition stage. + */ + WithCreate withExistingDatabase(String resourceGroupName, String serverName, String databaseName); + } + /** + * The stage of the LogicalDatabaseTransparentDataEncryption definition which contains all the minimum required + * properties for the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithState { + /** + * Executes the create request. + * + * @return the created resource. + */ + LogicalDatabaseTransparentDataEncryption create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + LogicalDatabaseTransparentDataEncryption create(Context context); + } + /** The stage of the LogicalDatabaseTransparentDataEncryption definition allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the transparent data encryption.. + * + * @param state Specifies the state of the transparent data encryption. + * @return the next definition stage. + */ + WithCreate withState(TransparentDataEncryptionState state); + } + } + /** + * Begins update for the LogicalDatabaseTransparentDataEncryption resource. + * + * @return the stage of resource update. + */ + LogicalDatabaseTransparentDataEncryption.Update update(); + + /** The template for LogicalDatabaseTransparentDataEncryption update. */ + interface Update extends UpdateStages.WithState { + /** + * Executes the update request. + * + * @return the updated resource. + */ + LogicalDatabaseTransparentDataEncryption apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + LogicalDatabaseTransparentDataEncryption apply(Context context); + } + /** The LogicalDatabaseTransparentDataEncryption update stages. */ + interface UpdateStages { + /** The stage of the LogicalDatabaseTransparentDataEncryption update allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the transparent data encryption.. + * + * @param state Specifies the state of the transparent data encryption. + * @return the next definition stage. + */ + Update withState(TransparentDataEncryptionState state); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + LogicalDatabaseTransparentDataEncryption refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + LogicalDatabaseTransparentDataEncryption refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LogicalDatabaseTransparentDataEncryptionListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LogicalDatabaseTransparentDataEncryptionListResult.java new file mode 100644 index 0000000000000..afc7fbbd6a099 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LogicalDatabaseTransparentDataEncryptionListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.LogicalDatabaseTransparentDataEncryptionInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of transparent data encryptions. */ +@Immutable +public final class LogicalDatabaseTransparentDataEncryptionListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of LogicalDatabaseTransparentDataEncryptionListResult class. */ + public LogicalDatabaseTransparentDataEncryptionListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LogicalServerAdvancedThreatProtectionListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LogicalServerAdvancedThreatProtectionListResult.java new file mode 100644 index 0000000000000..b8519385b45ca --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LogicalServerAdvancedThreatProtectionListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerAdvancedThreatProtectionInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of the server's Advanced Threat Protection configurations. */ +@Immutable +public final class LogicalServerAdvancedThreatProtectionListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of LogicalServerAdvancedThreatProtectionListResult class. */ + public LogicalServerAdvancedThreatProtectionListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LogicalServerSecurityAlertPolicyListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LogicalServerSecurityAlertPolicyListResult.java new file mode 100644 index 0000000000000..345ac46a5532c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LogicalServerSecurityAlertPolicyListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerSecurityAlertPolicyInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of the server's security alert policies. */ +@Immutable +public final class LogicalServerSecurityAlertPolicyListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of LogicalServerSecurityAlertPolicyListResult class. */ + public LogicalServerSecurityAlertPolicyListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionBackup.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionBackup.java new file mode 100644 index 0000000000000..fcde28b640712 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionBackup.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.LongTermRetentionBackupInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of LongTermRetentionBackup. */ +public interface LongTermRetentionBackup { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the serverName property: The server name that the backup database belong to. + * + * @return the serverName value. + */ + String serverName(); + + /** + * Gets the serverCreateTime property: The create time of the server. + * + * @return the serverCreateTime value. + */ + OffsetDateTime serverCreateTime(); + + /** + * Gets the databaseName property: The name of the database the backup belong to. + * + * @return the databaseName value. + */ + String databaseName(); + + /** + * Gets the databaseDeletionTime property: The delete time of the database. + * + * @return the databaseDeletionTime value. + */ + OffsetDateTime databaseDeletionTime(); + + /** + * Gets the backupTime property: The time the backup was taken. + * + * @return the backupTime value. + */ + OffsetDateTime backupTime(); + + /** + * Gets the backupExpirationTime property: The time the long term retention backup will expire. + * + * @return the backupExpirationTime value. + */ + OffsetDateTime backupExpirationTime(); + + /** + * Gets the backupStorageRedundancy property: The storage redundancy type of the backup. + * + * @return the backupStorageRedundancy value. + */ + BackupStorageRedundancy backupStorageRedundancy(); + + /** + * Gets the requestedBackupStorageRedundancy property: The storage redundancy type of the backup. + * + * @return the requestedBackupStorageRedundancy value. + */ + BackupStorageRedundancy requestedBackupStorageRedundancy(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.LongTermRetentionBackupInner object. + * + * @return the inner object. + */ + LongTermRetentionBackupInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionBackupListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionBackupListResult.java new file mode 100644 index 0000000000000..3e7194715dbbb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionBackupListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.LongTermRetentionBackupInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of long term retention backups. */ +@Immutable +public final class LongTermRetentionBackupListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of LongTermRetentionBackupListResult class. */ + public LongTermRetentionBackupListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionBackupOperationResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionBackupOperationResult.java new file mode 100644 index 0000000000000..797cfd86f8452 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionBackupOperationResult.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.LongTermRetentionBackupOperationResultInner; +import java.util.UUID; + +/** An immutable client-side representation of LongTermRetentionBackupOperationResult. */ +public interface LongTermRetentionBackupOperationResult { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the requestId property: Request Id. + * + * @return the requestId value. + */ + UUID requestId(); + + /** + * Gets the operationType property: Operation type. + * + * @return the operationType value. + */ + String operationType(); + + /** + * Gets the fromBackupResourceId property: Source backup resource id. + * + * @return the fromBackupResourceId value. + */ + String fromBackupResourceId(); + + /** + * Gets the toBackupResourceId property: Target backup resource id. + * + * @return the toBackupResourceId value. + */ + String toBackupResourceId(); + + /** + * Gets the targetBackupStorageRedundancy property: The storage redundancy type of the copied backup. + * + * @return the targetBackupStorageRedundancy value. + */ + BackupStorageRedundancy targetBackupStorageRedundancy(); + + /** + * Gets the status property: Operation status. + * + * @return the status value. + */ + String status(); + + /** + * Gets the message property: Progress message. + * + * @return the message value. + */ + String message(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.LongTermRetentionBackupOperationResultInner + * object. + * + * @return the inner object. + */ + LongTermRetentionBackupOperationResultInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionBackups.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionBackups.java new file mode 100644 index 0000000000000..4280785cc8dac --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionBackups.java @@ -0,0 +1,562 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of LongTermRetentionBackups. */ +public interface LongTermRetentionBackups { + /** + * Copy an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource. + */ + LongTermRetentionBackupOperationResult copy( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters); + + /** + * Copy an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource. + */ + LongTermRetentionBackupOperationResult copy( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters, + Context context); + + /** + * Updates an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource. + */ + LongTermRetentionBackupOperationResult update( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters); + + /** + * Updates an existing long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource. + */ + LongTermRetentionBackupOperationResult update( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters, + Context context); + + /** + * Gets a long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup along with {@link Response}. + */ + Response getWithResponse( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + Context context); + + /** + * Gets a long term retention backup. + * + * @param locationName The location of the database. + * @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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup. + */ + LongTermRetentionBackup get( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName); + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName); + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + Context context); + + /** + * Lists all long term retention backups for a database. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String locationName, String longTermRetentionServerName, String longTermRetentionDatabaseName); + + /** + * Lists all long term retention backups for a database. + * + * @param locationName The location of the database. + * @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups as paginated response with {@link PagedIterable}. + */ + PagedIterable listByLocation(String locationName); + + /** + * 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups as paginated response with {@link PagedIterable}. + */ + PagedIterable listByLocation( + String locationName, Boolean onlyLatestPerDatabase, DatabaseState databaseState, Context context); + + /** + * Lists the long term retention backups for a given server. + * + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String locationName, String longTermRetentionServerName); + + /** + * Lists the long term retention backups for a given server. + * + * @param locationName The location of the database. + * @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer( + String locationName, + String longTermRetentionServerName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context); + + /** + * Copy an existing long term retention backup to a different server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource. + */ + LongTermRetentionBackupOperationResult copyByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters); + + /** + * Copy an existing long term retention backup to a different server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The parameters needed for long term retention copy request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource. + */ + LongTermRetentionBackupOperationResult copyByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + CopyLongTermRetentionBackupParameters parameters, + Context context); + + /** + * Updates an existing long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource. + */ + LongTermRetentionBackupOperationResult updateByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters); + + /** + * Updates an existing long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param parameters The requested backup resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a LongTermRetentionBackup operation result resource. + */ + LongTermRetentionBackupOperationResult updateByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + UpdateLongTermRetentionBackupParameters parameters, + Context context); + + /** + * Gets a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + Context context); + + /** + * Gets a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup. + */ + LongTermRetentionBackup getByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName); + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName); + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + String backupName, + Context context); + + /** + * Lists all long term retention backups for 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 locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @param longTermRetentionDatabaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroupDatabase( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName); + + /** + * Lists all long term retention backups for 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 locationName The location of the database. + * @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroupDatabase( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + String longTermRetentionDatabaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context); + + /** + * Lists the long term retention backups for a given location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroupLocation(String resourceGroupName, String locationName); + + /** + * Lists the long term retention backups for a given location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroupLocation( + String resourceGroupName, + String locationName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context); + + /** + * Lists the long term retention backups 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 locationName The location of the database. + * @param longTermRetentionServerName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroupServer( + String resourceGroupName, String locationName, String longTermRetentionServerName); + + /** + * Lists the long term retention backups 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 locationName The location of the database. + * @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroupServer( + String resourceGroupName, + String locationName, + String longTermRetentionServerName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionManagedInstanceBackups.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionManagedInstanceBackups.java new file mode 100644 index 0000000000000..bbe0b88371d7a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionManagedInstanceBackups.java @@ -0,0 +1,378 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of LongTermRetentionManagedInstanceBackups. */ +public interface LongTermRetentionManagedInstanceBackups { + /** + * Gets a long term retention backup for a managed database. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup for a managed database along with {@link Response}. + */ + Response getWithResponse( + String locationName, String managedInstanceName, String databaseName, String backupName, Context context); + + /** + * Gets a long term retention backup for a managed database. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup for a managed database. + */ + ManagedInstanceLongTermRetentionBackup get( + String locationName, String managedInstanceName, String databaseName, String backupName); + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String locationName, String managedInstanceName, String databaseName, String backupName); + + /** + * Deletes a long term retention backup. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete( + String locationName, String managedInstanceName, String databaseName, String backupName, Context context); + + /** + * Lists all long term retention backups for a managed database. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByDatabase( + String locationName, String managedInstanceName, String databaseName); + + /** + * Lists all long term retention backups for a managed database. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByDatabase( + String locationName, + String managedInstanceName, + String databaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context); + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByInstance( + String locationName, String managedInstanceName); + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByInstance( + String locationName, + String managedInstanceName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context); + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param locationName The location of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByLocation(String locationName); + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param locationName The location of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByLocation( + String locationName, Boolean onlyLatestPerDatabase, DatabaseState databaseState, Context context); + + /** + * Gets a long term retention backup for a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup for a managed database along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + String backupName, + Context context); + + /** + * Gets a long term retention backup for a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a long term retention backup for a managed database. + */ + ManagedInstanceLongTermRetentionBackup getByResourceGroup( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + String backupName); + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + String backupName); + + /** + * Deletes a long term retention backup. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param backupName The backup name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + String backupName, + Context context); + + /** + * Lists all long term retention backups for a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByResourceGroupDatabase( + String resourceGroupName, String locationName, String managedInstanceName, String databaseName); + + /** + * Lists all long term retention backups for a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByResourceGroupDatabase( + String resourceGroupName, + String locationName, + String managedInstanceName, + String databaseName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context); + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByResourceGroupInstance( + String resourceGroupName, String locationName, String managedInstanceName); + + /** + * Lists the long term retention backups for a given managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param managedInstanceName The name of the managed instance. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByResourceGroupInstance( + String resourceGroupName, + String locationName, + String managedInstanceName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context); + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByResourceGroupLocation( + String resourceGroupName, String locationName); + + /** + * Lists the long term retention backups for managed databases in a given location. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param locationName The location of the database. + * @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. + * @param databaseState Whether to query against just live databases, just deleted databases, or all databases. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of long term retention backups for managed database(s) as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByResourceGroupLocation( + String resourceGroupName, + String locationName, + Boolean onlyLatestPerDatabase, + DatabaseState databaseState, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionPolicies.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionPolicies.java new file mode 100644 index 0000000000000..068364fb4048d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionPolicies.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of LongTermRetentionPolicies. */ +public interface LongTermRetentionPolicies { + /** + * 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 policyName The policy name. Should always be Default. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's long term retention policy along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + LongTermRetentionPolicyName policyName, + Context context); + + /** + * 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 policyName The policy name. Should always be Default. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's long term retention policy. + */ + LongTermRetentionPolicy get( + String resourceGroupName, String serverName, String databaseName, LongTermRetentionPolicyName policyName); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's long term retention policy as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's long term retention policy as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Gets a database's long term retention policy. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's long term retention policy along with {@link Response}. + */ + LongTermRetentionPolicy getById(String id); + + /** + * Gets a database's long term retention policy. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's long term retention policy along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new LongTermRetentionPolicy resource. + * + * @param name resource name. + * @return the first stage of the new LongTermRetentionPolicy definition. + */ + LongTermRetentionPolicy.DefinitionStages.Blank define(LongTermRetentionPolicyName name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionPolicy.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionPolicy.java new file mode 100644 index 0000000000000..28976feb56d5f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionPolicy.java @@ -0,0 +1,253 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.LongTermRetentionPolicyInner; + +/** An immutable client-side representation of LongTermRetentionPolicy. */ +public interface LongTermRetentionPolicy { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the weeklyRetention property: The weekly retention policy for an LTR backup in an ISO 8601 format. + * + * @return the weeklyRetention value. + */ + String weeklyRetention(); + + /** + * Gets the monthlyRetention property: The monthly retention policy for an LTR backup in an ISO 8601 format. + * + * @return the monthlyRetention value. + */ + String monthlyRetention(); + + /** + * Gets the yearlyRetention property: The yearly retention policy for an LTR backup in an ISO 8601 format. + * + * @return the yearlyRetention value. + */ + String yearlyRetention(); + + /** + * Gets the weekOfYear property: The week of year to take the yearly backup in an ISO 8601 format. + * + * @return the weekOfYear value. + */ + Integer weekOfYear(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.LongTermRetentionPolicyInner object. + * + * @return the inner object. + */ + LongTermRetentionPolicyInner innerModel(); + + /** The entirety of the LongTermRetentionPolicy definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The LongTermRetentionPolicy definition stages. */ + interface DefinitionStages { + /** The first stage of the LongTermRetentionPolicy definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the LongTermRetentionPolicy definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName, databaseName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @return the next definition stage. + */ + WithCreate withExistingDatabase(String resourceGroupName, String serverName, String databaseName); + } + /** + * The stage of the LongTermRetentionPolicy definition which contains all the minimum required properties for + * the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithWeeklyRetention, + DefinitionStages.WithMonthlyRetention, + DefinitionStages.WithYearlyRetention, + DefinitionStages.WithWeekOfYear { + /** + * Executes the create request. + * + * @return the created resource. + */ + LongTermRetentionPolicy create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + LongTermRetentionPolicy create(Context context); + } + /** The stage of the LongTermRetentionPolicy definition allowing to specify weeklyRetention. */ + interface WithWeeklyRetention { + /** + * Specifies the weeklyRetention property: The weekly retention policy for an LTR backup in an ISO 8601 + * format.. + * + * @param weeklyRetention The weekly retention policy for an LTR backup in an ISO 8601 format. + * @return the next definition stage. + */ + WithCreate withWeeklyRetention(String weeklyRetention); + } + /** The stage of the LongTermRetentionPolicy definition allowing to specify monthlyRetention. */ + interface WithMonthlyRetention { + /** + * Specifies the monthlyRetention property: The monthly retention policy for an LTR backup in an ISO 8601 + * format.. + * + * @param monthlyRetention The monthly retention policy for an LTR backup in an ISO 8601 format. + * @return the next definition stage. + */ + WithCreate withMonthlyRetention(String monthlyRetention); + } + /** The stage of the LongTermRetentionPolicy definition allowing to specify yearlyRetention. */ + interface WithYearlyRetention { + /** + * Specifies the yearlyRetention property: The yearly retention policy for an LTR backup in an ISO 8601 + * format.. + * + * @param yearlyRetention The yearly retention policy for an LTR backup in an ISO 8601 format. + * @return the next definition stage. + */ + WithCreate withYearlyRetention(String yearlyRetention); + } + /** The stage of the LongTermRetentionPolicy definition allowing to specify weekOfYear. */ + interface WithWeekOfYear { + /** + * Specifies the weekOfYear property: The week of year to take the yearly backup in an ISO 8601 format.. + * + * @param weekOfYear The week of year to take the yearly backup in an ISO 8601 format. + * @return the next definition stage. + */ + WithCreate withWeekOfYear(Integer weekOfYear); + } + } + /** + * Begins update for the LongTermRetentionPolicy resource. + * + * @return the stage of resource update. + */ + LongTermRetentionPolicy.Update update(); + + /** The template for LongTermRetentionPolicy update. */ + interface Update + extends UpdateStages.WithWeeklyRetention, + UpdateStages.WithMonthlyRetention, + UpdateStages.WithYearlyRetention, + UpdateStages.WithWeekOfYear { + /** + * Executes the update request. + * + * @return the updated resource. + */ + LongTermRetentionPolicy apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + LongTermRetentionPolicy apply(Context context); + } + /** The LongTermRetentionPolicy update stages. */ + interface UpdateStages { + /** The stage of the LongTermRetentionPolicy update allowing to specify weeklyRetention. */ + interface WithWeeklyRetention { + /** + * Specifies the weeklyRetention property: The weekly retention policy for an LTR backup in an ISO 8601 + * format.. + * + * @param weeklyRetention The weekly retention policy for an LTR backup in an ISO 8601 format. + * @return the next definition stage. + */ + Update withWeeklyRetention(String weeklyRetention); + } + /** The stage of the LongTermRetentionPolicy update allowing to specify monthlyRetention. */ + interface WithMonthlyRetention { + /** + * Specifies the monthlyRetention property: The monthly retention policy for an LTR backup in an ISO 8601 + * format.. + * + * @param monthlyRetention The monthly retention policy for an LTR backup in an ISO 8601 format. + * @return the next definition stage. + */ + Update withMonthlyRetention(String monthlyRetention); + } + /** The stage of the LongTermRetentionPolicy update allowing to specify yearlyRetention. */ + interface WithYearlyRetention { + /** + * Specifies the yearlyRetention property: The yearly retention policy for an LTR backup in an ISO 8601 + * format.. + * + * @param yearlyRetention The yearly retention policy for an LTR backup in an ISO 8601 format. + * @return the next definition stage. + */ + Update withYearlyRetention(String yearlyRetention); + } + /** The stage of the LongTermRetentionPolicy update allowing to specify weekOfYear. */ + interface WithWeekOfYear { + /** + * Specifies the weekOfYear property: The week of year to take the yearly backup in an ISO 8601 format.. + * + * @param weekOfYear The week of year to take the yearly backup in an ISO 8601 format. + * @return the next definition stage. + */ + Update withWeekOfYear(Integer weekOfYear); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + LongTermRetentionPolicy refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + LongTermRetentionPolicy refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionPolicyListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionPolicyListResult.java new file mode 100644 index 0000000000000..6ff3e70436d7a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionPolicyListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.LongTermRetentionPolicyInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of long term retention policies. */ +@Immutable +public final class LongTermRetentionPolicyListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of LongTermRetentionPolicyListResult class. */ + public LongTermRetentionPolicyListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionPolicyName.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionPolicyName.java new file mode 100644 index 0000000000000..685e7f5beec6f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/LongTermRetentionPolicyName.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for LongTermRetentionPolicyName. */ +public final class LongTermRetentionPolicyName extends ExpandableStringEnum { + /** Static value default for LongTermRetentionPolicyName. */ + public static final LongTermRetentionPolicyName DEFAULT = fromString("default"); + + /** + * Creates or finds a LongTermRetentionPolicyName from its string representation. + * + * @param name a name to look for. + * @return the corresponding LongTermRetentionPolicyName. + */ + @JsonCreator + public static LongTermRetentionPolicyName fromString(String name) { + return fromString(name, LongTermRetentionPolicyName.class); + } + + /** + * Gets known LongTermRetentionPolicyName values. + * + * @return known LongTermRetentionPolicyName values. + */ + public static Collection values() { + return values(LongTermRetentionPolicyName.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaintenanceConfigurationCapability.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaintenanceConfigurationCapability.java new file mode 100644 index 0000000000000..6503922c7c48f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaintenanceConfigurationCapability.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The maintenance configuration capability. */ +@Fluent +public final class MaintenanceConfigurationCapability { + /* + * Maintenance configuration name + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Whether or not zone redundancy is supported for the maintenance configuration. + */ + @JsonProperty(value = "zoneRedundant", access = JsonProperty.Access.WRITE_ONLY) + private Boolean zoneRedundant; + + /* + * The status of the capability. + */ + @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; + + /** Creates an instance of MaintenanceConfigurationCapability class. */ + public MaintenanceConfigurationCapability() { + } + + /** + * Get the name property: Maintenance configuration name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the zoneRedundant property: Whether or not zone redundancy is supported for the maintenance configuration. + * + * @return the zoneRedundant value. + */ + public Boolean zoneRedundant() { + return this.zoneRedundant; + } + + /** + * Get the status property: The status of the capability. + * + * @return the status value. + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason property: The reason for the capability not being available. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: The reason for the capability not being available. + * + * @param reason the reason value to set. + * @return the MaintenanceConfigurationCapability object itself. + */ + public MaintenanceConfigurationCapability withReason(String reason) { + this.reason = reason; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaintenanceWindowOptions.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaintenanceWindowOptions.java new file mode 100644 index 0000000000000..49b36aa0fd201 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaintenanceWindowOptions.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.MaintenanceWindowOptionsInner; +import java.util.List; + +/** An immutable client-side representation of MaintenanceWindowOptions. */ +public interface MaintenanceWindowOptions { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the isEnabled property: Whether maintenance windows are enabled for the database. + * + * @return the isEnabled value. + */ + Boolean isEnabled(); + + /** + * Gets the maintenanceWindowCycles property: Available maintenance cycles e.g. {Saturday, 0, 48*60}, {Wednesday, 0, + * 24*60}. + * + * @return the maintenanceWindowCycles value. + */ + List maintenanceWindowCycles(); + + /** + * Gets the minDurationInMinutes property: Minimum duration of maintenance window. + * + * @return the minDurationInMinutes value. + */ + Integer minDurationInMinutes(); + + /** + * Gets the defaultDurationInMinutes property: Default duration for maintenance window. + * + * @return the defaultDurationInMinutes value. + */ + Integer defaultDurationInMinutes(); + + /** + * Gets the minCycles property: Minimum number of maintenance windows cycles to be set on the database. + * + * @return the minCycles value. + */ + Integer minCycles(); + + /** + * Gets the timeGranularityInMinutes property: Time granularity in minutes for maintenance windows. + * + * @return the timeGranularityInMinutes value. + */ + Integer timeGranularityInMinutes(); + + /** + * Gets the allowMultipleMaintenanceWindowsPerCycle property: Whether we allow multiple maintenance windows per + * cycle. + * + * @return the allowMultipleMaintenanceWindowsPerCycle value. + */ + Boolean allowMultipleMaintenanceWindowsPerCycle(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.MaintenanceWindowOptionsInner object. + * + * @return the inner object. + */ + MaintenanceWindowOptionsInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaintenanceWindowOptionsOperations.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaintenanceWindowOptionsOperations.java new file mode 100644 index 0000000000000..ac18715eebc7e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaintenanceWindowOptionsOperations.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of MaintenanceWindowOptionsOperations. */ +public interface MaintenanceWindowOptionsOperations { + /** + * Gets a list of available maintenance windows. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 maintenance windows options for. + * @param maintenanceWindowOptionsName Maintenance window options name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of available maintenance windows along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String maintenanceWindowOptionsName, + Context context); + + /** + * Gets a list of available maintenance windows. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 maintenance windows options for. + * @param maintenanceWindowOptionsName Maintenance window options name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of available maintenance windows. + */ + MaintenanceWindowOptions get( + String resourceGroupName, String serverName, String databaseName, String maintenanceWindowOptionsName); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaintenanceWindowTimeRange.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaintenanceWindowTimeRange.java new file mode 100644 index 0000000000000..497078d9964d2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaintenanceWindowTimeRange.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Maintenance window time range. */ +@Fluent +public final class MaintenanceWindowTimeRange { + /* + * Day of maintenance window. + */ + @JsonProperty(value = "dayOfWeek") + private DayOfWeek dayOfWeek; + + /* + * Start time minutes offset from 12am. + */ + @JsonProperty(value = "startTime") + private String startTime; + + /* + * Duration of maintenance window in minutes. + */ + @JsonProperty(value = "duration") + private String duration; + + /** Creates an instance of MaintenanceWindowTimeRange class. */ + public MaintenanceWindowTimeRange() { + } + + /** + * Get the dayOfWeek property: Day of maintenance window. + * + * @return the dayOfWeek value. + */ + public DayOfWeek dayOfWeek() { + return this.dayOfWeek; + } + + /** + * Set the dayOfWeek property: Day of maintenance window. + * + * @param dayOfWeek the dayOfWeek value to set. + * @return the MaintenanceWindowTimeRange object itself. + */ + public MaintenanceWindowTimeRange withDayOfWeek(DayOfWeek dayOfWeek) { + this.dayOfWeek = dayOfWeek; + return this; + } + + /** + * Get the startTime property: Start time minutes offset from 12am. + * + * @return the startTime value. + */ + public String startTime() { + return this.startTime; + } + + /** + * Set the startTime property: Start time minutes offset from 12am. + * + * @param startTime the startTime value to set. + * @return the MaintenanceWindowTimeRange object itself. + */ + public MaintenanceWindowTimeRange withStartTime(String startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the duration property: Duration of maintenance window in minutes. + * + * @return the duration value. + */ + public String duration() { + return this.duration; + } + + /** + * Set the duration property: Duration of maintenance window in minutes. + * + * @param duration the duration value to set. + * @return the MaintenanceWindowTimeRange object itself. + */ + public MaintenanceWindowTimeRange withDuration(String duration) { + this.duration = duration; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaintenanceWindows.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaintenanceWindows.java new file mode 100644 index 0000000000000..2fd361a259b1c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaintenanceWindows.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.MaintenanceWindowsInner; +import java.util.List; + +/** An immutable client-side representation of MaintenanceWindows. */ +public interface MaintenanceWindows { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the timeRanges property: The timeRanges property. + * + * @return the timeRanges value. + */ + List timeRanges(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.MaintenanceWindowsInner object. + * + * @return the inner object. + */ + MaintenanceWindowsInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaintenanceWindowsOperations.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaintenanceWindowsOperations.java new file mode 100644 index 0000000000000..2ea8e0f735c52 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaintenanceWindowsOperations.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.MaintenanceWindowsInner; + +/** Resource collection API of MaintenanceWindowsOperations. */ +public interface MaintenanceWindowsOperations { + /** + * Gets maintenance windows settings for 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 get maintenance windows for. + * @param maintenanceWindowName Maintenance window name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return maintenance windows settings for a database along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String maintenanceWindowName, + Context context); + + /** + * Gets maintenance windows settings for 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 get maintenance windows for. + * @param maintenanceWindowName Maintenance window name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return maintenance windows settings for a database. + */ + MaintenanceWindows get( + String resourceGroupName, String serverName, String databaseName, String maintenanceWindowName); + + /** + * Sets maintenance windows settings for 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 set maintenance windows for. + * @param maintenanceWindowName Maintenance window name. + * @param parameters Maintenance windows. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String maintenanceWindowName, + MaintenanceWindowsInner parameters, + Context context); + + /** + * Sets maintenance windows settings for 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 set maintenance windows for. + * @param maintenanceWindowName Maintenance window name. + * @param parameters Maintenance windows. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String maintenanceWindowName, + MaintenanceWindowsInner parameters); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedBackupShortTermRetentionPolicies.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedBackupShortTermRetentionPolicies.java new file mode 100644 index 0000000000000..5e4576ebfa40e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedBackupShortTermRetentionPolicies.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ManagedBackupShortTermRetentionPolicies. */ +public interface ManagedBackupShortTermRetentionPolicies { + /** + * 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 policyName The policy name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's short term retention policy along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName, + Context context); + + /** + * 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 policyName The policy name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's short term retention policy. + */ + ManagedBackupShortTermRetentionPolicy get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedShortTermRetentionPolicyName policyName); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's short term retention policy list as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's short term retention policy list as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName, Context context); + + /** + * Gets a managed database's short term retention policy. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's short term retention policy along with {@link Response}. + */ + ManagedBackupShortTermRetentionPolicy getById(String id); + + /** + * Gets a managed database's short term retention policy. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's short term retention policy along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ManagedBackupShortTermRetentionPolicy resource. + * + * @param name resource name. + * @return the first stage of the new ManagedBackupShortTermRetentionPolicy definition. + */ + ManagedBackupShortTermRetentionPolicy.DefinitionStages.Blank define(ManagedShortTermRetentionPolicyName name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedBackupShortTermRetentionPolicy.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedBackupShortTermRetentionPolicy.java new file mode 100644 index 0000000000000..4b5b2097e4e5e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedBackupShortTermRetentionPolicy.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedBackupShortTermRetentionPolicyInner; + +/** An immutable client-side representation of ManagedBackupShortTermRetentionPolicy. */ +public interface ManagedBackupShortTermRetentionPolicy { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the retentionDays property: The backup retention period in days. This is how many days Point-in-Time Restore + * will be supported. + * + * @return the retentionDays value. + */ + Integer retentionDays(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ManagedBackupShortTermRetentionPolicyInner + * object. + * + * @return the inner object. + */ + ManagedBackupShortTermRetentionPolicyInner innerModel(); + + /** The entirety of the ManagedBackupShortTermRetentionPolicy definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ManagedBackupShortTermRetentionPolicy definition stages. */ + interface DefinitionStages { + /** The first stage of the ManagedBackupShortTermRetentionPolicy definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ManagedBackupShortTermRetentionPolicy definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, managedInstanceName, databaseName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @return the next definition stage. + */ + WithCreate withExistingDatabase(String resourceGroupName, String managedInstanceName, String databaseName); + } + /** + * The stage of the ManagedBackupShortTermRetentionPolicy definition which contains all the minimum required + * properties for the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithRetentionDays { + /** + * Executes the create request. + * + * @return the created resource. + */ + ManagedBackupShortTermRetentionPolicy create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ManagedBackupShortTermRetentionPolicy create(Context context); + } + /** The stage of the ManagedBackupShortTermRetentionPolicy definition allowing to specify retentionDays. */ + interface WithRetentionDays { + /** + * Specifies the retentionDays property: The backup retention period in days. This is how many days + * Point-in-Time Restore will be supported.. + * + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore + * will be supported. + * @return the next definition stage. + */ + WithCreate withRetentionDays(Integer retentionDays); + } + } + /** + * Begins update for the ManagedBackupShortTermRetentionPolicy resource. + * + * @return the stage of resource update. + */ + ManagedBackupShortTermRetentionPolicy.Update update(); + + /** The template for ManagedBackupShortTermRetentionPolicy update. */ + interface Update extends UpdateStages.WithRetentionDays { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ManagedBackupShortTermRetentionPolicy apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ManagedBackupShortTermRetentionPolicy apply(Context context); + } + /** The ManagedBackupShortTermRetentionPolicy update stages. */ + interface UpdateStages { + /** The stage of the ManagedBackupShortTermRetentionPolicy update allowing to specify retentionDays. */ + interface WithRetentionDays { + /** + * Specifies the retentionDays property: The backup retention period in days. This is how many days + * Point-in-Time Restore will be supported.. + * + * @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore + * will be supported. + * @return the next definition stage. + */ + Update withRetentionDays(Integer retentionDays); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ManagedBackupShortTermRetentionPolicy refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ManagedBackupShortTermRetentionPolicy refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedBackupShortTermRetentionPolicyListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedBackupShortTermRetentionPolicyListResult.java new file mode 100644 index 0000000000000..a199c5b436c73 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedBackupShortTermRetentionPolicyListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedBackupShortTermRetentionPolicyInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of short term retention policies. */ +@Immutable +public final class ManagedBackupShortTermRetentionPolicyListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of ManagedBackupShortTermRetentionPolicyListResult class. */ + public ManagedBackupShortTermRetentionPolicyListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabase.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabase.java new file mode 100644 index 0000000000000..3521cb3273801 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabase.java @@ -0,0 +1,609 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedDatabaseInner; +import java.time.OffsetDateTime; +import java.util.Map; + +/** An immutable client-side representation of ManagedDatabase. */ +public interface ManagedDatabase { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the collation property: Collation of the managed database. + * + * @return the collation value. + */ + String collation(); + + /** + * Gets the status property: Status of the database. + * + * @return the status value. + */ + ManagedDatabaseStatus status(); + + /** + * Gets the creationDate property: Creation date of the database. + * + * @return the creationDate value. + */ + OffsetDateTime creationDate(); + + /** + * Gets the earliestRestorePoint property: Earliest restore point in time for point in time restore. + * + * @return the earliestRestorePoint value. + */ + OffsetDateTime earliestRestorePoint(); + + /** + * Gets the restorePointInTime property: Conditional. If createMode is PointInTimeRestore, this value is required. + * Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new + * database. + * + * @return the restorePointInTime value. + */ + OffsetDateTime restorePointInTime(); + + /** + * Gets the defaultSecondaryLocation property: Geo paired region. + * + * @return the defaultSecondaryLocation value. + */ + String defaultSecondaryLocation(); + + /** + * Gets the catalogCollation property: Collation of the metadata catalog. + * + * @return the catalogCollation value. + */ + CatalogCollationType catalogCollation(); + + /** + * Gets the createMode property: 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. RestoreLongTermRetentionBackup: Create a database by restoring from a long term retention backup + * (longTermRetentionBackupResourceId required). + * + * @return the createMode value. + */ + ManagedDatabaseCreateMode createMode(); + + /** + * Gets the storageContainerUri property: 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. + */ + String storageContainerUri(); + + /** + * Gets the sourceDatabaseId property: The resource identifier of the source database associated with create + * operation of this database. + * + * @return the sourceDatabaseId value. + */ + String sourceDatabaseId(); + + /** + * Gets the restorableDroppedDatabaseId property: The restorable dropped database resource id to restore when + * creating this database. + * + * @return the restorableDroppedDatabaseId value. + */ + String restorableDroppedDatabaseId(); + + /** + * Gets the storageContainerIdentity property: Conditional. If createMode is RestoreExternalBackup, this value is + * used. Specifies the identity used for storage container authentication. Can be 'SharedAccessSignature' or + * 'ManagedIdentity'; if not specified 'SharedAccessSignature' is assumed. + * + * @return the storageContainerIdentity value. + */ + String storageContainerIdentity(); + + /** + * Gets the storageContainerSasToken property: Conditional. If createMode is RestoreExternalBackup and + * storageContainerIdentity is not ManagedIdentity, this value is required. Specifies the storage container sas + * token. + * + * @return the storageContainerSasToken value. + */ + String storageContainerSasToken(); + + /** + * Gets the failoverGroupId property: Instance Failover Group resource identifier that this managed database belongs + * to. + * + * @return the failoverGroupId value. + */ + String failoverGroupId(); + + /** + * Gets the recoverableDatabaseId property: The resource identifier of the recoverable database associated with + * create operation of this database. + * + * @return the recoverableDatabaseId value. + */ + String recoverableDatabaseId(); + + /** + * Gets the longTermRetentionBackupResourceId property: The name of the Long Term Retention backup to be used for + * restore of this managed database. + * + * @return the longTermRetentionBackupResourceId value. + */ + String longTermRetentionBackupResourceId(); + + /** + * Gets the autoCompleteRestore property: Whether to auto complete restore of this managed database. + * + * @return the autoCompleteRestore value. + */ + Boolean autoCompleteRestore(); + + /** + * Gets the lastBackupName property: Last backup file name for restore of this managed database. + * + * @return the lastBackupName value. + */ + String lastBackupName(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ManagedDatabaseInner object. + * + * @return the inner object. + */ + ManagedDatabaseInner innerModel(); + + /** The entirety of the ManagedDatabase definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, + DefinitionStages.WithCreate { + } + /** The ManagedDatabase definition stages. */ + interface DefinitionStages { + /** The first stage of the ManagedDatabase definition. */ + interface Blank extends WithLocation { + } + /** The stage of the ManagedDatabase definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + /** The stage of the ManagedDatabase definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, managedInstanceName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @return the next definition stage. + */ + WithCreate withExistingManagedInstance(String resourceGroupName, String managedInstanceName); + } + /** + * The stage of the ManagedDatabase definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithCollation, + DefinitionStages.WithRestorePointInTime, + DefinitionStages.WithCatalogCollation, + DefinitionStages.WithCreateMode, + DefinitionStages.WithStorageContainerUri, + DefinitionStages.WithSourceDatabaseId, + DefinitionStages.WithRestorableDroppedDatabaseId, + DefinitionStages.WithStorageContainerIdentity, + DefinitionStages.WithStorageContainerSasToken, + DefinitionStages.WithRecoverableDatabaseId, + DefinitionStages.WithLongTermRetentionBackupResourceId, + DefinitionStages.WithAutoCompleteRestore, + DefinitionStages.WithLastBackupName { + /** + * Executes the create request. + * + * @return the created resource. + */ + ManagedDatabase create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ManagedDatabase create(Context context); + } + /** The stage of the ManagedDatabase definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the ManagedDatabase definition allowing to specify collation. */ + interface WithCollation { + /** + * Specifies the collation property: Collation of the managed database.. + * + * @param collation Collation of the managed database. + * @return the next definition stage. + */ + WithCreate withCollation(String collation); + } + /** The stage of the ManagedDatabase definition allowing to specify restorePointInTime. */ + interface WithRestorePointInTime { + /** + * Specifies the restorePointInTime property: Conditional. If createMode is PointInTimeRestore, this value + * is required. Specifies the point in time (ISO8601 format) of the source database that will be restored to + * create the new database.. + * + * @param restorePointInTime Conditional. If createMode is PointInTimeRestore, this value is required. + * Specifies the point in time (ISO8601 format) of the source database that will be restored to create + * the new database. + * @return the next definition stage. + */ + WithCreate withRestorePointInTime(OffsetDateTime restorePointInTime); + } + /** The stage of the ManagedDatabase definition allowing to specify catalogCollation. */ + interface WithCatalogCollation { + /** + * Specifies the catalogCollation property: Collation of the metadata catalog.. + * + * @param catalogCollation Collation of the metadata catalog. + * @return the next definition stage. + */ + WithCreate withCatalogCollation(CatalogCollationType catalogCollation); + } + /** The stage of the ManagedDatabase definition allowing to specify createMode. */ + interface WithCreateMode { + /** + * Specifies the createMode property: 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. RestoreLongTermRetentionBackup: Create a database by + * restoring from a long term retention backup (longTermRetentionBackupResourceId required).. + * + * @param createMode Managed database create mode. PointInTimeRestore: Create a database by restoring a + * point in time backup of an existing database. SourceDatabaseName, SourceManagedInstanceName and + * PointInTime must be specified. RestoreExternalBackup: Create a database by restoring from external + * backup files. Collation, StorageContainerUri and StorageContainerSasToken must be specified. + * Recovery: Creates a database by restoring a geo-replicated backup. RecoverableDatabaseId must be + * specified as the recoverable database resource ID to restore. RestoreLongTermRetentionBackup: Create + * a database by restoring from a long term retention backup (longTermRetentionBackupResourceId + * required). + * @return the next definition stage. + */ + WithCreate withCreateMode(ManagedDatabaseCreateMode createMode); + } + /** The stage of the ManagedDatabase definition allowing to specify storageContainerUri. */ + interface WithStorageContainerUri { + /** + * Specifies the storageContainerUri property: 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 Conditional. If createMode is RestoreExternalBackup, this value is required. + * Specifies the uri of the storage container where backups for this restore are stored. + * @return the next definition stage. + */ + WithCreate withStorageContainerUri(String storageContainerUri); + } + /** The stage of the ManagedDatabase definition allowing to specify sourceDatabaseId. */ + interface WithSourceDatabaseId { + /** + * Specifies the sourceDatabaseId property: The resource identifier of the source database associated with + * create operation of this database.. + * + * @param sourceDatabaseId The resource identifier of the source database associated with create operation + * of this database. + * @return the next definition stage. + */ + WithCreate withSourceDatabaseId(String sourceDatabaseId); + } + /** The stage of the ManagedDatabase definition allowing to specify restorableDroppedDatabaseId. */ + interface WithRestorableDroppedDatabaseId { + /** + * Specifies the restorableDroppedDatabaseId property: The restorable dropped database resource id to + * restore when creating this database.. + * + * @param restorableDroppedDatabaseId The restorable dropped database resource id to restore when creating + * this database. + * @return the next definition stage. + */ + WithCreate withRestorableDroppedDatabaseId(String restorableDroppedDatabaseId); + } + /** The stage of the ManagedDatabase definition allowing to specify storageContainerIdentity. */ + interface WithStorageContainerIdentity { + /** + * Specifies the storageContainerIdentity property: Conditional. If createMode is RestoreExternalBackup, + * this value is used. Specifies the identity used for storage container authentication. Can be + * 'SharedAccessSignature' or 'ManagedIdentity'; if not specified 'SharedAccessSignature' is assumed.. + * + * @param storageContainerIdentity Conditional. If createMode is RestoreExternalBackup, this value is used. + * Specifies the identity used for storage container authentication. Can be 'SharedAccessSignature' or + * 'ManagedIdentity'; if not specified 'SharedAccessSignature' is assumed. + * @return the next definition stage. + */ + WithCreate withStorageContainerIdentity(String storageContainerIdentity); + } + /** The stage of the ManagedDatabase definition allowing to specify storageContainerSasToken. */ + interface WithStorageContainerSasToken { + /** + * Specifies the storageContainerSasToken property: Conditional. If createMode is RestoreExternalBackup and + * storageContainerIdentity is not ManagedIdentity, this value is required. Specifies the storage container + * sas token.. + * + * @param storageContainerSasToken Conditional. If createMode is RestoreExternalBackup and + * storageContainerIdentity is not ManagedIdentity, this value is required. Specifies the storage + * container sas token. + * @return the next definition stage. + */ + WithCreate withStorageContainerSasToken(String storageContainerSasToken); + } + /** The stage of the ManagedDatabase definition allowing to specify recoverableDatabaseId. */ + interface WithRecoverableDatabaseId { + /** + * Specifies the recoverableDatabaseId property: The resource identifier of the recoverable database + * associated with create operation of this database.. + * + * @param recoverableDatabaseId The resource identifier of the recoverable database associated with create + * operation of this database. + * @return the next definition stage. + */ + WithCreate withRecoverableDatabaseId(String recoverableDatabaseId); + } + /** The stage of the ManagedDatabase definition allowing to specify longTermRetentionBackupResourceId. */ + interface WithLongTermRetentionBackupResourceId { + /** + * Specifies the longTermRetentionBackupResourceId property: The name of the Long Term Retention backup to + * be used for restore of this managed database.. + * + * @param longTermRetentionBackupResourceId The name of the Long Term Retention backup to be used for + * restore of this managed database. + * @return the next definition stage. + */ + WithCreate withLongTermRetentionBackupResourceId(String longTermRetentionBackupResourceId); + } + /** The stage of the ManagedDatabase definition allowing to specify autoCompleteRestore. */ + interface WithAutoCompleteRestore { + /** + * Specifies the autoCompleteRestore property: Whether to auto complete restore of this managed database.. + * + * @param autoCompleteRestore Whether to auto complete restore of this managed database. + * @return the next definition stage. + */ + WithCreate withAutoCompleteRestore(Boolean autoCompleteRestore); + } + /** The stage of the ManagedDatabase definition allowing to specify lastBackupName. */ + interface WithLastBackupName { + /** + * Specifies the lastBackupName property: Last backup file name for restore of this managed database.. + * + * @param lastBackupName Last backup file name for restore of this managed database. + * @return the next definition stage. + */ + WithCreate withLastBackupName(String lastBackupName); + } + } + /** + * Begins update for the ManagedDatabase resource. + * + * @return the stage of resource update. + */ + ManagedDatabase.Update update(); + + /** The template for ManagedDatabase update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ManagedDatabase apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ManagedDatabase apply(Context context); + } + /** The ManagedDatabase update stages. */ + interface UpdateStages { + /** The stage of the ManagedDatabase update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ManagedDatabase refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ManagedDatabase refresh(Context context); + + /** + * Cancels a managed database move operation. + * + * @param parameters Parameters of the cancel managed database move operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void cancelMove(ManagedDatabaseMoveDefinition parameters); + + /** + * Cancels a managed database move operation. + * + * @param parameters Parameters of the cancel managed database move operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void cancelMove(ManagedDatabaseMoveDefinition parameters, Context context); + + /** + * Completes a managed database move operation. + * + * @param parameters Parameters of the complete managed database move operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void completeMove(ManagedDatabaseMoveDefinition parameters); + + /** + * Completes a managed database move operation. + * + * @param parameters Parameters of the complete managed database move operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void completeMove(ManagedDatabaseMoveDefinition parameters, Context context); + + /** + * Completes the restore operation on a managed database. + * + * @param parameters The definition for completing the restore of this managed database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void completeRestore(CompleteDatabaseRestoreDefinition parameters); + + /** + * Completes the restore operation on a managed database. + * + * @param parameters The definition for completing the restore of this managed database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void completeRestore(CompleteDatabaseRestoreDefinition parameters, Context context); + + /** + * Starts a managed database move operation. + * + * @param parameters Parameters of the start managed database move operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void startMove(ManagedDatabaseStartMoveDefinition parameters); + + /** + * Starts a managed database move operation. + * + * @param parameters Parameters of the start managed database move operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void startMove(ManagedDatabaseStartMoveDefinition parameters, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseAdvancedThreatProtection.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseAdvancedThreatProtection.java new file mode 100644 index 0000000000000..dbc10e5617161 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseAdvancedThreatProtection.java @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedDatabaseAdvancedThreatProtectionInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of ManagedDatabaseAdvancedThreatProtection. */ +public interface ManagedDatabaseAdvancedThreatProtection { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: SystemData of AdvancedThreatProtectionResource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the state property: Specifies the state of the Advanced Threat Protection, whether it is enabled or disabled + * or a state has not been applied yet on the specific database or server. + * + * @return the state value. + */ + AdvancedThreatProtectionState state(); + + /** + * Gets the creationTime property: Specifies the UTC creation time of the policy. + * + * @return the creationTime value. + */ + OffsetDateTime creationTime(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ManagedDatabaseAdvancedThreatProtectionInner + * object. + * + * @return the inner object. + */ + ManagedDatabaseAdvancedThreatProtectionInner innerModel(); + + /** The entirety of the ManagedDatabaseAdvancedThreatProtection definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ManagedDatabaseAdvancedThreatProtection definition stages. */ + interface DefinitionStages { + /** The first stage of the ManagedDatabaseAdvancedThreatProtection definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ManagedDatabaseAdvancedThreatProtection definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, managedInstanceName, databaseName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @return the next definition stage. + */ + WithCreate withExistingDatabase(String resourceGroupName, String managedInstanceName, String databaseName); + } + /** + * The stage of the ManagedDatabaseAdvancedThreatProtection definition which contains all the minimum required + * properties for the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithState { + /** + * Executes the create request. + * + * @return the created resource. + */ + ManagedDatabaseAdvancedThreatProtection create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ManagedDatabaseAdvancedThreatProtection create(Context context); + } + /** The stage of the ManagedDatabaseAdvancedThreatProtection definition allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the Advanced Threat Protection, whether it is + * enabled or disabled or a state has not been applied yet on the specific database or server.. + * + * @param state Specifies the state of the Advanced Threat Protection, whether it is enabled or disabled or + * a state has not been applied yet on the specific database or server. + * @return the next definition stage. + */ + WithCreate withState(AdvancedThreatProtectionState state); + } + } + /** + * Begins update for the ManagedDatabaseAdvancedThreatProtection resource. + * + * @return the stage of resource update. + */ + ManagedDatabaseAdvancedThreatProtection.Update update(); + + /** The template for ManagedDatabaseAdvancedThreatProtection update. */ + interface Update extends UpdateStages.WithState { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ManagedDatabaseAdvancedThreatProtection apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ManagedDatabaseAdvancedThreatProtection apply(Context context); + } + /** The ManagedDatabaseAdvancedThreatProtection update stages. */ + interface UpdateStages { + /** The stage of the ManagedDatabaseAdvancedThreatProtection update allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the Advanced Threat Protection, whether it is + * enabled or disabled or a state has not been applied yet on the specific database or server.. + * + * @param state Specifies the state of the Advanced Threat Protection, whether it is enabled or disabled or + * a state has not been applied yet on the specific database or server. + * @return the next definition stage. + */ + Update withState(AdvancedThreatProtectionState state); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ManagedDatabaseAdvancedThreatProtection refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ManagedDatabaseAdvancedThreatProtection refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseAdvancedThreatProtectionListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseAdvancedThreatProtectionListResult.java new file mode 100644 index 0000000000000..cf002dae614c5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseAdvancedThreatProtectionListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedDatabaseAdvancedThreatProtectionInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of the managed database's Advanced Threat Protection settings. */ +@Immutable +public final class ManagedDatabaseAdvancedThreatProtectionListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of ManagedDatabaseAdvancedThreatProtectionListResult class. */ + public ManagedDatabaseAdvancedThreatProtectionListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseAdvancedThreatProtectionSettings.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseAdvancedThreatProtectionSettings.java new file mode 100644 index 0000000000000..011435ba61854 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseAdvancedThreatProtectionSettings.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ManagedDatabaseAdvancedThreatProtectionSettings. */ +public interface ManagedDatabaseAdvancedThreatProtectionSettings { + /** + * Gets a list of managed database's Advanced Threat Protection states. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed database's Advanced Threat Protection states as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName); + + /** + * Gets a list of managed database's Advanced Threat Protection states. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed database's Advanced Threat Protection states as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName, Context context); + + /** + * Gets a managed database's Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's Advanced Threat Protection state along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + AdvancedThreatProtectionName advancedThreatProtectionName, + Context context); + + /** + * Gets a managed database's Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's Advanced Threat Protection state. + */ + ManagedDatabaseAdvancedThreatProtection get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + AdvancedThreatProtectionName advancedThreatProtectionName); + + /** + * Gets a managed database's Advanced Threat Protection state. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's Advanced Threat Protection state along with {@link Response}. + */ + ManagedDatabaseAdvancedThreatProtection getById(String id); + + /** + * Gets a managed database's Advanced Threat Protection state. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's Advanced Threat Protection state along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ManagedDatabaseAdvancedThreatProtection resource. + * + * @param name resource name. + * @return the first stage of the new ManagedDatabaseAdvancedThreatProtection definition. + */ + ManagedDatabaseAdvancedThreatProtection.DefinitionStages.Blank define(AdvancedThreatProtectionName name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseColumns.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseColumns.java new file mode 100644 index 0000000000000..7daef698476fa --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseColumns.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import java.util.List; + +/** Resource collection API of ManagedDatabaseColumns. */ +public interface ManagedDatabaseColumns { + /** + * List managed database columns. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database columns as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName); + + /** + * List managed database columns. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schema Array of Get3ItemsItem. + * @param table Array of Get4ItemsItem. + * @param column Array of Get5ItemsItem. + * @param orderBy Array of Get6ItemsItem. + * @param skiptoken An opaque token that identifies a starting point in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database columns as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, + String managedInstanceName, + String databaseName, + List schema, + List table, + List column, + List orderBy, + String skiptoken, + Context context); + + /** + * List managed database columns. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database columns as paginated response with {@link PagedIterable}. + */ + PagedIterable listByTable( + String resourceGroupName, String managedInstanceName, String databaseName, String schemaName, String tableName); + + /** + * List managed database columns. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param filter An OData filter expression that filters elements in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database columns as paginated response with {@link PagedIterable}. + */ + PagedIterable listByTable( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String filter, + Context context); + + /** + * Get managed database column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return managed database column along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context); + + /** + * Get managed database column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return managed database column. + */ + DatabaseColumn get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseCreateMode.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseCreateMode.java new file mode 100644 index 0000000000000..226c15b6e129f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseCreateMode.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * 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. + * RestoreLongTermRetentionBackup: Create a database by restoring from a long term retention backup + * (longTermRetentionBackupResourceId required). + */ +public final class ManagedDatabaseCreateMode extends ExpandableStringEnum { + /** Static value Default for ManagedDatabaseCreateMode. */ + public static final ManagedDatabaseCreateMode DEFAULT = fromString("Default"); + + /** Static value RestoreExternalBackup for ManagedDatabaseCreateMode. */ + public static final ManagedDatabaseCreateMode RESTORE_EXTERNAL_BACKUP = fromString("RestoreExternalBackup"); + + /** Static value PointInTimeRestore for ManagedDatabaseCreateMode. */ + public static final ManagedDatabaseCreateMode POINT_IN_TIME_RESTORE = fromString("PointInTimeRestore"); + + /** Static value Recovery for ManagedDatabaseCreateMode. */ + public static final ManagedDatabaseCreateMode RECOVERY = fromString("Recovery"); + + /** Static value RestoreLongTermRetentionBackup for ManagedDatabaseCreateMode. */ + public static final ManagedDatabaseCreateMode RESTORE_LONG_TERM_RETENTION_BACKUP = + fromString("RestoreLongTermRetentionBackup"); + + /** + * Creates or finds a ManagedDatabaseCreateMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagedDatabaseCreateMode. + */ + @JsonCreator + public static ManagedDatabaseCreateMode fromString(String name) { + return fromString(name, ManagedDatabaseCreateMode.class); + } + + /** + * Gets known ManagedDatabaseCreateMode values. + * + * @return known ManagedDatabaseCreateMode values. + */ + public static Collection values() { + return values(ManagedDatabaseCreateMode.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseListResult.java new file mode 100644 index 0000000000000..01c7b774801ae --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedDatabaseInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of managed databases. */ +@Immutable +public final class ManagedDatabaseListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of ManagedDatabaseListResult class. */ + public ManagedDatabaseListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseMoveDefinition.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseMoveDefinition.java new file mode 100644 index 0000000000000..5811a10208b1c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseMoveDefinition.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Contains the information necessary to perform a managed database move. */ +@Fluent +public final class ManagedDatabaseMoveDefinition { + /* + * The destination managed database ID + */ + @JsonProperty(value = "destinationManagedDatabaseId", required = true) + private String destinationManagedDatabaseId; + + /** Creates an instance of ManagedDatabaseMoveDefinition class. */ + public ManagedDatabaseMoveDefinition() { + } + + /** + * Get the destinationManagedDatabaseId property: The destination managed database ID. + * + * @return the destinationManagedDatabaseId value. + */ + public String destinationManagedDatabaseId() { + return this.destinationManagedDatabaseId; + } + + /** + * Set the destinationManagedDatabaseId property: The destination managed database ID. + * + * @param destinationManagedDatabaseId the destinationManagedDatabaseId value to set. + * @return the ManagedDatabaseMoveDefinition object itself. + */ + public ManagedDatabaseMoveDefinition withDestinationManagedDatabaseId(String destinationManagedDatabaseId) { + this.destinationManagedDatabaseId = destinationManagedDatabaseId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (destinationManagedDatabaseId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property destinationManagedDatabaseId in model" + + " ManagedDatabaseMoveDefinition")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ManagedDatabaseMoveDefinition.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseMoveOperationListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseMoveOperationListResult.java new file mode 100644 index 0000000000000..759cad8527f11 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseMoveOperationListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedDatabaseMoveOperationResultInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of managed database move operations. */ +@Immutable +public final class ManagedDatabaseMoveOperationListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of ManagedDatabaseMoveOperationListResult class. */ + public ManagedDatabaseMoveOperationListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseMoveOperationResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseMoveOperationResult.java new file mode 100644 index 0000000000000..e0a53a2768d4c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseMoveOperationResult.java @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedDatabaseMoveOperationResultInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of ManagedDatabaseMoveOperationResult. */ +public interface ManagedDatabaseMoveOperationResult { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the operation property: The name of operation. + * + * @return the operation value. + */ + String operation(); + + /** + * Gets the operationFriendlyName property: The friendly name of operation. + * + * @return the operationFriendlyName value. + */ + String operationFriendlyName(); + + /** + * Gets the startTime property: The operation start time. + * + * @return the startTime value. + */ + OffsetDateTime startTime(); + + /** + * Gets the state property: The operation state. + * + * @return the state value. + */ + ManagementOperationState state(); + + /** + * Gets the operationMode property: Operation mode. + * + * @return the operationMode value. + */ + MoveOperationMode operationMode(); + + /** + * Gets the sourceManagedInstanceName property: Source Managed Instance name. + * + * @return the sourceManagedInstanceName value. + */ + String sourceManagedInstanceName(); + + /** + * Gets the targetManagedInstanceName property: Target Managed Instance name. + * + * @return the targetManagedInstanceName value. + */ + String targetManagedInstanceName(); + + /** + * Gets the sourceManagedInstanceId property: Source Managed Instance resource id. + * + * @return the sourceManagedInstanceId value. + */ + String sourceManagedInstanceId(); + + /** + * Gets the targetManagedInstanceId property: Target Managed instance resource id. + * + * @return the targetManagedInstanceId value. + */ + String targetManagedInstanceId(); + + /** + * Gets the sourceDatabaseName property: Source database name. + * + * @return the sourceDatabaseName value. + */ + String sourceDatabaseName(); + + /** + * Gets the targetDatabaseName property: Target database name. + * + * @return the targetDatabaseName value. + */ + String targetDatabaseName(); + + /** + * Gets the isCancellable property: Is move operation cancellable. + * + * @return the isCancellable value. + */ + Boolean isCancellable(); + + /** + * Gets the errorCode property: The operation error code. + * + * @return the errorCode value. + */ + Integer errorCode(); + + /** + * Gets the errorDescription property: The operation error description. + * + * @return the errorDescription value. + */ + String errorDescription(); + + /** + * Gets the errorSeverity property: The operation error severity. + * + * @return the errorSeverity value. + */ + Integer errorSeverity(); + + /** + * Gets the isUserError property: Whether or not the error is a user error. + * + * @return the isUserError value. + */ + Boolean isUserError(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ManagedDatabaseMoveOperationResultInner + * object. + * + * @return the inner object. + */ + ManagedDatabaseMoveOperationResultInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseMoveOperations.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseMoveOperations.java new file mode 100644 index 0000000000000..4343483289450 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseMoveOperations.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import java.util.UUID; + +/** Resource collection API of ManagedDatabaseMoveOperations. */ +public interface ManagedDatabaseMoveOperations { + /** + * Lists managed database move operations. + * + * @param resourceGroupName The 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 locationName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed database move operations as paginated response with {@link PagedIterable}. + */ + PagedIterable listByLocation(String resourceGroupName, String locationName); + + /** + * Lists managed database move operations. + * + * @param resourceGroupName The 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 locationName parameter. + * @param onlyLatestPerDatabase Whether or not to only get the latest operation for each database. Has higher + * priority than $filter. + * @param filter An OData filter expression that filters elements in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of managed database move operations as paginated response with {@link PagedIterable}. + */ + PagedIterable listByLocation( + String resourceGroupName, String locationName, Boolean onlyLatestPerDatabase, String filter, Context context); + + /** + * Gets a managed database move operation. + * + * @param resourceGroupName The 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 locationName parameter. + * @param operationId The operationId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database move operation along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String locationName, UUID operationId, Context context); + + /** + * Gets a managed database move operation. + * + * @param resourceGroupName The 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 locationName parameter. + * @param operationId The operationId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database move operation. + */ + ManagedDatabaseMoveOperationResult get(String resourceGroupName, String locationName, UUID operationId); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseQueries.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseQueries.java new file mode 100644 index 0000000000000..e7ba057dae467 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseQueries.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ManagedDatabaseQueries. */ +public interface ManagedDatabaseQueries { + /** + * Get query by query id. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 queryId The queryId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query by query id along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String managedInstanceName, String databaseName, String queryId, Context context); + + /** + * Get query by query id. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 queryId The queryId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query by query id. + */ + ManagedInstanceQuery get(String resourceGroupName, String managedInstanceName, String databaseName, String queryId); + + /** + * Get query execution statistics by query id. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 queryId The queryId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query execution statistics by query id as paginated response with {@link PagedIterable}. + */ + PagedIterable listByQuery( + String resourceGroupName, String managedInstanceName, String databaseName, String queryId); + + /** + * Get query execution statistics by query id. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 queryId The queryId parameter. + * @param startTime Start time for observed period. + * @param endTime End time for observed period. + * @param interval The time step to be used to summarize the metric values. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return query execution statistics by query id as paginated response with {@link PagedIterable}. + */ + PagedIterable listByQuery( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String queryId, + String startTime, + String endTime, + QueryTimeGrainType interval, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseRecommendedSensitivityLabels.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseRecommendedSensitivityLabels.java new file mode 100644 index 0000000000000..d1c1a59506d24 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseRecommendedSensitivityLabels.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ManagedDatabaseRecommendedSensitivityLabels. */ +public interface ManagedDatabaseRecommendedSensitivityLabels { + /** + * Update recommended sensitivity labels states of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of recommended sensitivity label update operations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response updateWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + RecommendedSensitivityLabelUpdateList parameters, + Context context); + + /** + * Update recommended sensitivity labels states of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of recommended sensitivity label update operations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void update( + String resourceGroupName, + String managedInstanceName, + String databaseName, + RecommendedSensitivityLabelUpdateList parameters); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseRestoreDetails.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseRestoreDetails.java new file mode 100644 index 0000000000000..b034f3c264905 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseRestoreDetails.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ManagedDatabaseRestoreDetails. */ +public interface ManagedDatabaseRestoreDetails { + /** + * Gets managed database restore details. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param restoreDetailsName The name of the restore details to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return managed database restore details along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + RestoreDetailsName restoreDetailsName, + Context context); + + /** + * Gets managed database restore details. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param restoreDetailsName The name of the restore details to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return managed database restore details. + */ + ManagedDatabaseRestoreDetailsResult get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + RestoreDetailsName restoreDetailsName); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseRestoreDetailsBackupSetProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseRestoreDetailsBackupSetProperties.java new file mode 100644 index 0000000000000..3f14fc392693b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseRestoreDetailsBackupSetProperties.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The managed database's restore details backup set properties. */ +@Immutable +public final class ManagedDatabaseRestoreDetailsBackupSetProperties { + /* + * Backup set status. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /* + * First stripe name. + */ + @JsonProperty(value = "firstStripeName", access = JsonProperty.Access.WRITE_ONLY) + private String firstStripeName; + + /* + * Number of stripes. + */ + @JsonProperty(value = "numberOfStripes", access = JsonProperty.Access.WRITE_ONLY) + private Integer numberOfStripes; + + /* + * Backup size. + */ + @JsonProperty(value = "backupSizeMB", access = JsonProperty.Access.WRITE_ONLY) + private Integer backupSizeMB; + + /* + * Last restored file time. + */ + @JsonProperty(value = "restoreStartedTimestampUtc", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime restoreStartedTimestampUtc; + + /* + * Last restored file time. + */ + @JsonProperty(value = "restoreFinishedTimestampUtc", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime restoreFinishedTimestampUtc; + + /** Creates an instance of ManagedDatabaseRestoreDetailsBackupSetProperties class. */ + public ManagedDatabaseRestoreDetailsBackupSetProperties() { + } + + /** + * Get the status property: Backup set status. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Get the firstStripeName property: First stripe name. + * + * @return the firstStripeName value. + */ + public String firstStripeName() { + return this.firstStripeName; + } + + /** + * Get the numberOfStripes property: Number of stripes. + * + * @return the numberOfStripes value. + */ + public Integer numberOfStripes() { + return this.numberOfStripes; + } + + /** + * Get the backupSizeMB property: Backup size. + * + * @return the backupSizeMB value. + */ + public Integer backupSizeMB() { + return this.backupSizeMB; + } + + /** + * Get the restoreStartedTimestampUtc property: Last restored file time. + * + * @return the restoreStartedTimestampUtc value. + */ + public OffsetDateTime restoreStartedTimestampUtc() { + return this.restoreStartedTimestampUtc; + } + + /** + * Get the restoreFinishedTimestampUtc property: Last restored file time. + * + * @return the restoreFinishedTimestampUtc value. + */ + public OffsetDateTime restoreFinishedTimestampUtc() { + return this.restoreFinishedTimestampUtc; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseRestoreDetailsResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseRestoreDetailsResult.java new file mode 100644 index 0000000000000..8e1963e854abf --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseRestoreDetailsResult.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedDatabaseRestoreDetailsResultInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of ManagedDatabaseRestoreDetailsResult. */ +public interface ManagedDatabaseRestoreDetailsResult { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the typePropertiesType property: Restore type. + * + * @return the typePropertiesType value. + */ + String typePropertiesType(); + + /** + * Gets the status property: Restore status. + * + * @return the status value. + */ + String status(); + + /** + * Gets the blockReason property: The reason why restore is in Blocked state. + * + * @return the blockReason value. + */ + String blockReason(); + + /** + * Gets the lastUploadedFileName property: Last uploaded file name. + * + * @return the lastUploadedFileName value. + */ + String lastUploadedFileName(); + + /** + * Gets the lastUploadedFileTime property: Last uploaded file time. + * + * @return the lastUploadedFileTime value. + */ + OffsetDateTime lastUploadedFileTime(); + + /** + * Gets the lastRestoredFileName property: Last restored file name. + * + * @return the lastRestoredFileName value. + */ + String lastRestoredFileName(); + + /** + * Gets the lastRestoredFileTime property: Last restored file time. + * + * @return the lastRestoredFileTime value. + */ + OffsetDateTime lastRestoredFileTime(); + + /** + * Gets the percentCompleted property: Percent completed. + * + * @return the percentCompleted value. + */ + Integer percentCompleted(); + + /** + * Gets the currentRestoredSizeMB property: Current restored size MB. + * + * @return the currentRestoredSizeMB value. + */ + Integer currentRestoredSizeMB(); + + /** + * Gets the currentRestorePlanSizeMB property: Current restore plan size MB. + * + * @return the currentRestorePlanSizeMB value. + */ + Integer currentRestorePlanSizeMB(); + + /** + * Gets the currentBackupType property: Current backup type. + * + * @return the currentBackupType value. + */ + String currentBackupType(); + + /** + * Gets the currentRestoringFileName property: Current restoring file name. + * + * @return the currentRestoringFileName value. + */ + String currentRestoringFileName(); + + /** + * Gets the numberOfFilesDetected property: Number of files detected. + * + * @return the numberOfFilesDetected value. + */ + Integer numberOfFilesDetected(); + + /** + * Gets the numberOfFilesQueued property: Number of files queued. + * + * @return the numberOfFilesQueued value. + */ + Integer numberOfFilesQueued(); + + /** + * Gets the numberOfFilesSkipped property: Number of files skipped. + * + * @return the numberOfFilesSkipped value. + */ + Integer numberOfFilesSkipped(); + + /** + * Gets the numberOfFilesRestoring property: Number of files restoring. + * + * @return the numberOfFilesRestoring value. + */ + Integer numberOfFilesRestoring(); + + /** + * Gets the numberOfFilesRestored property: Number of files restored. + * + * @return the numberOfFilesRestored value. + */ + Integer numberOfFilesRestored(); + + /** + * Gets the numberOfFilesUnrestorable property: Number of files unrestorable. + * + * @return the numberOfFilesUnrestorable value. + */ + Integer numberOfFilesUnrestorable(); + + /** + * Gets the fullBackupSets property: Full backup sets. + * + * @return the fullBackupSets value. + */ + List fullBackupSets(); + + /** + * Gets the diffBackupSets property: Diff backup sets. + * + * @return the diffBackupSets value. + */ + List diffBackupSets(); + + /** + * Gets the logBackupSets property: Log backup sets. + * + * @return the logBackupSets value. + */ + List logBackupSets(); + + /** + * Gets the unrestorableFiles property: Unrestorable files. + * + * @return the unrestorableFiles value. + */ + List unrestorableFiles(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ManagedDatabaseRestoreDetailsResultInner + * object. + * + * @return the inner object. + */ + ManagedDatabaseRestoreDetailsResultInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseRestoreDetailsUnrestorableFileProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseRestoreDetailsUnrestorableFileProperties.java new file mode 100644 index 0000000000000..c9c06d7b6f761 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseRestoreDetailsUnrestorableFileProperties.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The managed database's restore details unrestorable file properties. */ +@Immutable +public final class ManagedDatabaseRestoreDetailsUnrestorableFileProperties { + /* + * File name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** Creates an instance of ManagedDatabaseRestoreDetailsUnrestorableFileProperties class. */ + public ManagedDatabaseRestoreDetailsUnrestorableFileProperties() { + } + + /** + * Get the name property: File name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseSchemas.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseSchemas.java new file mode 100644 index 0000000000000..47fb0a9a00c11 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseSchemas.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ManagedDatabaseSchemas. */ +public interface ManagedDatabaseSchemas { + /** + * List managed 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database schemas as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName); + + /** + * List managed 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param filter An OData filter expression that filters elements in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database schemas as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName, String filter, Context context); + + /** + * Get managed 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return managed database schema along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String managedInstanceName, String databaseName, String schemaName, Context context); + + /** + * Get managed 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 managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return managed database schema. + */ + DatabaseSchema get(String resourceGroupName, String managedInstanceName, String databaseName, String schemaName); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseSecurityAlertPolicies.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseSecurityAlertPolicies.java new file mode 100644 index 0000000000000..3a55bab87e566 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseSecurityAlertPolicies.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ManagedDatabaseSecurityAlertPolicies. */ +public interface ManagedDatabaseSecurityAlertPolicies { + /** + * 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 securityAlertPolicyName The name of the security alert policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's security alert policy along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName, + Context context); + + /** + * 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 securityAlertPolicyName The name of the security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's security alert policy. + */ + ManagedDatabaseSecurityAlertPolicy get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + SecurityAlertPolicyName securityAlertPolicyName); + + /** + * Gets a list of managed database's security alert policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policies are defined. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed database's security alert policies as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName); + + /** + * Gets a list of managed database's security alert policies. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policies are defined. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed database's security alert policies as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName, Context context); + + /** + * Gets a managed database's security alert policy. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's security alert policy along with {@link Response}. + */ + ManagedDatabaseSecurityAlertPolicy getById(String id); + + /** + * Gets a managed database's security alert policy. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's security alert policy along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ManagedDatabaseSecurityAlertPolicy resource. + * + * @param name resource name. + * @return the first stage of the new ManagedDatabaseSecurityAlertPolicy definition. + */ + ManagedDatabaseSecurityAlertPolicy.DefinitionStages.Blank define(SecurityAlertPolicyName name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseSecurityAlertPolicy.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseSecurityAlertPolicy.java new file mode 100644 index 0000000000000..7df90a4c5cad3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseSecurityAlertPolicy.java @@ -0,0 +1,376 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedDatabaseSecurityAlertPolicyInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of ManagedDatabaseSecurityAlertPolicy. */ +public interface ManagedDatabaseSecurityAlertPolicy { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the state property: Specifies the state of the policy, whether it is enabled or disabled or a policy has not + * been applied yet on the specific database. + * + * @return the state value. + */ + SecurityAlertPolicyState state(); + + /** + * Gets the disabledAlerts property: Specifies an array of alerts that are disabled. Allowed values are: + * Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action, Brute_Force. + * + * @return the disabledAlerts value. + */ + List disabledAlerts(); + + /** + * Gets the emailAddresses property: Specifies an array of e-mail addresses to which the alert is sent. + * + * @return the emailAddresses value. + */ + List emailAddresses(); + + /** + * Gets the emailAccountAdmins property: Specifies that the alert is sent to the account administrators. + * + * @return the emailAccountAdmins value. + */ + Boolean emailAccountAdmins(); + + /** + * Gets the storageEndpoint property: 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. + */ + String storageEndpoint(); + + /** + * Gets the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection audit storage + * account. + * + * @return the storageAccountAccessKey value. + */ + String storageAccountAccessKey(); + + /** + * Gets the retentionDays property: Specifies the number of days to keep in the Threat Detection audit logs. + * + * @return the retentionDays value. + */ + Integer retentionDays(); + + /** + * Gets the creationTime property: Specifies the UTC creation time of the policy. + * + * @return the creationTime value. + */ + OffsetDateTime creationTime(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ManagedDatabaseSecurityAlertPolicyInner + * object. + * + * @return the inner object. + */ + ManagedDatabaseSecurityAlertPolicyInner innerModel(); + + /** The entirety of the ManagedDatabaseSecurityAlertPolicy definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ManagedDatabaseSecurityAlertPolicy definition stages. */ + interface DefinitionStages { + /** The first stage of the ManagedDatabaseSecurityAlertPolicy definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ManagedDatabaseSecurityAlertPolicy definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, managedInstanceName, databaseName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policy is defined. + * @return the next definition stage. + */ + WithCreate withExistingDatabase(String resourceGroupName, String managedInstanceName, String databaseName); + } + /** + * The stage of the ManagedDatabaseSecurityAlertPolicy definition which contains all the minimum required + * properties for the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithState, + DefinitionStages.WithDisabledAlerts, + DefinitionStages.WithEmailAddresses, + DefinitionStages.WithEmailAccountAdmins, + DefinitionStages.WithStorageEndpoint, + DefinitionStages.WithStorageAccountAccessKey, + DefinitionStages.WithRetentionDays { + /** + * Executes the create request. + * + * @return the created resource. + */ + ManagedDatabaseSecurityAlertPolicy create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ManagedDatabaseSecurityAlertPolicy create(Context context); + } + /** The stage of the ManagedDatabaseSecurityAlertPolicy definition allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the policy, whether it is enabled or disabled or a + * policy has not been applied yet on the specific database.. + * + * @param state Specifies the state of the policy, whether it is enabled or disabled or a policy has not + * been applied yet on the specific database. + * @return the next definition stage. + */ + WithCreate withState(SecurityAlertPolicyState state); + } + /** The stage of the ManagedDatabaseSecurityAlertPolicy definition allowing to specify disabledAlerts. */ + interface WithDisabledAlerts { + /** + * Specifies the disabledAlerts property: Specifies an array of alerts that are disabled. Allowed values + * are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action, + * Brute_Force. + * + * @param disabledAlerts Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, + * Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action, Brute_Force. + * @return the next definition stage. + */ + WithCreate withDisabledAlerts(List disabledAlerts); + } + /** The stage of the ManagedDatabaseSecurityAlertPolicy definition allowing to specify emailAddresses. */ + interface WithEmailAddresses { + /** + * Specifies the emailAddresses property: Specifies an array of e-mail addresses to which the alert is + * sent.. + * + * @param emailAddresses Specifies an array of e-mail addresses to which the alert is sent. + * @return the next definition stage. + */ + WithCreate withEmailAddresses(List emailAddresses); + } + /** The stage of the ManagedDatabaseSecurityAlertPolicy definition allowing to specify emailAccountAdmins. */ + interface WithEmailAccountAdmins { + /** + * Specifies the emailAccountAdmins property: Specifies that the alert is sent to the account + * administrators.. + * + * @param emailAccountAdmins Specifies that the alert is sent to the account administrators. + * @return the next definition stage. + */ + WithCreate withEmailAccountAdmins(Boolean emailAccountAdmins); + } + /** The stage of the ManagedDatabaseSecurityAlertPolicy definition allowing to specify storageEndpoint. */ + interface WithStorageEndpoint { + /** + * Specifies the storageEndpoint property: 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 Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit + * logs. + * @return the next definition stage. + */ + WithCreate withStorageEndpoint(String storageEndpoint); + } + /** + * The stage of the ManagedDatabaseSecurityAlertPolicy definition allowing to specify storageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection + * audit storage account.. + * + * @param storageAccountAccessKey Specifies the identifier key of the Threat Detection audit storage + * account. + * @return the next definition stage. + */ + WithCreate withStorageAccountAccessKey(String storageAccountAccessKey); + } + /** The stage of the ManagedDatabaseSecurityAlertPolicy definition allowing to specify retentionDays. */ + interface WithRetentionDays { + /** + * Specifies the retentionDays property: Specifies the number of days to keep in the Threat Detection audit + * logs.. + * + * @param retentionDays Specifies the number of days to keep in the Threat Detection audit logs. + * @return the next definition stage. + */ + WithCreate withRetentionDays(Integer retentionDays); + } + } + /** + * Begins update for the ManagedDatabaseSecurityAlertPolicy resource. + * + * @return the stage of resource update. + */ + ManagedDatabaseSecurityAlertPolicy.Update update(); + + /** The template for ManagedDatabaseSecurityAlertPolicy update. */ + interface Update + extends UpdateStages.WithState, + UpdateStages.WithDisabledAlerts, + UpdateStages.WithEmailAddresses, + UpdateStages.WithEmailAccountAdmins, + UpdateStages.WithStorageEndpoint, + UpdateStages.WithStorageAccountAccessKey, + UpdateStages.WithRetentionDays { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ManagedDatabaseSecurityAlertPolicy apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ManagedDatabaseSecurityAlertPolicy apply(Context context); + } + /** The ManagedDatabaseSecurityAlertPolicy update stages. */ + interface UpdateStages { + /** The stage of the ManagedDatabaseSecurityAlertPolicy update allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the policy, whether it is enabled or disabled or a + * policy has not been applied yet on the specific database.. + * + * @param state Specifies the state of the policy, whether it is enabled or disabled or a policy has not + * been applied yet on the specific database. + * @return the next definition stage. + */ + Update withState(SecurityAlertPolicyState state); + } + /** The stage of the ManagedDatabaseSecurityAlertPolicy update allowing to specify disabledAlerts. */ + interface WithDisabledAlerts { + /** + * Specifies the disabledAlerts property: Specifies an array of alerts that are disabled. Allowed values + * are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action, + * Brute_Force. + * + * @param disabledAlerts Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, + * Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action, Brute_Force. + * @return the next definition stage. + */ + Update withDisabledAlerts(List disabledAlerts); + } + /** The stage of the ManagedDatabaseSecurityAlertPolicy update allowing to specify emailAddresses. */ + interface WithEmailAddresses { + /** + * Specifies the emailAddresses property: Specifies an array of e-mail addresses to which the alert is + * sent.. + * + * @param emailAddresses Specifies an array of e-mail addresses to which the alert is sent. + * @return the next definition stage. + */ + Update withEmailAddresses(List emailAddresses); + } + /** The stage of the ManagedDatabaseSecurityAlertPolicy update allowing to specify emailAccountAdmins. */ + interface WithEmailAccountAdmins { + /** + * Specifies the emailAccountAdmins property: Specifies that the alert is sent to the account + * administrators.. + * + * @param emailAccountAdmins Specifies that the alert is sent to the account administrators. + * @return the next definition stage. + */ + Update withEmailAccountAdmins(Boolean emailAccountAdmins); + } + /** The stage of the ManagedDatabaseSecurityAlertPolicy update allowing to specify storageEndpoint. */ + interface WithStorageEndpoint { + /** + * Specifies the storageEndpoint property: 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 Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit + * logs. + * @return the next definition stage. + */ + Update withStorageEndpoint(String storageEndpoint); + } + /** The stage of the ManagedDatabaseSecurityAlertPolicy update allowing to specify storageAccountAccessKey. */ + interface WithStorageAccountAccessKey { + /** + * Specifies the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection + * audit storage account.. + * + * @param storageAccountAccessKey Specifies the identifier key of the Threat Detection audit storage + * account. + * @return the next definition stage. + */ + Update withStorageAccountAccessKey(String storageAccountAccessKey); + } + /** The stage of the ManagedDatabaseSecurityAlertPolicy update allowing to specify retentionDays. */ + interface WithRetentionDays { + /** + * Specifies the retentionDays property: Specifies the number of days to keep in the Threat Detection audit + * logs.. + * + * @param retentionDays Specifies the number of days to keep in the Threat Detection audit logs. + * @return the next definition stage. + */ + Update withRetentionDays(Integer retentionDays); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ManagedDatabaseSecurityAlertPolicy refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ManagedDatabaseSecurityAlertPolicy refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseSecurityAlertPolicyListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseSecurityAlertPolicyListResult.java new file mode 100644 index 0000000000000..305929bda832f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseSecurityAlertPolicyListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedDatabaseSecurityAlertPolicyInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of the managed database's security alert policies. */ +@Immutable +public final class ManagedDatabaseSecurityAlertPolicyListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of ManagedDatabaseSecurityAlertPolicyListResult class. */ + public ManagedDatabaseSecurityAlertPolicyListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseSecurityEvents.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseSecurityEvents.java new file mode 100644 index 0000000000000..4499fda056afe --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseSecurityEvents.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of ManagedDatabaseSecurityEvents. */ +public interface ManagedDatabaseSecurityEvents { + /** + * Gets a list of security events. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 events are retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of security events as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName); + + /** + * Gets a list of security events. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 events are retrieved. + * @param filter An OData filter expression that filters elements in the collection. + * @param skip The number of elements in the collection to skip. + * @param top The number of elements to return from the collection. + * @param skiptoken An opaque token that identifies a starting point in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of security events as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String filter, + Integer skip, + Integer top, + String skiptoken, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseSensitivityLabels.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseSensitivityLabels.java new file mode 100644 index 0000000000000..f1b5664021bce --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseSensitivityLabels.java @@ -0,0 +1,353 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ManagedDatabaseSensitivityLabels. */ +public interface ManagedDatabaseSensitivityLabels { + /** + * Gets the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param sensitivityLabelSource The source of the sensitivity label. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity label of a given column along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelSource sensitivityLabelSource, + Context context); + + /** + * Gets the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param sensitivityLabelSource The source of the sensitivity label. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity label of a given column. + */ + SensitivityLabel get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelSource sensitivityLabelSource); + + /** + * Deletes the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context); + + /** + * Deletes the sensitivity label of a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName); + + /** + * Disables sensitivity recommendations on a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response disableRecommendationWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context); + + /** + * Disables sensitivity recommendations on a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void disableRecommendation( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName); + + /** + * Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response enableRecommendationWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context); + + /** + * Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void enableRecommendation( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName); + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity labels of a given database as paginated response with {@link PagedIterable}. + */ + PagedIterable listCurrentByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName); + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param skipToken The skipToken parameter. + * @param count The count parameter. + * @param filter An OData filter expression that filters elements in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity labels of a given database as paginated response with {@link PagedIterable}. + */ + PagedIterable listCurrentByDatabase( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String skipToken, + Boolean count, + String filter, + Context context); + + /** + * Update sensitivity labels of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of sensitivity label update operations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response updateWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + SensitivityLabelUpdateList parameters, + Context context); + + /** + * Update sensitivity labels of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of sensitivity label update operations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void update( + String resourceGroupName, + String managedInstanceName, + String databaseName, + SensitivityLabelUpdateList parameters); + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity labels of a given database as paginated response with {@link PagedIterable}. + */ + PagedIterable listRecommendedByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName); + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param skipToken The skipToken parameter. + * @param includeDisabledRecommendations Specifies whether to include disabled recommendations or not. + * @param filter An OData filter expression that filters elements in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity labels of a given database as paginated response with {@link PagedIterable}. + */ + PagedIterable listRecommendedByDatabase( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String skipToken, + Boolean includeDisabledRecommendations, + String filter, + Context context); + + /** + * Deletes the sensitivity label of a given column. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes the sensitivity label of a given column. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new SensitivityLabel resource. + * + * @return the first stage of the new SensitivityLabel definition. + */ + SensitivityLabel.DefinitionStages.Blank define(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseStartMoveDefinition.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseStartMoveDefinition.java new file mode 100644 index 0000000000000..644bf1b04b981 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseStartMoveDefinition.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Contains the information necessary to start a managed database move. */ +@Fluent +public final class ManagedDatabaseStartMoveDefinition { + /* + * The destination managed database ID + */ + @JsonProperty(value = "destinationManagedDatabaseId", required = true) + private String destinationManagedDatabaseId; + + /* + * The move operation mode. + */ + @JsonProperty(value = "operationMode") + private MoveOperationMode operationMode; + + /** Creates an instance of ManagedDatabaseStartMoveDefinition class. */ + public ManagedDatabaseStartMoveDefinition() { + } + + /** + * Get the destinationManagedDatabaseId property: The destination managed database ID. + * + * @return the destinationManagedDatabaseId value. + */ + public String destinationManagedDatabaseId() { + return this.destinationManagedDatabaseId; + } + + /** + * Set the destinationManagedDatabaseId property: The destination managed database ID. + * + * @param destinationManagedDatabaseId the destinationManagedDatabaseId value to set. + * @return the ManagedDatabaseStartMoveDefinition object itself. + */ + public ManagedDatabaseStartMoveDefinition withDestinationManagedDatabaseId(String destinationManagedDatabaseId) { + this.destinationManagedDatabaseId = destinationManagedDatabaseId; + return this; + } + + /** + * Get the operationMode property: The move operation mode. + * + * @return the operationMode value. + */ + public MoveOperationMode operationMode() { + return this.operationMode; + } + + /** + * Set the operationMode property: The move operation mode. + * + * @param operationMode the operationMode value to set. + * @return the ManagedDatabaseStartMoveDefinition object itself. + */ + public ManagedDatabaseStartMoveDefinition withOperationMode(MoveOperationMode operationMode) { + this.operationMode = operationMode; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (destinationManagedDatabaseId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property destinationManagedDatabaseId in model" + + " ManagedDatabaseStartMoveDefinition")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ManagedDatabaseStartMoveDefinition.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseStatus.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseStatus.java new file mode 100644 index 0000000000000..3d07eb5ba594f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseStatus.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Status of the database. */ +public final class ManagedDatabaseStatus extends ExpandableStringEnum { + /** Static value Online for ManagedDatabaseStatus. */ + public static final ManagedDatabaseStatus ONLINE = fromString("Online"); + + /** Static value Offline for ManagedDatabaseStatus. */ + public static final ManagedDatabaseStatus OFFLINE = fromString("Offline"); + + /** Static value Shutdown for ManagedDatabaseStatus. */ + public static final ManagedDatabaseStatus SHUTDOWN = fromString("Shutdown"); + + /** Static value Creating for ManagedDatabaseStatus. */ + public static final ManagedDatabaseStatus CREATING = fromString("Creating"); + + /** Static value Inaccessible for ManagedDatabaseStatus. */ + public static final ManagedDatabaseStatus INACCESSIBLE = fromString("Inaccessible"); + + /** Static value Restoring for ManagedDatabaseStatus. */ + public static final ManagedDatabaseStatus RESTORING = fromString("Restoring"); + + /** Static value Updating for ManagedDatabaseStatus. */ + public static final ManagedDatabaseStatus UPDATING = fromString("Updating"); + + /** + * Creates or finds a ManagedDatabaseStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagedDatabaseStatus. + */ + @JsonCreator + public static ManagedDatabaseStatus fromString(String name) { + return fromString(name, ManagedDatabaseStatus.class); + } + + /** + * Gets known ManagedDatabaseStatus values. + * + * @return known ManagedDatabaseStatus values. + */ + public static Collection values() { + return values(ManagedDatabaseStatus.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseTables.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseTables.java new file mode 100644 index 0000000000000..e7f84e3a2622a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseTables.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ManagedDatabaseTables. */ +public interface ManagedDatabaseTables { + /** + * List managed database tables. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database tables as paginated response with {@link PagedIterable}. + */ + PagedIterable listBySchema( + String resourceGroupName, String managedInstanceName, String databaseName, String schemaName); + + /** + * List managed database tables. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param filter An OData filter expression that filters elements in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database tables as paginated response with {@link PagedIterable}. + */ + PagedIterable listBySchema( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String filter, + Context context); + + /** + * Get managed database table. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return managed database table along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + Context context); + + /** + * Get managed database table. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return managed database table. + */ + DatabaseTable get( + String resourceGroupName, String managedInstanceName, String databaseName, String schemaName, String tableName); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseTransparentDataEncryptions.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseTransparentDataEncryptions.java new file mode 100644 index 0000000000000..15503fdaa1bda --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseTransparentDataEncryptions.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ManagedDatabaseTransparentDataEncryptions. */ +public interface ManagedDatabaseTransparentDataEncryptions { + /** + * Gets a managed database's transparent data encryption. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 transparent data encryption is defined. + * @param tdeName The name of the transparent data encryption configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's transparent data encryption along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + TransparentDataEncryptionName tdeName, + Context context); + + /** + * Gets a managed database's transparent data encryption. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 transparent data encryption is defined. + * @param tdeName The name of the transparent data encryption configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's transparent data encryption. + */ + ManagedTransparentDataEncryption get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + TransparentDataEncryptionName tdeName); + + /** + * Gets a list of managed database's transparent data encryptions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 transparent data encryption is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed database's transparent data encryptions as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName); + + /** + * Gets a list of managed database's transparent data encryptions. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 transparent data encryption is defined. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed database's transparent data encryptions as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName, Context context); + + /** + * Gets a managed database's transparent data encryption. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's transparent data encryption along with {@link Response}. + */ + ManagedTransparentDataEncryption getById(String id); + + /** + * Gets a managed database's transparent data encryption. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's transparent data encryption along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ManagedTransparentDataEncryption resource. + * + * @param name resource name. + * @return the first stage of the new ManagedTransparentDataEncryption definition. + */ + ManagedTransparentDataEncryption.DefinitionStages.Blank define(TransparentDataEncryptionName name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseUpdate.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseUpdate.java new file mode 100644 index 0000000000000..8cb472cde748d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseUpdate.java @@ -0,0 +1,452 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedDatabaseProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.Map; + +/** An managed database update. */ +@Fluent +public final class ManagedDatabaseUpdate { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ManagedDatabaseProperties innerProperties; + + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** Creates an instance of ManagedDatabaseUpdate class. */ + public ManagedDatabaseUpdate() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ManagedDatabaseProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the ManagedDatabaseUpdate object itself. + */ + public ManagedDatabaseUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the collation property: Collation of the managed database. + * + * @return the collation value. + */ + public String collation() { + return this.innerProperties() == null ? null : this.innerProperties().collation(); + } + + /** + * Set the collation property: Collation of the managed database. + * + * @param collation the collation value to set. + * @return the ManagedDatabaseUpdate object itself. + */ + public ManagedDatabaseUpdate withCollation(String collation) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedDatabaseProperties(); + } + this.innerProperties().withCollation(collation); + return this; + } + + /** + * Get the status property: Status of the database. + * + * @return the status value. + */ + public ManagedDatabaseStatus status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); + } + + /** + * Get the creationDate property: Creation date of the database. + * + * @return the creationDate value. + */ + public OffsetDateTime creationDate() { + return this.innerProperties() == null ? null : this.innerProperties().creationDate(); + } + + /** + * Get the earliestRestorePoint property: Earliest restore point in time for point in time restore. + * + * @return the earliestRestorePoint value. + */ + public OffsetDateTime earliestRestorePoint() { + return this.innerProperties() == null ? null : this.innerProperties().earliestRestorePoint(); + } + + /** + * Get the restorePointInTime property: Conditional. If createMode is PointInTimeRestore, this value is required. + * Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new + * database. + * + * @return the restorePointInTime value. + */ + public OffsetDateTime restorePointInTime() { + return this.innerProperties() == null ? null : this.innerProperties().restorePointInTime(); + } + + /** + * Set the restorePointInTime property: Conditional. If createMode is PointInTimeRestore, this value is required. + * Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new + * database. + * + * @param restorePointInTime the restorePointInTime value to set. + * @return the ManagedDatabaseUpdate object itself. + */ + public ManagedDatabaseUpdate withRestorePointInTime(OffsetDateTime restorePointInTime) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedDatabaseProperties(); + } + this.innerProperties().withRestorePointInTime(restorePointInTime); + return this; + } + + /** + * Get the defaultSecondaryLocation property: Geo paired region. + * + * @return the defaultSecondaryLocation value. + */ + public String defaultSecondaryLocation() { + return this.innerProperties() == null ? null : this.innerProperties().defaultSecondaryLocation(); + } + + /** + * Get the catalogCollation property: Collation of the metadata catalog. + * + * @return the catalogCollation value. + */ + public CatalogCollationType catalogCollation() { + return this.innerProperties() == null ? null : this.innerProperties().catalogCollation(); + } + + /** + * Set the catalogCollation property: Collation of the metadata catalog. + * + * @param catalogCollation the catalogCollation value to set. + * @return the ManagedDatabaseUpdate object itself. + */ + public ManagedDatabaseUpdate withCatalogCollation(CatalogCollationType catalogCollation) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedDatabaseProperties(); + } + this.innerProperties().withCatalogCollation(catalogCollation); + return this; + } + + /** + * Get the createMode property: 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. RestoreLongTermRetentionBackup: Create a database by restoring from a long term retention backup + * (longTermRetentionBackupResourceId required). + * + * @return the createMode value. + */ + public ManagedDatabaseCreateMode createMode() { + return this.innerProperties() == null ? null : this.innerProperties().createMode(); + } + + /** + * Set the createMode property: 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. RestoreLongTermRetentionBackup: Create a database by restoring from a long term retention backup + * (longTermRetentionBackupResourceId required). + * + * @param createMode the createMode value to set. + * @return the ManagedDatabaseUpdate object itself. + */ + public ManagedDatabaseUpdate withCreateMode(ManagedDatabaseCreateMode createMode) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedDatabaseProperties(); + } + this.innerProperties().withCreateMode(createMode); + return this; + } + + /** + * Get the storageContainerUri property: 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.innerProperties() == null ? null : this.innerProperties().storageContainerUri(); + } + + /** + * Set the storageContainerUri property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedDatabaseProperties(); + } + this.innerProperties().withStorageContainerUri(storageContainerUri); + return this; + } + + /** + * Get the sourceDatabaseId property: The resource identifier of the source database associated with create + * operation of this database. + * + * @return the sourceDatabaseId value. + */ + public String sourceDatabaseId() { + return this.innerProperties() == null ? null : this.innerProperties().sourceDatabaseId(); + } + + /** + * Set the sourceDatabaseId property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedDatabaseProperties(); + } + this.innerProperties().withSourceDatabaseId(sourceDatabaseId); + return this; + } + + /** + * Get the restorableDroppedDatabaseId property: The restorable dropped database resource id to restore when + * creating this database. + * + * @return the restorableDroppedDatabaseId value. + */ + public String restorableDroppedDatabaseId() { + return this.innerProperties() == null ? null : this.innerProperties().restorableDroppedDatabaseId(); + } + + /** + * Set the restorableDroppedDatabaseId property: The restorable dropped database resource id to restore when + * creating this database. + * + * @param restorableDroppedDatabaseId the restorableDroppedDatabaseId value to set. + * @return the ManagedDatabaseUpdate object itself. + */ + public ManagedDatabaseUpdate withRestorableDroppedDatabaseId(String restorableDroppedDatabaseId) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedDatabaseProperties(); + } + this.innerProperties().withRestorableDroppedDatabaseId(restorableDroppedDatabaseId); + return this; + } + + /** + * Get the storageContainerIdentity property: Conditional. If createMode is RestoreExternalBackup, this value is + * used. Specifies the identity used for storage container authentication. Can be 'SharedAccessSignature' or + * 'ManagedIdentity'; if not specified 'SharedAccessSignature' is assumed. + * + * @return the storageContainerIdentity value. + */ + public String storageContainerIdentity() { + return this.innerProperties() == null ? null : this.innerProperties().storageContainerIdentity(); + } + + /** + * Set the storageContainerIdentity property: Conditional. If createMode is RestoreExternalBackup, this value is + * used. Specifies the identity used for storage container authentication. Can be 'SharedAccessSignature' or + * 'ManagedIdentity'; if not specified 'SharedAccessSignature' is assumed. + * + * @param storageContainerIdentity the storageContainerIdentity value to set. + * @return the ManagedDatabaseUpdate object itself. + */ + public ManagedDatabaseUpdate withStorageContainerIdentity(String storageContainerIdentity) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedDatabaseProperties(); + } + this.innerProperties().withStorageContainerIdentity(storageContainerIdentity); + return this; + } + + /** + * Get the storageContainerSasToken property: Conditional. If createMode is RestoreExternalBackup and + * storageContainerIdentity is not ManagedIdentity, this value is required. Specifies the storage container sas + * token. + * + * @return the storageContainerSasToken value. + */ + public String storageContainerSasToken() { + return this.innerProperties() == null ? null : this.innerProperties().storageContainerSasToken(); + } + + /** + * Set the storageContainerSasToken property: Conditional. If createMode is RestoreExternalBackup and + * storageContainerIdentity is not ManagedIdentity, 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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedDatabaseProperties(); + } + this.innerProperties().withStorageContainerSasToken(storageContainerSasToken); + return this; + } + + /** + * Get the failoverGroupId property: Instance Failover Group resource identifier that this managed database belongs + * to. + * + * @return the failoverGroupId value. + */ + public String failoverGroupId() { + return this.innerProperties() == null ? null : this.innerProperties().failoverGroupId(); + } + + /** + * Get the recoverableDatabaseId property: The resource identifier of the recoverable database associated with + * create operation of this database. + * + * @return the recoverableDatabaseId value. + */ + public String recoverableDatabaseId() { + return this.innerProperties() == null ? null : this.innerProperties().recoverableDatabaseId(); + } + + /** + * Set the recoverableDatabaseId property: The resource identifier of the recoverable database associated with + * create operation of this database. + * + * @param recoverableDatabaseId the recoverableDatabaseId value to set. + * @return the ManagedDatabaseUpdate object itself. + */ + public ManagedDatabaseUpdate withRecoverableDatabaseId(String recoverableDatabaseId) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedDatabaseProperties(); + } + this.innerProperties().withRecoverableDatabaseId(recoverableDatabaseId); + return this; + } + + /** + * Get the longTermRetentionBackupResourceId property: The name of the Long Term Retention backup to be used for + * restore of this managed database. + * + * @return the longTermRetentionBackupResourceId value. + */ + public String longTermRetentionBackupResourceId() { + return this.innerProperties() == null ? null : this.innerProperties().longTermRetentionBackupResourceId(); + } + + /** + * Set the longTermRetentionBackupResourceId property: The name of the Long Term Retention backup to be used for + * restore of this managed database. + * + * @param longTermRetentionBackupResourceId the longTermRetentionBackupResourceId value to set. + * @return the ManagedDatabaseUpdate object itself. + */ + public ManagedDatabaseUpdate withLongTermRetentionBackupResourceId(String longTermRetentionBackupResourceId) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedDatabaseProperties(); + } + this.innerProperties().withLongTermRetentionBackupResourceId(longTermRetentionBackupResourceId); + return this; + } + + /** + * Get the autoCompleteRestore property: Whether to auto complete restore of this managed database. + * + * @return the autoCompleteRestore value. + */ + public Boolean autoCompleteRestore() { + return this.innerProperties() == null ? null : this.innerProperties().autoCompleteRestore(); + } + + /** + * Set the autoCompleteRestore property: Whether to auto complete restore of this managed database. + * + * @param autoCompleteRestore the autoCompleteRestore value to set. + * @return the ManagedDatabaseUpdate object itself. + */ + public ManagedDatabaseUpdate withAutoCompleteRestore(Boolean autoCompleteRestore) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedDatabaseProperties(); + } + this.innerProperties().withAutoCompleteRestore(autoCompleteRestore); + return this; + } + + /** + * Get the lastBackupName property: Last backup file name for restore of this managed database. + * + * @return the lastBackupName value. + */ + public String lastBackupName() { + return this.innerProperties() == null ? null : this.innerProperties().lastBackupName(); + } + + /** + * Set the lastBackupName property: Last backup file name for restore of this managed database. + * + * @param lastBackupName the lastBackupName value to set. + * @return the ManagedDatabaseUpdate object itself. + */ + public ManagedDatabaseUpdate withLastBackupName(String lastBackupName) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedDatabaseProperties(); + } + this.innerProperties().withLastBackupName(lastBackupName); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseVulnerabilityAssessmentRuleBaselines.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseVulnerabilityAssessmentRuleBaselines.java new file mode 100644 index 0000000000000..4a90362027448 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseVulnerabilityAssessmentRuleBaselines.java @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentRuleBaselineInner; + +/** Resource collection API of ManagedDatabaseVulnerabilityAssessmentRuleBaselines. */ +public interface ManagedDatabaseVulnerabilityAssessmentRuleBaselines { + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's vulnerability assessment rule baseline along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's vulnerability assessment rule baseline. + */ + DatabaseVulnerabilityAssessmentRuleBaseline get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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). + * @param parameters The requested rule baseline resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database vulnerability assessment rule baseline along with {@link Response}. + */ + Response createOrUpdateWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + DatabaseVulnerabilityAssessmentRuleBaselineInner parameters, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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). + * @param parameters The requested rule baseline resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database vulnerability assessment rule baseline. + */ + DatabaseVulnerabilityAssessmentRuleBaseline createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + DatabaseVulnerabilityAssessmentRuleBaselineInner parameters); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @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). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String ruleId, + VulnerabilityAssessmentPolicyBaselineName baselineName); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseVulnerabilityAssessmentScans.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseVulnerabilityAssessmentScans.java new file mode 100644 index 0000000000000..039a9caf693c0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseVulnerabilityAssessmentScans.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ManagedDatabaseVulnerabilityAssessmentScans. */ +public interface ManagedDatabaseVulnerabilityAssessmentScans { + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void initiateScan( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void initiateScan( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database Vulnerability Assessment scan export resource along with {@link Response}. + */ + Response exportWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database Vulnerability Assessment scan export resource. + */ + DatabaseVulnerabilityAssessmentScansExport export( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + 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. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan records as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan records as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a vulnerability assessment scan record of a database along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The vulnerability assessment scan Id of the scan to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a vulnerability assessment scan record of a database. + */ + VulnerabilityAssessmentScanRecord get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseVulnerabilityAssessments.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseVulnerabilityAssessments.java new file mode 100644 index 0000000000000..7d42e2423b32d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabaseVulnerabilityAssessments.java @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentInner; + +/** Resource collection API of ManagedDatabaseVulnerabilityAssessments. */ +public interface ManagedDatabaseVulnerabilityAssessments { + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the database's vulnerability assessment along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the database's vulnerability assessment. + */ + DatabaseVulnerabilityAssessment get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database vulnerability assessment along with {@link Response}. + */ + Response createOrUpdateWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + DatabaseVulnerabilityAssessmentInner parameters, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param parameters The requested resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database vulnerability assessment. + */ + DatabaseVulnerabilityAssessment createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + DatabaseVulnerabilityAssessmentInner parameters); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete( + String resourceGroupName, + String managedInstanceName, + String databaseName, + VulnerabilityAssessmentName vulnerabilityAssessmentName); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the database's vulnerability assessments as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the database's vulnerability assessments as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabases.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabases.java new file mode 100644 index 0000000000000..56ee311cf19fa --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedDatabases.java @@ -0,0 +1,331 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ManagedDatabases. */ +public interface ManagedDatabases { + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed databases as paginated response with {@link PagedIterable}. + */ + PagedIterable listByInstance(String resourceGroupName, String managedInstanceName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed databases as paginated response with {@link PagedIterable}. + */ + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String managedInstanceName, String databaseName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database. + */ + ManagedDatabase get(String resourceGroupName, String managedInstanceName, String databaseName); + + /** + * Deletes a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String managedInstanceName, String databaseName); + + /** + * Deletes a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String managedInstanceName, String databaseName, Context context); + + /** + * Cancels a managed database move operation. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 Parameters of the cancel managed database move operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void cancelMove( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseMoveDefinition parameters); + + /** + * Cancels a managed database move operation. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 Parameters of the cancel managed database move operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void cancelMove( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseMoveDefinition parameters, + Context context); + + /** + * Completes a managed database move operation. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 Parameters of the complete managed database move operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void completeMove( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseMoveDefinition parameters); + + /** + * Completes a managed database move operation. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 Parameters of the complete managed database move operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void completeMove( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseMoveDefinition parameters, + Context context); + + /** + * Completes the restore operation on a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The definition for completing the restore of this managed database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void completeRestore( + String resourceGroupName, + String managedInstanceName, + String databaseName, + CompleteDatabaseRestoreDefinition parameters); + + /** + * Completes the restore operation on a managed database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param parameters The definition for completing the restore of this managed database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void completeRestore( + String resourceGroupName, + String managedInstanceName, + String databaseName, + CompleteDatabaseRestoreDefinition parameters, + Context context); + + /** + * Starts a managed database move operation. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 Parameters of the start managed database move operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void startMove( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseStartMoveDefinition parameters); + + /** + * Starts a managed database move operation. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 Parameters of the start managed database move operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void startMove( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedDatabaseStartMoveDefinition parameters, + Context context); + + /** + * Gets a list of inaccessible managed databases in 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of inaccessible managed databases in a managed instance as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listInaccessibleByInstance(String resourceGroupName, String managedInstanceName); + + /** + * Gets a list of inaccessible managed databases in 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of inaccessible managed databases in a managed instance as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listInaccessibleByInstance( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * Gets a managed database. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database along with {@link Response}. + */ + ManagedDatabase getById(String id); + + /** + * Gets a managed database. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a managed database. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a managed database. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ManagedDatabase resource. + * + * @param name resource name. + * @return the first stage of the new ManagedDatabase definition. + */ + ManagedDatabase.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstance.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstance.java new file mode 100644 index 0000000000000..b03d3b05adb65 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstance.java @@ -0,0 +1,956 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceInner; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of ManagedInstance. */ +public interface ManagedInstance { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the identity property: The Azure Active Directory identity of the managed instance. + * + * @return the identity value. + */ + ResourceIdentity identity(); + + /** + * Gets the sku property: Managed instance SKU. Allowed values for sku.name: GP_Gen4, GP_Gen5, BC_Gen4, BC_Gen5. + * + * @return the sku value. + */ + Sku sku(); + + /** + * Gets the provisioningState property: The provisioningState property. + * + * @return the provisioningState value. + */ + ManagedInstancePropertiesProvisioningState provisioningState(); + + /** + * Gets the managedInstanceCreateMode property: Specifies the mode of database creation. + * + *

Default: Regular instance creation. + * + *

Restore: Creates an instance by restoring a set of backups to specific point in time. RestorePointInTime and + * SourceManagedInstanceId must be specified. + * + * @return the managedInstanceCreateMode value. + */ + ManagedServerCreateMode managedInstanceCreateMode(); + + /** + * Gets the fullyQualifiedDomainName property: The fully qualified domain name of the managed instance. + * + * @return the fullyQualifiedDomainName value. + */ + String fullyQualifiedDomainName(); + + /** + * Gets the administratorLogin property: 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. + */ + String administratorLogin(); + + /** + * Gets the administratorLoginPassword property: The administrator login password (required for managed instance + * creation). + * + * @return the administratorLoginPassword value. + */ + String administratorLoginPassword(); + + /** + * Gets the subnetId property: Subnet resource ID for the managed instance. + * + * @return the subnetId value. + */ + String subnetId(); + + /** + * Gets the state property: The state of the managed instance. + * + * @return the state value. + */ + String state(); + + /** + * Gets the licenseType property: The license type. Possible values are 'LicenseIncluded' (regular price inclusive + * of a new SQL license) and 'BasePrice' (discounted AHB price for bringing your own SQL licenses). + * + * @return the licenseType value. + */ + ManagedInstanceLicenseType licenseType(); + + /** + * Gets the vCores property: The number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80. + * + * @return the vCores value. + */ + Integer vCores(); + + /** + * Gets the storageSizeInGB property: Storage size in GB. Minimum value: 32. Maximum value: 8192. Increments of 32 + * GB allowed only. + * + * @return the storageSizeInGB value. + */ + Integer storageSizeInGB(); + + /** + * Gets the collation property: Collation of the managed instance. + * + * @return the collation value. + */ + String collation(); + + /** + * Gets the dnsZone property: The Dns Zone that the managed instance is in. + * + * @return the dnsZone value. + */ + String dnsZone(); + + /** + * Gets the dnsZonePartner property: The resource id of another managed instance whose DNS zone this managed + * instance will share after creation. + * + * @return the dnsZonePartner value. + */ + String dnsZonePartner(); + + /** + * Gets the publicDataEndpointEnabled property: Whether or not the public data endpoint is enabled. + * + * @return the publicDataEndpointEnabled value. + */ + Boolean publicDataEndpointEnabled(); + + /** + * Gets the sourceManagedInstanceId property: The resource identifier of the source managed instance associated with + * create operation of this instance. + * + * @return the sourceManagedInstanceId value. + */ + String sourceManagedInstanceId(); + + /** + * Gets the restorePointInTime property: Specifies the point in time (ISO8601 format) of the source database that + * will be restored to create the new database. + * + * @return the restorePointInTime value. + */ + OffsetDateTime restorePointInTime(); + + /** + * Gets the proxyOverride property: Connection type used for connecting to the instance. + * + * @return the proxyOverride value. + */ + ManagedInstanceProxyOverride proxyOverride(); + + /** + * Gets the timezoneId property: Id of the timezone. Allowed values are timezones supported by Windows. Windows + * keeps details on supported timezones, including the id, in registry under + * KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones. You can get those registry values via + * SQL Server by querying SELECT name AS timezone_id FROM sys.time_zone_info. List of Ids can also be obtained by + * executing [System.TimeZoneInfo]::GetSystemTimeZones() in PowerShell. An example of valid timezone id is "Pacific + * Standard Time" or "W. Europe Standard Time". + * + * @return the timezoneId value. + */ + String timezoneId(); + + /** + * Gets the instancePoolId property: The Id of the instance pool this managed server belongs to. + * + * @return the instancePoolId value. + */ + String instancePoolId(); + + /** + * Gets the maintenanceConfigurationId property: Specifies maintenance configuration id to apply to this managed + * instance. + * + * @return the maintenanceConfigurationId value. + */ + String maintenanceConfigurationId(); + + /** + * Gets the privateEndpointConnections property: List of private endpoint connections on a managed instance. + * + * @return the privateEndpointConnections value. + */ + List privateEndpointConnections(); + + /** + * Gets the minimalTlsVersion property: Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2'. + * + * @return the minimalTlsVersion value. + */ + String minimalTlsVersion(); + + /** + * Gets the currentBackupStorageRedundancy property: The storage account type used to store backups for this + * instance. The options are Local (LocallyRedundantStorage), Zone (ZoneRedundantStorage), Geo (GeoRedundantStorage) + * and GeoZone(GeoZoneRedundantStorage). + * + * @return the currentBackupStorageRedundancy value. + */ + BackupStorageRedundancy currentBackupStorageRedundancy(); + + /** + * Gets the requestedBackupStorageRedundancy property: The storage account type to be used to store backups for this + * instance. The options are Local (LocallyRedundantStorage), Zone (ZoneRedundantStorage), Geo (GeoRedundantStorage) + * and GeoZone(GeoZoneRedundantStorage). + * + * @return the requestedBackupStorageRedundancy value. + */ + BackupStorageRedundancy requestedBackupStorageRedundancy(); + + /** + * Gets the zoneRedundant property: Whether or not the multi-az is enabled. + * + * @return the zoneRedundant value. + */ + Boolean zoneRedundant(); + + /** + * Gets the primaryUserAssignedIdentityId property: The resource id of a user assigned identity to be used by + * default. + * + * @return the primaryUserAssignedIdentityId value. + */ + String primaryUserAssignedIdentityId(); + + /** + * Gets the keyId property: A CMK URI of the key to use for encryption. + * + * @return the keyId value. + */ + String keyId(); + + /** + * Gets the administrators property: The Azure Active Directory administrator of the server. + * + * @return the administrators value. + */ + ManagedInstanceExternalAdministrator administrators(); + + /** + * Gets the servicePrincipal property: The managed instance's service principal. + * + * @return the servicePrincipal value. + */ + ServicePrincipal servicePrincipal(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceInner object. + * + * @return the inner object. + */ + ManagedInstanceInner innerModel(); + + /** The entirety of the ManagedInstance definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The ManagedInstance definition stages. */ + interface DefinitionStages { + /** The first stage of the ManagedInstance definition. */ + interface Blank extends WithLocation { + } + /** The stage of the ManagedInstance definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the ManagedInstance definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the ManagedInstance definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithIdentity, + DefinitionStages.WithSku, + DefinitionStages.WithManagedInstanceCreateMode, + DefinitionStages.WithAdministratorLogin, + DefinitionStages.WithAdministratorLoginPassword, + DefinitionStages.WithSubnetId, + DefinitionStages.WithLicenseType, + DefinitionStages.WithVCores, + DefinitionStages.WithStorageSizeInGB, + DefinitionStages.WithCollation, + DefinitionStages.WithDnsZonePartner, + DefinitionStages.WithPublicDataEndpointEnabled, + DefinitionStages.WithSourceManagedInstanceId, + DefinitionStages.WithRestorePointInTime, + DefinitionStages.WithProxyOverride, + DefinitionStages.WithTimezoneId, + DefinitionStages.WithInstancePoolId, + DefinitionStages.WithMaintenanceConfigurationId, + DefinitionStages.WithMinimalTlsVersion, + DefinitionStages.WithRequestedBackupStorageRedundancy, + DefinitionStages.WithZoneRedundant, + DefinitionStages.WithPrimaryUserAssignedIdentityId, + DefinitionStages.WithKeyId, + DefinitionStages.WithAdministrators, + DefinitionStages.WithServicePrincipal { + /** + * Executes the create request. + * + * @return the created resource. + */ + ManagedInstance create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ManagedInstance create(Context context); + } + /** The stage of the ManagedInstance definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the ManagedInstance definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: The Azure Active Directory identity of the managed instance.. + * + * @param identity The Azure Active Directory identity of the managed instance. + * @return the next definition stage. + */ + WithCreate withIdentity(ResourceIdentity identity); + } + /** The stage of the ManagedInstance definition allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: Managed instance SKU. Allowed values for sku.name: GP_Gen4, GP_Gen5, BC_Gen4, + * BC_Gen5. + * + * @param sku Managed instance SKU. Allowed values for sku.name: GP_Gen4, GP_Gen5, BC_Gen4, BC_Gen5. + * @return the next definition stage. + */ + WithCreate withSku(Sku sku); + } + /** The stage of the ManagedInstance definition allowing to specify managedInstanceCreateMode. */ + interface WithManagedInstanceCreateMode { + /** + * Specifies the managedInstanceCreateMode property: Specifies the mode of database creation. + * + *

Default: Regular instance creation. + * + *

Restore: Creates an instance by restoring a set of backups to specific point in time. + * RestorePointInTime and SourceManagedInstanceId must be specified.. + * + * @param managedInstanceCreateMode Specifies the mode of database creation. + *

Default: Regular instance creation. + *

Restore: Creates an instance by restoring a set of backups to specific point in time. + * RestorePointInTime and SourceManagedInstanceId must be specified. + * @return the next definition stage. + */ + WithCreate withManagedInstanceCreateMode(ManagedServerCreateMode managedInstanceCreateMode); + } + /** The stage of the ManagedInstance definition allowing to specify administratorLogin. */ + interface WithAdministratorLogin { + /** + * Specifies the administratorLogin property: Administrator username for the managed instance. Can only be + * specified when the managed instance is being created (and is required for creation).. + * + * @param administratorLogin Administrator username for the managed instance. Can only be specified when the + * managed instance is being created (and is required for creation). + * @return the next definition stage. + */ + WithCreate withAdministratorLogin(String administratorLogin); + } + /** The stage of the ManagedInstance definition allowing to specify administratorLoginPassword. */ + interface WithAdministratorLoginPassword { + /** + * Specifies the administratorLoginPassword property: The administrator login password (required for managed + * instance creation).. + * + * @param administratorLoginPassword The administrator login password (required for managed instance + * creation). + * @return the next definition stage. + */ + WithCreate withAdministratorLoginPassword(String administratorLoginPassword); + } + /** The stage of the ManagedInstance definition allowing to specify subnetId. */ + interface WithSubnetId { + /** + * Specifies the subnetId property: Subnet resource ID for the managed instance.. + * + * @param subnetId Subnet resource ID for the managed instance. + * @return the next definition stage. + */ + WithCreate withSubnetId(String subnetId); + } + /** The stage of the ManagedInstance definition allowing to specify licenseType. */ + interface WithLicenseType { + /** + * Specifies the licenseType property: The license type. Possible values are 'LicenseIncluded' (regular + * price inclusive of a new SQL license) and 'BasePrice' (discounted AHB price for bringing your own SQL + * licenses).. + * + * @param licenseType The license type. Possible values are 'LicenseIncluded' (regular price inclusive of a + * new SQL license) and 'BasePrice' (discounted AHB price for bringing your own SQL licenses). + * @return the next definition stage. + */ + WithCreate withLicenseType(ManagedInstanceLicenseType licenseType); + } + /** The stage of the ManagedInstance definition allowing to specify vCores. */ + interface WithVCores { + /** + * Specifies the vCores property: The number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80.. + * + * @param vCores The number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80. + * @return the next definition stage. + */ + WithCreate withVCores(Integer vCores); + } + /** The stage of the ManagedInstance definition allowing to specify storageSizeInGB. */ + interface WithStorageSizeInGB { + /** + * Specifies the storageSizeInGB property: Storage size in GB. Minimum value: 32. Maximum value: 8192. + * Increments of 32 GB allowed only.. + * + * @param storageSizeInGB Storage size in GB. Minimum value: 32. Maximum value: 8192. Increments of 32 GB + * allowed only. + * @return the next definition stage. + */ + WithCreate withStorageSizeInGB(Integer storageSizeInGB); + } + /** The stage of the ManagedInstance definition allowing to specify collation. */ + interface WithCollation { + /** + * Specifies the collation property: Collation of the managed instance.. + * + * @param collation Collation of the managed instance. + * @return the next definition stage. + */ + WithCreate withCollation(String collation); + } + /** The stage of the ManagedInstance definition allowing to specify dnsZonePartner. */ + interface WithDnsZonePartner { + /** + * Specifies the dnsZonePartner property: The resource id of another managed instance whose DNS zone this + * managed instance will share after creation.. + * + * @param dnsZonePartner The resource id of another managed instance whose DNS zone this managed instance + * will share after creation. + * @return the next definition stage. + */ + WithCreate withDnsZonePartner(String dnsZonePartner); + } + /** The stage of the ManagedInstance definition allowing to specify publicDataEndpointEnabled. */ + interface WithPublicDataEndpointEnabled { + /** + * Specifies the publicDataEndpointEnabled property: Whether or not the public data endpoint is enabled.. + * + * @param publicDataEndpointEnabled Whether or not the public data endpoint is enabled. + * @return the next definition stage. + */ + WithCreate withPublicDataEndpointEnabled(Boolean publicDataEndpointEnabled); + } + /** The stage of the ManagedInstance definition allowing to specify sourceManagedInstanceId. */ + interface WithSourceManagedInstanceId { + /** + * Specifies the sourceManagedInstanceId property: The resource identifier of the source managed instance + * associated with create operation of this instance.. + * + * @param sourceManagedInstanceId The resource identifier of the source managed instance associated with + * create operation of this instance. + * @return the next definition stage. + */ + WithCreate withSourceManagedInstanceId(String sourceManagedInstanceId); + } + /** The stage of the ManagedInstance definition allowing to specify restorePointInTime. */ + interface WithRestorePointInTime { + /** + * Specifies the restorePointInTime property: Specifies the point in time (ISO8601 format) of the source + * database that will be restored to create the new database.. + * + * @param restorePointInTime Specifies the point in time (ISO8601 format) of the source database that will + * be restored to create the new database. + * @return the next definition stage. + */ + WithCreate withRestorePointInTime(OffsetDateTime restorePointInTime); + } + /** The stage of the ManagedInstance definition allowing to specify proxyOverride. */ + interface WithProxyOverride { + /** + * Specifies the proxyOverride property: Connection type used for connecting to the instance.. + * + * @param proxyOverride Connection type used for connecting to the instance. + * @return the next definition stage. + */ + WithCreate withProxyOverride(ManagedInstanceProxyOverride proxyOverride); + } + /** The stage of the ManagedInstance definition allowing to specify timezoneId. */ + interface WithTimezoneId { + /** + * Specifies the timezoneId property: Id of the timezone. Allowed values are timezones supported by Windows. + * Windows keeps details on supported timezones, including the id, in registry under + * KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones. You can get those registry + * values via SQL Server by querying SELECT name AS timezone_id FROM sys.time_zone_info. List of Ids can + * also be obtained by executing [System.TimeZoneInfo]::GetSystemTimeZones() in PowerShell. An example of + * valid timezone id is "Pacific Standard Time" or "W. Europe Standard Time".. + * + * @param timezoneId Id of the timezone. Allowed values are timezones supported by Windows. Windows keeps + * details on supported timezones, including the id, in registry under + * KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones. You can get those registry + * values via SQL Server by querying SELECT name AS timezone_id FROM sys.time_zone_info. List of Ids can + * also be obtained by executing [System.TimeZoneInfo]::GetSystemTimeZones() in PowerShell. An example + * of valid timezone id is "Pacific Standard Time" or "W. Europe Standard Time". + * @return the next definition stage. + */ + WithCreate withTimezoneId(String timezoneId); + } + /** The stage of the ManagedInstance definition allowing to specify instancePoolId. */ + interface WithInstancePoolId { + /** + * Specifies the instancePoolId property: The Id of the instance pool this managed server belongs to.. + * + * @param instancePoolId The Id of the instance pool this managed server belongs to. + * @return the next definition stage. + */ + WithCreate withInstancePoolId(String instancePoolId); + } + /** The stage of the ManagedInstance definition allowing to specify maintenanceConfigurationId. */ + interface WithMaintenanceConfigurationId { + /** + * Specifies the maintenanceConfigurationId property: Specifies maintenance configuration id to apply to + * this managed instance.. + * + * @param maintenanceConfigurationId Specifies maintenance configuration id to apply to this managed + * instance. + * @return the next definition stage. + */ + WithCreate withMaintenanceConfigurationId(String maintenanceConfigurationId); + } + /** The stage of the ManagedInstance definition allowing to specify minimalTlsVersion. */ + interface WithMinimalTlsVersion { + /** + * Specifies the minimalTlsVersion property: Minimal TLS version. Allowed values: 'None', '1.0', '1.1', + * '1.2'. + * + * @param minimalTlsVersion Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2'. + * @return the next definition stage. + */ + WithCreate withMinimalTlsVersion(String minimalTlsVersion); + } + /** The stage of the ManagedInstance definition allowing to specify requestedBackupStorageRedundancy. */ + interface WithRequestedBackupStorageRedundancy { + /** + * Specifies the requestedBackupStorageRedundancy property: The storage account type to be used to store + * backups for this instance. The options are Local (LocallyRedundantStorage), Zone (ZoneRedundantStorage), + * Geo (GeoRedundantStorage) and GeoZone(GeoZoneRedundantStorage). + * + * @param requestedBackupStorageRedundancy The storage account type to be used to store backups for this + * instance. The options are Local (LocallyRedundantStorage), Zone (ZoneRedundantStorage), Geo + * (GeoRedundantStorage) and GeoZone(GeoZoneRedundantStorage). + * @return the next definition stage. + */ + WithCreate withRequestedBackupStorageRedundancy(BackupStorageRedundancy requestedBackupStorageRedundancy); + } + /** The stage of the ManagedInstance definition allowing to specify zoneRedundant. */ + interface WithZoneRedundant { + /** + * Specifies the zoneRedundant property: Whether or not the multi-az is enabled.. + * + * @param zoneRedundant Whether or not the multi-az is enabled. + * @return the next definition stage. + */ + WithCreate withZoneRedundant(Boolean zoneRedundant); + } + /** The stage of the ManagedInstance definition allowing to specify primaryUserAssignedIdentityId. */ + interface WithPrimaryUserAssignedIdentityId { + /** + * Specifies the primaryUserAssignedIdentityId property: The resource id of a user assigned identity to be + * used by default.. + * + * @param primaryUserAssignedIdentityId The resource id of a user assigned identity to be used by default. + * @return the next definition stage. + */ + WithCreate withPrimaryUserAssignedIdentityId(String primaryUserAssignedIdentityId); + } + /** The stage of the ManagedInstance definition allowing to specify keyId. */ + interface WithKeyId { + /** + * Specifies the keyId property: A CMK URI of the key to use for encryption.. + * + * @param keyId A CMK URI of the key to use for encryption. + * @return the next definition stage. + */ + WithCreate withKeyId(String keyId); + } + /** The stage of the ManagedInstance definition allowing to specify administrators. */ + interface WithAdministrators { + /** + * Specifies the administrators property: The Azure Active Directory administrator of the server.. + * + * @param administrators The Azure Active Directory administrator of the server. + * @return the next definition stage. + */ + WithCreate withAdministrators(ManagedInstanceExternalAdministrator administrators); + } + /** The stage of the ManagedInstance definition allowing to specify servicePrincipal. */ + interface WithServicePrincipal { + /** + * Specifies the servicePrincipal property: The managed instance's service principal.. + * + * @param servicePrincipal The managed instance's service principal. + * @return the next definition stage. + */ + WithCreate withServicePrincipal(ServicePrincipal servicePrincipal); + } + } + /** + * Begins update for the ManagedInstance resource. + * + * @return the stage of resource update. + */ + ManagedInstance.Update update(); + + /** The template for ManagedInstance update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithSku, + UpdateStages.WithIdentity, + UpdateStages.WithAdministratorLoginPassword, + UpdateStages.WithSubnetId, + UpdateStages.WithLicenseType, + UpdateStages.WithVCores, + UpdateStages.WithStorageSizeInGB, + UpdateStages.WithPublicDataEndpointEnabled, + UpdateStages.WithProxyOverride, + UpdateStages.WithInstancePoolId, + UpdateStages.WithMaintenanceConfigurationId, + UpdateStages.WithMinimalTlsVersion, + UpdateStages.WithZoneRedundant, + UpdateStages.WithPrimaryUserAssignedIdentityId, + UpdateStages.WithServicePrincipal { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ManagedInstance apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ManagedInstance apply(Context context); + } + /** The ManagedInstance update stages. */ + interface UpdateStages { + /** The stage of the ManagedInstance update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the ManagedInstance update allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: Managed instance sku. + * + * @param sku Managed instance sku. + * @return the next definition stage. + */ + Update withSku(Sku sku); + } + /** The stage of the ManagedInstance update allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Managed instance identity. + * + * @param identity Managed instance identity. + * @return the next definition stage. + */ + Update withIdentity(ResourceIdentity identity); + } + /** The stage of the ManagedInstance update allowing to specify administratorLoginPassword. */ + interface WithAdministratorLoginPassword { + /** + * Specifies the administratorLoginPassword property: The administrator login password (required for managed + * instance creation).. + * + * @param administratorLoginPassword The administrator login password (required for managed instance + * creation). + * @return the next definition stage. + */ + Update withAdministratorLoginPassword(String administratorLoginPassword); + } + /** The stage of the ManagedInstance update allowing to specify subnetId. */ + interface WithSubnetId { + /** + * Specifies the subnetId property: Subnet resource ID for the managed instance.. + * + * @param subnetId Subnet resource ID for the managed instance. + * @return the next definition stage. + */ + Update withSubnetId(String subnetId); + } + /** The stage of the ManagedInstance update allowing to specify licenseType. */ + interface WithLicenseType { + /** + * Specifies the licenseType property: The license type. Possible values are 'LicenseIncluded' (regular + * price inclusive of a new SQL license) and 'BasePrice' (discounted AHB price for bringing your own SQL + * licenses).. + * + * @param licenseType The license type. Possible values are 'LicenseIncluded' (regular price inclusive of a + * new SQL license) and 'BasePrice' (discounted AHB price for bringing your own SQL licenses). + * @return the next definition stage. + */ + Update withLicenseType(ManagedInstanceLicenseType licenseType); + } + /** The stage of the ManagedInstance update allowing to specify vCores. */ + interface WithVCores { + /** + * Specifies the vCores property: The number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80.. + * + * @param vCores The number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80. + * @return the next definition stage. + */ + Update withVCores(Integer vCores); + } + /** The stage of the ManagedInstance update allowing to specify storageSizeInGB. */ + interface WithStorageSizeInGB { + /** + * Specifies the storageSizeInGB property: Storage size in GB. Minimum value: 32. Maximum value: 8192. + * Increments of 32 GB allowed only.. + * + * @param storageSizeInGB Storage size in GB. Minimum value: 32. Maximum value: 8192. Increments of 32 GB + * allowed only. + * @return the next definition stage. + */ + Update withStorageSizeInGB(Integer storageSizeInGB); + } + /** The stage of the ManagedInstance update allowing to specify publicDataEndpointEnabled. */ + interface WithPublicDataEndpointEnabled { + /** + * Specifies the publicDataEndpointEnabled property: Whether or not the public data endpoint is enabled.. + * + * @param publicDataEndpointEnabled Whether or not the public data endpoint is enabled. + * @return the next definition stage. + */ + Update withPublicDataEndpointEnabled(Boolean publicDataEndpointEnabled); + } + /** The stage of the ManagedInstance update allowing to specify proxyOverride. */ + interface WithProxyOverride { + /** + * Specifies the proxyOverride property: Connection type used for connecting to the instance.. + * + * @param proxyOverride Connection type used for connecting to the instance. + * @return the next definition stage. + */ + Update withProxyOverride(ManagedInstanceProxyOverride proxyOverride); + } + /** The stage of the ManagedInstance update allowing to specify instancePoolId. */ + interface WithInstancePoolId { + /** + * Specifies the instancePoolId property: The Id of the instance pool this managed server belongs to.. + * + * @param instancePoolId The Id of the instance pool this managed server belongs to. + * @return the next definition stage. + */ + Update withInstancePoolId(String instancePoolId); + } + /** The stage of the ManagedInstance update allowing to specify maintenanceConfigurationId. */ + interface WithMaintenanceConfigurationId { + /** + * Specifies the maintenanceConfigurationId property: Specifies maintenance configuration id to apply to + * this managed instance.. + * + * @param maintenanceConfigurationId Specifies maintenance configuration id to apply to this managed + * instance. + * @return the next definition stage. + */ + Update withMaintenanceConfigurationId(String maintenanceConfigurationId); + } + /** The stage of the ManagedInstance update allowing to specify minimalTlsVersion. */ + interface WithMinimalTlsVersion { + /** + * Specifies the minimalTlsVersion property: Minimal TLS version. Allowed values: 'None', '1.0', '1.1', + * '1.2'. + * + * @param minimalTlsVersion Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2'. + * @return the next definition stage. + */ + Update withMinimalTlsVersion(String minimalTlsVersion); + } + /** The stage of the ManagedInstance update allowing to specify zoneRedundant. */ + interface WithZoneRedundant { + /** + * Specifies the zoneRedundant property: Whether or not the multi-az is enabled.. + * + * @param zoneRedundant Whether or not the multi-az is enabled. + * @return the next definition stage. + */ + Update withZoneRedundant(Boolean zoneRedundant); + } + /** The stage of the ManagedInstance update allowing to specify primaryUserAssignedIdentityId. */ + interface WithPrimaryUserAssignedIdentityId { + /** + * Specifies the primaryUserAssignedIdentityId property: The resource id of a user assigned identity to be + * used by default.. + * + * @param primaryUserAssignedIdentityId The resource id of a user assigned identity to be used by default. + * @return the next definition stage. + */ + Update withPrimaryUserAssignedIdentityId(String primaryUserAssignedIdentityId); + } + /** The stage of the ManagedInstance update allowing to specify servicePrincipal. */ + interface WithServicePrincipal { + /** + * Specifies the servicePrincipal property: The managed instance's service principal.. + * + * @param servicePrincipal The managed instance's service principal. + * @return the next definition stage. + */ + Update withServicePrincipal(ServicePrincipal servicePrincipal); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ManagedInstance refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ManagedInstance refresh(Context context); + + /** + * Failovers a managed instance. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void failover(); + + /** + * Failovers a managed instance. + * + * @param replicaType The type of replica to be failed over. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void failover(ReplicaType replicaType, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAdministrator.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAdministrator.java new file mode 100644 index 0000000000000..67bbe0fd18b6b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAdministrator.java @@ -0,0 +1,247 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceAdministratorInner; +import java.util.UUID; + +/** An immutable client-side representation of ManagedInstanceAdministrator. */ +public interface ManagedInstanceAdministrator { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the administratorType property: Type of the managed instance administrator. + * + * @return the administratorType value. + */ + ManagedInstanceAdministratorType administratorType(); + + /** + * Gets the login property: Login name of the managed instance administrator. + * + * @return the login value. + */ + String login(); + + /** + * Gets the sid property: SID (object ID) of the managed instance administrator. + * + * @return the sid value. + */ + UUID sid(); + + /** + * Gets the tenantId property: Tenant ID of the managed instance administrator. + * + * @return the tenantId value. + */ + UUID tenantId(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceAdministratorInner object. + * + * @return the inner object. + */ + ManagedInstanceAdministratorInner innerModel(); + + /** The entirety of the ManagedInstanceAdministrator definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ManagedInstanceAdministrator definition stages. */ + interface DefinitionStages { + /** The first stage of the ManagedInstanceAdministrator definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ManagedInstanceAdministrator definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, managedInstanceName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @return the next definition stage. + */ + WithCreate withExistingManagedInstance(String resourceGroupName, String managedInstanceName); + } + /** + * The stage of the ManagedInstanceAdministrator definition which contains all the minimum required properties + * for the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithAdministratorType, + DefinitionStages.WithLogin, + DefinitionStages.WithSid, + DefinitionStages.WithTenantId { + /** + * Executes the create request. + * + * @return the created resource. + */ + ManagedInstanceAdministrator create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ManagedInstanceAdministrator create(Context context); + } + /** The stage of the ManagedInstanceAdministrator definition allowing to specify administratorType. */ + interface WithAdministratorType { + /** + * Specifies the administratorType property: Type of the managed instance administrator.. + * + * @param administratorType Type of the managed instance administrator. + * @return the next definition stage. + */ + WithCreate withAdministratorType(ManagedInstanceAdministratorType administratorType); + } + /** The stage of the ManagedInstanceAdministrator definition allowing to specify login. */ + interface WithLogin { + /** + * Specifies the login property: Login name of the managed instance administrator.. + * + * @param login Login name of the managed instance administrator. + * @return the next definition stage. + */ + WithCreate withLogin(String login); + } + /** The stage of the ManagedInstanceAdministrator definition allowing to specify sid. */ + interface WithSid { + /** + * Specifies the sid property: SID (object ID) of the managed instance administrator.. + * + * @param sid SID (object ID) of the managed instance administrator. + * @return the next definition stage. + */ + WithCreate withSid(UUID sid); + } + /** The stage of the ManagedInstanceAdministrator definition allowing to specify tenantId. */ + interface WithTenantId { + /** + * Specifies the tenantId property: Tenant ID of the managed instance administrator.. + * + * @param tenantId Tenant ID of the managed instance administrator. + * @return the next definition stage. + */ + WithCreate withTenantId(UUID tenantId); + } + } + /** + * Begins update for the ManagedInstanceAdministrator resource. + * + * @return the stage of resource update. + */ + ManagedInstanceAdministrator.Update update(); + + /** The template for ManagedInstanceAdministrator update. */ + interface Update + extends UpdateStages.WithAdministratorType, + UpdateStages.WithLogin, + UpdateStages.WithSid, + UpdateStages.WithTenantId { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ManagedInstanceAdministrator apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ManagedInstanceAdministrator apply(Context context); + } + /** The ManagedInstanceAdministrator update stages. */ + interface UpdateStages { + /** The stage of the ManagedInstanceAdministrator update allowing to specify administratorType. */ + interface WithAdministratorType { + /** + * Specifies the administratorType property: Type of the managed instance administrator.. + * + * @param administratorType Type of the managed instance administrator. + * @return the next definition stage. + */ + Update withAdministratorType(ManagedInstanceAdministratorType administratorType); + } + /** The stage of the ManagedInstanceAdministrator update allowing to specify login. */ + interface WithLogin { + /** + * Specifies the login property: Login name of the managed instance administrator.. + * + * @param login Login name of the managed instance administrator. + * @return the next definition stage. + */ + Update withLogin(String login); + } + /** The stage of the ManagedInstanceAdministrator update allowing to specify sid. */ + interface WithSid { + /** + * Specifies the sid property: SID (object ID) of the managed instance administrator.. + * + * @param sid SID (object ID) of the managed instance administrator. + * @return the next definition stage. + */ + Update withSid(UUID sid); + } + /** The stage of the ManagedInstanceAdministrator update allowing to specify tenantId. */ + interface WithTenantId { + /** + * Specifies the tenantId property: Tenant ID of the managed instance administrator.. + * + * @param tenantId Tenant ID of the managed instance administrator. + * @return the next definition stage. + */ + Update withTenantId(UUID tenantId); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ManagedInstanceAdministrator refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ManagedInstanceAdministrator refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAdministratorListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAdministratorListResult.java new file mode 100644 index 0000000000000..689c5c9b40b73 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAdministratorListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceAdministratorInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of managed instance administrators. */ +@Immutable +public final class ManagedInstanceAdministratorListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of ManagedInstanceAdministratorListResult class. */ + public ManagedInstanceAdministratorListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAdministratorType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAdministratorType.java new file mode 100644 index 0000000000000..c1d1e3127925e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAdministratorType.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Type of the managed instance administrator. */ +public final class ManagedInstanceAdministratorType extends ExpandableStringEnum { + /** Static value ActiveDirectory for ManagedInstanceAdministratorType. */ + public static final ManagedInstanceAdministratorType ACTIVE_DIRECTORY = fromString("ActiveDirectory"); + + /** + * Creates or finds a ManagedInstanceAdministratorType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagedInstanceAdministratorType. + */ + @JsonCreator + public static ManagedInstanceAdministratorType fromString(String name) { + return fromString(name, ManagedInstanceAdministratorType.class); + } + + /** + * Gets known ManagedInstanceAdministratorType values. + * + * @return known ManagedInstanceAdministratorType values. + */ + public static Collection values() { + return values(ManagedInstanceAdministratorType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAdministrators.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAdministrators.java new file mode 100644 index 0000000000000..875f5d07db2f8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAdministrators.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ManagedInstanceAdministrators. */ +public interface ManagedInstanceAdministrators { + /** + * Gets a list of managed instance 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 managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance administrators as paginated response with {@link PagedIterable}. + */ + PagedIterable listByInstance(String resourceGroupName, String managedInstanceName); + + /** + * Gets a list of managed instance 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 managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance administrators as paginated response with {@link PagedIterable}. + */ + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * Gets a managed instance 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 managedInstanceName The name of the managed instance. + * @param administratorName The administratorName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance administrator along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String managedInstanceName, AdministratorName administratorName, Context context); + + /** + * Gets a managed instance 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 managedInstanceName The name of the managed instance. + * @param administratorName The administratorName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance administrator. + */ + ManagedInstanceAdministrator get( + String resourceGroupName, String managedInstanceName, AdministratorName administratorName); + + /** + * Deletes a managed instance 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 managedInstanceName The name of the managed instance. + * @param administratorName The administratorName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String managedInstanceName, AdministratorName administratorName); + + /** + * Deletes a managed instance 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 managedInstanceName The name of the managed instance. + * @param administratorName The administratorName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete( + String resourceGroupName, String managedInstanceName, AdministratorName administratorName, Context context); + + /** + * Gets a managed instance administrator. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance administrator along with {@link Response}. + */ + ManagedInstanceAdministrator getById(String id); + + /** + * Gets a managed instance administrator. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance administrator along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a managed instance administrator. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a managed instance administrator. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ManagedInstanceAdministrator resource. + * + * @param name resource name. + * @return the first stage of the new ManagedInstanceAdministrator definition. + */ + ManagedInstanceAdministrator.DefinitionStages.Blank define(AdministratorName name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAdvancedThreatProtection.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAdvancedThreatProtection.java new file mode 100644 index 0000000000000..96714117c17a3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAdvancedThreatProtection.java @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceAdvancedThreatProtectionInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of ManagedInstanceAdvancedThreatProtection. */ +public interface ManagedInstanceAdvancedThreatProtection { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: SystemData of AdvancedThreatProtectionResource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the state property: Specifies the state of the Advanced Threat Protection, whether it is enabled or disabled + * or a state has not been applied yet on the specific database or server. + * + * @return the state value. + */ + AdvancedThreatProtectionState state(); + + /** + * Gets the creationTime property: Specifies the UTC creation time of the policy. + * + * @return the creationTime value. + */ + OffsetDateTime creationTime(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceAdvancedThreatProtectionInner + * object. + * + * @return the inner object. + */ + ManagedInstanceAdvancedThreatProtectionInner innerModel(); + + /** The entirety of the ManagedInstanceAdvancedThreatProtection definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ManagedInstanceAdvancedThreatProtection definition stages. */ + interface DefinitionStages { + /** The first stage of the ManagedInstanceAdvancedThreatProtection definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ManagedInstanceAdvancedThreatProtection definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, managedInstanceName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @return the next definition stage. + */ + WithCreate withExistingManagedInstance(String resourceGroupName, String managedInstanceName); + } + /** + * The stage of the ManagedInstanceAdvancedThreatProtection definition which contains all the minimum required + * properties for the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithState { + /** + * Executes the create request. + * + * @return the created resource. + */ + ManagedInstanceAdvancedThreatProtection create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ManagedInstanceAdvancedThreatProtection create(Context context); + } + /** The stage of the ManagedInstanceAdvancedThreatProtection definition allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the Advanced Threat Protection, whether it is + * enabled or disabled or a state has not been applied yet on the specific database or server.. + * + * @param state Specifies the state of the Advanced Threat Protection, whether it is enabled or disabled or + * a state has not been applied yet on the specific database or server. + * @return the next definition stage. + */ + WithCreate withState(AdvancedThreatProtectionState state); + } + } + /** + * Begins update for the ManagedInstanceAdvancedThreatProtection resource. + * + * @return the stage of resource update. + */ + ManagedInstanceAdvancedThreatProtection.Update update(); + + /** The template for ManagedInstanceAdvancedThreatProtection update. */ + interface Update extends UpdateStages.WithState { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ManagedInstanceAdvancedThreatProtection apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ManagedInstanceAdvancedThreatProtection apply(Context context); + } + /** The ManagedInstanceAdvancedThreatProtection update stages. */ + interface UpdateStages { + /** The stage of the ManagedInstanceAdvancedThreatProtection update allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the Advanced Threat Protection, whether it is + * enabled or disabled or a state has not been applied yet on the specific database or server.. + * + * @param state Specifies the state of the Advanced Threat Protection, whether it is enabled or disabled or + * a state has not been applied yet on the specific database or server. + * @return the next definition stage. + */ + Update withState(AdvancedThreatProtectionState state); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ManagedInstanceAdvancedThreatProtection refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ManagedInstanceAdvancedThreatProtection refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAdvancedThreatProtectionListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAdvancedThreatProtectionListResult.java new file mode 100644 index 0000000000000..f88ec79b1008a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAdvancedThreatProtectionListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceAdvancedThreatProtectionInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of the managed instance's Advanced Threat Protection settings. */ +@Immutable +public final class ManagedInstanceAdvancedThreatProtectionListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of ManagedInstanceAdvancedThreatProtectionListResult class. */ + public ManagedInstanceAdvancedThreatProtectionListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAdvancedThreatProtectionSettings.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAdvancedThreatProtectionSettings.java new file mode 100644 index 0000000000000..acda9eca20207 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAdvancedThreatProtectionSettings.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ManagedInstanceAdvancedThreatProtectionSettings. */ +public interface ManagedInstanceAdvancedThreatProtectionSettings { + /** + * Get the managed instance's Advanced Threat Protection settings. + * + * @param resourceGroupName The name of the resource group that contains 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed instance's Advanced Threat Protection settings as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName); + + /** + * Get the managed instance's Advanced Threat Protection settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed instance's Advanced Threat Protection settings as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * Get a managed instance's Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance's Advanced Threat Protection state along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + AdvancedThreatProtectionName advancedThreatProtectionName, + Context context); + + /** + * Get a managed instance's Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance's Advanced Threat Protection state. + */ + ManagedInstanceAdvancedThreatProtection get( + String resourceGroupName, + String managedInstanceName, + AdvancedThreatProtectionName advancedThreatProtectionName); + + /** + * Get a managed instance's Advanced Threat Protection state. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance's Advanced Threat Protection state along with {@link Response}. + */ + ManagedInstanceAdvancedThreatProtection getById(String id); + + /** + * Get a managed instance's Advanced Threat Protection state. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance's Advanced Threat Protection state along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ManagedInstanceAdvancedThreatProtection resource. + * + * @param name resource name. + * @return the first stage of the new ManagedInstanceAdvancedThreatProtection definition. + */ + ManagedInstanceAdvancedThreatProtection.DefinitionStages.Blank define(AdvancedThreatProtectionName name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAzureADOnlyAuthListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAzureADOnlyAuthListResult.java new file mode 100644 index 0000000000000..5eb1454ca559f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAzureADOnlyAuthListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceAzureADOnlyAuthenticationInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of active directory only authentications. */ +@Immutable +public final class ManagedInstanceAzureADOnlyAuthListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of ManagedInstanceAzureADOnlyAuthListResult class. */ + public ManagedInstanceAzureADOnlyAuthListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAzureADOnlyAuthentication.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAzureADOnlyAuthentication.java new file mode 100644 index 0000000000000..c02de0899dc46 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAzureADOnlyAuthentication.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceAzureADOnlyAuthenticationInner; + +/** An immutable client-side representation of ManagedInstanceAzureADOnlyAuthentication. */ +public interface ManagedInstanceAzureADOnlyAuthentication { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the azureADOnlyAuthentication property: Azure Active Directory only Authentication enabled. + * + * @return the azureADOnlyAuthentication value. + */ + boolean azureADOnlyAuthentication(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner + * com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceAzureADOnlyAuthenticationInner object. + * + * @return the inner object. + */ + ManagedInstanceAzureADOnlyAuthenticationInner innerModel(); + + /** The entirety of the ManagedInstanceAzureADOnlyAuthentication definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ManagedInstanceAzureADOnlyAuthentication definition stages. */ + interface DefinitionStages { + /** The first stage of the ManagedInstanceAzureADOnlyAuthentication definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ManagedInstanceAzureADOnlyAuthentication definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, managedInstanceName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @return the next definition stage. + */ + WithCreate withExistingManagedInstance(String resourceGroupName, String managedInstanceName); + } + /** + * The stage of the ManagedInstanceAzureADOnlyAuthentication definition which contains all the minimum required + * properties for the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithAzureADOnlyAuthentication { + /** + * Executes the create request. + * + * @return the created resource. + */ + ManagedInstanceAzureADOnlyAuthentication create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ManagedInstanceAzureADOnlyAuthentication create(Context context); + } + /** + * The stage of the ManagedInstanceAzureADOnlyAuthentication definition allowing to specify + * azureADOnlyAuthentication. + */ + interface WithAzureADOnlyAuthentication { + /** + * Specifies the azureADOnlyAuthentication property: Azure Active Directory only Authentication enabled.. + * + * @param azureADOnlyAuthentication Azure Active Directory only Authentication enabled. + * @return the next definition stage. + */ + WithCreate withAzureADOnlyAuthentication(boolean azureADOnlyAuthentication); + } + } + /** + * Begins update for the ManagedInstanceAzureADOnlyAuthentication resource. + * + * @return the stage of resource update. + */ + ManagedInstanceAzureADOnlyAuthentication.Update update(); + + /** The template for ManagedInstanceAzureADOnlyAuthentication update. */ + interface Update extends UpdateStages.WithAzureADOnlyAuthentication { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ManagedInstanceAzureADOnlyAuthentication apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ManagedInstanceAzureADOnlyAuthentication apply(Context context); + } + /** The ManagedInstanceAzureADOnlyAuthentication update stages. */ + interface UpdateStages { + /** + * The stage of the ManagedInstanceAzureADOnlyAuthentication update allowing to specify + * azureADOnlyAuthentication. + */ + interface WithAzureADOnlyAuthentication { + /** + * Specifies the azureADOnlyAuthentication property: Azure Active Directory only Authentication enabled.. + * + * @param azureADOnlyAuthentication Azure Active Directory only Authentication enabled. + * @return the next definition stage. + */ + Update withAzureADOnlyAuthentication(boolean azureADOnlyAuthentication); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ManagedInstanceAzureADOnlyAuthentication refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ManagedInstanceAzureADOnlyAuthentication refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAzureADOnlyAuthentications.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAzureADOnlyAuthentications.java new file mode 100644 index 0000000000000..a1a671fef626e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceAzureADOnlyAuthentications.java @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ManagedInstanceAzureADOnlyAuthentications. */ +public interface ManagedInstanceAzureADOnlyAuthentications { + /** + * Gets a specific Azure Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific Azure Active Directory only authentication property along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String managedInstanceName, AuthenticationName authenticationName, Context context); + + /** + * Gets a specific Azure Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific Azure Active Directory only authentication property. + */ + ManagedInstanceAzureADOnlyAuthentication get( + String resourceGroupName, String managedInstanceName, AuthenticationName authenticationName); + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String managedInstanceName, AuthenticationName authenticationName); + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param authenticationName The name of server azure active directory only authentication. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete( + String resourceGroupName, String managedInstanceName, AuthenticationName authenticationName, Context context); + + /** + * Gets a list of server Azure Active Directory only authentications. + * + * @param resourceGroupName The name of the resource group that contains 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server Azure Active Directory only authentications as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName); + + /** + * Gets a list of server Azure Active Directory only authentications. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server Azure Active Directory only authentications as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * Gets a specific Azure Active Directory only authentication property. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific Azure Active Directory only authentication property along with {@link Response}. + */ + ManagedInstanceAzureADOnlyAuthentication getById(String id); + + /** + * Gets a specific Azure Active Directory only authentication property. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific Azure Active Directory only authentication property along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ManagedInstanceAzureADOnlyAuthentication resource. + * + * @param name resource name. + * @return the first stage of the new ManagedInstanceAzureADOnlyAuthentication definition. + */ + ManagedInstanceAzureADOnlyAuthentication.DefinitionStages.Blank define(AuthenticationName name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceDtc.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceDtc.java new file mode 100644 index 0000000000000..b83b3d4745018 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceDtc.java @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceDtcInner; +import java.util.List; + +/** An immutable client-side representation of ManagedInstanceDtc. */ +public interface ManagedInstanceDtc { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the dtcEnabled property: Active status of managed instance DTC. + * + * @return the dtcEnabled value. + */ + Boolean dtcEnabled(); + + /** + * Gets the securitySettings property: Security settings of managed instance DTC. + * + * @return the securitySettings value. + */ + ManagedInstanceDtcSecuritySettings securitySettings(); + + /** + * Gets the externalDnsSuffixSearchList property: External dns suffix search list of managed instance DTC. + * + * @return the externalDnsSuffixSearchList value. + */ + List externalDnsSuffixSearchList(); + + /** + * Gets the dtcHostnameDnsSuffix property: Host name dns suffix of managed instance DTC. + * + * @return the dtcHostnameDnsSuffix value. + */ + String dtcHostnameDnsSuffix(); + + /** + * Gets the provisioningState property: Provisioning state of managed instance DTC. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceDtcInner object. + * + * @return the inner object. + */ + ManagedInstanceDtcInner innerModel(); + + /** The entirety of the ManagedInstanceDtc definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ManagedInstanceDtc definition stages. */ + interface DefinitionStages { + /** The first stage of the ManagedInstanceDtc definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ManagedInstanceDtc definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, managedInstanceName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @return the next definition stage. + */ + WithCreate withExistingManagedInstance(String resourceGroupName, String managedInstanceName); + } + /** + * The stage of the ManagedInstanceDtc definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithDtcEnabled, + DefinitionStages.WithSecuritySettings, + DefinitionStages.WithExternalDnsSuffixSearchList { + /** + * Executes the create request. + * + * @return the created resource. + */ + ManagedInstanceDtc create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ManagedInstanceDtc create(Context context); + } + /** The stage of the ManagedInstanceDtc definition allowing to specify dtcEnabled. */ + interface WithDtcEnabled { + /** + * Specifies the dtcEnabled property: Active status of managed instance DTC.. + * + * @param dtcEnabled Active status of managed instance DTC. + * @return the next definition stage. + */ + WithCreate withDtcEnabled(Boolean dtcEnabled); + } + /** The stage of the ManagedInstanceDtc definition allowing to specify securitySettings. */ + interface WithSecuritySettings { + /** + * Specifies the securitySettings property: Security settings of managed instance DTC.. + * + * @param securitySettings Security settings of managed instance DTC. + * @return the next definition stage. + */ + WithCreate withSecuritySettings(ManagedInstanceDtcSecuritySettings securitySettings); + } + /** The stage of the ManagedInstanceDtc definition allowing to specify externalDnsSuffixSearchList. */ + interface WithExternalDnsSuffixSearchList { + /** + * Specifies the externalDnsSuffixSearchList property: External dns suffix search list of managed instance + * DTC.. + * + * @param externalDnsSuffixSearchList External dns suffix search list of managed instance DTC. + * @return the next definition stage. + */ + WithCreate withExternalDnsSuffixSearchList(List externalDnsSuffixSearchList); + } + } + /** + * Begins update for the ManagedInstanceDtc resource. + * + * @return the stage of resource update. + */ + ManagedInstanceDtc.Update update(); + + /** The template for ManagedInstanceDtc update. */ + interface Update + extends UpdateStages.WithDtcEnabled, + UpdateStages.WithSecuritySettings, + UpdateStages.WithExternalDnsSuffixSearchList { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ManagedInstanceDtc apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ManagedInstanceDtc apply(Context context); + } + /** The ManagedInstanceDtc update stages. */ + interface UpdateStages { + /** The stage of the ManagedInstanceDtc update allowing to specify dtcEnabled. */ + interface WithDtcEnabled { + /** + * Specifies the dtcEnabled property: Active status of managed instance DTC.. + * + * @param dtcEnabled Active status of managed instance DTC. + * @return the next definition stage. + */ + Update withDtcEnabled(Boolean dtcEnabled); + } + /** The stage of the ManagedInstanceDtc update allowing to specify securitySettings. */ + interface WithSecuritySettings { + /** + * Specifies the securitySettings property: Security settings of managed instance DTC.. + * + * @param securitySettings Security settings of managed instance DTC. + * @return the next definition stage. + */ + Update withSecuritySettings(ManagedInstanceDtcSecuritySettings securitySettings); + } + /** The stage of the ManagedInstanceDtc update allowing to specify externalDnsSuffixSearchList. */ + interface WithExternalDnsSuffixSearchList { + /** + * Specifies the externalDnsSuffixSearchList property: External dns suffix search list of managed instance + * DTC.. + * + * @param externalDnsSuffixSearchList External dns suffix search list of managed instance DTC. + * @return the next definition stage. + */ + Update withExternalDnsSuffixSearchList(List externalDnsSuffixSearchList); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ManagedInstanceDtc refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ManagedInstanceDtc refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceDtcListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceDtcListResult.java new file mode 100644 index 0000000000000..2a1adf9914628 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceDtcListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceDtcInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of managed instance's DTCs. */ +@Immutable +public final class ManagedInstanceDtcListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of ManagedInstanceDtcListResult class. */ + public ManagedInstanceDtcListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceDtcSecuritySettings.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceDtcSecuritySettings.java new file mode 100644 index 0000000000000..9e582fdba7c20 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceDtcSecuritySettings.java @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The Security Settings of managed instance DTC. */ +@Fluent +public final class ManagedInstanceDtcSecuritySettings { + /* + * Transaction Manager communication settings of managed instance DTC. + */ + @JsonProperty(value = "transactionManagerCommunicationSettings") + private ManagedInstanceDtcTransactionManagerCommunicationSettings transactionManagerCommunicationSettings; + + /* + * Allow XA Transactions to managed instance DTC. + */ + @JsonProperty(value = "xaTransactionsEnabled") + private Boolean xaTransactionsEnabled; + + /* + * Allow SNA LU 6.2 Transactions to managed instance DTC. + */ + @JsonProperty(value = "snaLu6point2TransactionsEnabled") + private Boolean snaLu6Point2TransactionsEnabled; + + /* + * Default timeout for XA Transactions (in seconds). + */ + @JsonProperty(value = "xaTransactionsDefaultTimeout") + private Integer xaTransactionsDefaultTimeout; + + /* + * Maximum timeout for XA Transactions (in seconds). + */ + @JsonProperty(value = "xaTransactionsMaximumTimeout") + private Integer xaTransactionsMaximumTimeout; + + /** Creates an instance of ManagedInstanceDtcSecuritySettings class. */ + public ManagedInstanceDtcSecuritySettings() { + } + + /** + * Get the transactionManagerCommunicationSettings property: Transaction Manager communication settings of managed + * instance DTC. + * + * @return the transactionManagerCommunicationSettings value. + */ + public ManagedInstanceDtcTransactionManagerCommunicationSettings transactionManagerCommunicationSettings() { + return this.transactionManagerCommunicationSettings; + } + + /** + * Set the transactionManagerCommunicationSettings property: Transaction Manager communication settings of managed + * instance DTC. + * + * @param transactionManagerCommunicationSettings the transactionManagerCommunicationSettings value to set. + * @return the ManagedInstanceDtcSecuritySettings object itself. + */ + public ManagedInstanceDtcSecuritySettings withTransactionManagerCommunicationSettings( + ManagedInstanceDtcTransactionManagerCommunicationSettings transactionManagerCommunicationSettings) { + this.transactionManagerCommunicationSettings = transactionManagerCommunicationSettings; + return this; + } + + /** + * Get the xaTransactionsEnabled property: Allow XA Transactions to managed instance DTC. + * + * @return the xaTransactionsEnabled value. + */ + public Boolean xaTransactionsEnabled() { + return this.xaTransactionsEnabled; + } + + /** + * Set the xaTransactionsEnabled property: Allow XA Transactions to managed instance DTC. + * + * @param xaTransactionsEnabled the xaTransactionsEnabled value to set. + * @return the ManagedInstanceDtcSecuritySettings object itself. + */ + public ManagedInstanceDtcSecuritySettings withXaTransactionsEnabled(Boolean xaTransactionsEnabled) { + this.xaTransactionsEnabled = xaTransactionsEnabled; + return this; + } + + /** + * Get the snaLu6Point2TransactionsEnabled property: Allow SNA LU 6.2 Transactions to managed instance DTC. + * + * @return the snaLu6Point2TransactionsEnabled value. + */ + public Boolean snaLu6Point2TransactionsEnabled() { + return this.snaLu6Point2TransactionsEnabled; + } + + /** + * Set the snaLu6Point2TransactionsEnabled property: Allow SNA LU 6.2 Transactions to managed instance DTC. + * + * @param snaLu6Point2TransactionsEnabled the snaLu6Point2TransactionsEnabled value to set. + * @return the ManagedInstanceDtcSecuritySettings object itself. + */ + public ManagedInstanceDtcSecuritySettings withSnaLu6Point2TransactionsEnabled( + Boolean snaLu6Point2TransactionsEnabled) { + this.snaLu6Point2TransactionsEnabled = snaLu6Point2TransactionsEnabled; + return this; + } + + /** + * Get the xaTransactionsDefaultTimeout property: Default timeout for XA Transactions (in seconds). + * + * @return the xaTransactionsDefaultTimeout value. + */ + public Integer xaTransactionsDefaultTimeout() { + return this.xaTransactionsDefaultTimeout; + } + + /** + * Set the xaTransactionsDefaultTimeout property: Default timeout for XA Transactions (in seconds). + * + * @param xaTransactionsDefaultTimeout the xaTransactionsDefaultTimeout value to set. + * @return the ManagedInstanceDtcSecuritySettings object itself. + */ + public ManagedInstanceDtcSecuritySettings withXaTransactionsDefaultTimeout(Integer xaTransactionsDefaultTimeout) { + this.xaTransactionsDefaultTimeout = xaTransactionsDefaultTimeout; + return this; + } + + /** + * Get the xaTransactionsMaximumTimeout property: Maximum timeout for XA Transactions (in seconds). + * + * @return the xaTransactionsMaximumTimeout value. + */ + public Integer xaTransactionsMaximumTimeout() { + return this.xaTransactionsMaximumTimeout; + } + + /** + * Set the xaTransactionsMaximumTimeout property: Maximum timeout for XA Transactions (in seconds). + * + * @param xaTransactionsMaximumTimeout the xaTransactionsMaximumTimeout value to set. + * @return the ManagedInstanceDtcSecuritySettings object itself. + */ + public ManagedInstanceDtcSecuritySettings withXaTransactionsMaximumTimeout(Integer xaTransactionsMaximumTimeout) { + this.xaTransactionsMaximumTimeout = xaTransactionsMaximumTimeout; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (transactionManagerCommunicationSettings() != null) { + transactionManagerCommunicationSettings().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceDtcTransactionManagerCommunicationSettings.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceDtcTransactionManagerCommunicationSettings.java new file mode 100644 index 0000000000000..3579c21f48e72 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceDtcTransactionManagerCommunicationSettings.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The Transaction Manager Communication Settings of managed instance DTC. */ +@Fluent +public final class ManagedInstanceDtcTransactionManagerCommunicationSettings { + /* + * Allow Inbound traffic to managed instance DTC. + */ + @JsonProperty(value = "allowInboundEnabled") + private Boolean allowInboundEnabled; + + /* + * Allow Outbound traffic of managed instance DTC. + */ + @JsonProperty(value = "allowOutboundEnabled") + private Boolean allowOutboundEnabled; + + /* + * Authentication type of managed instance DTC. + */ + @JsonProperty(value = "authentication") + private String authentication; + + /** Creates an instance of ManagedInstanceDtcTransactionManagerCommunicationSettings class. */ + public ManagedInstanceDtcTransactionManagerCommunicationSettings() { + } + + /** + * Get the allowInboundEnabled property: Allow Inbound traffic to managed instance DTC. + * + * @return the allowInboundEnabled value. + */ + public Boolean allowInboundEnabled() { + return this.allowInboundEnabled; + } + + /** + * Set the allowInboundEnabled property: Allow Inbound traffic to managed instance DTC. + * + * @param allowInboundEnabled the allowInboundEnabled value to set. + * @return the ManagedInstanceDtcTransactionManagerCommunicationSettings object itself. + */ + public ManagedInstanceDtcTransactionManagerCommunicationSettings withAllowInboundEnabled( + Boolean allowInboundEnabled) { + this.allowInboundEnabled = allowInboundEnabled; + return this; + } + + /** + * Get the allowOutboundEnabled property: Allow Outbound traffic of managed instance DTC. + * + * @return the allowOutboundEnabled value. + */ + public Boolean allowOutboundEnabled() { + return this.allowOutboundEnabled; + } + + /** + * Set the allowOutboundEnabled property: Allow Outbound traffic of managed instance DTC. + * + * @param allowOutboundEnabled the allowOutboundEnabled value to set. + * @return the ManagedInstanceDtcTransactionManagerCommunicationSettings object itself. + */ + public ManagedInstanceDtcTransactionManagerCommunicationSettings withAllowOutboundEnabled( + Boolean allowOutboundEnabled) { + this.allowOutboundEnabled = allowOutboundEnabled; + return this; + } + + /** + * Get the authentication property: Authentication type of managed instance DTC. + * + * @return the authentication value. + */ + public String authentication() { + return this.authentication; + } + + /** + * Set the authentication property: Authentication type of managed instance DTC. + * + * @param authentication the authentication value to set. + * @return the ManagedInstanceDtcTransactionManagerCommunicationSettings object itself. + */ + public ManagedInstanceDtcTransactionManagerCommunicationSettings withAuthentication(String authentication) { + this.authentication = authentication; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceDtcs.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceDtcs.java new file mode 100644 index 0000000000000..4fa77da4ceaf4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceDtcs.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ManagedInstanceDtcs. */ +public interface ManagedInstanceDtcs { + /** + * Gets a list of managed instance DTC settings. + * + * @param resourceGroupName The name of the resource group that contains 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance DTC settings as paginated response with {@link PagedIterable}. + */ + PagedIterable listByManagedInstance(String resourceGroupName, String managedInstanceName); + + /** + * Gets a list of managed instance DTC settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance DTC settings as paginated response with {@link PagedIterable}. + */ + PagedIterable listByManagedInstance( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * Gets managed instance DTC settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param dtcName The name of the managed instance DTC. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return managed instance DTC settings along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String managedInstanceName, DtcName dtcName, Context context); + + /** + * Gets managed instance DTC settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param dtcName The name of the managed instance DTC. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return managed instance DTC settings. + */ + ManagedInstanceDtc get(String resourceGroupName, String managedInstanceName, DtcName dtcName); + + /** + * Gets managed instance DTC settings. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return managed instance DTC settings along with {@link Response}. + */ + ManagedInstanceDtc getById(String id); + + /** + * Gets managed instance DTC settings. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return managed instance DTC settings along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ManagedInstanceDtc resource. + * + * @param name resource name. + * @return the first stage of the new ManagedInstanceDtc definition. + */ + ManagedInstanceDtc.DefinitionStages.Blank define(DtcName name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceEditionCapability.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceEditionCapability.java new file mode 100644 index 0000000000000..e821e1f13c9bd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceEditionCapability.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The managed server capability. */ +@Fluent +public final 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 list of supported storage capabilities for this edition + */ + @JsonProperty(value = "supportedStorageCapabilities", access = JsonProperty.Access.WRITE_ONLY) + private List supportedStorageCapabilities; + + /* + * 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. + */ + @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; + + /** Creates an instance of ManagedInstanceEditionCapability class. */ + public ManagedInstanceEditionCapability() { + } + + /** + * Get the name property: The managed server version name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the supportedFamilies property: The supported families. + * + * @return the supportedFamilies value. + */ + public List supportedFamilies() { + return this.supportedFamilies; + } + + /** + * Get the supportedStorageCapabilities property: The list of supported storage capabilities for this edition. + * + * @return the supportedStorageCapabilities value. + */ + public List supportedStorageCapabilities() { + return this.supportedStorageCapabilities; + } + + /** + * Get the zoneRedundant property: Whether or not zone redundancy is supported for the edition. + * + * @return the zoneRedundant value. + */ + public Boolean zoneRedundant() { + return this.zoneRedundant; + } + + /** + * Get the status property: The status of the capability. + * + * @return the status value. + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason property: The reason for the capability not being available. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (supportedFamilies() != null) { + supportedFamilies().forEach(e -> e.validate()); + } + if (supportedStorageCapabilities() != null) { + supportedStorageCapabilities().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceEncryptionProtector.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceEncryptionProtector.java new file mode 100644 index 0000000000000..d2f1665dc1ad2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceEncryptionProtector.java @@ -0,0 +1,257 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceEncryptionProtectorInner; + +/** An immutable client-side representation of ManagedInstanceEncryptionProtector. */ +public interface ManagedInstanceEncryptionProtector { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the kind property: Kind of encryption protector. This is metadata used for the Azure portal experience. + * + * @return the kind value. + */ + String kind(); + + /** + * Gets the serverKeyName property: The name of the managed instance key. + * + * @return the serverKeyName value. + */ + String serverKeyName(); + + /** + * Gets the serverKeyType property: The encryption protector type like 'ServiceManaged', 'AzureKeyVault'. + * + * @return the serverKeyType value. + */ + ServerKeyType serverKeyType(); + + /** + * Gets the uri property: The URI of the server key. + * + * @return the uri value. + */ + String uri(); + + /** + * Gets the thumbprint property: Thumbprint of the server key. + * + * @return the thumbprint value. + */ + String thumbprint(); + + /** + * Gets the autoRotationEnabled property: Key auto rotation opt-in flag. Either true or false. + * + * @return the autoRotationEnabled value. + */ + Boolean autoRotationEnabled(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceEncryptionProtectorInner + * object. + * + * @return the inner object. + */ + ManagedInstanceEncryptionProtectorInner innerModel(); + + /** The entirety of the ManagedInstanceEncryptionProtector definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ManagedInstanceEncryptionProtector definition stages. */ + interface DefinitionStages { + /** The first stage of the ManagedInstanceEncryptionProtector definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ManagedInstanceEncryptionProtector definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, managedInstanceName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @return the next definition stage. + */ + WithCreate withExistingManagedInstance(String resourceGroupName, String managedInstanceName); + } + /** + * The stage of the ManagedInstanceEncryptionProtector definition which contains all the minimum required + * properties for the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithServerKeyName, + DefinitionStages.WithServerKeyType, + DefinitionStages.WithAutoRotationEnabled { + /** + * Executes the create request. + * + * @return the created resource. + */ + ManagedInstanceEncryptionProtector create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ManagedInstanceEncryptionProtector create(Context context); + } + /** The stage of the ManagedInstanceEncryptionProtector definition allowing to specify serverKeyName. */ + interface WithServerKeyName { + /** + * Specifies the serverKeyName property: The name of the managed instance key.. + * + * @param serverKeyName The name of the managed instance key. + * @return the next definition stage. + */ + WithCreate withServerKeyName(String serverKeyName); + } + /** The stage of the ManagedInstanceEncryptionProtector definition allowing to specify serverKeyType. */ + interface WithServerKeyType { + /** + * Specifies the serverKeyType property: The encryption protector type like 'ServiceManaged', + * 'AzureKeyVault'.. + * + * @param serverKeyType The encryption protector type like 'ServiceManaged', 'AzureKeyVault'. + * @return the next definition stage. + */ + WithCreate withServerKeyType(ServerKeyType serverKeyType); + } + /** The stage of the ManagedInstanceEncryptionProtector definition allowing to specify autoRotationEnabled. */ + interface WithAutoRotationEnabled { + /** + * Specifies the autoRotationEnabled property: Key auto rotation opt-in flag. Either true or false.. + * + * @param autoRotationEnabled Key auto rotation opt-in flag. Either true or false. + * @return the next definition stage. + */ + WithCreate withAutoRotationEnabled(Boolean autoRotationEnabled); + } + } + /** + * Begins update for the ManagedInstanceEncryptionProtector resource. + * + * @return the stage of resource update. + */ + ManagedInstanceEncryptionProtector.Update update(); + + /** The template for ManagedInstanceEncryptionProtector update. */ + interface Update + extends UpdateStages.WithServerKeyName, UpdateStages.WithServerKeyType, UpdateStages.WithAutoRotationEnabled { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ManagedInstanceEncryptionProtector apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ManagedInstanceEncryptionProtector apply(Context context); + } + /** The ManagedInstanceEncryptionProtector update stages. */ + interface UpdateStages { + /** The stage of the ManagedInstanceEncryptionProtector update allowing to specify serverKeyName. */ + interface WithServerKeyName { + /** + * Specifies the serverKeyName property: The name of the managed instance key.. + * + * @param serverKeyName The name of the managed instance key. + * @return the next definition stage. + */ + Update withServerKeyName(String serverKeyName); + } + /** The stage of the ManagedInstanceEncryptionProtector update allowing to specify serverKeyType. */ + interface WithServerKeyType { + /** + * Specifies the serverKeyType property: The encryption protector type like 'ServiceManaged', + * 'AzureKeyVault'.. + * + * @param serverKeyType The encryption protector type like 'ServiceManaged', 'AzureKeyVault'. + * @return the next definition stage. + */ + Update withServerKeyType(ServerKeyType serverKeyType); + } + /** The stage of the ManagedInstanceEncryptionProtector update allowing to specify autoRotationEnabled. */ + interface WithAutoRotationEnabled { + /** + * Specifies the autoRotationEnabled property: Key auto rotation opt-in flag. Either true or false.. + * + * @param autoRotationEnabled Key auto rotation opt-in flag. Either true or false. + * @return the next definition stage. + */ + Update withAutoRotationEnabled(Boolean autoRotationEnabled); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ManagedInstanceEncryptionProtector refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ManagedInstanceEncryptionProtector refresh(Context context); + + /** + * Revalidates an existing encryption protector. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void revalidate(); + + /** + * Revalidates an existing encryption protector. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void revalidate(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceEncryptionProtectorListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceEncryptionProtectorListResult.java new file mode 100644 index 0000000000000..b2ab7a35487fa --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceEncryptionProtectorListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceEncryptionProtectorInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of managed instance encryption protectors. */ +@Immutable +public final class ManagedInstanceEncryptionProtectorListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of ManagedInstanceEncryptionProtectorListResult class. */ + public ManagedInstanceEncryptionProtectorListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceEncryptionProtectors.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceEncryptionProtectors.java new file mode 100644 index 0000000000000..8aac1faea0a9b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceEncryptionProtectors.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ManagedInstanceEncryptionProtectors. */ +public interface ManagedInstanceEncryptionProtectors { + /** + * Revalidates 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 encryptionProtectorName The name of the encryption protector to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void revalidate( + String resourceGroupName, String managedInstanceName, EncryptionProtectorName encryptionProtectorName); + + /** + * Revalidates 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 encryptionProtectorName The name of the encryption protector to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void revalidate( + String resourceGroupName, + String managedInstanceName, + EncryptionProtectorName encryptionProtectorName, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance encryption protectors as paginated response with {@link PagedIterable}. + */ + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance encryption protectors as paginated response with {@link PagedIterable}. + */ + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * 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 encryptionProtectorName The name of the encryption protector to be retrieved. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance encryption protector along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + EncryptionProtectorName encryptionProtectorName, + Context context); + + /** + * 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 encryptionProtectorName The name of the encryption protector to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance encryption protector. + */ + ManagedInstanceEncryptionProtector get( + String resourceGroupName, String managedInstanceName, EncryptionProtectorName encryptionProtectorName); + + /** + * Gets a managed instance encryption protector. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance encryption protector along with {@link Response}. + */ + ManagedInstanceEncryptionProtector getById(String id); + + /** + * Gets a managed instance encryption protector. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance encryption protector along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ManagedInstanceEncryptionProtector resource. + * + * @param name resource name. + * @return the first stage of the new ManagedInstanceEncryptionProtector definition. + */ + ManagedInstanceEncryptionProtector.DefinitionStages.Blank define(EncryptionProtectorName name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceExternalAdministrator.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceExternalAdministrator.java new file mode 100644 index 0000000000000..658ee14b677fc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceExternalAdministrator.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +/** Properties of a active directory administrator. */ +@Fluent +public final class ManagedInstanceExternalAdministrator { + /* + * Type of the sever administrator. + */ + @JsonProperty(value = "administratorType") + private AdministratorType administratorType; + + /* + * Principal Type of the sever administrator. + */ + @JsonProperty(value = "principalType") + private PrincipalType principalType; + + /* + * Login name of the server administrator. + */ + @JsonProperty(value = "login") + private String login; + + /* + * SID (object ID) of the server administrator. + */ + @JsonProperty(value = "sid") + private UUID sid; + + /* + * Tenant ID of the administrator. + */ + @JsonProperty(value = "tenantId") + private UUID tenantId; + + /* + * Azure Active Directory only Authentication enabled. + */ + @JsonProperty(value = "azureADOnlyAuthentication") + private Boolean azureADOnlyAuthentication; + + /** Creates an instance of ManagedInstanceExternalAdministrator class. */ + public ManagedInstanceExternalAdministrator() { + } + + /** + * Get the administratorType property: Type of the sever administrator. + * + * @return the administratorType value. + */ + public AdministratorType administratorType() { + return this.administratorType; + } + + /** + * Set the administratorType property: Type of the sever administrator. + * + * @param administratorType the administratorType value to set. + * @return the ManagedInstanceExternalAdministrator object itself. + */ + public ManagedInstanceExternalAdministrator withAdministratorType(AdministratorType administratorType) { + this.administratorType = administratorType; + return this; + } + + /** + * Get the principalType property: Principal Type of the sever administrator. + * + * @return the principalType value. + */ + public PrincipalType principalType() { + return this.principalType; + } + + /** + * Set the principalType property: Principal Type of the sever administrator. + * + * @param principalType the principalType value to set. + * @return the ManagedInstanceExternalAdministrator object itself. + */ + public ManagedInstanceExternalAdministrator withPrincipalType(PrincipalType principalType) { + this.principalType = principalType; + return this; + } + + /** + * Get the login property: Login name of the server administrator. + * + * @return the login value. + */ + public String login() { + return this.login; + } + + /** + * Set the login property: Login name of the server administrator. + * + * @param login the login value to set. + * @return the ManagedInstanceExternalAdministrator object itself. + */ + public ManagedInstanceExternalAdministrator withLogin(String login) { + this.login = login; + return this; + } + + /** + * Get the sid property: SID (object ID) of the server administrator. + * + * @return the sid value. + */ + public UUID sid() { + return this.sid; + } + + /** + * Set the sid property: SID (object ID) of the server administrator. + * + * @param sid the sid value to set. + * @return the ManagedInstanceExternalAdministrator object itself. + */ + public ManagedInstanceExternalAdministrator withSid(UUID sid) { + this.sid = sid; + return this; + } + + /** + * Get the tenantId property: Tenant ID of the administrator. + * + * @return the tenantId value. + */ + public UUID tenantId() { + return this.tenantId; + } + + /** + * Set the tenantId property: Tenant ID of the administrator. + * + * @param tenantId the tenantId value to set. + * @return the ManagedInstanceExternalAdministrator object itself. + */ + public ManagedInstanceExternalAdministrator withTenantId(UUID tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Get the azureADOnlyAuthentication property: Azure Active Directory only Authentication enabled. + * + * @return the azureADOnlyAuthentication value. + */ + public Boolean azureADOnlyAuthentication() { + return this.azureADOnlyAuthentication; + } + + /** + * Set the azureADOnlyAuthentication property: Azure Active Directory only Authentication enabled. + * + * @param azureADOnlyAuthentication the azureADOnlyAuthentication value to set. + * @return the ManagedInstanceExternalAdministrator object itself. + */ + public ManagedInstanceExternalAdministrator withAzureADOnlyAuthentication(Boolean azureADOnlyAuthentication) { + this.azureADOnlyAuthentication = azureADOnlyAuthentication; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceFamilyCapability.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceFamilyCapability.java new file mode 100644 index 0000000000000..f1ddc1430d9fc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceFamilyCapability.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The managed server family capability. */ +@Fluent +public final 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; + + /* + * The status of the capability. + */ + @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; + + /** Creates an instance of ManagedInstanceFamilyCapability class. */ + public ManagedInstanceFamilyCapability() { + } + + /** + * Get the name property: Family name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the sku property: SKU name. + * + * @return the sku value. + */ + public String sku() { + return this.sku; + } + + /** + * Get the supportedLicenseTypes property: List of supported license types. + * + * @return the supportedLicenseTypes value. + */ + public List supportedLicenseTypes() { + return this.supportedLicenseTypes; + } + + /** + * Get the supportedVcoresValues property: List of supported virtual cores values. + * + * @return the supportedVcoresValues value. + */ + public List supportedVcoresValues() { + return this.supportedVcoresValues; + } + + /** + * Get the status property: The status of the capability. + * + * @return the status value. + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason property: The reason for the capability not being available. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (supportedLicenseTypes() != null) { + supportedLicenseTypes().forEach(e -> e.validate()); + } + if (supportedVcoresValues() != null) { + supportedVcoresValues().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceKey.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceKey.java new file mode 100644 index 0000000000000..235c9278688e7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceKey.java @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceKeyInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of ManagedInstanceKey. */ +public interface ManagedInstanceKey { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the kind property: Kind of encryption protector. This is metadata used for the Azure portal experience. + * + * @return the kind value. + */ + String kind(); + + /** + * Gets the serverKeyType property: The key type like 'ServiceManaged', 'AzureKeyVault'. + * + * @return the serverKeyType value. + */ + ServerKeyType serverKeyType(); + + /** + * Gets the uri property: The URI of the key. If the ServerKeyType is AzureKeyVault, then the URI is required. + * + * @return the uri value. + */ + String uri(); + + /** + * Gets the thumbprint property: Thumbprint of the key. + * + * @return the thumbprint value. + */ + String thumbprint(); + + /** + * Gets the creationDate property: The key creation date. + * + * @return the creationDate value. + */ + OffsetDateTime creationDate(); + + /** + * Gets the autoRotationEnabled property: Key auto rotation opt-in flag. Either true or false. + * + * @return the autoRotationEnabled value. + */ + Boolean autoRotationEnabled(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceKeyInner object. + * + * @return the inner object. + */ + ManagedInstanceKeyInner innerModel(); + + /** The entirety of the ManagedInstanceKey definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ManagedInstanceKey definition stages. */ + interface DefinitionStages { + /** The first stage of the ManagedInstanceKey definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ManagedInstanceKey definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, managedInstanceName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @return the next definition stage. + */ + WithCreate withExistingManagedInstance(String resourceGroupName, String managedInstanceName); + } + /** + * The stage of the ManagedInstanceKey definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithServerKeyType, DefinitionStages.WithUri { + /** + * Executes the create request. + * + * @return the created resource. + */ + ManagedInstanceKey create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ManagedInstanceKey create(Context context); + } + /** The stage of the ManagedInstanceKey definition allowing to specify serverKeyType. */ + interface WithServerKeyType { + /** + * Specifies the serverKeyType property: The key type like 'ServiceManaged', 'AzureKeyVault'.. + * + * @param serverKeyType The key type like 'ServiceManaged', 'AzureKeyVault'. + * @return the next definition stage. + */ + WithCreate withServerKeyType(ServerKeyType serverKeyType); + } + /** The stage of the ManagedInstanceKey definition allowing to specify uri. */ + interface WithUri { + /** + * Specifies the uri property: The URI of the key. If the ServerKeyType is AzureKeyVault, then the URI is + * required.. + * + * @param uri The URI of the key. If the ServerKeyType is AzureKeyVault, then the URI is required. + * @return the next definition stage. + */ + WithCreate withUri(String uri); + } + } + /** + * Begins update for the ManagedInstanceKey resource. + * + * @return the stage of resource update. + */ + ManagedInstanceKey.Update update(); + + /** The template for ManagedInstanceKey update. */ + interface Update { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ManagedInstanceKey apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ManagedInstanceKey apply(Context context); + } + /** The ManagedInstanceKey update stages. */ + interface UpdateStages { + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ManagedInstanceKey refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ManagedInstanceKey refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceKeyListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceKeyListResult.java new file mode 100644 index 0000000000000..9904e087070bf --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceKeyListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceKeyInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of managed instance keys. */ +@Immutable +public final class ManagedInstanceKeyListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of ManagedInstanceKeyListResult class. */ + public ManagedInstanceKeyListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceKeys.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceKeys.java new file mode 100644 index 0000000000000..9d8893d286e57 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceKeys.java @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ManagedInstanceKeys. */ +public interface ManagedInstanceKeys { + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance keys as paginated response with {@link PagedIterable}. + */ + PagedIterable listByInstance(String resourceGroupName, String managedInstanceName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance keys as paginated response with {@link PagedIterable}. + */ + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, String filter, Context context); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance key along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String managedInstanceName, String keyName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance key. + */ + ManagedInstanceKey get(String resourceGroupName, String managedInstanceName, String keyName); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String managedInstanceName, String keyName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String managedInstanceName, String keyName, Context context); + + /** + * Gets a managed instance key. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance key along with {@link Response}. + */ + ManagedInstanceKey getById(String id); + + /** + * Gets a managed instance key. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance key along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the managed instance key with the given name. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes the managed instance key with the given name. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ManagedInstanceKey resource. + * + * @param name resource name. + * @return the first stage of the new ManagedInstanceKey definition. + */ + ManagedInstanceKey.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceLicenseType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceLicenseType.java new file mode 100644 index 0000000000000..256e2afa76c69 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceLicenseType.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * The license type. Possible values are 'LicenseIncluded' (regular price inclusive of a new SQL license) and + * 'BasePrice' (discounted AHB price for bringing your own SQL licenses). + */ +public final class ManagedInstanceLicenseType extends ExpandableStringEnum { + /** Static value LicenseIncluded for ManagedInstanceLicenseType. */ + public static final ManagedInstanceLicenseType LICENSE_INCLUDED = fromString("LicenseIncluded"); + + /** Static value BasePrice for ManagedInstanceLicenseType. */ + public static final ManagedInstanceLicenseType BASE_PRICE = fromString("BasePrice"); + + /** + * Creates or finds a ManagedInstanceLicenseType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagedInstanceLicenseType. + */ + @JsonCreator + public static ManagedInstanceLicenseType fromString(String name) { + return fromString(name, ManagedInstanceLicenseType.class); + } + + /** + * Gets known ManagedInstanceLicenseType values. + * + * @return known ManagedInstanceLicenseType values. + */ + public static Collection values() { + return values(ManagedInstanceLicenseType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceListResult.java new file mode 100644 index 0000000000000..5db386e5f9ea3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of managed instances. */ +@Immutable +public final class ManagedInstanceListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of ManagedInstanceListResult class. */ + public ManagedInstanceListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceLongTermRetentionBackup.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceLongTermRetentionBackup.java new file mode 100644 index 0000000000000..5380845cc4692 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceLongTermRetentionBackup.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceLongTermRetentionBackupInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of ManagedInstanceLongTermRetentionBackup. */ +public interface ManagedInstanceLongTermRetentionBackup { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the managedInstanceName property: The managed instance that the backup database belongs to. + * + * @return the managedInstanceName value. + */ + String managedInstanceName(); + + /** + * Gets the managedInstanceCreateTime property: The create time of the instance. + * + * @return the managedInstanceCreateTime value. + */ + OffsetDateTime managedInstanceCreateTime(); + + /** + * Gets the databaseName property: The name of the database the backup belong to. + * + * @return the databaseName value. + */ + String databaseName(); + + /** + * Gets the databaseDeletionTime property: The delete time of the database. + * + * @return the databaseDeletionTime value. + */ + OffsetDateTime databaseDeletionTime(); + + /** + * Gets the backupTime property: The time the backup was taken. + * + * @return the backupTime value. + */ + OffsetDateTime backupTime(); + + /** + * Gets the backupExpirationTime property: The time the long term retention backup will expire. + * + * @return the backupExpirationTime value. + */ + OffsetDateTime backupExpirationTime(); + + /** + * Gets the backupStorageRedundancy property: The storage redundancy type of the backup. + * + * @return the backupStorageRedundancy value. + */ + BackupStorageRedundancy backupStorageRedundancy(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceLongTermRetentionBackupInner + * object. + * + * @return the inner object. + */ + ManagedInstanceLongTermRetentionBackupInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceLongTermRetentionBackupListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceLongTermRetentionBackupListResult.java new file mode 100644 index 0000000000000..dc43d25fb499a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceLongTermRetentionBackupListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceLongTermRetentionBackupInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of long term retention backups for managed database(s). */ +@Immutable +public final class ManagedInstanceLongTermRetentionBackupListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of ManagedInstanceLongTermRetentionBackupListResult class. */ + public ManagedInstanceLongTermRetentionBackupListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceLongTermRetentionPolicies.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceLongTermRetentionPolicies.java new file mode 100644 index 0000000000000..eef4e1440236a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceLongTermRetentionPolicies.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ManagedInstanceLongTermRetentionPolicies. */ +public interface ManagedInstanceLongTermRetentionPolicies { + /** + * Gets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's long term retention policy along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedInstanceLongTermRetentionPolicyName policyName, + Context context); + + /** + * Gets a managed database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param policyName The policy name. Should always be Default. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's long term retention policy. + */ + ManagedInstanceLongTermRetentionPolicy get( + String resourceGroupName, + String managedInstanceName, + String databaseName, + ManagedInstanceLongTermRetentionPolicyName policyName); + + /** + * Gets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's long term retention policy as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName); + + /** + * Gets a database's long term retention policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database's long term retention policy as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String managedInstanceName, String databaseName, Context context); + + /** + * Gets a managed database's long term retention policy. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's long term retention policy along with {@link Response}. + */ + ManagedInstanceLongTermRetentionPolicy getById(String id); + + /** + * Gets a managed database's long term retention policy. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed database's long term retention policy along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ManagedInstanceLongTermRetentionPolicy resource. + * + * @param name resource name. + * @return the first stage of the new ManagedInstanceLongTermRetentionPolicy definition. + */ + ManagedInstanceLongTermRetentionPolicy.DefinitionStages.Blank define( + ManagedInstanceLongTermRetentionPolicyName name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceLongTermRetentionPolicy.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceLongTermRetentionPolicy.java new file mode 100644 index 0000000000000..753807f511091 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceLongTermRetentionPolicy.java @@ -0,0 +1,254 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceLongTermRetentionPolicyInner; + +/** An immutable client-side representation of ManagedInstanceLongTermRetentionPolicy. */ +public interface ManagedInstanceLongTermRetentionPolicy { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the weeklyRetention property: The weekly retention policy for an LTR backup in an ISO 8601 format. + * + * @return the weeklyRetention value. + */ + String weeklyRetention(); + + /** + * Gets the monthlyRetention property: The monthly retention policy for an LTR backup in an ISO 8601 format. + * + * @return the monthlyRetention value. + */ + String monthlyRetention(); + + /** + * Gets the yearlyRetention property: The yearly retention policy for an LTR backup in an ISO 8601 format. + * + * @return the yearlyRetention value. + */ + String yearlyRetention(); + + /** + * Gets the weekOfYear property: The week of year to take the yearly backup in an ISO 8601 format. + * + * @return the weekOfYear value. + */ + Integer weekOfYear(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceLongTermRetentionPolicyInner + * object. + * + * @return the inner object. + */ + ManagedInstanceLongTermRetentionPolicyInner innerModel(); + + /** The entirety of the ManagedInstanceLongTermRetentionPolicy definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ManagedInstanceLongTermRetentionPolicy definition stages. */ + interface DefinitionStages { + /** The first stage of the ManagedInstanceLongTermRetentionPolicy definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ManagedInstanceLongTermRetentionPolicy definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, managedInstanceName, databaseName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @return the next definition stage. + */ + WithCreate withExistingDatabase(String resourceGroupName, String managedInstanceName, String databaseName); + } + /** + * The stage of the ManagedInstanceLongTermRetentionPolicy definition which contains all the minimum required + * properties for the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithWeeklyRetention, + DefinitionStages.WithMonthlyRetention, + DefinitionStages.WithYearlyRetention, + DefinitionStages.WithWeekOfYear { + /** + * Executes the create request. + * + * @return the created resource. + */ + ManagedInstanceLongTermRetentionPolicy create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ManagedInstanceLongTermRetentionPolicy create(Context context); + } + /** The stage of the ManagedInstanceLongTermRetentionPolicy definition allowing to specify weeklyRetention. */ + interface WithWeeklyRetention { + /** + * Specifies the weeklyRetention property: The weekly retention policy for an LTR backup in an ISO 8601 + * format.. + * + * @param weeklyRetention The weekly retention policy for an LTR backup in an ISO 8601 format. + * @return the next definition stage. + */ + WithCreate withWeeklyRetention(String weeklyRetention); + } + /** The stage of the ManagedInstanceLongTermRetentionPolicy definition allowing to specify monthlyRetention. */ + interface WithMonthlyRetention { + /** + * Specifies the monthlyRetention property: The monthly retention policy for an LTR backup in an ISO 8601 + * format.. + * + * @param monthlyRetention The monthly retention policy for an LTR backup in an ISO 8601 format. + * @return the next definition stage. + */ + WithCreate withMonthlyRetention(String monthlyRetention); + } + /** The stage of the ManagedInstanceLongTermRetentionPolicy definition allowing to specify yearlyRetention. */ + interface WithYearlyRetention { + /** + * Specifies the yearlyRetention property: The yearly retention policy for an LTR backup in an ISO 8601 + * format.. + * + * @param yearlyRetention The yearly retention policy for an LTR backup in an ISO 8601 format. + * @return the next definition stage. + */ + WithCreate withYearlyRetention(String yearlyRetention); + } + /** The stage of the ManagedInstanceLongTermRetentionPolicy definition allowing to specify weekOfYear. */ + interface WithWeekOfYear { + /** + * Specifies the weekOfYear property: The week of year to take the yearly backup in an ISO 8601 format.. + * + * @param weekOfYear The week of year to take the yearly backup in an ISO 8601 format. + * @return the next definition stage. + */ + WithCreate withWeekOfYear(Integer weekOfYear); + } + } + /** + * Begins update for the ManagedInstanceLongTermRetentionPolicy resource. + * + * @return the stage of resource update. + */ + ManagedInstanceLongTermRetentionPolicy.Update update(); + + /** The template for ManagedInstanceLongTermRetentionPolicy update. */ + interface Update + extends UpdateStages.WithWeeklyRetention, + UpdateStages.WithMonthlyRetention, + UpdateStages.WithYearlyRetention, + UpdateStages.WithWeekOfYear { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ManagedInstanceLongTermRetentionPolicy apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ManagedInstanceLongTermRetentionPolicy apply(Context context); + } + /** The ManagedInstanceLongTermRetentionPolicy update stages. */ + interface UpdateStages { + /** The stage of the ManagedInstanceLongTermRetentionPolicy update allowing to specify weeklyRetention. */ + interface WithWeeklyRetention { + /** + * Specifies the weeklyRetention property: The weekly retention policy for an LTR backup in an ISO 8601 + * format.. + * + * @param weeklyRetention The weekly retention policy for an LTR backup in an ISO 8601 format. + * @return the next definition stage. + */ + Update withWeeklyRetention(String weeklyRetention); + } + /** The stage of the ManagedInstanceLongTermRetentionPolicy update allowing to specify monthlyRetention. */ + interface WithMonthlyRetention { + /** + * Specifies the monthlyRetention property: The monthly retention policy for an LTR backup in an ISO 8601 + * format.. + * + * @param monthlyRetention The monthly retention policy for an LTR backup in an ISO 8601 format. + * @return the next definition stage. + */ + Update withMonthlyRetention(String monthlyRetention); + } + /** The stage of the ManagedInstanceLongTermRetentionPolicy update allowing to specify yearlyRetention. */ + interface WithYearlyRetention { + /** + * Specifies the yearlyRetention property: The yearly retention policy for an LTR backup in an ISO 8601 + * format.. + * + * @param yearlyRetention The yearly retention policy for an LTR backup in an ISO 8601 format. + * @return the next definition stage. + */ + Update withYearlyRetention(String yearlyRetention); + } + /** The stage of the ManagedInstanceLongTermRetentionPolicy update allowing to specify weekOfYear. */ + interface WithWeekOfYear { + /** + * Specifies the weekOfYear property: The week of year to take the yearly backup in an ISO 8601 format.. + * + * @param weekOfYear The week of year to take the yearly backup in an ISO 8601 format. + * @return the next definition stage. + */ + Update withWeekOfYear(Integer weekOfYear); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ManagedInstanceLongTermRetentionPolicy refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ManagedInstanceLongTermRetentionPolicy refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceLongTermRetentionPolicyListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceLongTermRetentionPolicyListResult.java new file mode 100644 index 0000000000000..4a22d6950879b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceLongTermRetentionPolicyListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceLongTermRetentionPolicyInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of long term retention policies. */ +@Immutable +public final class ManagedInstanceLongTermRetentionPolicyListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of ManagedInstanceLongTermRetentionPolicyListResult class. */ + public ManagedInstanceLongTermRetentionPolicyListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceLongTermRetentionPolicyName.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceLongTermRetentionPolicyName.java new file mode 100644 index 0000000000000..9ae4350ca6505 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceLongTermRetentionPolicyName.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ManagedInstanceLongTermRetentionPolicyName. */ +public final class ManagedInstanceLongTermRetentionPolicyName + extends ExpandableStringEnum { + /** Static value default for ManagedInstanceLongTermRetentionPolicyName. */ + public static final ManagedInstanceLongTermRetentionPolicyName DEFAULT = fromString("default"); + + /** + * Creates or finds a ManagedInstanceLongTermRetentionPolicyName from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagedInstanceLongTermRetentionPolicyName. + */ + @JsonCreator + public static ManagedInstanceLongTermRetentionPolicyName fromString(String name) { + return fromString(name, ManagedInstanceLongTermRetentionPolicyName.class); + } + + /** + * Gets known ManagedInstanceLongTermRetentionPolicyName values. + * + * @return known ManagedInstanceLongTermRetentionPolicyName values. + */ + public static Collection values() { + return values(ManagedInstanceLongTermRetentionPolicyName.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceMaintenanceConfigurationCapability.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceMaintenanceConfigurationCapability.java new file mode 100644 index 0000000000000..12a33e3ba525a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceMaintenanceConfigurationCapability.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The maintenance configuration capability. */ +@Fluent +public final class ManagedInstanceMaintenanceConfigurationCapability { + /* + * Maintenance configuration name + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The status of the capability. + */ + @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; + + /** Creates an instance of ManagedInstanceMaintenanceConfigurationCapability class. */ + public ManagedInstanceMaintenanceConfigurationCapability() { + } + + /** + * Get the name property: Maintenance configuration name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the status property: The status of the capability. + * + * @return the status value. + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason property: The reason for the capability not being available. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: The reason for the capability not being available. + * + * @param reason the reason value to set. + * @return the ManagedInstanceMaintenanceConfigurationCapability object itself. + */ + public ManagedInstanceMaintenanceConfigurationCapability withReason(String reason) { + this.reason = reason; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceOperation.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceOperation.java new file mode 100644 index 0000000000000..9a8bdcaafd2e6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceOperation.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceOperationInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of ManagedInstanceOperation. */ +public interface ManagedInstanceOperation { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the managedInstanceName property: The name of the managed instance the operation is being performed on. + * + * @return the managedInstanceName value. + */ + String managedInstanceName(); + + /** + * Gets the operation property: The name of operation. + * + * @return the operation value. + */ + String operation(); + + /** + * Gets the operationFriendlyName property: The friendly name of operation. + * + * @return the operationFriendlyName value. + */ + String operationFriendlyName(); + + /** + * Gets the percentComplete property: The percentage of the operation completed. + * + * @return the percentComplete value. + */ + Integer percentComplete(); + + /** + * Gets the startTime property: The operation start time. + * + * @return the startTime value. + */ + OffsetDateTime startTime(); + + /** + * Gets the state property: The operation state. + * + * @return the state value. + */ + ManagementOperationState state(); + + /** + * Gets the errorCode property: The operation error code. + * + * @return the errorCode value. + */ + Integer errorCode(); + + /** + * Gets the errorDescription property: The operation error description. + * + * @return the errorDescription value. + */ + String errorDescription(); + + /** + * Gets the errorSeverity property: The operation error severity. + * + * @return the errorSeverity value. + */ + Integer errorSeverity(); + + /** + * Gets the isUserError property: Whether or not the error is a user error. + * + * @return the isUserError value. + */ + Boolean isUserError(); + + /** + * Gets the estimatedCompletionTime property: The estimated completion time of the operation. + * + * @return the estimatedCompletionTime value. + */ + OffsetDateTime estimatedCompletionTime(); + + /** + * Gets the description property: The operation description. + * + * @return the description value. + */ + String description(); + + /** + * Gets the isCancellable property: Whether the operation can be cancelled. + * + * @return the isCancellable value. + */ + Boolean isCancellable(); + + /** + * Gets the operationParameters property: The operation parameters. + * + * @return the operationParameters value. + */ + ManagedInstanceOperationParametersPair operationParameters(); + + /** + * Gets the operationSteps property: The operation steps. + * + * @return the operationSteps value. + */ + ManagedInstanceOperationSteps operationSteps(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceOperationInner object. + * + * @return the inner object. + */ + ManagedInstanceOperationInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceOperationListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceOperationListResult.java new file mode 100644 index 0000000000000..99f020ae4c0b1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceOperationListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceOperationInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response to a list managed instance operations request. */ +@Immutable +public final class ManagedInstanceOperationListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of ManagedInstanceOperationListResult class. */ + public ManagedInstanceOperationListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceOperationParametersPair.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceOperationParametersPair.java new file mode 100644 index 0000000000000..038a6490be7a6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceOperationParametersPair.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The parameters of a managed instance operation. */ +@Immutable +public final class ManagedInstanceOperationParametersPair { + /* + * The current parameters. + */ + @JsonProperty(value = "currentParameters", access = JsonProperty.Access.WRITE_ONLY) + private UpsertManagedServerOperationParameters currentParameters; + + /* + * The requested parameters. + */ + @JsonProperty(value = "requestedParameters", access = JsonProperty.Access.WRITE_ONLY) + private UpsertManagedServerOperationParameters requestedParameters; + + /** Creates an instance of ManagedInstanceOperationParametersPair class. */ + public ManagedInstanceOperationParametersPair() { + } + + /** + * Get the currentParameters property: The current parameters. + * + * @return the currentParameters value. + */ + public UpsertManagedServerOperationParameters currentParameters() { + return this.currentParameters; + } + + /** + * Get the requestedParameters property: The requested parameters. + * + * @return the requestedParameters value. + */ + public UpsertManagedServerOperationParameters requestedParameters() { + return this.requestedParameters; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (currentParameters() != null) { + currentParameters().validate(); + } + if (requestedParameters() != null) { + requestedParameters().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceOperationSteps.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceOperationSteps.java new file mode 100644 index 0000000000000..26aec306a5693 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceOperationSteps.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The steps of a managed instance operation. */ +@Immutable +public final class ManagedInstanceOperationSteps { + /* + * The total number of operation steps. + */ + @JsonProperty(value = "totalSteps", access = JsonProperty.Access.WRITE_ONLY) + private String totalSteps; + + /* + * The number of current operation steps. + */ + @JsonProperty(value = "currentStep", access = JsonProperty.Access.WRITE_ONLY) + private Integer currentStep; + + /* + * The operation steps list. + */ + @JsonProperty(value = "stepsList", access = JsonProperty.Access.WRITE_ONLY) + private List stepsList; + + /** Creates an instance of ManagedInstanceOperationSteps class. */ + public ManagedInstanceOperationSteps() { + } + + /** + * Get the totalSteps property: The total number of operation steps. + * + * @return the totalSteps value. + */ + public String totalSteps() { + return this.totalSteps; + } + + /** + * Get the currentStep property: The number of current operation steps. + * + * @return the currentStep value. + */ + public Integer currentStep() { + return this.currentStep; + } + + /** + * Get the stepsList property: The operation steps list. + * + * @return the stepsList value. + */ + public List stepsList() { + return this.stepsList; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (stepsList() != null) { + stepsList().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceOperations.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceOperations.java new file mode 100644 index 0000000000000..c176f3d1023bc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceOperations.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import java.util.UUID; + +/** Resource collection API of ManagedInstanceOperations. */ +public interface ManagedInstanceOperations { + /** + * Gets a list of operations performed on the managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of operations performed on the managed instance as paginated response with {@link PagedIterable}. + */ + PagedIterable listByManagedInstance(String resourceGroupName, String managedInstanceName); + + /** + * Gets a list of operations performed on the managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of operations performed on the managed instance as paginated response with {@link PagedIterable}. + */ + PagedIterable listByManagedInstance( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * Gets a management operation on a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param operationId The operationId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a management operation on a managed instance along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String managedInstanceName, UUID operationId, Context context); + + /** + * Gets a management operation on a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param operationId The operationId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a management operation on a managed instance. + */ + ManagedInstanceOperation get(String resourceGroupName, String managedInstanceName, UUID operationId); + + /** + * Cancels the asynchronous operation on the managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param operationId The operationId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response cancelWithResponse( + String resourceGroupName, String managedInstanceName, UUID operationId, Context context); + + /** + * Cancels the asynchronous operation on the managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param operationId The operationId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void cancel(String resourceGroupName, String managedInstanceName, UUID operationId); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePairInfo.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePairInfo.java new file mode 100644 index 0000000000000..38144086f1ae1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePairInfo.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Pairs of Managed Instances in the failover group. */ +@Fluent +public final 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; + + /** Creates an instance of ManagedInstancePairInfo class. */ + public ManagedInstancePairInfo() { + } + + /** + * Get the primaryManagedInstanceId property: Id of Primary Managed Instance in pair. + * + * @return the primaryManagedInstanceId value. + */ + public String primaryManagedInstanceId() { + return this.primaryManagedInstanceId; + } + + /** + * Set the primaryManagedInstanceId property: 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 the partnerManagedInstanceId property: Id of Partner Managed Instance in pair. + * + * @return the partnerManagedInstanceId value. + */ + public String partnerManagedInstanceId() { + return this.partnerManagedInstanceId; + } + + /** + * Set the partnerManagedInstanceId property: 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePecProperty.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePecProperty.java new file mode 100644 index 0000000000000..88494550e1988 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePecProperty.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstancePrivateEndpointConnectionProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A private endpoint connection under a managed instance. */ +@Immutable +public final class ManagedInstancePecProperty { + /* + * Resource ID. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * Private endpoint connection properties + */ + @JsonProperty(value = "properties", access = JsonProperty.Access.WRITE_ONLY) + private ManagedInstancePrivateEndpointConnectionProperties properties; + + /** Creates an instance of ManagedInstancePecProperty class. */ + public ManagedInstancePecProperty() { + } + + /** + * Get the id property: Resource ID. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the properties property: Private endpoint connection properties. + * + * @return the properties value. + */ + public ManagedInstancePrivateEndpointConnectionProperties properties() { + return this.properties; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateEndpointConnection.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateEndpointConnection.java new file mode 100644 index 0000000000000..ae4f204111843 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateEndpointConnection.java @@ -0,0 +1,203 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstancePrivateEndpointConnectionInner; + +/** An immutable client-side representation of ManagedInstancePrivateEndpointConnection. */ +public interface ManagedInstancePrivateEndpointConnection { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the privateEndpoint property: Private endpoint which the connection belongs to. + * + * @return the privateEndpoint value. + */ + ManagedInstancePrivateEndpointProperty privateEndpoint(); + + /** + * Gets the privateLinkServiceConnectionState property: Connection State of the Private Endpoint Connection. + * + * @return the privateLinkServiceConnectionState value. + */ + ManagedInstancePrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState(); + + /** + * Gets the provisioningState property: State of the Private Endpoint Connection. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner + * com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstancePrivateEndpointConnectionInner object. + * + * @return the inner object. + */ + ManagedInstancePrivateEndpointConnectionInner innerModel(); + + /** The entirety of the ManagedInstancePrivateEndpointConnection definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ManagedInstancePrivateEndpointConnection definition stages. */ + interface DefinitionStages { + /** The first stage of the ManagedInstancePrivateEndpointConnection definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ManagedInstancePrivateEndpointConnection definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, managedInstanceName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @return the next definition stage. + */ + WithCreate withExistingManagedInstance(String resourceGroupName, String managedInstanceName); + } + /** + * The stage of the ManagedInstancePrivateEndpointConnection definition which contains all the minimum required + * properties for the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithPrivateEndpoint, DefinitionStages.WithPrivateLinkServiceConnectionState { + /** + * Executes the create request. + * + * @return the created resource. + */ + ManagedInstancePrivateEndpointConnection create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ManagedInstancePrivateEndpointConnection create(Context context); + } + /** The stage of the ManagedInstancePrivateEndpointConnection definition allowing to specify privateEndpoint. */ + interface WithPrivateEndpoint { + /** + * Specifies the privateEndpoint property: Private endpoint which the connection belongs to.. + * + * @param privateEndpoint Private endpoint which the connection belongs to. + * @return the next definition stage. + */ + WithCreate withPrivateEndpoint(ManagedInstancePrivateEndpointProperty privateEndpoint); + } + /** + * The stage of the ManagedInstancePrivateEndpointConnection definition allowing to specify + * privateLinkServiceConnectionState. + */ + interface WithPrivateLinkServiceConnectionState { + /** + * Specifies the privateLinkServiceConnectionState property: Connection State of the Private Endpoint + * Connection.. + * + * @param privateLinkServiceConnectionState Connection State of the Private Endpoint Connection. + * @return the next definition stage. + */ + WithCreate withPrivateLinkServiceConnectionState( + ManagedInstancePrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState); + } + } + /** + * Begins update for the ManagedInstancePrivateEndpointConnection resource. + * + * @return the stage of resource update. + */ + ManagedInstancePrivateEndpointConnection.Update update(); + + /** The template for ManagedInstancePrivateEndpointConnection update. */ + interface Update extends UpdateStages.WithPrivateEndpoint, UpdateStages.WithPrivateLinkServiceConnectionState { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ManagedInstancePrivateEndpointConnection apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ManagedInstancePrivateEndpointConnection apply(Context context); + } + /** The ManagedInstancePrivateEndpointConnection update stages. */ + interface UpdateStages { + /** The stage of the ManagedInstancePrivateEndpointConnection update allowing to specify privateEndpoint. */ + interface WithPrivateEndpoint { + /** + * Specifies the privateEndpoint property: Private endpoint which the connection belongs to.. + * + * @param privateEndpoint Private endpoint which the connection belongs to. + * @return the next definition stage. + */ + Update withPrivateEndpoint(ManagedInstancePrivateEndpointProperty privateEndpoint); + } + /** + * The stage of the ManagedInstancePrivateEndpointConnection update allowing to specify + * privateLinkServiceConnectionState. + */ + interface WithPrivateLinkServiceConnectionState { + /** + * Specifies the privateLinkServiceConnectionState property: Connection State of the Private Endpoint + * Connection.. + * + * @param privateLinkServiceConnectionState Connection State of the Private Endpoint Connection. + * @return the next definition stage. + */ + Update withPrivateLinkServiceConnectionState( + ManagedInstancePrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ManagedInstancePrivateEndpointConnection refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ManagedInstancePrivateEndpointConnection refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateEndpointConnectionListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateEndpointConnectionListResult.java new file mode 100644 index 0000000000000..3f4a55163f1c8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateEndpointConnectionListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstancePrivateEndpointConnectionInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of private endpoint connections. */ +@Immutable +public final class ManagedInstancePrivateEndpointConnectionListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of ManagedInstancePrivateEndpointConnectionListResult class. */ + public ManagedInstancePrivateEndpointConnectionListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateEndpointConnections.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateEndpointConnections.java new file mode 100644 index 0000000000000..94bfe224a20c9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateEndpointConnections.java @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ManagedInstancePrivateEndpointConnections. */ +public interface ManagedInstancePrivateEndpointConnections { + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String managedInstanceName, String privateEndpointConnectionName, Context context); + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + ManagedInstancePrivateEndpointConnection get( + String resourceGroupName, String managedInstanceName, String privateEndpointConnectionName); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String managedInstanceName, String privateEndpointConnectionName); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete( + String resourceGroupName, String managedInstanceName, String privateEndpointConnectionName, Context context); + + /** + * Gets all private endpoint connections on a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all private endpoint connections on a server as paginated response with {@link PagedIterable}. + */ + PagedIterable listByManagedInstance( + String resourceGroupName, String managedInstanceName); + + /** + * Gets all private endpoint connections on a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all private endpoint connections on a server as paginated response with {@link PagedIterable}. + */ + PagedIterable listByManagedInstance( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * Gets a private endpoint connection. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection along with {@link Response}. + */ + ManagedInstancePrivateEndpointConnection getById(String id); + + /** + * Gets a private endpoint connection. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ManagedInstancePrivateEndpointConnection resource. + * + * @param name resource name. + * @return the first stage of the new ManagedInstancePrivateEndpointConnection definition. + */ + ManagedInstancePrivateEndpointConnection.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateEndpointProperty.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateEndpointProperty.java new file mode 100644 index 0000000000000..d94a1b55702c6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateEndpointProperty.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The ManagedInstancePrivateEndpointProperty model. */ +@Fluent +public final class ManagedInstancePrivateEndpointProperty { + /* + * Resource id of the private endpoint. + */ + @JsonProperty(value = "id") + private String id; + + /** Creates an instance of ManagedInstancePrivateEndpointProperty class. */ + public ManagedInstancePrivateEndpointProperty() { + } + + /** + * Get the id property: Resource id of the private endpoint. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Resource id of the private endpoint. + * + * @param id the id value to set. + * @return the ManagedInstancePrivateEndpointProperty object itself. + */ + public ManagedInstancePrivateEndpointProperty withId(String id) { + this.id = id; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateLink.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateLink.java new file mode 100644 index 0000000000000..a6f1c21596e7d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateLink.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstancePrivateLinkInner; + +/** An immutable client-side representation of ManagedInstancePrivateLink. */ +public interface ManagedInstancePrivateLink { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: The private link resource group id. + * + * @return the properties value. + */ + ManagedInstancePrivateLinkProperties properties(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstancePrivateLinkInner object. + * + * @return the inner object. + */ + ManagedInstancePrivateLinkInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateLinkListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateLinkListResult.java new file mode 100644 index 0000000000000..05429c61c76d1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateLinkListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstancePrivateLinkInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of private link resources. */ +@Immutable +public final class ManagedInstancePrivateLinkListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of ManagedInstancePrivateLinkListResult class. */ + public ManagedInstancePrivateLinkListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateLinkProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateLinkProperties.java new file mode 100644 index 0000000000000..4d96a6c9940c1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateLinkProperties.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of a private link resource. */ +@Immutable +public final class ManagedInstancePrivateLinkProperties { + /* + * The private link resource group id. + */ + @JsonProperty(value = "groupId", access = JsonProperty.Access.WRITE_ONLY) + private String groupId; + + /* + * The private link resource required member names. + */ + @JsonProperty(value = "requiredMembers", access = JsonProperty.Access.WRITE_ONLY) + private List requiredMembers; + + /** Creates an instance of ManagedInstancePrivateLinkProperties class. */ + public ManagedInstancePrivateLinkProperties() { + } + + /** + * Get the groupId property: The private link resource group id. + * + * @return the groupId value. + */ + public String groupId() { + return this.groupId; + } + + /** + * Get the requiredMembers property: The private link resource required member names. + * + * @return the requiredMembers value. + */ + public List requiredMembers() { + return this.requiredMembers; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateLinkResources.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateLinkResources.java new file mode 100644 index 0000000000000..dfae7c50b21f0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateLinkResources.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ManagedInstancePrivateLinkResources. */ +public interface ManagedInstancePrivateLinkResources { + /** + * Gets the private link resources for 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 managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources for SQL server as paginated response with {@link PagedIterable}. + */ + PagedIterable listByManagedInstance( + String resourceGroupName, String managedInstanceName); + + /** + * Gets the private link resources for 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 managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources for SQL server as paginated response with {@link PagedIterable}. + */ + PagedIterable listByManagedInstance( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * Gets a private link resource for 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 managedInstanceName The name of the managed instance. + * @param groupName The name of the private link resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private link resource for SQL server along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String managedInstanceName, String groupName, Context context); + + /** + * Gets a private link resource for 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 managedInstanceName The name of the managed instance. + * @param groupName The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private link resource for SQL server. + */ + ManagedInstancePrivateLink get(String resourceGroupName, String managedInstanceName, String groupName); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateLinkServiceConnectionStateProperty.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateLinkServiceConnectionStateProperty.java new file mode 100644 index 0000000000000..82bf5dc78cb0c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePrivateLinkServiceConnectionStateProperty.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The ManagedInstancePrivateLinkServiceConnectionStateProperty model. */ +@Fluent +public final class ManagedInstancePrivateLinkServiceConnectionStateProperty { + /* + * The private link service connection status. + */ + @JsonProperty(value = "status", required = true) + private String status; + + /* + * The private link service connection description. + */ + @JsonProperty(value = "description", required = true) + private String description; + + /* + * The private link service connection description. + */ + @JsonProperty(value = "actionsRequired", access = JsonProperty.Access.WRITE_ONLY) + private String actionsRequired; + + /** Creates an instance of ManagedInstancePrivateLinkServiceConnectionStateProperty class. */ + public ManagedInstancePrivateLinkServiceConnectionStateProperty() { + } + + /** + * Get the status property: The private link service connection status. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Set the status property: The private link service connection status. + * + * @param status the status value to set. + * @return the ManagedInstancePrivateLinkServiceConnectionStateProperty object itself. + */ + public ManagedInstancePrivateLinkServiceConnectionStateProperty withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get the description property: The private link service connection description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The private link service connection description. + * + * @param description the description value to set. + * @return the ManagedInstancePrivateLinkServiceConnectionStateProperty object itself. + */ + public ManagedInstancePrivateLinkServiceConnectionStateProperty withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the actionsRequired property: The private link service connection description. + * + * @return the actionsRequired value. + */ + public String actionsRequired() { + return this.actionsRequired; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (status() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property status in model" + + " ManagedInstancePrivateLinkServiceConnectionStateProperty")); + } + if (description() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property description in model" + + " ManagedInstancePrivateLinkServiceConnectionStateProperty")); + } + } + + private static final ClientLogger LOGGER = + new ClientLogger(ManagedInstancePrivateLinkServiceConnectionStateProperty.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePropertiesProvisioningState.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePropertiesProvisioningState.java new file mode 100644 index 0000000000000..3bbea6b0f94dc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstancePropertiesProvisioningState.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ManagedInstancePropertiesProvisioningState. */ +public final class ManagedInstancePropertiesProvisioningState + extends ExpandableStringEnum { + /** Static value Creating for ManagedInstancePropertiesProvisioningState. */ + public static final ManagedInstancePropertiesProvisioningState CREATING = fromString("Creating"); + + /** Static value Deleting for ManagedInstancePropertiesProvisioningState. */ + public static final ManagedInstancePropertiesProvisioningState DELETING = fromString("Deleting"); + + /** Static value Updating for ManagedInstancePropertiesProvisioningState. */ + public static final ManagedInstancePropertiesProvisioningState UPDATING = fromString("Updating"); + + /** Static value Unknown for ManagedInstancePropertiesProvisioningState. */ + public static final ManagedInstancePropertiesProvisioningState UNKNOWN = fromString("Unknown"); + + /** Static value Succeeded for ManagedInstancePropertiesProvisioningState. */ + public static final ManagedInstancePropertiesProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for ManagedInstancePropertiesProvisioningState. */ + public static final ManagedInstancePropertiesProvisioningState FAILED = fromString("Failed"); + + /** Static value Accepted for ManagedInstancePropertiesProvisioningState. */ + public static final ManagedInstancePropertiesProvisioningState ACCEPTED = fromString("Accepted"); + + /** Static value Created for ManagedInstancePropertiesProvisioningState. */ + public static final ManagedInstancePropertiesProvisioningState CREATED = fromString("Created"); + + /** Static value Deleted for ManagedInstancePropertiesProvisioningState. */ + public static final ManagedInstancePropertiesProvisioningState DELETED = fromString("Deleted"); + + /** Static value Unrecognized for ManagedInstancePropertiesProvisioningState. */ + public static final ManagedInstancePropertiesProvisioningState UNRECOGNIZED = fromString("Unrecognized"); + + /** Static value Running for ManagedInstancePropertiesProvisioningState. */ + public static final ManagedInstancePropertiesProvisioningState RUNNING = fromString("Running"); + + /** Static value Canceled for ManagedInstancePropertiesProvisioningState. */ + public static final ManagedInstancePropertiesProvisioningState CANCELED = fromString("Canceled"); + + /** Static value NotSpecified for ManagedInstancePropertiesProvisioningState. */ + public static final ManagedInstancePropertiesProvisioningState NOT_SPECIFIED = fromString("NotSpecified"); + + /** Static value Registering for ManagedInstancePropertiesProvisioningState. */ + public static final ManagedInstancePropertiesProvisioningState REGISTERING = fromString("Registering"); + + /** Static value TimedOut for ManagedInstancePropertiesProvisioningState. */ + public static final ManagedInstancePropertiesProvisioningState TIMED_OUT = fromString("TimedOut"); + + /** + * Creates or finds a ManagedInstancePropertiesProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagedInstancePropertiesProvisioningState. + */ + @JsonCreator + public static ManagedInstancePropertiesProvisioningState fromString(String name) { + return fromString(name, ManagedInstancePropertiesProvisioningState.class); + } + + /** + * Gets known ManagedInstancePropertiesProvisioningState values. + * + * @return known ManagedInstancePropertiesProvisioningState values. + */ + public static Collection values() { + return values(ManagedInstancePropertiesProvisioningState.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceProxyOverride.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceProxyOverride.java new file mode 100644 index 0000000000000..fe390eaab2053 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceProxyOverride.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Connection type used for connecting to the instance. */ +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); + } + + /** + * Gets known ManagedInstanceProxyOverride values. + * + * @return known ManagedInstanceProxyOverride values. + */ + public static Collection values() { + return values(ManagedInstanceProxyOverride.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceQuery.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceQuery.java new file mode 100644 index 0000000000000..394a757435e9b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceQuery.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceQueryInner; + +/** An immutable client-side representation of ManagedInstanceQuery. */ +public interface ManagedInstanceQuery { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the queryText property: Query text. + * + * @return the queryText value. + */ + String queryText(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceQueryInner object. + * + * @return the inner object. + */ + ManagedInstanceQueryInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceQueryStatistics.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceQueryStatistics.java new file mode 100644 index 0000000000000..a4163f0da8f1d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceQueryStatistics.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.QueryStatisticsInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Execution statistics for one particular query. */ +@Immutable +public final class ManagedInstanceQueryStatistics { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of ManagedInstanceQueryStatistics class. */ + public ManagedInstanceQueryStatistics() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceTdeCertificates.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceTdeCertificates.java new file mode 100644 index 0000000000000..4f94ff4961fb9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceTdeCertificates.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; + +/** Resource collection API of ManagedInstanceTdeCertificates. */ +public interface ManagedInstanceTdeCertificates { + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void create(String resourceGroupName, String managedInstanceName, TdeCertificate parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void create(String resourceGroupName, String managedInstanceName, TdeCertificate parameters, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceUpdate.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceUpdate.java new file mode 100644 index 0000000000000..4805aae68e4b0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceUpdate.java @@ -0,0 +1,760 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** An update request for an Azure SQL Database managed instance. */ +@Fluent +public final class ManagedInstanceUpdate { + /* + * Managed instance sku + */ + @JsonProperty(value = "sku") + private Sku sku; + + /* + * Managed instance identity + */ + @JsonProperty(value = "identity") + private ResourceIdentity identity; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ManagedInstanceProperties innerProperties; + + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** Creates an instance of ManagedInstanceUpdate class. */ + public ManagedInstanceUpdate() { + } + + /** + * Get the sku property: Managed instance sku. + * + * @return the sku value. + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku property: 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 identity property: Managed instance identity. + * + * @return the identity value. + */ + public ResourceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: Managed instance identity. + * + * @param identity the identity value to set. + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withIdentity(ResourceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ManagedInstanceProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the provisioningState property: The provisioningState property. + * + * @return the provisioningState value. + */ + public ManagedInstancePropertiesProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the managedInstanceCreateMode property: Specifies the mode of database creation. + * + *

Default: Regular instance creation. + * + *

Restore: Creates an instance by restoring a set of backups to specific point in time. RestorePointInTime and + * SourceManagedInstanceId must be specified. + * + * @return the managedInstanceCreateMode value. + */ + public ManagedServerCreateMode managedInstanceCreateMode() { + return this.innerProperties() == null ? null : this.innerProperties().managedInstanceCreateMode(); + } + + /** + * Set the managedInstanceCreateMode property: Specifies the mode of database creation. + * + *

Default: Regular instance creation. + * + *

Restore: Creates an instance by restoring a set of backups to specific point in time. RestorePointInTime and + * SourceManagedInstanceId must be specified. + * + * @param managedInstanceCreateMode the managedInstanceCreateMode value to set. + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withManagedInstanceCreateMode(ManagedServerCreateMode managedInstanceCreateMode) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withManagedInstanceCreateMode(managedInstanceCreateMode); + return this; + } + + /** + * Get the fullyQualifiedDomainName property: The fully qualified domain name of the managed instance. + * + * @return the fullyQualifiedDomainName value. + */ + public String fullyQualifiedDomainName() { + return this.innerProperties() == null ? null : this.innerProperties().fullyQualifiedDomainName(); + } + + /** + * Get the administratorLogin property: 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.innerProperties() == null ? null : this.innerProperties().administratorLogin(); + } + + /** + * Set the administratorLogin property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withAdministratorLogin(administratorLogin); + return this; + } + + /** + * Get the administratorLoginPassword property: The administrator login password (required for managed instance + * creation). + * + * @return the administratorLoginPassword value. + */ + public String administratorLoginPassword() { + return this.innerProperties() == null ? null : this.innerProperties().administratorLoginPassword(); + } + + /** + * Set the administratorLoginPassword property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withAdministratorLoginPassword(administratorLoginPassword); + return this; + } + + /** + * Get the subnetId property: Subnet resource ID for the managed instance. + * + * @return the subnetId value. + */ + public String subnetId() { + return this.innerProperties() == null ? null : this.innerProperties().subnetId(); + } + + /** + * Set the subnetId property: Subnet resource ID for the managed instance. + * + * @param subnetId the subnetId value to set. + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withSubnetId(String subnetId) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withSubnetId(subnetId); + return this; + } + + /** + * Get the state property: The state of the managed instance. + * + * @return the state value. + */ + public String state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Get the licenseType property: The license type. Possible values are 'LicenseIncluded' (regular price inclusive of + * a new SQL license) and 'BasePrice' (discounted AHB price for bringing your own SQL licenses). + * + * @return the licenseType value. + */ + public ManagedInstanceLicenseType licenseType() { + return this.innerProperties() == null ? null : this.innerProperties().licenseType(); + } + + /** + * Set the licenseType property: The license type. Possible values are 'LicenseIncluded' (regular price inclusive of + * a new SQL license) and 'BasePrice' (discounted AHB price for bringing your own SQL licenses). + * + * @param licenseType the licenseType value to set. + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withLicenseType(ManagedInstanceLicenseType licenseType) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withLicenseType(licenseType); + return this; + } + + /** + * Get the vCores property: The number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80. + * + * @return the vCores value. + */ + public Integer vCores() { + return this.innerProperties() == null ? null : this.innerProperties().vCores(); + } + + /** + * Set the vCores property: The number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80. + * + * @param vCores the vCores value to set. + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withVCores(Integer vCores) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withVCores(vCores); + return this; + } + + /** + * Get the storageSizeInGB property: Storage size in GB. Minimum value: 32. Maximum value: 8192. Increments of 32 GB + * allowed only. + * + * @return the storageSizeInGB value. + */ + public Integer storageSizeInGB() { + return this.innerProperties() == null ? null : this.innerProperties().storageSizeInGB(); + } + + /** + * Set the storageSizeInGB property: Storage size in GB. Minimum value: 32. Maximum value: 8192. Increments of 32 GB + * allowed only. + * + * @param storageSizeInGB the storageSizeInGB value to set. + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withStorageSizeInGB(Integer storageSizeInGB) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withStorageSizeInGB(storageSizeInGB); + return this; + } + + /** + * Get the collation property: Collation of the managed instance. + * + * @return the collation value. + */ + public String collation() { + return this.innerProperties() == null ? null : this.innerProperties().collation(); + } + + /** + * Set the collation property: Collation of the managed instance. + * + * @param collation the collation value to set. + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withCollation(String collation) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withCollation(collation); + return this; + } + + /** + * Get the dnsZone property: The Dns Zone that the managed instance is in. + * + * @return the dnsZone value. + */ + public String dnsZone() { + return this.innerProperties() == null ? null : this.innerProperties().dnsZone(); + } + + /** + * Get the dnsZonePartner property: 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.innerProperties() == null ? null : this.innerProperties().dnsZonePartner(); + } + + /** + * Set the dnsZonePartner property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withDnsZonePartner(dnsZonePartner); + return this; + } + + /** + * Get the publicDataEndpointEnabled property: Whether or not the public data endpoint is enabled. + * + * @return the publicDataEndpointEnabled value. + */ + public Boolean publicDataEndpointEnabled() { + return this.innerProperties() == null ? null : this.innerProperties().publicDataEndpointEnabled(); + } + + /** + * Set the publicDataEndpointEnabled property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withPublicDataEndpointEnabled(publicDataEndpointEnabled); + return this; + } + + /** + * Get the sourceManagedInstanceId property: The resource identifier of the source managed instance associated with + * create operation of this instance. + * + * @return the sourceManagedInstanceId value. + */ + public String sourceManagedInstanceId() { + return this.innerProperties() == null ? null : this.innerProperties().sourceManagedInstanceId(); + } + + /** + * Set the sourceManagedInstanceId property: The resource identifier of the source managed instance associated with + * create operation of this instance. + * + * @param sourceManagedInstanceId the sourceManagedInstanceId value to set. + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withSourceManagedInstanceId(String sourceManagedInstanceId) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withSourceManagedInstanceId(sourceManagedInstanceId); + return this; + } + + /** + * Get the restorePointInTime property: Specifies the point in time (ISO8601 format) of the source database that + * will be restored to create the new database. + * + * @return the restorePointInTime value. + */ + public OffsetDateTime restorePointInTime() { + return this.innerProperties() == null ? null : this.innerProperties().restorePointInTime(); + } + + /** + * Set the restorePointInTime property: Specifies the point in time (ISO8601 format) of the source database that + * will be restored to create the new database. + * + * @param restorePointInTime the restorePointInTime value to set. + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withRestorePointInTime(OffsetDateTime restorePointInTime) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withRestorePointInTime(restorePointInTime); + return this; + } + + /** + * Get the proxyOverride property: Connection type used for connecting to the instance. + * + * @return the proxyOverride value. + */ + public ManagedInstanceProxyOverride proxyOverride() { + return this.innerProperties() == null ? null : this.innerProperties().proxyOverride(); + } + + /** + * Set the proxyOverride property: Connection type used for connecting to the instance. + * + * @param proxyOverride the proxyOverride value to set. + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withProxyOverride(ManagedInstanceProxyOverride proxyOverride) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withProxyOverride(proxyOverride); + return this; + } + + /** + * Get the timezoneId property: Id of the timezone. Allowed values are timezones supported by Windows. Windows keeps + * details on supported timezones, including the id, in registry under KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows + * NT\CurrentVersion\Time Zones. You can get those registry values via SQL Server by querying SELECT name AS + * timezone_id FROM sys.time_zone_info. List of Ids can also be obtained by executing + * [System.TimeZoneInfo]::GetSystemTimeZones() in PowerShell. An example of valid timezone id is "Pacific Standard + * Time" or "W. Europe Standard Time". + * + * @return the timezoneId value. + */ + public String timezoneId() { + return this.innerProperties() == null ? null : this.innerProperties().timezoneId(); + } + + /** + * Set the timezoneId property: Id of the timezone. Allowed values are timezones supported by Windows. Windows keeps + * details on supported timezones, including the id, in registry under KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows + * NT\CurrentVersion\Time Zones. You can get those registry values via SQL Server by querying SELECT name AS + * timezone_id FROM sys.time_zone_info. List of Ids can also be obtained by executing + * [System.TimeZoneInfo]::GetSystemTimeZones() in PowerShell. An example of valid timezone id is "Pacific Standard + * Time" or "W. Europe Standard Time". + * + * @param timezoneId the timezoneId value to set. + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withTimezoneId(String timezoneId) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withTimezoneId(timezoneId); + return this; + } + + /** + * Get the instancePoolId property: The Id of the instance pool this managed server belongs to. + * + * @return the instancePoolId value. + */ + public String instancePoolId() { + return this.innerProperties() == null ? null : this.innerProperties().instancePoolId(); + } + + /** + * Set the instancePoolId property: The Id of the instance pool this managed server belongs to. + * + * @param instancePoolId the instancePoolId value to set. + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withInstancePoolId(String instancePoolId) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withInstancePoolId(instancePoolId); + return this; + } + + /** + * Get the maintenanceConfigurationId property: Specifies maintenance configuration id to apply to this managed + * instance. + * + * @return the maintenanceConfigurationId value. + */ + public String maintenanceConfigurationId() { + return this.innerProperties() == null ? null : this.innerProperties().maintenanceConfigurationId(); + } + + /** + * Set the maintenanceConfigurationId property: Specifies maintenance configuration id to apply to this managed + * instance. + * + * @param maintenanceConfigurationId the maintenanceConfigurationId value to set. + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withMaintenanceConfigurationId(String maintenanceConfigurationId) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withMaintenanceConfigurationId(maintenanceConfigurationId); + return this; + } + + /** + * Get the privateEndpointConnections property: List of private endpoint connections on a managed instance. + * + * @return the privateEndpointConnections value. + */ + public List privateEndpointConnections() { + return this.innerProperties() == null ? null : this.innerProperties().privateEndpointConnections(); + } + + /** + * Get the minimalTlsVersion property: Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2'. + * + * @return the minimalTlsVersion value. + */ + public String minimalTlsVersion() { + return this.innerProperties() == null ? null : this.innerProperties().minimalTlsVersion(); + } + + /** + * Set the minimalTlsVersion property: Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2'. + * + * @param minimalTlsVersion the minimalTlsVersion value to set. + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withMinimalTlsVersion(String minimalTlsVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withMinimalTlsVersion(minimalTlsVersion); + return this; + } + + /** + * Get the currentBackupStorageRedundancy property: The storage account type used to store backups for this + * instance. The options are Local (LocallyRedundantStorage), Zone (ZoneRedundantStorage), Geo (GeoRedundantStorage) + * and GeoZone(GeoZoneRedundantStorage). + * + * @return the currentBackupStorageRedundancy value. + */ + public BackupStorageRedundancy currentBackupStorageRedundancy() { + return this.innerProperties() == null ? null : this.innerProperties().currentBackupStorageRedundancy(); + } + + /** + * Get the requestedBackupStorageRedundancy property: The storage account type to be used to store backups for this + * instance. The options are Local (LocallyRedundantStorage), Zone (ZoneRedundantStorage), Geo (GeoRedundantStorage) + * and GeoZone(GeoZoneRedundantStorage). + * + * @return the requestedBackupStorageRedundancy value. + */ + public BackupStorageRedundancy requestedBackupStorageRedundancy() { + return this.innerProperties() == null ? null : this.innerProperties().requestedBackupStorageRedundancy(); + } + + /** + * Set the requestedBackupStorageRedundancy property: The storage account type to be used to store backups for this + * instance. The options are Local (LocallyRedundantStorage), Zone (ZoneRedundantStorage), Geo (GeoRedundantStorage) + * and GeoZone(GeoZoneRedundantStorage). + * + * @param requestedBackupStorageRedundancy the requestedBackupStorageRedundancy value to set. + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withRequestedBackupStorageRedundancy( + BackupStorageRedundancy requestedBackupStorageRedundancy) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withRequestedBackupStorageRedundancy(requestedBackupStorageRedundancy); + return this; + } + + /** + * Get the zoneRedundant property: Whether or not the multi-az is enabled. + * + * @return the zoneRedundant value. + */ + public Boolean zoneRedundant() { + return this.innerProperties() == null ? null : this.innerProperties().zoneRedundant(); + } + + /** + * Set the zoneRedundant property: Whether or not the multi-az is enabled. + * + * @param zoneRedundant the zoneRedundant value to set. + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withZoneRedundant(Boolean zoneRedundant) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withZoneRedundant(zoneRedundant); + return this; + } + + /** + * Get the primaryUserAssignedIdentityId property: The resource id of a user assigned identity to be used by + * default. + * + * @return the primaryUserAssignedIdentityId value. + */ + public String primaryUserAssignedIdentityId() { + return this.innerProperties() == null ? null : this.innerProperties().primaryUserAssignedIdentityId(); + } + + /** + * Set the primaryUserAssignedIdentityId property: The resource id of a user assigned identity to be used by + * default. + * + * @param primaryUserAssignedIdentityId the primaryUserAssignedIdentityId value to set. + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withPrimaryUserAssignedIdentityId(String primaryUserAssignedIdentityId) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withPrimaryUserAssignedIdentityId(primaryUserAssignedIdentityId); + return this; + } + + /** + * Get the keyId property: A CMK URI of the key to use for encryption. + * + * @return the keyId value. + */ + public String keyId() { + return this.innerProperties() == null ? null : this.innerProperties().keyId(); + } + + /** + * Set the keyId property: A CMK URI of the key to use for encryption. + * + * @param keyId the keyId value to set. + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withKeyId(String keyId) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withKeyId(keyId); + return this; + } + + /** + * Get the administrators property: The Azure Active Directory administrator of the server. + * + * @return the administrators value. + */ + public ManagedInstanceExternalAdministrator administrators() { + return this.innerProperties() == null ? null : this.innerProperties().administrators(); + } + + /** + * Set the administrators property: The Azure Active Directory administrator of the server. + * + * @param administrators the administrators value to set. + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withAdministrators(ManagedInstanceExternalAdministrator administrators) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withAdministrators(administrators); + return this; + } + + /** + * Get the servicePrincipal property: The managed instance's service principal. + * + * @return the servicePrincipal value. + */ + public ServicePrincipal servicePrincipal() { + return this.innerProperties() == null ? null : this.innerProperties().servicePrincipal(); + } + + /** + * Set the servicePrincipal property: The managed instance's service principal. + * + * @param servicePrincipal the servicePrincipal value to set. + * @return the ManagedInstanceUpdate object itself. + */ + public ManagedInstanceUpdate withServicePrincipal(ServicePrincipal servicePrincipal) { + if (this.innerProperties() == null) { + this.innerProperties = new ManagedInstanceProperties(); + } + this.innerProperties().withServicePrincipal(servicePrincipal); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + if (identity() != null) { + identity().validate(); + } + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceVcoresCapability.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceVcoresCapability.java new file mode 100644 index 0000000000000..0d18fa17f43fb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceVcoresCapability.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The managed instance virtual cores capability. */ +@Fluent +public final 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; + + /* + * 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; + + /* + * True if this service objective is supported for managed instances in an instance pool. + */ + @JsonProperty(value = "instancePoolSupported", access = JsonProperty.Access.WRITE_ONLY) + private Boolean instancePoolSupported; + + /* + * True if this service objective is supported for standalone managed instances. + */ + @JsonProperty(value = "standaloneSupported", access = JsonProperty.Access.WRITE_ONLY) + private Boolean standaloneSupported; + + /* + * List of supported maintenance configurations + */ + @JsonProperty(value = "supportedMaintenanceConfigurations", access = JsonProperty.Access.WRITE_ONLY) + private List supportedMaintenanceConfigurations; + + /* + * The status of the capability. + */ + @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; + + /** Creates an instance of ManagedInstanceVcoresCapability class. */ + public ManagedInstanceVcoresCapability() { + } + + /** + * Get the name property: The virtual cores identifier. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the value property: The virtual cores value. + * + * @return the value value. + */ + public Integer value() { + return this.value; + } + + /** + * Get the includedMaxSize property: Included size. + * + * @return the includedMaxSize value. + */ + public MaxSizeCapability includedMaxSize() { + return this.includedMaxSize; + } + + /** + * Get the supportedStorageSizes property: Storage size ranges. + * + * @return the supportedStorageSizes value. + */ + public List supportedStorageSizes() { + return this.supportedStorageSizes; + } + + /** + * Get the instancePoolSupported property: True if this service objective is supported for managed instances in an + * instance pool. + * + * @return the instancePoolSupported value. + */ + public Boolean instancePoolSupported() { + return this.instancePoolSupported; + } + + /** + * Get the standaloneSupported property: True if this service objective is supported for standalone managed + * instances. + * + * @return the standaloneSupported value. + */ + public Boolean standaloneSupported() { + return this.standaloneSupported; + } + + /** + * Get the supportedMaintenanceConfigurations property: List of supported maintenance configurations. + * + * @return the supportedMaintenanceConfigurations value. + */ + public List supportedMaintenanceConfigurations() { + return this.supportedMaintenanceConfigurations; + } + + /** + * Get the status property: The status of the capability. + * + * @return the status value. + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason property: The reason for the capability not being available. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (includedMaxSize() != null) { + includedMaxSize().validate(); + } + if (supportedStorageSizes() != null) { + supportedStorageSizes().forEach(e -> e.validate()); + } + if (supportedMaintenanceConfigurations() != null) { + supportedMaintenanceConfigurations().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceVersionCapability.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceVersionCapability.java new file mode 100644 index 0000000000000..cc3afa345a717 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceVersionCapability.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The managed instance capability. */ +@Fluent +public final 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 list of supported instance pool editions. + */ + @JsonProperty(value = "supportedInstancePoolEditions", access = JsonProperty.Access.WRITE_ONLY) + private List supportedInstancePoolEditions; + + /* + * The status of the capability. + */ + @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; + + /** Creates an instance of ManagedInstanceVersionCapability class. */ + public ManagedInstanceVersionCapability() { + } + + /** + * Get the name property: The server version name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the supportedEditions property: The list of supported managed instance editions. + * + * @return the supportedEditions value. + */ + public List supportedEditions() { + return this.supportedEditions; + } + + /** + * Get the supportedInstancePoolEditions property: The list of supported instance pool editions. + * + * @return the supportedInstancePoolEditions value. + */ + public List supportedInstancePoolEditions() { + return this.supportedInstancePoolEditions; + } + + /** + * Get the status property: The status of the capability. + * + * @return the status value. + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason property: The reason for the capability not being available. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (supportedEditions() != null) { + supportedEditions().forEach(e -> e.validate()); + } + if (supportedInstancePoolEditions() != null) { + supportedInstancePoolEditions().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceVulnerabilityAssessment.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceVulnerabilityAssessment.java new file mode 100644 index 0000000000000..098368f860f7d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceVulnerabilityAssessment.java @@ -0,0 +1,291 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceVulnerabilityAssessmentInner; + +/** An immutable client-side representation of ManagedInstanceVulnerabilityAssessment. */ +public interface ManagedInstanceVulnerabilityAssessment { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the storageContainerPath property: A blob storage container path to hold the scan results (e.g. + * https://myStorage.blob.core.windows.net/VaScans/). + * + * @return the storageContainerPath value. + */ + String storageContainerPath(); + + /** + * Gets the storageContainerSasKey property: 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. Applies only if the storage account is not behind a Vnet or a firewall. + * + * @return the storageContainerSasKey value. + */ + String storageContainerSasKey(); + + /** + * Gets the storageAccountAccessKey property: Specifies the identifier key of the storage account for vulnerability + * assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. + * Applies only if the storage account is not behind a Vnet or a firewall. + * + * @return the storageAccountAccessKey value. + */ + String storageAccountAccessKey(); + + /** + * Gets the recurringScans property: The recurring scans settings. + * + * @return the recurringScans value. + */ + VulnerabilityAssessmentRecurringScansProperties recurringScans(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceVulnerabilityAssessmentInner + * object. + * + * @return the inner object. + */ + ManagedInstanceVulnerabilityAssessmentInner innerModel(); + + /** The entirety of the ManagedInstanceVulnerabilityAssessment definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ManagedInstanceVulnerabilityAssessment definition stages. */ + interface DefinitionStages { + /** The first stage of the ManagedInstanceVulnerabilityAssessment definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ManagedInstanceVulnerabilityAssessment definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, managedInstanceName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance for which the vulnerability assessment is + * defined. + * @return the next definition stage. + */ + WithCreate withExistingManagedInstance(String resourceGroupName, String managedInstanceName); + } + /** + * The stage of the ManagedInstanceVulnerabilityAssessment definition which contains all the minimum required + * properties for the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithStorageContainerPath, + DefinitionStages.WithStorageContainerSasKey, + DefinitionStages.WithStorageAccountAccessKey, + DefinitionStages.WithRecurringScans { + /** + * Executes the create request. + * + * @return the created resource. + */ + ManagedInstanceVulnerabilityAssessment create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ManagedInstanceVulnerabilityAssessment create(Context context); + } + /** + * The stage of the ManagedInstanceVulnerabilityAssessment definition allowing to specify storageContainerPath. + */ + interface WithStorageContainerPath { + /** + * Specifies the storageContainerPath property: A blob storage container path to hold the scan results (e.g. + * https://myStorage.blob.core.windows.net/VaScans/).. + * + * @param storageContainerPath A blob storage container path to hold the scan results (e.g. + * https://myStorage.blob.core.windows.net/VaScans/). + * @return the next definition stage. + */ + WithCreate withStorageContainerPath(String storageContainerPath); + } + /** + * The stage of the ManagedInstanceVulnerabilityAssessment definition allowing to specify + * storageContainerSasKey. + */ + interface WithStorageContainerSasKey { + /** + * Specifies the storageContainerSasKey property: 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. Applies only if the storage account is not behind a Vnet + * or a firewall. + * + * @param storageContainerSasKey A shared access signature (SAS Key) that has write access to the blob + * container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't + * specified, StorageContainerSasKey is required. Applies only if the storage account is not behind a + * Vnet or a firewall. + * @return the next definition stage. + */ + WithCreate withStorageContainerSasKey(String storageContainerSasKey); + } + /** + * The stage of the ManagedInstanceVulnerabilityAssessment definition allowing to specify + * storageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies the storageAccountAccessKey property: Specifies the identifier key of the storage account for + * vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified, + * storageAccountAccessKey is required. Applies only if the storage account is not behind a Vnet or a + * firewall. + * + * @param storageAccountAccessKey Specifies the identifier key of the storage account for vulnerability + * assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is + * required. Applies only if the storage account is not behind a Vnet or a firewall. + * @return the next definition stage. + */ + WithCreate withStorageAccountAccessKey(String storageAccountAccessKey); + } + /** The stage of the ManagedInstanceVulnerabilityAssessment definition allowing to specify recurringScans. */ + interface WithRecurringScans { + /** + * Specifies the recurringScans property: The recurring scans settings. + * + * @param recurringScans The recurring scans settings. + * @return the next definition stage. + */ + WithCreate withRecurringScans(VulnerabilityAssessmentRecurringScansProperties recurringScans); + } + } + /** + * Begins update for the ManagedInstanceVulnerabilityAssessment resource. + * + * @return the stage of resource update. + */ + ManagedInstanceVulnerabilityAssessment.Update update(); + + /** The template for ManagedInstanceVulnerabilityAssessment update. */ + interface Update + extends UpdateStages.WithStorageContainerPath, + UpdateStages.WithStorageContainerSasKey, + UpdateStages.WithStorageAccountAccessKey, + UpdateStages.WithRecurringScans { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ManagedInstanceVulnerabilityAssessment apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ManagedInstanceVulnerabilityAssessment apply(Context context); + } + /** The ManagedInstanceVulnerabilityAssessment update stages. */ + interface UpdateStages { + /** The stage of the ManagedInstanceVulnerabilityAssessment update allowing to specify storageContainerPath. */ + interface WithStorageContainerPath { + /** + * Specifies the storageContainerPath property: A blob storage container path to hold the scan results (e.g. + * https://myStorage.blob.core.windows.net/VaScans/).. + * + * @param storageContainerPath A blob storage container path to hold the scan results (e.g. + * https://myStorage.blob.core.windows.net/VaScans/). + * @return the next definition stage. + */ + Update withStorageContainerPath(String storageContainerPath); + } + /** + * The stage of the ManagedInstanceVulnerabilityAssessment update allowing to specify storageContainerSasKey. + */ + interface WithStorageContainerSasKey { + /** + * Specifies the storageContainerSasKey property: 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. Applies only if the storage account is not behind a Vnet + * or a firewall. + * + * @param storageContainerSasKey A shared access signature (SAS Key) that has write access to the blob + * container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't + * specified, StorageContainerSasKey is required. Applies only if the storage account is not behind a + * Vnet or a firewall. + * @return the next definition stage. + */ + Update withStorageContainerSasKey(String storageContainerSasKey); + } + /** + * The stage of the ManagedInstanceVulnerabilityAssessment update allowing to specify storageAccountAccessKey. + */ + interface WithStorageAccountAccessKey { + /** + * Specifies the storageAccountAccessKey property: Specifies the identifier key of the storage account for + * vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified, + * storageAccountAccessKey is required. Applies only if the storage account is not behind a Vnet or a + * firewall. + * + * @param storageAccountAccessKey Specifies the identifier key of the storage account for vulnerability + * assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is + * required. Applies only if the storage account is not behind a Vnet or a firewall. + * @return the next definition stage. + */ + Update withStorageAccountAccessKey(String storageAccountAccessKey); + } + /** The stage of the ManagedInstanceVulnerabilityAssessment update allowing to specify recurringScans. */ + interface WithRecurringScans { + /** + * Specifies the recurringScans property: The recurring scans settings. + * + * @param recurringScans The recurring scans settings. + * @return the next definition stage. + */ + Update withRecurringScans(VulnerabilityAssessmentRecurringScansProperties recurringScans); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ManagedInstanceVulnerabilityAssessment refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ManagedInstanceVulnerabilityAssessment refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceVulnerabilityAssessmentListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceVulnerabilityAssessmentListResult.java new file mode 100644 index 0000000000000..4b41bddec6b8e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceVulnerabilityAssessmentListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedInstanceVulnerabilityAssessmentInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of the ManagedInstance's vulnerability assessments. */ +@Immutable +public final class ManagedInstanceVulnerabilityAssessmentListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of ManagedInstanceVulnerabilityAssessmentListResult class. */ + public ManagedInstanceVulnerabilityAssessmentListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceVulnerabilityAssessments.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceVulnerabilityAssessments.java new file mode 100644 index 0000000000000..e54c0b5a649ee --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstanceVulnerabilityAssessments.java @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ManagedInstanceVulnerabilityAssessments. */ +public interface ManagedInstanceVulnerabilityAssessments { + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed instance's vulnerability assessment along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed instance's vulnerability assessment. + */ + ManagedInstanceVulnerabilityAssessment get( + String resourceGroupName, String managedInstanceName, VulnerabilityAssessmentName vulnerabilityAssessmentName); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse( + String resourceGroupName, + String managedInstanceName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete( + String resourceGroupName, String managedInstanceName, VulnerabilityAssessmentName vulnerabilityAssessmentName); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed instance's vulnerability assessment policies as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByInstance( + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed instance's vulnerability assessment policies as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * Gets the managed instance's vulnerability assessment. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed instance's vulnerability assessment along with {@link Response}. + */ + ManagedInstanceVulnerabilityAssessment getById(String id); + + /** + * Gets the managed instance's vulnerability assessment. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed instance's vulnerability assessment along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Removes the managed instance's vulnerability assessment. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Removes the managed instance's vulnerability assessment. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ManagedInstanceVulnerabilityAssessment resource. + * + * @param name resource name. + * @return the first stage of the new ManagedInstanceVulnerabilityAssessment definition. + */ + ManagedInstanceVulnerabilityAssessment.DefinitionStages.Blank define(VulnerabilityAssessmentName name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstances.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstances.java new file mode 100644 index 0000000000000..a8a7fbf6b292d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedInstances.java @@ -0,0 +1,266 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ManagedInstances. */ +public interface ManagedInstances { + /** + * Gets a list of all managed instances in an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The instance pool name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all managed instances in an instance pool as paginated response with {@link PagedIterable}. + */ + PagedIterable listByInstancePool(String resourceGroupName, String instancePoolName); + + /** + * Gets a list of all managed instances in an instance pool. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The instance pool name. + * @param expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all managed instances in an instance pool as paginated response with {@link PagedIterable}. + */ + PagedIterable listByInstancePool( + String resourceGroupName, String instancePoolName, String expand, Context context); + + /** + * Gets a list of all managed instances in the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all managed instances in the subscription as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Gets a list of all managed instances in the subscription. + * + * @param expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all managed instances in the subscription as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String expand, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instances in a resource group as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * 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 expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instances in a resource group as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, String expand, Context context); + + /** + * 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 expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String managedInstanceName, String expand, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance. + */ + ManagedInstance getByResourceGroup(String resourceGroupName, String managedInstanceName); + + /** + * Deletes a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String managedInstanceName); + + /** + * Deletes a managed instance. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String managedInstanceName, Context context); + + /** + * Get top resource consuming queries of 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return top resource consuming queries of a managed instance as paginated response with {@link PagedIterable}. + */ + PagedIterable listByManagedInstance(String resourceGroupName, String managedInstanceName); + + /** + * Get top resource consuming queries of 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 numberOfQueries How many 'top queries' to return. Default is 5. + * @param databases Comma separated list of databases to be included into search. All DB's are included if this + * parameter is not specified. + * @param startTime Start time for observed period. + * @param endTime End time for observed period. + * @param interval The time step to be used to summarize the metric values. Default value is PT1H. + * @param aggregationFunction Aggregation function to be used, default value is 'sum'. + * @param observationMetric Metric to be used for ranking top queries. Default is 'cpu'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return top resource consuming queries of a managed instance as paginated response with {@link PagedIterable}. + */ + PagedIterable listByManagedInstance( + String resourceGroupName, + String managedInstanceName, + Integer numberOfQueries, + String databases, + String startTime, + String endTime, + QueryTimeGrainType interval, + AggregationFunctionType aggregationFunction, + MetricType observationMetric, + Context context); + + /** + * Failovers 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 to failover. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void failover(String resourceGroupName, String managedInstanceName); + + /** + * Failovers 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 to failover. + * @param replicaType The type of replica to be failed over. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void failover(String resourceGroupName, String managedInstanceName, ReplicaType replicaType, Context context); + + /** + * Gets a managed instance. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance along with {@link Response}. + */ + ManagedInstance getById(String id); + + /** + * Gets a managed instance. + * + * @param id the resource ID. + * @param expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance along with {@link Response}. + */ + Response getByIdWithResponse(String id, String expand, Context context); + + /** + * Deletes a managed instance. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a managed instance. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ManagedInstance resource. + * + * @param name resource name. + * @return the first stage of the new ManagedInstance definition. + */ + ManagedInstance.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies.java new file mode 100644 index 0000000000000..e0a2cf63e2f30 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedBackupShortTermRetentionPolicyInner; + +/** Resource collection API of ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies. */ +public interface ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies { + /** + * 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 restorableDroppedDatabaseId parameter. + * @param policyName The policy name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a dropped database's short term retention policy along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + Context context); + + /** + * 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 restorableDroppedDatabaseId parameter. + * @param policyName The policy name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a dropped database's short term retention policy. + */ + ManagedBackupShortTermRetentionPolicy get( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName); + + /** + * Sets 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a short term retention policy. + */ + ManagedBackupShortTermRetentionPolicy createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters); + + /** + * Sets 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a short term retention policy. + */ + ManagedBackupShortTermRetentionPolicy createOrUpdate( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context); + + /** + * Sets 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a short term retention policy. + */ + ManagedBackupShortTermRetentionPolicy update( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters); + + /** + * Sets 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 managedInstanceName The name of the managed instance. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param policyName The policy name. Should always be "default". + * @param parameters The short term retention policy info. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a short term retention policy. + */ + ManagedBackupShortTermRetentionPolicy update( + String resourceGroupName, + String managedInstanceName, + String restorableDroppedDatabaseId, + ManagedShortTermRetentionPolicyName policyName, + ManagedBackupShortTermRetentionPolicyInner parameters, + Context context); + + /** + * 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 restorableDroppedDatabaseId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a dropped database's short term retention policy list as paginated response with {@link PagedIterable}. + */ + PagedIterable listByRestorableDroppedDatabase( + 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 restorableDroppedDatabaseId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a dropped database's short term retention policy list as paginated response with {@link PagedIterable}. + */ + PagedIterable listByRestorableDroppedDatabase( + String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedServerCreateMode.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedServerCreateMode.java new file mode 100644 index 0000000000000..f9e63fb2ed315 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedServerCreateMode.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * Specifies the mode of database creation. + * + *

Default: Regular instance creation. + * + *

Restore: Creates an instance by restoring a set of backups to specific point in time. RestorePointInTime and + * SourceManagedInstanceId must be specified. + */ +public final class ManagedServerCreateMode extends ExpandableStringEnum { + /** Static value Default for ManagedServerCreateMode. */ + public static final ManagedServerCreateMode DEFAULT = fromString("Default"); + + /** Static value PointInTimeRestore for ManagedServerCreateMode. */ + public static final ManagedServerCreateMode POINT_IN_TIME_RESTORE = fromString("PointInTimeRestore"); + + /** + * Creates or finds a ManagedServerCreateMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagedServerCreateMode. + */ + @JsonCreator + public static ManagedServerCreateMode fromString(String name) { + return fromString(name, ManagedServerCreateMode.class); + } + + /** + * Gets known ManagedServerCreateMode values. + * + * @return known ManagedServerCreateMode values. + */ + public static Collection values() { + return values(ManagedServerCreateMode.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedServerDnsAlias.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedServerDnsAlias.java new file mode 100644 index 0000000000000..5e1ae15211a6a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedServerDnsAlias.java @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedServerDnsAliasInner; + +/** An immutable client-side representation of ManagedServerDnsAlias. */ +public interface ManagedServerDnsAlias { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the azureDnsRecord property: The fully qualified DNS record for managed server alias. + * + * @return the azureDnsRecord value. + */ + String azureDnsRecord(); + + /** + * Gets the publicAzureDnsRecord property: The fully qualified public DNS record for managed server alias. + * + * @return the publicAzureDnsRecord value. + */ + String publicAzureDnsRecord(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ManagedServerDnsAliasInner object. + * + * @return the inner object. + */ + ManagedServerDnsAliasInner innerModel(); + + /** The entirety of the ManagedServerDnsAlias definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ManagedServerDnsAlias definition stages. */ + interface DefinitionStages { + /** The first stage of the ManagedServerDnsAlias definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ManagedServerDnsAlias definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, managedInstanceName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @return the next definition stage. + */ + WithCreate withExistingManagedInstance(String resourceGroupName, String managedInstanceName); + } + /** + * The stage of the ManagedServerDnsAlias definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithCreateDnsRecord { + /** + * Executes the create request. + * + * @return the created resource. + */ + ManagedServerDnsAlias create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ManagedServerDnsAlias create(Context context); + } + /** The stage of the ManagedServerDnsAlias definition allowing to specify createDnsRecord. */ + interface WithCreateDnsRecord { + /** + * Specifies the createDnsRecord property: Whether or not DNS record should be created for this alias.. + * + * @param createDnsRecord Whether or not DNS record should be created for this alias. + * @return the next definition stage. + */ + WithCreate withCreateDnsRecord(Boolean createDnsRecord); + } + } + /** + * Begins update for the ManagedServerDnsAlias resource. + * + * @return the stage of resource update. + */ + ManagedServerDnsAlias.Update update(); + + /** The template for ManagedServerDnsAlias update. */ + interface Update extends UpdateStages.WithCreateDnsRecord { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ManagedServerDnsAlias apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ManagedServerDnsAlias apply(Context context); + } + /** The ManagedServerDnsAlias update stages. */ + interface UpdateStages { + /** The stage of the ManagedServerDnsAlias update allowing to specify createDnsRecord. */ + interface WithCreateDnsRecord { + /** + * Specifies the createDnsRecord property: Whether or not DNS record should be created for this alias.. + * + * @param createDnsRecord Whether or not DNS record should be created for this alias. + * @return the next definition stage. + */ + Update withCreateDnsRecord(Boolean createDnsRecord); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ManagedServerDnsAlias refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ManagedServerDnsAlias refresh(Context context); + + /** + * Acquires managed server DNS alias from another managed server. + * + * @param parameters A managed server DNS alias acquisition request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed server DNS alias. + */ + ManagedServerDnsAlias acquire(ManagedServerDnsAliasAcquisition parameters); + + /** + * Acquires managed server DNS alias from another managed server. + * + * @param parameters A managed server DNS alias acquisition request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed server DNS alias. + */ + ManagedServerDnsAlias acquire(ManagedServerDnsAliasAcquisition parameters, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedServerDnsAliasAcquisition.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedServerDnsAliasAcquisition.java new file mode 100644 index 0000000000000..9e26f71b30cfb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedServerDnsAliasAcquisition.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A managed server DNS alias acquisition request. */ +@Fluent +public final class ManagedServerDnsAliasAcquisition { + /* + * The resource ID of the managed server DNS alias that will be acquired to point to this managed server instead. + */ + @JsonProperty(value = "oldManagedServerDnsAliasResourceId", required = true) + private String oldManagedServerDnsAliasResourceId; + + /** Creates an instance of ManagedServerDnsAliasAcquisition class. */ + public ManagedServerDnsAliasAcquisition() { + } + + /** + * Get the oldManagedServerDnsAliasResourceId property: The resource ID of the managed server DNS alias that will be + * acquired to point to this managed server instead. + * + * @return the oldManagedServerDnsAliasResourceId value. + */ + public String oldManagedServerDnsAliasResourceId() { + return this.oldManagedServerDnsAliasResourceId; + } + + /** + * Set the oldManagedServerDnsAliasResourceId property: The resource ID of the managed server DNS alias that will be + * acquired to point to this managed server instead. + * + * @param oldManagedServerDnsAliasResourceId the oldManagedServerDnsAliasResourceId value to set. + * @return the ManagedServerDnsAliasAcquisition object itself. + */ + public ManagedServerDnsAliasAcquisition withOldManagedServerDnsAliasResourceId( + String oldManagedServerDnsAliasResourceId) { + this.oldManagedServerDnsAliasResourceId = oldManagedServerDnsAliasResourceId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (oldManagedServerDnsAliasResourceId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property oldManagedServerDnsAliasResourceId in model" + + " ManagedServerDnsAliasAcquisition")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ManagedServerDnsAliasAcquisition.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedServerDnsAliasCreation.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedServerDnsAliasCreation.java new file mode 100644 index 0000000000000..492702996ca83 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedServerDnsAliasCreation.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A managed server dns alias creation request. */ +@Fluent +public final class ManagedServerDnsAliasCreation { + /* + * Whether or not DNS record should be created for this alias. + */ + @JsonProperty(value = "createDnsRecord") + private Boolean createDnsRecord; + + /** Creates an instance of ManagedServerDnsAliasCreation class. */ + public ManagedServerDnsAliasCreation() { + } + + /** + * Get the createDnsRecord property: Whether or not DNS record should be created for this alias. + * + * @return the createDnsRecord value. + */ + public Boolean createDnsRecord() { + return this.createDnsRecord; + } + + /** + * Set the createDnsRecord property: Whether or not DNS record should be created for this alias. + * + * @param createDnsRecord the createDnsRecord value to set. + * @return the ManagedServerDnsAliasCreation object itself. + */ + public ManagedServerDnsAliasCreation withCreateDnsRecord(Boolean createDnsRecord) { + this.createDnsRecord = createDnsRecord; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedServerDnsAliasListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedServerDnsAliasListResult.java new file mode 100644 index 0000000000000..b8100fe3eeacc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedServerDnsAliasListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedServerDnsAliasInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of managed server DNS aliases. */ +@Immutable +public final class ManagedServerDnsAliasListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of ManagedServerDnsAliasListResult class. */ + public ManagedServerDnsAliasListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedServerDnsAliases.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedServerDnsAliases.java new file mode 100644 index 0000000000000..aa9ea046c76a7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedServerDnsAliases.java @@ -0,0 +1,191 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ManagedServerDnsAliases. */ +public interface ManagedServerDnsAliases { + /** + * Gets a list of managed server DNS aliases for a managed server. + * + * @param resourceGroupName The name of the resource group that contains 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed server DNS aliases for a managed server as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByManagedInstance(String resourceGroupName, String managedInstanceName); + + /** + * Gets a list of managed server DNS aliases for a managed server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed server DNS aliases for a managed server as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByManagedInstance( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * 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 managedInstanceName The name of the managed instance. + * @param dnsAliasName The dnsAliasName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server DNS alias along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String managedInstanceName, String dnsAliasName, Context context); + + /** + * 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 managedInstanceName The name of the managed instance. + * @param dnsAliasName The dnsAliasName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server DNS alias. + */ + ManagedServerDnsAlias get(String resourceGroupName, String managedInstanceName, String dnsAliasName); + + /** + * Deletes the managed 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 managedInstanceName The name of the managed instance. + * @param dnsAliasName The dnsAliasName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String managedInstanceName, String dnsAliasName); + + /** + * Deletes the managed 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 managedInstanceName The name of the managed instance. + * @param dnsAliasName The dnsAliasName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String managedInstanceName, String dnsAliasName, Context context); + + /** + * Acquires managed server DNS alias from another managed server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param dnsAliasName The dnsAliasName parameter. + * @param parameters A managed server DNS alias acquisition request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed server DNS alias. + */ + ManagedServerDnsAlias acquire( + String resourceGroupName, + String managedInstanceName, + String dnsAliasName, + ManagedServerDnsAliasAcquisition parameters); + + /** + * Acquires managed server DNS alias from another managed server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param dnsAliasName The dnsAliasName parameter. + * @param parameters A managed server DNS alias acquisition request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed server DNS alias. + */ + ManagedServerDnsAlias acquire( + String resourceGroupName, + String managedInstanceName, + String dnsAliasName, + ManagedServerDnsAliasAcquisition parameters, + Context context); + + /** + * Gets a server DNS alias. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server DNS alias along with {@link Response}. + */ + ManagedServerDnsAlias getById(String id); + + /** + * Gets a server DNS alias. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server DNS alias along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the managed server DNS alias with the given name. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes the managed server DNS alias with the given name. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ManagedServerDnsAlias resource. + * + * @param name resource name. + * @return the first stage of the new ManagedServerDnsAlias definition. + */ + ManagedServerDnsAlias.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedServerSecurityAlertPolicies.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedServerSecurityAlertPolicies.java new file mode 100644 index 0000000000000..0f89f7442793f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedServerSecurityAlertPolicies.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ManagedServerSecurityAlertPolicies. */ +public interface ManagedServerSecurityAlertPolicies { + /** + * 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 securityAlertPolicyName The name of the security alert policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed server's threat detection policy along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String managedInstanceName, + SecurityAlertPolicyName securityAlertPolicyName, + Context context); + + /** + * 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 securityAlertPolicyName The name of the security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed server's threat detection policy. + */ + ManagedServerSecurityAlertPolicy get( + String resourceGroupName, String managedInstanceName, SecurityAlertPolicyName securityAlertPolicyName); + + /** + * Get the managed server's threat detection 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed server's threat detection policies as paginated response with {@link PagedIterable}. + */ + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName); + + /** + * Get the managed server's threat detection 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the managed server's threat detection policies as paginated response with {@link PagedIterable}. + */ + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * Get a managed server's threat detection policy. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed server's threat detection policy along with {@link Response}. + */ + ManagedServerSecurityAlertPolicy getById(String id); + + /** + * Get a managed server's threat detection policy. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed server's threat detection policy along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ManagedServerSecurityAlertPolicy resource. + * + * @param name resource name. + * @return the first stage of the new ManagedServerSecurityAlertPolicy definition. + */ + ManagedServerSecurityAlertPolicy.DefinitionStages.Blank define(SecurityAlertPolicyName name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedServerSecurityAlertPolicy.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedServerSecurityAlertPolicy.java new file mode 100644 index 0000000000000..e9e4fd1140b8c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedServerSecurityAlertPolicy.java @@ -0,0 +1,381 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedServerSecurityAlertPolicyInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of ManagedServerSecurityAlertPolicy. */ +public interface ManagedServerSecurityAlertPolicy { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: SystemData of SecurityAlertPolicyResource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the state property: Specifies the state of the policy, whether it is enabled or disabled or a policy has not + * been applied yet on the specific database. + * + * @return the state value. + */ + SecurityAlertsPolicyState state(); + + /** + * Gets the disabledAlerts property: Specifies an array of alerts that are disabled. Allowed values are: + * Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action, Brute_Force. + * + * @return the disabledAlerts value. + */ + List disabledAlerts(); + + /** + * Gets the emailAddresses property: Specifies an array of e-mail addresses to which the alert is sent. + * + * @return the emailAddresses value. + */ + List emailAddresses(); + + /** + * Gets the emailAccountAdmins property: Specifies that the alert is sent to the account administrators. + * + * @return the emailAccountAdmins value. + */ + Boolean emailAccountAdmins(); + + /** + * Gets the storageEndpoint property: 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. + */ + String storageEndpoint(); + + /** + * Gets the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection audit storage + * account. + * + * @return the storageAccountAccessKey value. + */ + String storageAccountAccessKey(); + + /** + * Gets the retentionDays property: Specifies the number of days to keep in the Threat Detection audit logs. + * + * @return the retentionDays value. + */ + Integer retentionDays(); + + /** + * Gets the creationTime property: Specifies the UTC creation time of the policy. + * + * @return the creationTime value. + */ + OffsetDateTime creationTime(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ManagedServerSecurityAlertPolicyInner + * object. + * + * @return the inner object. + */ + ManagedServerSecurityAlertPolicyInner innerModel(); + + /** The entirety of the ManagedServerSecurityAlertPolicy definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ManagedServerSecurityAlertPolicy definition stages. */ + interface DefinitionStages { + /** The first stage of the ManagedServerSecurityAlertPolicy definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ManagedServerSecurityAlertPolicy definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, managedInstanceName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @return the next definition stage. + */ + WithCreate withExistingManagedInstance(String resourceGroupName, String managedInstanceName); + } + /** + * The stage of the ManagedServerSecurityAlertPolicy definition which contains all the minimum required + * properties for the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithState, + DefinitionStages.WithDisabledAlerts, + DefinitionStages.WithEmailAddresses, + DefinitionStages.WithEmailAccountAdmins, + DefinitionStages.WithStorageEndpoint, + DefinitionStages.WithStorageAccountAccessKey, + DefinitionStages.WithRetentionDays { + /** + * Executes the create request. + * + * @return the created resource. + */ + ManagedServerSecurityAlertPolicy create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ManagedServerSecurityAlertPolicy create(Context context); + } + /** The stage of the ManagedServerSecurityAlertPolicy definition allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the policy, whether it is enabled or disabled or a + * policy has not been applied yet on the specific database.. + * + * @param state Specifies the state of the policy, whether it is enabled or disabled or a policy has not + * been applied yet on the specific database. + * @return the next definition stage. + */ + WithCreate withState(SecurityAlertsPolicyState state); + } + /** The stage of the ManagedServerSecurityAlertPolicy definition allowing to specify disabledAlerts. */ + interface WithDisabledAlerts { + /** + * Specifies the disabledAlerts property: Specifies an array of alerts that are disabled. Allowed values + * are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action, + * Brute_Force. + * + * @param disabledAlerts Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, + * Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action, Brute_Force. + * @return the next definition stage. + */ + WithCreate withDisabledAlerts(List disabledAlerts); + } + /** The stage of the ManagedServerSecurityAlertPolicy definition allowing to specify emailAddresses. */ + interface WithEmailAddresses { + /** + * Specifies the emailAddresses property: Specifies an array of e-mail addresses to which the alert is + * sent.. + * + * @param emailAddresses Specifies an array of e-mail addresses to which the alert is sent. + * @return the next definition stage. + */ + WithCreate withEmailAddresses(List emailAddresses); + } + /** The stage of the ManagedServerSecurityAlertPolicy definition allowing to specify emailAccountAdmins. */ + interface WithEmailAccountAdmins { + /** + * Specifies the emailAccountAdmins property: Specifies that the alert is sent to the account + * administrators.. + * + * @param emailAccountAdmins Specifies that the alert is sent to the account administrators. + * @return the next definition stage. + */ + WithCreate withEmailAccountAdmins(Boolean emailAccountAdmins); + } + /** The stage of the ManagedServerSecurityAlertPolicy definition allowing to specify storageEndpoint. */ + interface WithStorageEndpoint { + /** + * Specifies the storageEndpoint property: 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 Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit + * logs. + * @return the next definition stage. + */ + WithCreate withStorageEndpoint(String storageEndpoint); + } + /** The stage of the ManagedServerSecurityAlertPolicy definition allowing to specify storageAccountAccessKey. */ + interface WithStorageAccountAccessKey { + /** + * Specifies the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection + * audit storage account.. + * + * @param storageAccountAccessKey Specifies the identifier key of the Threat Detection audit storage + * account. + * @return the next definition stage. + */ + WithCreate withStorageAccountAccessKey(String storageAccountAccessKey); + } + /** The stage of the ManagedServerSecurityAlertPolicy definition allowing to specify retentionDays. */ + interface WithRetentionDays { + /** + * Specifies the retentionDays property: Specifies the number of days to keep in the Threat Detection audit + * logs.. + * + * @param retentionDays Specifies the number of days to keep in the Threat Detection audit logs. + * @return the next definition stage. + */ + WithCreate withRetentionDays(Integer retentionDays); + } + } + /** + * Begins update for the ManagedServerSecurityAlertPolicy resource. + * + * @return the stage of resource update. + */ + ManagedServerSecurityAlertPolicy.Update update(); + + /** The template for ManagedServerSecurityAlertPolicy update. */ + interface Update + extends UpdateStages.WithState, + UpdateStages.WithDisabledAlerts, + UpdateStages.WithEmailAddresses, + UpdateStages.WithEmailAccountAdmins, + UpdateStages.WithStorageEndpoint, + UpdateStages.WithStorageAccountAccessKey, + UpdateStages.WithRetentionDays { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ManagedServerSecurityAlertPolicy apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ManagedServerSecurityAlertPolicy apply(Context context); + } + /** The ManagedServerSecurityAlertPolicy update stages. */ + interface UpdateStages { + /** The stage of the ManagedServerSecurityAlertPolicy update allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the policy, whether it is enabled or disabled or a + * policy has not been applied yet on the specific database.. + * + * @param state Specifies the state of the policy, whether it is enabled or disabled or a policy has not + * been applied yet on the specific database. + * @return the next definition stage. + */ + Update withState(SecurityAlertsPolicyState state); + } + /** The stage of the ManagedServerSecurityAlertPolicy update allowing to specify disabledAlerts. */ + interface WithDisabledAlerts { + /** + * Specifies the disabledAlerts property: Specifies an array of alerts that are disabled. Allowed values + * are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action, + * Brute_Force. + * + * @param disabledAlerts Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, + * Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action, Brute_Force. + * @return the next definition stage. + */ + Update withDisabledAlerts(List disabledAlerts); + } + /** The stage of the ManagedServerSecurityAlertPolicy update allowing to specify emailAddresses. */ + interface WithEmailAddresses { + /** + * Specifies the emailAddresses property: Specifies an array of e-mail addresses to which the alert is + * sent.. + * + * @param emailAddresses Specifies an array of e-mail addresses to which the alert is sent. + * @return the next definition stage. + */ + Update withEmailAddresses(List emailAddresses); + } + /** The stage of the ManagedServerSecurityAlertPolicy update allowing to specify emailAccountAdmins. */ + interface WithEmailAccountAdmins { + /** + * Specifies the emailAccountAdmins property: Specifies that the alert is sent to the account + * administrators.. + * + * @param emailAccountAdmins Specifies that the alert is sent to the account administrators. + * @return the next definition stage. + */ + Update withEmailAccountAdmins(Boolean emailAccountAdmins); + } + /** The stage of the ManagedServerSecurityAlertPolicy update allowing to specify storageEndpoint. */ + interface WithStorageEndpoint { + /** + * Specifies the storageEndpoint property: 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 Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit + * logs. + * @return the next definition stage. + */ + Update withStorageEndpoint(String storageEndpoint); + } + /** The stage of the ManagedServerSecurityAlertPolicy update allowing to specify storageAccountAccessKey. */ + interface WithStorageAccountAccessKey { + /** + * Specifies the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection + * audit storage account.. + * + * @param storageAccountAccessKey Specifies the identifier key of the Threat Detection audit storage + * account. + * @return the next definition stage. + */ + Update withStorageAccountAccessKey(String storageAccountAccessKey); + } + /** The stage of the ManagedServerSecurityAlertPolicy update allowing to specify retentionDays. */ + interface WithRetentionDays { + /** + * Specifies the retentionDays property: Specifies the number of days to keep in the Threat Detection audit + * logs.. + * + * @param retentionDays Specifies the number of days to keep in the Threat Detection audit logs. + * @return the next definition stage. + */ + Update withRetentionDays(Integer retentionDays); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ManagedServerSecurityAlertPolicy refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ManagedServerSecurityAlertPolicy refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedServerSecurityAlertPolicyListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedServerSecurityAlertPolicyListResult.java new file mode 100644 index 0000000000000..0acadc6277b7c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedServerSecurityAlertPolicyListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedServerSecurityAlertPolicyInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of the managed Server's security alert policies. */ +@Immutable +public final class ManagedServerSecurityAlertPolicyListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of ManagedServerSecurityAlertPolicyListResult class. */ + public ManagedServerSecurityAlertPolicyListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedShortTermRetentionPolicyName.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedShortTermRetentionPolicyName.java new file mode 100644 index 0000000000000..24460bc096ca0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedShortTermRetentionPolicyName.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ManagedShortTermRetentionPolicyName. */ +public final class ManagedShortTermRetentionPolicyName + extends ExpandableStringEnum { + /** Static value default for ManagedShortTermRetentionPolicyName. */ + public static final ManagedShortTermRetentionPolicyName DEFAULT = fromString("default"); + + /** + * Creates or finds a ManagedShortTermRetentionPolicyName from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagedShortTermRetentionPolicyName. + */ + @JsonCreator + public static ManagedShortTermRetentionPolicyName fromString(String name) { + return fromString(name, ManagedShortTermRetentionPolicyName.class); + } + + /** + * Gets known ManagedShortTermRetentionPolicyName values. + * + * @return known ManagedShortTermRetentionPolicyName values. + */ + public static Collection values() { + return values(ManagedShortTermRetentionPolicyName.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedTransparentDataEncryption.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedTransparentDataEncryption.java new file mode 100644 index 0000000000000..4200af71621de --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedTransparentDataEncryption.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedTransparentDataEncryptionInner; + +/** An immutable client-side representation of ManagedTransparentDataEncryption. */ +public interface ManagedTransparentDataEncryption { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the state property: Specifies the state of the transparent data encryption. + * + * @return the state value. + */ + TransparentDataEncryptionState state(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ManagedTransparentDataEncryptionInner + * object. + * + * @return the inner object. + */ + ManagedTransparentDataEncryptionInner innerModel(); + + /** The entirety of the ManagedTransparentDataEncryption definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ManagedTransparentDataEncryption definition stages. */ + interface DefinitionStages { + /** The first stage of the ManagedTransparentDataEncryption definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ManagedTransparentDataEncryption definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, managedInstanceName, databaseName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the managed database for which the security alert policy is defined. + * @return the next definition stage. + */ + WithCreate withExistingDatabase(String resourceGroupName, String managedInstanceName, String databaseName); + } + /** + * The stage of the ManagedTransparentDataEncryption definition which contains all the minimum required + * properties for the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithState { + /** + * Executes the create request. + * + * @return the created resource. + */ + ManagedTransparentDataEncryption create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ManagedTransparentDataEncryption create(Context context); + } + /** The stage of the ManagedTransparentDataEncryption definition allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the transparent data encryption.. + * + * @param state Specifies the state of the transparent data encryption. + * @return the next definition stage. + */ + WithCreate withState(TransparentDataEncryptionState state); + } + } + /** + * Begins update for the ManagedTransparentDataEncryption resource. + * + * @return the stage of resource update. + */ + ManagedTransparentDataEncryption.Update update(); + + /** The template for ManagedTransparentDataEncryption update. */ + interface Update extends UpdateStages.WithState { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ManagedTransparentDataEncryption apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ManagedTransparentDataEncryption apply(Context context); + } + /** The ManagedTransparentDataEncryption update stages. */ + interface UpdateStages { + /** The stage of the ManagedTransparentDataEncryption update allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the transparent data encryption.. + * + * @param state Specifies the state of the transparent data encryption. + * @return the next definition stage. + */ + Update withState(TransparentDataEncryptionState state); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ManagedTransparentDataEncryption refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ManagedTransparentDataEncryption refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedTransparentDataEncryptionListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedTransparentDataEncryptionListResult.java new file mode 100644 index 0000000000000..6c093402cf730 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagedTransparentDataEncryptionListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedTransparentDataEncryptionInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of managed transparent data encryptions. */ +@Immutable +public final class ManagedTransparentDataEncryptionListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of ManagedTransparentDataEncryptionListResult class. */ + public ManagedTransparentDataEncryptionListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagementOperationState.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagementOperationState.java new file mode 100644 index 0000000000000..f04f4ad71cf82 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ManagementOperationState.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The operation state. */ +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); + } + + /** + * Gets known ManagementOperationState values. + * + * @return known ManagementOperationState values. + */ + public static Collection values() { + return values(ManagementOperationState.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaxSizeCapability.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaxSizeCapability.java new file mode 100644 index 0000000000000..d1bc4621e17ea --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaxSizeCapability.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The maximum size capability. */ +@Immutable +public final 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. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private MaxSizeUnit unit; + + /** Creates an instance of MaxSizeCapability class. */ + public MaxSizeCapability() { + } + + /** + * Get the limit property: The maximum size limit (see 'unit' for the units). + * + * @return the limit value. + */ + public Integer limit() { + return this.limit; + } + + /** + * Get the unit property: The units that the limit is expressed in. + * + * @return the unit value. + */ + public MaxSizeUnit unit() { + return this.unit; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaxSizeRangeCapability.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaxSizeRangeCapability.java new file mode 100644 index 0000000000000..a149210dc39b6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaxSizeRangeCapability.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The maximum size range capability. */ +@Fluent +public final 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. + */ + @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; + + /** Creates an instance of MaxSizeRangeCapability class. */ + public MaxSizeRangeCapability() { + } + + /** + * Get the minValue property: Minimum value. + * + * @return the minValue value. + */ + public MaxSizeCapability minValue() { + return this.minValue; + } + + /** + * Get the maxValue property: Maximum value. + * + * @return the maxValue value. + */ + public MaxSizeCapability maxValue() { + return this.maxValue; + } + + /** + * Get the scaleSize property: 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 the logSize property: Size of transaction log. + * + * @return the logSize value. + */ + public LogSizeCapability logSize() { + return this.logSize; + } + + /** + * Get the status property: The status of the capability. + * + * @return the status value. + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason property: The reason for the capability not being available. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (minValue() != null) { + minValue().validate(); + } + if (maxValue() != null) { + maxValue().validate(); + } + if (scaleSize() != null) { + scaleSize().validate(); + } + if (logSize() != null) { + logSize().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaxSizeUnit.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaxSizeUnit.java new file mode 100644 index 0000000000000..904968114ea05 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MaxSizeUnit.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The units that the limit is expressed in. */ +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); + } + + /** + * Gets known MaxSizeUnit values. + * + * @return known MaxSizeUnit values. + */ + public static Collection values() { + return values(MaxSizeUnit.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Metric.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Metric.java new file mode 100644 index 0000000000000..060e7ff61b36a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Metric.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.MetricInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of Metric. */ +public interface Metric { + /** + * Gets the startTime property: The start time for the metric (ISO-8601 format). + * + * @return the startTime value. + */ + OffsetDateTime startTime(); + + /** + * Gets the endTime property: The end time for the metric (ISO-8601 format). + * + * @return the endTime value. + */ + OffsetDateTime endTime(); + + /** + * Gets the timeGrain property: The time step to be used to summarize the metric values. + * + * @return the timeGrain value. + */ + String timeGrain(); + + /** + * Gets the unit property: The unit of the metric. + * + * @return the unit value. + */ + UnitType unit(); + + /** + * Gets the name property: The name information for the metric. + * + * @return the name value. + */ + MetricName name(); + + /** + * Gets the metricValues property: The metric values for the specified time window and timestep. + * + * @return the metricValues value. + */ + List metricValues(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.MetricInner object. + * + * @return the inner object. + */ + MetricInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MetricAvailability.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MetricAvailability.java new file mode 100644 index 0000000000000..12ab0e97fd433 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MetricAvailability.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A metric availability value. */ +@Immutable +public final 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; + + /** Creates an instance of MetricAvailability class. */ + public MetricAvailability() { + } + + /** + * Get the retention property: The length of retention for the database metric. + * + * @return the retention value. + */ + public String retention() { + return this.retention; + } + + /** + * Get the timeGrain property: The granularity of the database metric. + * + * @return the timeGrain value. + */ + public String timeGrain() { + return this.timeGrain; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MetricDefinition.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MetricDefinition.java new file mode 100644 index 0000000000000..d9d41328520f6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MetricDefinition.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.MetricDefinitionInner; +import java.util.List; + +/** An immutable client-side representation of MetricDefinition. */ +public interface MetricDefinition { + /** + * Gets the name property: The name information for the metric. + * + * @return the name value. + */ + MetricName name(); + + /** + * Gets the primaryAggregationType property: The primary aggregation type defining how metric values are displayed. + * + * @return the primaryAggregationType value. + */ + PrimaryAggregationType primaryAggregationType(); + + /** + * Gets the resourceUri property: The resource uri of the database. + * + * @return the resourceUri value. + */ + String resourceUri(); + + /** + * Gets the unit property: The unit of the metric. + * + * @return the unit value. + */ + UnitDefinitionType unit(); + + /** + * Gets the metricAvailabilities property: The list of database metric availabilities for the metric. + * + * @return the metricAvailabilities value. + */ + List metricAvailabilities(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.MetricDefinitionInner object. + * + * @return the inner object. + */ + MetricDefinitionInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MetricDefinitionListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MetricDefinitionListResult.java new file mode 100644 index 0000000000000..9be5b9d71c784 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MetricDefinitionListResult.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.MetricDefinitionInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response to a list database metric definitions request. */ +@Fluent +public final class MetricDefinitionListResult { + /* + * The list of metric definitions for the database. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /** Creates an instance of MetricDefinitionListResult class. */ + public MetricDefinitionListResult() { + } + + /** + * Get the value property: The list of metric definitions for the database. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of metric definitions for the database. + * + * @param value the value value to set. + * @return the MetricDefinitionListResult object itself. + */ + public MetricDefinitionListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property value in model MetricDefinitionListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MetricDefinitionListResult.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MetricListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MetricListResult.java new file mode 100644 index 0000000000000..d6fe0c9c72bf1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MetricListResult.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.MetricInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response to a list database metrics request. */ +@Fluent +public final class MetricListResult { + /* + * The list of metrics for the database. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /** Creates an instance of MetricListResult class. */ + public MetricListResult() { + } + + /** + * Get the value property: The list of metrics for the database. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of metrics for the database. + * + * @param value the value value to set. + * @return the MetricListResult object itself. + */ + public MetricListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model MetricListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MetricListResult.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MetricName.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MetricName.java new file mode 100644 index 0000000000000..19ea65ff793b2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MetricName.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A database metric name. */ +@Immutable +public final 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; + + /** Creates an instance of MetricName class. */ + public MetricName() { + } + + /** + * Get the value property: The name of the database metric. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Get the localizedValue property: The friendly name of the database metric. + * + * @return the localizedValue value. + */ + public String localizedValue() { + return this.localizedValue; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MetricType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MetricType.java new file mode 100644 index 0000000000000..ea866d372b3b8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MetricType.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for MetricType. */ +public final class MetricType extends ExpandableStringEnum { + /** Static value cpu for MetricType. */ + public static final MetricType CPU = fromString("cpu"); + + /** Static value io for MetricType. */ + public static final MetricType IO = fromString("io"); + + /** Static value logIo for MetricType. */ + public static final MetricType LOG_IO = fromString("logIo"); + + /** Static value duration for MetricType. */ + public static final MetricType DURATION = fromString("duration"); + + /** Static value dtu for MetricType. */ + public static final MetricType DTU = fromString("dtu"); + + /** + * Creates or finds a MetricType from its string representation. + * + * @param name a name to look for. + * @return the corresponding MetricType. + */ + @JsonCreator + public static MetricType fromString(String name) { + return fromString(name, MetricType.class); + } + + /** + * Gets known MetricType values. + * + * @return known MetricType values. + */ + public static Collection values() { + return values(MetricType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MetricValue.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MetricValue.java new file mode 100644 index 0000000000000..e5a9258f81351 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MetricValue.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Represents database metrics. */ +@Immutable +public final class MetricValue { + /* + * The number of values for the metric. + */ + @JsonProperty(value = "count", access = JsonProperty.Access.WRITE_ONLY) + private Integer 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 OffsetDateTime timestamp; + + /* + * The total value of the metric. + */ + @JsonProperty(value = "total", access = JsonProperty.Access.WRITE_ONLY) + private Double total; + + /** Creates an instance of MetricValue class. */ + public MetricValue() { + } + + /** + * Get the count property: The number of values for the metric. + * + * @return the count value. + */ + public Integer count() { + return this.count; + } + + /** + * Get the average property: The average value of the metric. + * + * @return the average value. + */ + public Double average() { + return this.average; + } + + /** + * Get the maximum property: The max value of the metric. + * + * @return the maximum value. + */ + public Double maximum() { + return this.maximum; + } + + /** + * Get the minimum property: The min value of the metric. + * + * @return the minimum value. + */ + public Double minimum() { + return this.minimum; + } + + /** + * Get the timestamp property: The metric timestamp (ISO-8601 format). + * + * @return the timestamp value. + */ + public OffsetDateTime timestamp() { + return this.timestamp; + } + + /** + * Get the total property: The total value of the metric. + * + * @return the total value. + */ + public Double total() { + return this.total; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MinCapacityCapability.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MinCapacityCapability.java new file mode 100644 index 0000000000000..98f5916025fda --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MinCapacityCapability.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The min capacity capability. */ +@Fluent +public final class MinCapacityCapability { + /* + * Min capacity value + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private Double value; + + /* + * The status of the capability. + */ + @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; + + /** Creates an instance of MinCapacityCapability class. */ + public MinCapacityCapability() { + } + + /** + * Get the value property: Min capacity value. + * + * @return the value value. + */ + public Double value() { + return this.value; + } + + /** + * Get the status property: The status of the capability. + * + * @return the status value. + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason property: The reason for the capability not being available. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: The reason for the capability not being available. + * + * @param reason the reason value to set. + * @return the MinCapacityCapability object itself. + */ + public MinCapacityCapability withReason(String reason) { + this.reason = reason; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MoveOperationMode.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MoveOperationMode.java new file mode 100644 index 0000000000000..25a516c395265 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/MoveOperationMode.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The move operation mode. */ +public final class MoveOperationMode extends ExpandableStringEnum { + /** Static value Move for MoveOperationMode. */ + public static final MoveOperationMode MOVE = fromString("Move"); + + /** Static value Copy for MoveOperationMode. */ + public static final MoveOperationMode COPY = fromString("Copy"); + + /** + * Creates or finds a MoveOperationMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding MoveOperationMode. + */ + @JsonCreator + public static MoveOperationMode fromString(String name) { + return fromString(name, MoveOperationMode.class); + } + + /** + * Gets known MoveOperationMode values. + * + * @return known MoveOperationMode values. + */ + public static Collection values() { + return values(MoveOperationMode.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Name.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Name.java new file mode 100644 index 0000000000000..6c2bd885feb1e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Name.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** ARM Usage Name. */ +@Fluent +public final class Name { + /* + * Usage name value + */ + @JsonProperty(value = "value") + private String value; + + /* + * Usage name localized value. + */ + @JsonProperty(value = "localizedValue") + private String localizedValue; + + /** Creates an instance of Name class. */ + public Name() { + } + + /** + * Get the value property: Usage name value. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: Usage name value. + * + * @param value the value value to set. + * @return the Name object itself. + */ + public Name withValue(String value) { + this.value = value; + return this; + } + + /** + * Get the localizedValue property: Usage name localized value. + * + * @return the localizedValue value. + */ + public String localizedValue() { + return this.localizedValue; + } + + /** + * Set the localizedValue property: Usage name localized value. + * + * @param localizedValue the localizedValue value to set. + * @return the Name object itself. + */ + public Name withLocalizedValue(String localizedValue) { + this.localizedValue = localizedValue; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/NetworkIsolationSettings.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/NetworkIsolationSettings.java new file mode 100644 index 0000000000000..e1264c07c21a3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/NetworkIsolationSettings.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Contains the ARM resources for which to create private endpoint connection. */ +@Fluent +public final class NetworkIsolationSettings { + /* + * The resource id for the storage account used to store BACPAC file. If set, private endpoint connection will be + * created for the storage account. Must match storage account used for StorageUri parameter. + */ + @JsonProperty(value = "storageAccountResourceId") + private String storageAccountResourceId; + + /* + * The resource id for the SQL server which is the target of this request. If set, private endpoint connection will + * be created for the SQL server. Must match server which is target of the operation. + */ + @JsonProperty(value = "sqlServerResourceId") + private String sqlServerResourceId; + + /** Creates an instance of NetworkIsolationSettings class. */ + public NetworkIsolationSettings() { + } + + /** + * Get the storageAccountResourceId property: The resource id for the storage account used to store BACPAC file. If + * set, private endpoint connection will be created for the storage account. Must match storage account used for + * StorageUri parameter. + * + * @return the storageAccountResourceId value. + */ + public String storageAccountResourceId() { + return this.storageAccountResourceId; + } + + /** + * Set the storageAccountResourceId property: The resource id for the storage account used to store BACPAC file. If + * set, private endpoint connection will be created for the storage account. Must match storage account used for + * StorageUri parameter. + * + * @param storageAccountResourceId the storageAccountResourceId value to set. + * @return the NetworkIsolationSettings object itself. + */ + public NetworkIsolationSettings withStorageAccountResourceId(String storageAccountResourceId) { + this.storageAccountResourceId = storageAccountResourceId; + return this; + } + + /** + * Get the sqlServerResourceId property: The resource id for the SQL server which is the target of this request. If + * set, private endpoint connection will be created for the SQL server. Must match server which is target of the + * operation. + * + * @return the sqlServerResourceId value. + */ + public String sqlServerResourceId() { + return this.sqlServerResourceId; + } + + /** + * Set the sqlServerResourceId property: The resource id for the SQL server which is the target of this request. If + * set, private endpoint connection will be created for the SQL server. Must match server which is target of the + * operation. + * + * @param sqlServerResourceId the sqlServerResourceId value to set. + * @return the NetworkIsolationSettings object itself. + */ + public NetworkIsolationSettings withSqlServerResourceId(String sqlServerResourceId) { + this.sqlServerResourceId = sqlServerResourceId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Operation.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Operation.java new file mode 100644 index 0000000000000..5dd37d6dd7953 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Operation.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.OperationInner; +import java.util.Map; + +/** An immutable client-side representation of Operation. */ +public interface Operation { + /** + * Gets the name property: The name of the operation being performed on this particular object. + * + * @return the name value. + */ + String name(); + + /** + * Gets the display property: The localized display information for this particular operation / action. + * + * @return the display value. + */ + OperationDisplay display(); + + /** + * Gets the origin property: The intended executor of the operation. + * + * @return the origin value. + */ + OperationOrigin origin(); + + /** + * Gets the properties property: Additional descriptions for the operation. + * + * @return the properties value. + */ + Map properties(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/OperationDisplay.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/OperationDisplay.java new file mode 100644 index 0000000000000..e5b358166b263 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/OperationDisplay.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Display metadata associated with the operation. */ +@Immutable +public final 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; + + /** Creates an instance of OperationDisplay class. */ + public OperationDisplay() { + } + + /** + * Get the provider property: The localized friendly form of the resource provider name. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource property: The localized friendly form of the resource type related to this action/operation. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Get the operation property: The localized friendly name for the operation. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the description property: The localized friendly description for the operation. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/OperationListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/OperationListResult.java new file mode 100644 index 0000000000000..4ad4eda26d37a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/OperationListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.OperationInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Result of the request to list SQL operations. */ +@Immutable +public final class OperationListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of OperationListResult class. */ + public OperationListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/OperationMode.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/OperationMode.java new file mode 100644 index 0000000000000..b324100fa522c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/OperationMode.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Operation Mode. */ +public final class OperationMode extends ExpandableStringEnum { + /** Static value PolybaseImport for OperationMode. */ + public static final OperationMode POLYBASE_IMPORT = fromString("PolybaseImport"); + + /** + * Creates or finds a OperationMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding OperationMode. + */ + @JsonCreator + public static OperationMode fromString(String name) { + return fromString(name, OperationMode.class); + } + + /** + * Gets known OperationMode values. + * + * @return known OperationMode values. + */ + public static Collection values() { + return values(OperationMode.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/OperationOrigin.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/OperationOrigin.java new file mode 100644 index 0000000000000..257301684adeb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/OperationOrigin.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The intended executor of the operation. */ +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); + } + + /** + * Gets known OperationOrigin values. + * + * @return known OperationOrigin values. + */ + public static Collection values() { + return values(OperationOrigin.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Operations.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Operations.java new file mode 100644 index 0000000000000..99fa720c46f8b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Operations.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * Lists all of the available SQL Rest API operations. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list SQL operations as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Lists all of the available SQL Rest API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list SQL operations as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/OutboundFirewallRule.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/OutboundFirewallRule.java new file mode 100644 index 0000000000000..0faf097376026 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/OutboundFirewallRule.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.OutboundFirewallRuleInner; + +/** An immutable client-side representation of OutboundFirewallRule. */ +public interface OutboundFirewallRule { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the provisioningState property: The state of the outbound rule. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.OutboundFirewallRuleInner object. + * + * @return the inner object. + */ + OutboundFirewallRuleInner innerModel(); + + /** The entirety of the OutboundFirewallRule definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The OutboundFirewallRule definition stages. */ + interface DefinitionStages { + /** The first stage of the OutboundFirewallRule definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the OutboundFirewallRule definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @return the next definition stage. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + /** + * The stage of the OutboundFirewallRule definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate { + /** + * Executes the create request. + * + * @return the created resource. + */ + OutboundFirewallRule create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + OutboundFirewallRule create(Context context); + } + } + /** + * Begins update for the OutboundFirewallRule resource. + * + * @return the stage of resource update. + */ + OutboundFirewallRule.Update update(); + + /** The template for OutboundFirewallRule update. */ + interface Update { + /** + * Executes the update request. + * + * @return the updated resource. + */ + OutboundFirewallRule apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + OutboundFirewallRule apply(Context context); + } + /** The OutboundFirewallRule update stages. */ + interface UpdateStages { + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + OutboundFirewallRule refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + OutboundFirewallRule refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/OutboundFirewallRuleListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/OutboundFirewallRuleListResult.java new file mode 100644 index 0000000000000..5bfce380e108e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/OutboundFirewallRuleListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.OutboundFirewallRuleInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of outbound rules. */ +@Immutable +public final class OutboundFirewallRuleListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of OutboundFirewallRuleListResult class. */ + public OutboundFirewallRuleListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/OutboundFirewallRules.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/OutboundFirewallRules.java new file mode 100644 index 0000000000000..7d274e4487e1a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/OutboundFirewallRules.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of OutboundFirewallRules. */ +public interface OutboundFirewallRules { + /** + * Gets an outbound 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 outboundRuleFqdn The outboundRuleFqdn parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an outbound firewall rule along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String outboundRuleFqdn, Context context); + + /** + * Gets an outbound 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 outboundRuleFqdn The outboundRuleFqdn parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an outbound firewall rule. + */ + OutboundFirewallRule get(String resourceGroupName, String serverName, String outboundRuleFqdn); + + /** + * Deletes a outbound firewall rule with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param outboundRuleFqdn The outboundRuleFqdn parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, String outboundRuleFqdn); + + /** + * Deletes a outbound firewall rule with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param outboundRuleFqdn The outboundRuleFqdn parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, String outboundRuleFqdn, Context context); + + /** + * Gets all outbound firewall rules on a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all outbound firewall rules on a server as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets all outbound firewall rules on a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all outbound firewall rules on a server as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * Gets an outbound firewall rule. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an outbound firewall rule along with {@link Response}. + */ + OutboundFirewallRule getById(String id); + + /** + * Gets an outbound firewall rule. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an outbound firewall rule along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a outbound firewall rule with a given name. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a outbound firewall rule with a given name. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new OutboundFirewallRule resource. + * + * @param name resource name. + * @return the first stage of the new OutboundFirewallRule definition. + */ + OutboundFirewallRule.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PartnerInfo.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PartnerInfo.java new file mode 100644 index 0000000000000..f9ebda6b39764 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PartnerInfo.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Partner server information for the failover group. */ +@Fluent +public final 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. + */ + @JsonProperty(value = "replicationRole", access = JsonProperty.Access.WRITE_ONLY) + private FailoverGroupReplicationRole replicationRole; + + /** Creates an instance of PartnerInfo class. */ + public PartnerInfo() { + } + + /** + * Get the id property: Resource identifier of the partner server. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: 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 the location property: Geo location of the partner server. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Get the replicationRole property: Replication role of the partner server. + * + * @return the replicationRole value. + */ + public FailoverGroupReplicationRole replicationRole() { + return this.replicationRole; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("Missing required property id in model PartnerInfo")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(PartnerInfo.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PartnerRegionInfo.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PartnerRegionInfo.java new file mode 100644 index 0000000000000..284c679c10c0b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PartnerRegionInfo.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Partner region information for the failover group. */ +@Fluent +public final class PartnerRegionInfo { + /* + * Geo location of the partner managed instances. + */ + @JsonProperty(value = "location") + private String location; + + /* + * Replication role of the partner managed instances. + */ + @JsonProperty(value = "replicationRole", access = JsonProperty.Access.WRITE_ONLY) + private InstanceFailoverGroupReplicationRole replicationRole; + + /** Creates an instance of PartnerRegionInfo class. */ + public PartnerRegionInfo() { + } + + /** + * Get the location property: Geo location of the partner managed instances. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: 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 the replicationRole property: Replication role of the partner managed instances. + * + * @return the replicationRole value. + */ + public InstanceFailoverGroupReplicationRole replicationRole() { + return this.replicationRole; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PauseDelayTimeUnit.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PauseDelayTimeUnit.java new file mode 100644 index 0000000000000..cdee9ff9c824a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PauseDelayTimeUnit.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Unit of time that delay is expressed in. */ +public final class PauseDelayTimeUnit extends ExpandableStringEnum { + /** Static value Minutes for PauseDelayTimeUnit. */ + public static final PauseDelayTimeUnit MINUTES = fromString("Minutes"); + + /** + * Creates or finds a PauseDelayTimeUnit from its string representation. + * + * @param name a name to look for. + * @return the corresponding PauseDelayTimeUnit. + */ + @JsonCreator + public static PauseDelayTimeUnit fromString(String name) { + return fromString(name, PauseDelayTimeUnit.class); + } + + /** + * Gets known PauseDelayTimeUnit values. + * + * @return known PauseDelayTimeUnit values. + */ + public static Collection values() { + return values(PauseDelayTimeUnit.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PerformanceLevelCapability.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PerformanceLevelCapability.java new file mode 100644 index 0000000000000..86fb38355e667 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PerformanceLevelCapability.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The performance level capability. */ +@Immutable +public final class PerformanceLevelCapability { + /* + * Performance level value. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private Double value; + + /* + * Unit type used to measure performance level. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private PerformanceLevelUnit unit; + + /** Creates an instance of PerformanceLevelCapability class. */ + public PerformanceLevelCapability() { + } + + /** + * Get the value property: Performance level value. + * + * @return the value value. + */ + public Double value() { + return this.value; + } + + /** + * Get the unit property: Unit type used to measure performance level. + * + * @return the unit value. + */ + public PerformanceLevelUnit unit() { + return this.unit; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PerformanceLevelUnit.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PerformanceLevelUnit.java new file mode 100644 index 0000000000000..7a5ff002e7be2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PerformanceLevelUnit.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Unit type used to measure performance level. */ +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); + } + + /** + * Gets known PerformanceLevelUnit values. + * + * @return known PerformanceLevelUnit values. + */ + public static Collection values() { + return values(PerformanceLevelUnit.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrimaryAggregationType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrimaryAggregationType.java new file mode 100644 index 0000000000000..1fa1a872834ce --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrimaryAggregationType.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The primary aggregation type defining how metric values are displayed. */ +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); + } + + /** + * Gets known PrimaryAggregationType values. + * + * @return known PrimaryAggregationType values. + */ + public static Collection values() { + return values(PrimaryAggregationType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrincipalType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrincipalType.java new file mode 100644 index 0000000000000..963460140912e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrincipalType.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Principal Type of the sever administrator. */ +public final class PrincipalType extends ExpandableStringEnum { + /** Static value User for PrincipalType. */ + public static final PrincipalType USER = fromString("User"); + + /** Static value Group for PrincipalType. */ + public static final PrincipalType GROUP = fromString("Group"); + + /** Static value Application for PrincipalType. */ + public static final PrincipalType APPLICATION = fromString("Application"); + + /** + * Creates or finds a PrincipalType from its string representation. + * + * @param name a name to look for. + * @return the corresponding PrincipalType. + */ + @JsonCreator + public static PrincipalType fromString(String name) { + return fromString(name, PrincipalType.class); + } + + /** + * Gets known PrincipalType values. + * + * @return known PrincipalType values. + */ + public static Collection values() { + return values(PrincipalType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateEndpointConnection.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateEndpointConnection.java new file mode 100644 index 0000000000000..7b53493f2933f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateEndpointConnection.java @@ -0,0 +1,198 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.PrivateEndpointConnectionInner; + +/** An immutable client-side representation of PrivateEndpointConnection. */ +public interface PrivateEndpointConnection { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the privateEndpoint property: Private endpoint which the connection belongs to. + * + * @return the privateEndpoint value. + */ + PrivateEndpointProperty privateEndpoint(); + + /** + * Gets the privateLinkServiceConnectionState property: Connection state of the private endpoint connection. + * + * @return the privateLinkServiceConnectionState value. + */ + PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState(); + + /** + * Gets the provisioningState property: State of the private endpoint connection. + * + * @return the provisioningState value. + */ + PrivateEndpointProvisioningState provisioningState(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.PrivateEndpointConnectionInner object. + * + * @return the inner object. + */ + PrivateEndpointConnectionInner innerModel(); + + /** The entirety of the PrivateEndpointConnection definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The PrivateEndpointConnection definition stages. */ + interface DefinitionStages { + /** The first stage of the PrivateEndpointConnection definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the PrivateEndpointConnection definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @return the next definition stage. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + /** + * The stage of the PrivateEndpointConnection definition which contains all the minimum required properties for + * the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithPrivateEndpoint, DefinitionStages.WithPrivateLinkServiceConnectionState { + /** + * Executes the create request. + * + * @return the created resource. + */ + PrivateEndpointConnection create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + PrivateEndpointConnection create(Context context); + } + /** The stage of the PrivateEndpointConnection definition allowing to specify privateEndpoint. */ + interface WithPrivateEndpoint { + /** + * Specifies the privateEndpoint property: Private endpoint which the connection belongs to.. + * + * @param privateEndpoint Private endpoint which the connection belongs to. + * @return the next definition stage. + */ + WithCreate withPrivateEndpoint(PrivateEndpointProperty privateEndpoint); + } + /** + * The stage of the PrivateEndpointConnection definition allowing to specify privateLinkServiceConnectionState. + */ + interface WithPrivateLinkServiceConnectionState { + /** + * Specifies the privateLinkServiceConnectionState property: Connection state of the private endpoint + * connection.. + * + * @param privateLinkServiceConnectionState Connection state of the private endpoint connection. + * @return the next definition stage. + */ + WithCreate withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState); + } + } + /** + * Begins update for the PrivateEndpointConnection resource. + * + * @return the stage of resource update. + */ + PrivateEndpointConnection.Update update(); + + /** The template for PrivateEndpointConnection update. */ + interface Update extends UpdateStages.WithPrivateEndpoint, UpdateStages.WithPrivateLinkServiceConnectionState { + /** + * Executes the update request. + * + * @return the updated resource. + */ + PrivateEndpointConnection apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + PrivateEndpointConnection apply(Context context); + } + /** The PrivateEndpointConnection update stages. */ + interface UpdateStages { + /** The stage of the PrivateEndpointConnection update allowing to specify privateEndpoint. */ + interface WithPrivateEndpoint { + /** + * Specifies the privateEndpoint property: Private endpoint which the connection belongs to.. + * + * @param privateEndpoint Private endpoint which the connection belongs to. + * @return the next definition stage. + */ + Update withPrivateEndpoint(PrivateEndpointProperty privateEndpoint); + } + /** The stage of the PrivateEndpointConnection update allowing to specify privateLinkServiceConnectionState. */ + interface WithPrivateLinkServiceConnectionState { + /** + * Specifies the privateLinkServiceConnectionState property: Connection state of the private endpoint + * connection.. + * + * @param privateLinkServiceConnectionState Connection state of the private endpoint connection. + * @return the next definition stage. + */ + Update withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + PrivateEndpointConnection refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + PrivateEndpointConnection refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateEndpointConnectionListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateEndpointConnectionListResult.java new file mode 100644 index 0000000000000..335d64cb49ea2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateEndpointConnectionListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.PrivateEndpointConnectionInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of private endpoint connections. */ +@Immutable +public final class PrivateEndpointConnectionListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of PrivateEndpointConnectionListResult class. */ + public PrivateEndpointConnectionListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateEndpointConnectionRequestStatus.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateEndpointConnectionRequestStatus.java new file mode 100644 index 0000000000000..391c684089e53 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateEndpointConnectionRequestStatus.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Contains the private endpoint connection requests status. */ +@Immutable +public final class PrivateEndpointConnectionRequestStatus { + /* + * Resource id for which the private endpoint is created. + */ + @JsonProperty(value = "privateLinkServiceId", access = JsonProperty.Access.WRITE_ONLY) + private String privateLinkServiceId; + + /* + * The connection name for the private endpoint. + */ + @JsonProperty(value = "privateEndpointConnectionName", access = JsonProperty.Access.WRITE_ONLY) + private String privateEndpointConnectionName; + + /* + * Status of this private endpoint connection. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /** Creates an instance of PrivateEndpointConnectionRequestStatus class. */ + public PrivateEndpointConnectionRequestStatus() { + } + + /** + * Get the privateLinkServiceId property: Resource id for which the private endpoint is created. + * + * @return the privateLinkServiceId value. + */ + public String privateLinkServiceId() { + return this.privateLinkServiceId; + } + + /** + * Get the privateEndpointConnectionName property: The connection name for the private endpoint. + * + * @return the privateEndpointConnectionName value. + */ + public String privateEndpointConnectionName() { + return this.privateEndpointConnectionName; + } + + /** + * Get the status property: Status of this private endpoint connection. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateEndpointConnections.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateEndpointConnections.java new file mode 100644 index 0000000000000..d63e5087b2b28 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateEndpointConnections.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of PrivateEndpointConnections. */ +public interface PrivateEndpointConnections { + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context); + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + PrivateEndpointConnection get(String resourceGroupName, String serverName, String privateEndpointConnectionName); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, String privateEndpointConnectionName); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context); + + /** + * Gets all private endpoint connections on a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all private endpoint connections on a server as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets all private endpoint connections on a server. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all private endpoint connections on a server as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * Gets a private endpoint connection. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection along with {@link Response}. + */ + PrivateEndpointConnection getById(String id); + + /** + * Gets a private endpoint connection. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new PrivateEndpointConnection resource. + * + * @param name resource name. + * @return the first stage of the new PrivateEndpointConnection definition. + */ + PrivateEndpointConnection.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateEndpointProperty.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateEndpointProperty.java new file mode 100644 index 0000000000000..b4b8b8b704a10 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateEndpointProperty.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The PrivateEndpointProperty model. */ +@Fluent +public final class PrivateEndpointProperty { + /* + * Resource id of the private endpoint. + */ + @JsonProperty(value = "id") + private String id; + + /** Creates an instance of PrivateEndpointProperty class. */ + public PrivateEndpointProperty() { + } + + /** + * Get the id property: Resource id of the private endpoint. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Resource id of the private endpoint. + * + * @param id the id value to set. + * @return the PrivateEndpointProperty object itself. + */ + public PrivateEndpointProperty withId(String id) { + this.id = id; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateEndpointProvisioningState.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateEndpointProvisioningState.java new file mode 100644 index 0000000000000..0c37bac96379f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateEndpointProvisioningState.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** State of the private endpoint connection. */ +public final class PrivateEndpointProvisioningState extends ExpandableStringEnum { + /** Static value Approving for PrivateEndpointProvisioningState. */ + public static final PrivateEndpointProvisioningState APPROVING = fromString("Approving"); + + /** Static value Ready for PrivateEndpointProvisioningState. */ + public static final PrivateEndpointProvisioningState READY = fromString("Ready"); + + /** Static value Dropping for PrivateEndpointProvisioningState. */ + public static final PrivateEndpointProvisioningState DROPPING = fromString("Dropping"); + + /** Static value Failed for PrivateEndpointProvisioningState. */ + public static final PrivateEndpointProvisioningState FAILED = fromString("Failed"); + + /** Static value Rejecting for PrivateEndpointProvisioningState. */ + public static final PrivateEndpointProvisioningState REJECTING = fromString("Rejecting"); + + /** + * Creates or finds a PrivateEndpointProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding PrivateEndpointProvisioningState. + */ + @JsonCreator + public static PrivateEndpointProvisioningState fromString(String name) { + return fromString(name, PrivateEndpointProvisioningState.class); + } + + /** + * Gets known PrivateEndpointProvisioningState values. + * + * @return known PrivateEndpointProvisioningState values. + */ + public static Collection values() { + return values(PrivateEndpointProvisioningState.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateLinkResource.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateLinkResource.java new file mode 100644 index 0000000000000..f61a7bc7ceda3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateLinkResource.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.PrivateLinkResourceInner; + +/** An immutable client-side representation of PrivateLinkResource. */ +public interface PrivateLinkResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: The private link resource group id. + * + * @return the properties value. + */ + PrivateLinkResourceProperties properties(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.PrivateLinkResourceInner object. + * + * @return the inner object. + */ + PrivateLinkResourceInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateLinkResourceListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateLinkResourceListResult.java new file mode 100644 index 0000000000000..21f241eb6cbdd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateLinkResourceListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.PrivateLinkResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of private link resources. */ +@Immutable +public final class PrivateLinkResourceListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of PrivateLinkResourceListResult class. */ + public PrivateLinkResourceListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateLinkResourceProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateLinkResourceProperties.java new file mode 100644 index 0000000000000..e476e37e8c47d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateLinkResourceProperties.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of a private link resource. */ +@Immutable +public final class PrivateLinkResourceProperties { + /* + * The private link resource group id. + */ + @JsonProperty(value = "groupId", access = JsonProperty.Access.WRITE_ONLY) + private String groupId; + + /* + * The private link resource required member names. + */ + @JsonProperty(value = "requiredMembers", access = JsonProperty.Access.WRITE_ONLY) + private List requiredMembers; + + /* + * The private link resource required zone names. + */ + @JsonProperty(value = "requiredZoneNames", access = JsonProperty.Access.WRITE_ONLY) + private List requiredZoneNames; + + /** Creates an instance of PrivateLinkResourceProperties class. */ + public PrivateLinkResourceProperties() { + } + + /** + * Get the groupId property: The private link resource group id. + * + * @return the groupId value. + */ + public String groupId() { + return this.groupId; + } + + /** + * Get the requiredMembers property: The private link resource required member names. + * + * @return the requiredMembers value. + */ + public List requiredMembers() { + return this.requiredMembers; + } + + /** + * Get the requiredZoneNames property: The private link resource required zone names. + * + * @return the requiredZoneNames value. + */ + public List requiredZoneNames() { + return this.requiredZoneNames; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateLinkResources.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateLinkResources.java new file mode 100644 index 0000000000000..50ac99eb20ccd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateLinkResources.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of PrivateLinkResources. */ +public interface PrivateLinkResources { + /** + * Gets the private link resources for 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources for SQL server as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets the private link resources for 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources for SQL server as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * Gets a private link resource for 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 groupName The name of the private link resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private link resource for SQL server along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String groupName, Context context); + + /** + * Gets a private link resource for 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 groupName The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private link resource for SQL server. + */ + PrivateLinkResource get(String resourceGroupName, String serverName, String groupName); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateLinkServiceConnectionStateActionsRequire.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateLinkServiceConnectionStateActionsRequire.java new file mode 100644 index 0000000000000..a49f64f9f90f6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateLinkServiceConnectionStateActionsRequire.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The actions required for private link service connection. */ +public final class PrivateLinkServiceConnectionStateActionsRequire + extends ExpandableStringEnum { + /** Static value None for PrivateLinkServiceConnectionStateActionsRequire. */ + public static final PrivateLinkServiceConnectionStateActionsRequire NONE = fromString("None"); + + /** + * Creates or finds a PrivateLinkServiceConnectionStateActionsRequire from its string representation. + * + * @param name a name to look for. + * @return the corresponding PrivateLinkServiceConnectionStateActionsRequire. + */ + @JsonCreator + public static PrivateLinkServiceConnectionStateActionsRequire fromString(String name) { + return fromString(name, PrivateLinkServiceConnectionStateActionsRequire.class); + } + + /** + * Gets known PrivateLinkServiceConnectionStateActionsRequire values. + * + * @return known PrivateLinkServiceConnectionStateActionsRequire values. + */ + public static Collection values() { + return values(PrivateLinkServiceConnectionStateActionsRequire.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateLinkServiceConnectionStateProperty.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateLinkServiceConnectionStateProperty.java new file mode 100644 index 0000000000000..88c5efbc986d6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateLinkServiceConnectionStateProperty.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The PrivateLinkServiceConnectionStateProperty model. */ +@Fluent +public final class PrivateLinkServiceConnectionStateProperty { + /* + * The private link service connection status. + */ + @JsonProperty(value = "status", required = true) + private PrivateLinkServiceConnectionStateStatus status; + + /* + * The private link service connection description. + */ + @JsonProperty(value = "description", required = true) + private String description; + + /* + * The actions required for private link service connection. + */ + @JsonProperty(value = "actionsRequired", access = JsonProperty.Access.WRITE_ONLY) + private PrivateLinkServiceConnectionStateActionsRequire actionsRequired; + + /** Creates an instance of PrivateLinkServiceConnectionStateProperty class. */ + public PrivateLinkServiceConnectionStateProperty() { + } + + /** + * Get the status property: The private link service connection status. + * + * @return the status value. + */ + public PrivateLinkServiceConnectionStateStatus status() { + return this.status; + } + + /** + * Set the status property: The private link service connection status. + * + * @param status the status value to set. + * @return the PrivateLinkServiceConnectionStateProperty object itself. + */ + public PrivateLinkServiceConnectionStateProperty withStatus(PrivateLinkServiceConnectionStateStatus status) { + this.status = status; + return this; + } + + /** + * Get the description property: The private link service connection description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The private link service connection description. + * + * @param description the description value to set. + * @return the PrivateLinkServiceConnectionStateProperty object itself. + */ + public PrivateLinkServiceConnectionStateProperty withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the actionsRequired property: The actions required for private link service connection. + * + * @return the actionsRequired value. + */ + public PrivateLinkServiceConnectionStateActionsRequire actionsRequired() { + return this.actionsRequired; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (status() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property status in model PrivateLinkServiceConnectionStateProperty")); + } + if (description() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property description in model PrivateLinkServiceConnectionStateProperty")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(PrivateLinkServiceConnectionStateProperty.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateLinkServiceConnectionStateStatus.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateLinkServiceConnectionStateStatus.java new file mode 100644 index 0000000000000..4616f5780d61e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/PrivateLinkServiceConnectionStateStatus.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The private link service connection status. */ +public final class PrivateLinkServiceConnectionStateStatus + extends ExpandableStringEnum { + /** Static value Approved for PrivateLinkServiceConnectionStateStatus. */ + public static final PrivateLinkServiceConnectionStateStatus APPROVED = fromString("Approved"); + + /** Static value Pending for PrivateLinkServiceConnectionStateStatus. */ + public static final PrivateLinkServiceConnectionStateStatus PENDING = fromString("Pending"); + + /** Static value Rejected for PrivateLinkServiceConnectionStateStatus. */ + public static final PrivateLinkServiceConnectionStateStatus REJECTED = fromString("Rejected"); + + /** Static value Disconnected for PrivateLinkServiceConnectionStateStatus. */ + public static final PrivateLinkServiceConnectionStateStatus DISCONNECTED = fromString("Disconnected"); + + /** + * Creates or finds a PrivateLinkServiceConnectionStateStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding PrivateLinkServiceConnectionStateStatus. + */ + @JsonCreator + public static PrivateLinkServiceConnectionStateStatus fromString(String name) { + return fromString(name, PrivateLinkServiceConnectionStateStatus.class); + } + + /** + * Gets known PrivateLinkServiceConnectionStateStatus values. + * + * @return known PrivateLinkServiceConnectionStateStatus values. + */ + public static Collection values() { + return values(PrivateLinkServiceConnectionStateStatus.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ProvisioningState.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ProvisioningState.java new file mode 100644 index 0000000000000..775bbe5a86cff --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ProvisioningState.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The ARM provisioning state of the job execution. */ +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); + } + + /** + * Gets known ProvisioningState values. + * + * @return known ProvisioningState values. + */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ProxyResourceWithWritableName.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ProxyResourceWithWritableName.java new file mode 100644 index 0000000000000..aa077f2b209a7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ProxyResourceWithWritableName.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; + +/** ARM proxy resource. */ +@Fluent +public class ProxyResourceWithWritableName extends ResourceWithWritableName { + /** Creates an instance of ProxyResourceWithWritableName class. */ + public ProxyResourceWithWritableName() { + } + + /** {@inheritDoc} */ + @Override + public ProxyResourceWithWritableName withName(String name) { + super.withName(name); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/QueryCheck.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/QueryCheck.java new file mode 100644 index 0000000000000..e9642fe82b3b9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/QueryCheck.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** SQL Vulnerability Assessment query check object. */ +@Immutable +public final class QueryCheck { + /* + * SQL Vulnerability Assessment rule query. + */ + @JsonProperty(value = "query", access = JsonProperty.Access.WRITE_ONLY) + private String query; + + /* + * SQL Vulnerability Assessment query expected result. + */ + @JsonProperty(value = "expectedResult", access = JsonProperty.Access.WRITE_ONLY) + private List> expectedResult; + + /* + * SQL Vulnerability Assessment column names of query expected result. + */ + @JsonProperty(value = "columnNames", access = JsonProperty.Access.WRITE_ONLY) + private List columnNames; + + /** Creates an instance of QueryCheck class. */ + public QueryCheck() { + } + + /** + * Get the query property: SQL Vulnerability Assessment rule query. + * + * @return the query value. + */ + public String query() { + return this.query; + } + + /** + * Get the expectedResult property: SQL Vulnerability Assessment query expected result. + * + * @return the expectedResult value. + */ + public List> expectedResult() { + return this.expectedResult; + } + + /** + * Get the columnNames property: SQL Vulnerability Assessment column names of query expected result. + * + * @return the columnNames value. + */ + public List columnNames() { + return this.columnNames; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/QueryMetricInterval.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/QueryMetricInterval.java new file mode 100644 index 0000000000000..6a775a574d8a7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/QueryMetricInterval.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of a query metrics interval. */ +@Fluent +public final class QueryMetricInterval { + /* + * The start time for the metric interval (ISO-8601 format). + */ + @JsonProperty(value = "intervalStartTime", access = JsonProperty.Access.WRITE_ONLY) + private String intervalStartTime; + + /* + * Interval type (length). + */ + @JsonProperty(value = "intervalType", access = JsonProperty.Access.WRITE_ONLY) + private QueryTimeGrainType intervalType; + + /* + * Execution count of a query in this interval. + */ + @JsonProperty(value = "executionCount", access = JsonProperty.Access.WRITE_ONLY) + private Long executionCount; + + /* + * List of metric objects for this interval + */ + @JsonProperty(value = "metrics") + private List metrics; + + /** Creates an instance of QueryMetricInterval class. */ + public QueryMetricInterval() { + } + + /** + * Get the intervalStartTime property: The start time for the metric interval (ISO-8601 format). + * + * @return the intervalStartTime value. + */ + public String intervalStartTime() { + return this.intervalStartTime; + } + + /** + * Get the intervalType property: Interval type (length). + * + * @return the intervalType value. + */ + public QueryTimeGrainType intervalType() { + return this.intervalType; + } + + /** + * Get the executionCount property: Execution count of a query in this interval. + * + * @return the executionCount value. + */ + public Long executionCount() { + return this.executionCount; + } + + /** + * Get the metrics property: List of metric objects for this interval. + * + * @return the metrics value. + */ + public List metrics() { + return this.metrics; + } + + /** + * Set the metrics property: List of metric objects for this interval. + * + * @param metrics the metrics value to set. + * @return the QueryMetricInterval object itself. + */ + public QueryMetricInterval withMetrics(List metrics) { + this.metrics = metrics; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (metrics() != null) { + metrics().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/QueryMetricProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/QueryMetricProperties.java new file mode 100644 index 0000000000000..d05caa48db8d5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/QueryMetricProperties.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a topquery metric in one interval. */ +@Immutable +public final class QueryMetricProperties { + /* + * The name information for the metric. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The UI appropriate name for the metric. + */ + @JsonProperty(value = "displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /* + * The unit of the metric. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private QueryMetricUnitType unit; + + /* + * The value of the metric. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private Double value; + + /* + * Metric value when min() aggregate function is used over the interval. + */ + @JsonProperty(value = "min", access = JsonProperty.Access.WRITE_ONLY) + private Double min; + + /* + * Metric value when max() aggregate function is used over the interval. + */ + @JsonProperty(value = "max", access = JsonProperty.Access.WRITE_ONLY) + private Double max; + + /* + * Metric value when avg() aggregate function is used over the interval. + */ + @JsonProperty(value = "avg", access = JsonProperty.Access.WRITE_ONLY) + private Double avg; + + /* + * Metric value when sum() aggregate function is used over the interval. + */ + @JsonProperty(value = "sum", access = JsonProperty.Access.WRITE_ONLY) + private Double sum; + + /* + * Metric value when stdev aggregate function is used over the interval. + */ + @JsonProperty(value = "stdev", access = JsonProperty.Access.WRITE_ONLY) + private Double stdev; + + /** Creates an instance of QueryMetricProperties class. */ + public QueryMetricProperties() { + } + + /** + * Get the name property: The name information for the metric. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the displayName property: The UI appropriate name for the metric. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the unit property: The unit of the metric. + * + * @return the unit value. + */ + public QueryMetricUnitType unit() { + return this.unit; + } + + /** + * Get the value property: The value of the metric. + * + * @return the value value. + */ + public Double value() { + return this.value; + } + + /** + * Get the min property: Metric value when min() aggregate function is used over the interval. + * + * @return the min value. + */ + public Double min() { + return this.min; + } + + /** + * Get the max property: Metric value when max() aggregate function is used over the interval. + * + * @return the max value. + */ + public Double max() { + return this.max; + } + + /** + * Get the avg property: Metric value when avg() aggregate function is used over the interval. + * + * @return the avg value. + */ + public Double avg() { + return this.avg; + } + + /** + * Get the sum property: Metric value when sum() aggregate function is used over the interval. + * + * @return the sum value. + */ + public Double sum() { + return this.sum; + } + + /** + * Get the stdev property: Metric value when stdev aggregate function is used over the interval. + * + * @return the stdev value. + */ + public Double stdev() { + return this.stdev; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/QueryMetricUnitType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/QueryMetricUnitType.java new file mode 100644 index 0000000000000..81c738b88b5fe --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/QueryMetricUnitType.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The unit of the metric. */ +public final class QueryMetricUnitType extends ExpandableStringEnum { + /** Static value percentage for QueryMetricUnitType. */ + public static final QueryMetricUnitType PERCENTAGE = fromString("percentage"); + + /** Static value KB for QueryMetricUnitType. */ + public static final QueryMetricUnitType KB = fromString("KB"); + + /** Static value microseconds for QueryMetricUnitType. */ + public static final QueryMetricUnitType MICROSECONDS = fromString("microseconds"); + + /** Static value count for QueryMetricUnitType. */ + public static final QueryMetricUnitType COUNT = fromString("count"); + + /** + * Creates or finds a QueryMetricUnitType from its string representation. + * + * @param name a name to look for. + * @return the corresponding QueryMetricUnitType. + */ + @JsonCreator + public static QueryMetricUnitType fromString(String name) { + return fromString(name, QueryMetricUnitType.class); + } + + /** + * Gets known QueryMetricUnitType values. + * + * @return known QueryMetricUnitType values. + */ + public static Collection values() { + return values(QueryMetricUnitType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/QueryStatistics.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/QueryStatistics.java new file mode 100644 index 0000000000000..fdad1531c8781 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/QueryStatistics.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.QueryStatisticsInner; +import java.util.List; + +/** An immutable client-side representation of QueryStatistics. */ +public interface QueryStatistics { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the databaseName property: Database name of the database in which this query was executed. + * + * @return the databaseName value. + */ + String databaseName(); + + /** + * Gets the queryId property: Unique query id (unique within one database). + * + * @return the queryId value. + */ + String queryId(); + + /** + * Gets the startTime property: The start time for the metric (ISO-8601 format). + * + * @return the startTime value. + */ + String startTime(); + + /** + * Gets the endTime property: The end time for the metric (ISO-8601 format). + * + * @return the endTime value. + */ + String endTime(); + + /** + * Gets the intervals property: List of intervals with appropriate metric data. + * + * @return the intervals value. + */ + List intervals(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.QueryStatisticsInner object. + * + * @return the inner object. + */ + QueryStatisticsInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/QueryTimeGrainType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/QueryTimeGrainType.java new file mode 100644 index 0000000000000..053b0ff223135 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/QueryTimeGrainType.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Interval type (length). */ +public final class QueryTimeGrainType extends ExpandableStringEnum { + /** Static value PT1H for QueryTimeGrainType. */ + public static final QueryTimeGrainType PT1H = fromString("PT1H"); + + /** Static value P1D for QueryTimeGrainType. */ + public static final QueryTimeGrainType P1D = fromString("P1D"); + + /** + * Creates or finds a QueryTimeGrainType from its string representation. + * + * @param name a name to look for. + * @return the corresponding QueryTimeGrainType. + */ + @JsonCreator + public static QueryTimeGrainType fromString(String name) { + return fromString(name, QueryTimeGrainType.class); + } + + /** + * Gets known QueryTimeGrainType values. + * + * @return known QueryTimeGrainType values. + */ + public static Collection values() { + return values(QueryTimeGrainType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReadOnlyEndpointFailoverPolicy.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReadOnlyEndpointFailoverPolicy.java new file mode 100644 index 0000000000000..07da954e4272d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReadOnlyEndpointFailoverPolicy.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Failover policy of the read-only endpoint for the failover group. */ +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); + } + + /** + * Gets known ReadOnlyEndpointFailoverPolicy values. + * + * @return known ReadOnlyEndpointFailoverPolicy values. + */ + public static Collection values() { + return values(ReadOnlyEndpointFailoverPolicy.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReadScaleCapability.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReadScaleCapability.java new file mode 100644 index 0000000000000..9d46dfb5cbf67 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReadScaleCapability.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The read scale capability. */ +@Fluent +public final class ReadScaleCapability { + /* + * The maximum number of read scale replicas. + */ + @JsonProperty(value = "maxNumberOfReplicas", access = JsonProperty.Access.WRITE_ONLY) + private Integer maxNumberOfReplicas; + + /* + * The status of the capability. + */ + @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; + + /** Creates an instance of ReadScaleCapability class. */ + public ReadScaleCapability() { + } + + /** + * Get the maxNumberOfReplicas property: The maximum number of read scale replicas. + * + * @return the maxNumberOfReplicas value. + */ + public Integer maxNumberOfReplicas() { + return this.maxNumberOfReplicas; + } + + /** + * Get the status property: The status of the capability. + * + * @return the status value. + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason property: The reason for the capability not being available. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: The reason for the capability not being available. + * + * @param reason the reason value to set. + * @return the ReadScaleCapability object itself. + */ + public ReadScaleCapability withReason(String reason) { + this.reason = reason; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReadWriteEndpointFailoverPolicy.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReadWriteEndpointFailoverPolicy.java new file mode 100644 index 0000000000000..ddee9d02d9ad1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReadWriteEndpointFailoverPolicy.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * Failover policy of the read-write endpoint for the failover group. If failoverPolicy is Automatic then + * failoverWithDataLossGracePeriodMinutes is required. + */ +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); + } + + /** + * Gets known ReadWriteEndpointFailoverPolicy values. + * + * @return known ReadWriteEndpointFailoverPolicy values. + */ + public static Collection values() { + return values(ReadWriteEndpointFailoverPolicy.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedAction.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedAction.java new file mode 100644 index 0000000000000..dac9f7a62ab71 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedAction.java @@ -0,0 +1,229 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.RecommendedActionInner; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of RecommendedAction. */ +public interface RecommendedAction { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the kind property: Resource kind. + * + * @return the kind value. + */ + String kind(); + + /** + * Gets the location property: Resource location. + * + * @return the location value. + */ + String location(); + + /** + * Gets the recommendationReason property: Gets the reason for recommending this action. e.g., DuplicateIndex. + * + * @return the recommendationReason value. + */ + String recommendationReason(); + + /** + * Gets the validSince property: Gets the time since when this recommended action is valid. + * + * @return the validSince value. + */ + OffsetDateTime validSince(); + + /** + * Gets the lastRefresh property: Gets time when this recommended action was last refreshed. + * + * @return the lastRefresh value. + */ + OffsetDateTime lastRefresh(); + + /** + * Gets the state property: Gets the info of the current state the recommended action is in. + * + * @return the state value. + */ + RecommendedActionStateInfo state(); + + /** + * Gets the isExecutableAction property: Gets if this recommended action is actionable by user. + * + * @return the isExecutableAction value. + */ + Boolean isExecutableAction(); + + /** + * Gets the isRevertableAction property: Gets if changes applied by this recommended action can be reverted by user. + * + * @return the isRevertableAction value. + */ + Boolean isRevertableAction(); + + /** + * Gets the isArchivedAction property: 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. + */ + Boolean isArchivedAction(); + + /** + * Gets the executeActionStartTime property: Gets the time when system started applying this recommended action on + * the user resource. e.g., index creation start time. + * + * @return the executeActionStartTime value. + */ + OffsetDateTime executeActionStartTime(); + + /** + * Gets the executeActionDuration property: Gets the time taken for applying this recommended action on user + * resource. e.g., time taken for index creation. + * + * @return the executeActionDuration value. + */ + String executeActionDuration(); + + /** + * Gets the revertActionStartTime property: 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. + */ + OffsetDateTime revertActionStartTime(); + + /** + * Gets the revertActionDuration property: 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. + */ + String revertActionDuration(); + + /** + * Gets the executeActionInitiatedBy property: Gets if approval for applying this recommended action was given by + * user/system. + * + * @return the executeActionInitiatedBy value. + */ + RecommendedActionInitiatedBy executeActionInitiatedBy(); + + /** + * Gets the executeActionInitiatedTime property: Gets the time when this recommended action was approved for + * execution. + * + * @return the executeActionInitiatedTime value. + */ + OffsetDateTime executeActionInitiatedTime(); + + /** + * Gets the revertActionInitiatedBy property: Gets if approval for reverting this recommended action was given by + * user/system. + * + * @return the revertActionInitiatedBy value. + */ + RecommendedActionInitiatedBy revertActionInitiatedBy(); + + /** + * Gets the revertActionInitiatedTime property: Gets the time when this recommended action was approved for revert. + * + * @return the revertActionInitiatedTime value. + */ + OffsetDateTime revertActionInitiatedTime(); + + /** + * Gets the score property: Gets the impact of this recommended action. Possible values are 1 - Low impact, 2 - + * Medium Impact and 3 - High Impact. + * + * @return the score value. + */ + Integer score(); + + /** + * Gets the implementationDetails property: Gets the implementation details of this recommended action for user to + * apply it manually. + * + * @return the implementationDetails value. + */ + RecommendedActionImplementationInfo implementationDetails(); + + /** + * Gets the errorDetails property: Gets the error details if and why this recommended action is put to error state. + * + * @return the errorDetails value. + */ + RecommendedActionErrorInfo errorDetails(); + + /** + * Gets the estimatedImpact property: Gets the estimated impact info for this recommended action e.g., Estimated CPU + * gain, Estimated Disk Space change. + * + * @return the estimatedImpact value. + */ + List estimatedImpact(); + + /** + * Gets the observedImpact property: Gets the observed/actual impact info for this recommended action e.g., Actual + * CPU gain, Actual Disk Space change. + * + * @return the observedImpact value. + */ + List observedImpact(); + + /** + * Gets the timeSeries property: Gets the time series info of metrics for this recommended action e.g., CPU + * consumption time series. + * + * @return the timeSeries value. + */ + List timeSeries(); + + /** + * Gets the linkedObjects property: Gets the linked objects, if any. + * + * @return the linkedObjects value. + */ + List linkedObjects(); + + /** + * Gets the details property: Gets additional details specific to this recommended action. + * + * @return the details value. + */ + Map details(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.RecommendedActionInner object. + * + * @return the inner object. + */ + RecommendedActionInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedActionCurrentState.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedActionCurrentState.java new file mode 100644 index 0000000000000..c9c7d401201c2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedActionCurrentState.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * 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 -> successfully reverted the changes made by + * recommended action on user database. Ignored -> user explicitly ignored/discarded the recommended action. + */ +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); + } + + /** + * Gets known RecommendedActionCurrentState values. + * + * @return known RecommendedActionCurrentState values. + */ + public static Collection values() { + return values(RecommendedActionCurrentState.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedActionErrorInfo.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedActionErrorInfo.java new file mode 100644 index 0000000000000..31cf38ee2839f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedActionErrorInfo.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Contains error information for an Azure SQL Database, Server or Elastic Pool Recommended Action. */ +@Immutable +public final 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 + */ + @JsonProperty(value = "isRetryable", access = JsonProperty.Access.WRITE_ONLY) + private IsRetryable isRetryable; + + /** Creates an instance of RecommendedActionErrorInfo class. */ + public RecommendedActionErrorInfo() { + } + + /** + * Get the errorCode property: 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 the isRetryable property: Gets whether the error could be ignored and recommended action could be retried. + * Possible values are: Yes/No. + * + * @return the isRetryable value. + */ + public IsRetryable isRetryable() { + return this.isRetryable; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedActionImpactRecord.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedActionImpactRecord.java new file mode 100644 index 0000000000000..deac3a3fcba93 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedActionImpactRecord.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +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. + */ +@Immutable +public final 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; + + /** Creates an instance of RecommendedActionImpactRecord class. */ + public RecommendedActionImpactRecord() { + } + + /** + * Get the dimensionName property: Gets the name of the impact dimension. e.g., CPUChange, DiskSpaceChange, + * NumberOfQueriesAffected. + * + * @return the dimensionName value. + */ + public String dimensionName() { + return this.dimensionName; + } + + /** + * Get the unit property: Gets the name of the impact dimension. e.g., CPUChange, DiskSpaceChange, + * NumberOfQueriesAffected. + * + * @return the unit value. + */ + public String unit() { + return this.unit; + } + + /** + * Get the absoluteValue property: 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 the changeValueAbsolute property: 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 the changeValueRelative property: 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedActionImplementationInfo.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedActionImplementationInfo.java new file mode 100644 index 0000000000000..08452104c57c5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedActionImplementationInfo.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Contains information for manual implementation for an Azure SQL Database, Server or Elastic Pool Recommended Action. + */ +@Immutable +public final class RecommendedActionImplementationInfo { + /* + * Gets the method in which this recommended action can be manually implemented. e.g., 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; + + /** Creates an instance of RecommendedActionImplementationInfo class. */ + public RecommendedActionImplementationInfo() { + } + + /** + * Get the method property: Gets the method in which this recommended action can be manually implemented. e.g., + * TSql, AzurePowerShell. + * + * @return the method value. + */ + public ImplementationMethod method() { + return this.method; + } + + /** + * Get the script property: 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedActionInitiatedBy.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedActionInitiatedBy.java new file mode 100644 index 0000000000000..bbb3e912cd213 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedActionInitiatedBy.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Gets if approval for applying this recommended action was given by user/system. */ +public enum RecommendedActionInitiatedBy { + /** Enum value User. */ + USER("User"), + + /** Enum value System. */ + SYSTEM("System"); + + /** The actual serialized value for a RecommendedActionInitiatedBy instance. */ + private final 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) { + if (value == null) { + return null; + } + RecommendedActionInitiatedBy[] items = RecommendedActionInitiatedBy.values(); + for (RecommendedActionInitiatedBy item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedActionMetricInfo.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedActionMetricInfo.java new file mode 100644 index 0000000000000..db059d5d4f7bd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedActionMetricInfo.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** + * Contains time series of various impacted metrics for an Azure SQL Database, Server or Elastic Pool Recommended + * Action. + */ +@Immutable +public final 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 OffsetDateTime 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; + + /** Creates an instance of RecommendedActionMetricInfo class. */ + public RecommendedActionMetricInfo() { + } + + /** + * Get the metricName property: Gets the name of the metric. e.g., CPU, Number of Queries. + * + * @return the metricName value. + */ + public String metricName() { + return this.metricName; + } + + /** + * Get the unit property: Gets the unit in which metric is measured. e.g., DTU, Frequency. + * + * @return the unit value. + */ + public String unit() { + return this.unit; + } + + /** + * Get the timeGrain property: 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 the startTime property: Gets the start time of time interval given by this MetricInfo. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Get the value property: Gets the value of the metric in the time interval given by this MetricInfo. + * + * @return the value value. + */ + public Double value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedActionStateInfo.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedActionStateInfo.java new file mode 100644 index 0000000000000..c4ff6d8071aac --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedActionStateInfo.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Contains information of current state for an Azure SQL Database, Server or Elastic Pool Recommended Action. */ +@Fluent +public final 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 -> successfully + * reverted the changes made by recommended action on user database. Ignored -> user explicitly + * ignored/discarded the recommended action. + */ + @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. + */ + @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 OffsetDateTime lastModified; + + /** Creates an instance of RecommendedActionStateInfo class. */ + public RecommendedActionStateInfo() { + } + + /** + * Get the currentValue property: 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 + * -> successfully reverted the changes made by recommended action on user database. Ignored -> user + * explicitly ignored/discarded the recommended action. + * + * @return the currentValue value. + */ + public RecommendedActionCurrentState currentValue() { + return this.currentValue; + } + + /** + * Set the currentValue property: 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 + * -> successfully reverted the changes made by recommended action on user database. Ignored -> user + * explicitly ignored/discarded the recommended action. + * + * @param currentValue the currentValue value to set. + * @return the RecommendedActionStateInfo object itself. + */ + public RecommendedActionStateInfo withCurrentValue(RecommendedActionCurrentState currentValue) { + this.currentValue = currentValue; + return this; + } + + /** + * Get the actionInitiatedBy property: 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. + * + * @return the actionInitiatedBy value. + */ + public RecommendedActionInitiatedBy actionInitiatedBy() { + return this.actionInitiatedBy; + } + + /** + * Get the lastModified property: Gets the time when the state was last modified. + * + * @return the lastModified value. + */ + public OffsetDateTime lastModified() { + return this.lastModified; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (currentValue() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property currentValue in model RecommendedActionStateInfo")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(RecommendedActionStateInfo.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedSensitivityLabelUpdate.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedSensitivityLabelUpdate.java new file mode 100644 index 0000000000000..4e30284436c1e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedSensitivityLabelUpdate.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.fluent.models.RecommendedSensitivityLabelUpdateProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A recommended sensitivity label update operation. */ +@Fluent +public final class RecommendedSensitivityLabelUpdate extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private RecommendedSensitivityLabelUpdateProperties innerProperties; + + /** Creates an instance of RecommendedSensitivityLabelUpdate class. */ + public RecommendedSensitivityLabelUpdate() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private RecommendedSensitivityLabelUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the op property: The op property. + * + * @return the op value. + */ + public RecommendedSensitivityLabelUpdateKind op() { + return this.innerProperties() == null ? null : this.innerProperties().op(); + } + + /** + * Set the op property: The op property. + * + * @param op the op value to set. + * @return the RecommendedSensitivityLabelUpdate object itself. + */ + public RecommendedSensitivityLabelUpdate withOp(RecommendedSensitivityLabelUpdateKind op) { + if (this.innerProperties() == null) { + this.innerProperties = new RecommendedSensitivityLabelUpdateProperties(); + } + this.innerProperties().withOp(op); + return this; + } + + /** + * Get the schema property: Schema name of the column to update. + * + * @return the schema value. + */ + public String schema() { + return this.innerProperties() == null ? null : this.innerProperties().schema(); + } + + /** + * Set the schema property: Schema name of the column to update. + * + * @param schema the schema value to set. + * @return the RecommendedSensitivityLabelUpdate object itself. + */ + public RecommendedSensitivityLabelUpdate withSchema(String schema) { + if (this.innerProperties() == null) { + this.innerProperties = new RecommendedSensitivityLabelUpdateProperties(); + } + this.innerProperties().withSchema(schema); + return this; + } + + /** + * Get the table property: Table name of the column to update. + * + * @return the table value. + */ + public String table() { + return this.innerProperties() == null ? null : this.innerProperties().table(); + } + + /** + * Set the table property: Table name of the column to update. + * + * @param table the table value to set. + * @return the RecommendedSensitivityLabelUpdate object itself. + */ + public RecommendedSensitivityLabelUpdate withTable(String table) { + if (this.innerProperties() == null) { + this.innerProperties = new RecommendedSensitivityLabelUpdateProperties(); + } + this.innerProperties().withTable(table); + return this; + } + + /** + * Get the column property: Column name to update. + * + * @return the column value. + */ + public String column() { + return this.innerProperties() == null ? null : this.innerProperties().column(); + } + + /** + * Set the column property: Column name to update. + * + * @param column the column value to set. + * @return the RecommendedSensitivityLabelUpdate object itself. + */ + public RecommendedSensitivityLabelUpdate withColumn(String column) { + if (this.innerProperties() == null) { + this.innerProperties = new RecommendedSensitivityLabelUpdateProperties(); + } + this.innerProperties().withColumn(column); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedSensitivityLabelUpdateKind.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedSensitivityLabelUpdateKind.java new file mode 100644 index 0000000000000..fc9aa50c1b3df --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedSensitivityLabelUpdateKind.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for RecommendedSensitivityLabelUpdateKind. */ +public enum RecommendedSensitivityLabelUpdateKind { + /** Enum value enable. */ + ENABLE("enable"), + + /** Enum value disable. */ + DISABLE("disable"); + + /** The actual serialized value for a RecommendedSensitivityLabelUpdateKind instance. */ + private final String value; + + RecommendedSensitivityLabelUpdateKind(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a RecommendedSensitivityLabelUpdateKind instance. + * + * @param value the serialized value to parse. + * @return the parsed RecommendedSensitivityLabelUpdateKind object, or null if unable to parse. + */ + @JsonCreator + public static RecommendedSensitivityLabelUpdateKind fromString(String value) { + if (value == null) { + return null; + } + RecommendedSensitivityLabelUpdateKind[] items = RecommendedSensitivityLabelUpdateKind.values(); + for (RecommendedSensitivityLabelUpdateKind item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedSensitivityLabelUpdateList.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedSensitivityLabelUpdateList.java new file mode 100644 index 0000000000000..cf5d19a970ed1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedSensitivityLabelUpdateList.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of recommended sensitivity label update operations. */ +@Fluent +public final class RecommendedSensitivityLabelUpdateList { + /* + * The operations property. + */ + @JsonProperty(value = "operations") + private List operations; + + /** Creates an instance of RecommendedSensitivityLabelUpdateList class. */ + public RecommendedSensitivityLabelUpdateList() { + } + + /** + * Get the operations property: The operations property. + * + * @return the operations value. + */ + public List operations() { + return this.operations; + } + + /** + * Set the operations property: The operations property. + * + * @param operations the operations value to set. + * @return the RecommendedSensitivityLabelUpdateList object itself. + */ + public RecommendedSensitivityLabelUpdateList withOperations(List operations) { + this.operations = operations; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (operations() != null) { + operations().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedSensitivityLabels.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedSensitivityLabels.java new file mode 100644 index 0000000000000..4d2e3ddb8fdd5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecommendedSensitivityLabels.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of RecommendedSensitivityLabels. */ +public interface RecommendedSensitivityLabels { + /** + * Update recommended sensitivity labels states of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of recommended sensitivity label update operations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response updateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + RecommendedSensitivityLabelUpdateList parameters, + Context context); + + /** + * Update recommended sensitivity labels states of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of recommended sensitivity label update operations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void update( + String resourceGroupName, + String serverName, + String databaseName, + RecommendedSensitivityLabelUpdateList parameters); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecoverableDatabase.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecoverableDatabase.java new file mode 100644 index 0000000000000..4fe97f9bb963e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecoverableDatabase.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.RecoverableDatabaseInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of RecoverableDatabase. */ +public interface RecoverableDatabase { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the edition property: The edition of the database. + * + * @return the edition value. + */ + String edition(); + + /** + * Gets the serviceLevelObjective property: The service level objective name of the database. + * + * @return the serviceLevelObjective value. + */ + String serviceLevelObjective(); + + /** + * Gets the elasticPoolName property: The elastic pool name of the database. + * + * @return the elasticPoolName value. + */ + String elasticPoolName(); + + /** + * Gets the lastAvailableBackupDate property: The last available backup date of the database (ISO8601 format). + * + * @return the lastAvailableBackupDate value. + */ + OffsetDateTime lastAvailableBackupDate(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.RecoverableDatabaseInner object. + * + * @return the inner object. + */ + RecoverableDatabaseInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecoverableDatabaseListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecoverableDatabaseListResult.java new file mode 100644 index 0000000000000..398f9f3c599e0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecoverableDatabaseListResult.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.RecoverableDatabaseInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response to a list recoverable databases request. */ +@Fluent +public final class RecoverableDatabaseListResult { + /* + * A list of recoverable databases + */ + @JsonProperty(value = "value", required = true) + private List value; + + /** Creates an instance of RecoverableDatabaseListResult class. */ + public RecoverableDatabaseListResult() { + } + + /** + * Get the value property: A list of recoverable databases. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: A list of recoverable databases. + * + * @param value the value value to set. + * @return the RecoverableDatabaseListResult object itself. + */ + public RecoverableDatabaseListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property value in model RecoverableDatabaseListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(RecoverableDatabaseListResult.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecoverableDatabases.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecoverableDatabases.java new file mode 100644 index 0000000000000..fde75117e9287 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecoverableDatabases.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of RecoverableDatabases. */ +public interface RecoverableDatabases { + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a recoverable database, which is a resource representing a database's geo backup along with {@link + * Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a recoverable database, which is a resource representing a database's geo backup. + */ + RecoverableDatabase get(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. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of recoverable databases as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of recoverable databases as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecoverableManagedDatabase.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecoverableManagedDatabase.java new file mode 100644 index 0000000000000..616d07062dea3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecoverableManagedDatabase.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.RecoverableManagedDatabaseInner; + +/** An immutable client-side representation of RecoverableManagedDatabase. */ +public interface RecoverableManagedDatabase { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the lastAvailableBackupDate property: The last available backup date. + * + * @return the lastAvailableBackupDate value. + */ + String lastAvailableBackupDate(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.RecoverableManagedDatabaseInner object. + * + * @return the inner object. + */ + RecoverableManagedDatabaseInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecoverableManagedDatabaseListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecoverableManagedDatabaseListResult.java new file mode 100644 index 0000000000000..240cafe962a28 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecoverableManagedDatabaseListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.RecoverableManagedDatabaseInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of recoverable managed databases. */ +@Immutable +public final class RecoverableManagedDatabaseListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of RecoverableManagedDatabaseListResult class. */ + public RecoverableManagedDatabaseListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecoverableManagedDatabases.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecoverableManagedDatabases.java new file mode 100644 index 0000000000000..fc5cbbd27a8d3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RecoverableManagedDatabases.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of RecoverableManagedDatabases. */ +public interface RecoverableManagedDatabases { + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of recoverable managed databases as paginated response with {@link PagedIterable}. + */ + PagedIterable listByInstance(String resourceGroupName, String managedInstanceName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of recoverable managed databases as paginated response with {@link PagedIterable}. + */ + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * 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 recoverableDatabaseName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a recoverable managed database along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String managedInstanceName, String recoverableDatabaseName, Context context); + + /** + * 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 recoverableDatabaseName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a recoverable managed database. + */ + RecoverableManagedDatabase get( + String resourceGroupName, String managedInstanceName, String recoverableDatabaseName); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Remediation.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Remediation.java new file mode 100644 index 0000000000000..97d6f8c9576f2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Remediation.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** SQL Vulnerability Assessment remediation Details. */ +@Immutable +public final class Remediation { + /* + * SQL Vulnerability Assessment remediation description. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /* + * SQL Vulnerability Assessment remediation script. + */ + @JsonProperty(value = "scripts", access = JsonProperty.Access.WRITE_ONLY) + private List scripts; + + /* + * SQL Vulnerability Assessment is remediation automated. + */ + @JsonProperty(value = "automated", access = JsonProperty.Access.WRITE_ONLY) + private Boolean automated; + + /* + * SQL Vulnerability Assessment optional link to remediate in Azure Portal. + */ + @JsonProperty(value = "portalLink", access = JsonProperty.Access.WRITE_ONLY) + private String portalLink; + + /** Creates an instance of Remediation class. */ + public Remediation() { + } + + /** + * Get the description property: SQL Vulnerability Assessment remediation description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the scripts property: SQL Vulnerability Assessment remediation script. + * + * @return the scripts value. + */ + public List scripts() { + return this.scripts; + } + + /** + * Get the automated property: SQL Vulnerability Assessment is remediation automated. + * + * @return the automated value. + */ + public Boolean automated() { + return this.automated; + } + + /** + * Get the portalLink property: SQL Vulnerability Assessment optional link to remediate in Azure Portal. + * + * @return the portalLink value. + */ + public String portalLink() { + return this.portalLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReplicaType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReplicaType.java new file mode 100644 index 0000000000000..6299de096a9bd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReplicaType.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ReplicaType. */ +public final class ReplicaType extends ExpandableStringEnum { + /** Static value Primary for ReplicaType. */ + public static final ReplicaType PRIMARY = fromString("Primary"); + + /** Static value ReadableSecondary for ReplicaType. */ + public static final ReplicaType READABLE_SECONDARY = fromString("ReadableSecondary"); + + /** + * Creates or finds a ReplicaType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ReplicaType. + */ + @JsonCreator + public static ReplicaType fromString(String name) { + return fromString(name, ReplicaType.class); + } + + /** + * Gets known ReplicaType values. + * + * @return known ReplicaType values. + */ + public static Collection values() { + return values(ReplicaType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReplicationLink.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReplicationLink.java new file mode 100644 index 0000000000000..4f2ddc416d586 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReplicationLink.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.ReplicationLinkInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of ReplicationLink. */ +public interface ReplicationLink { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the partnerServer property: Resource partner server. + * + * @return the partnerServer value. + */ + String partnerServer(); + + /** + * Gets the partnerDatabase property: Resource partner database. + * + * @return the partnerDatabase value. + */ + String partnerDatabase(); + + /** + * Gets the partnerLocation property: Resource partner location. + * + * @return the partnerLocation value. + */ + String partnerLocation(); + + /** + * Gets the role property: Local replication role. + * + * @return the role value. + */ + ReplicationRole role(); + + /** + * Gets the partnerRole property: Partner replication role. + * + * @return the partnerRole value. + */ + ReplicationRole partnerRole(); + + /** + * Gets the replicationMode property: Replication mode. + * + * @return the replicationMode value. + */ + String replicationMode(); + + /** + * Gets the startTime property: Time at which the link was created. + * + * @return the startTime value. + */ + OffsetDateTime startTime(); + + /** + * Gets the percentComplete property: Seeding completion percentage for the link. + * + * @return the percentComplete value. + */ + Integer percentComplete(); + + /** + * Gets the replicationState property: Replication state (PENDING, SEEDING, CATCHUP, SUSPENDED). + * + * @return the replicationState value. + */ + ReplicationState replicationState(); + + /** + * Gets the isTerminationAllowed property: Whether the user is currently allowed to terminate the link. + * + * @return the isTerminationAllowed value. + */ + Boolean isTerminationAllowed(); + + /** + * Gets the linkType property: Link type (GEO, NAMED, STANDBY). + * + * @return the linkType value. + */ + ReplicationLinkType linkType(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ReplicationLinkInner object. + * + * @return the inner object. + */ + ReplicationLinkInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReplicationLinkListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReplicationLinkListResult.java new file mode 100644 index 0000000000000..3d159aec9fbe7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReplicationLinkListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.ReplicationLinkInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of replication links. */ +@Immutable +public final class ReplicationLinkListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of ReplicationLinkListResult class. */ + public ReplicationLinkListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReplicationLinkType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReplicationLinkType.java new file mode 100644 index 0000000000000..78d6691cfcbc3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReplicationLinkType.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Link type (GEO, NAMED, STANDBY). */ +public final class ReplicationLinkType extends ExpandableStringEnum { + /** Static value GEO for ReplicationLinkType. */ + public static final ReplicationLinkType GEO = fromString("GEO"); + + /** Static value NAMED for ReplicationLinkType. */ + public static final ReplicationLinkType NAMED = fromString("NAMED"); + + /** Static value STANDBY for ReplicationLinkType. */ + public static final ReplicationLinkType STANDBY = fromString("STANDBY"); + + /** + * Creates or finds a ReplicationLinkType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ReplicationLinkType. + */ + @JsonCreator + public static ReplicationLinkType fromString(String name) { + return fromString(name, ReplicationLinkType.class); + } + + /** + * Gets known ReplicationLinkType values. + * + * @return known ReplicationLinkType values. + */ + public static Collection values() { + return values(ReplicationLinkType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReplicationLinks.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReplicationLinks.java new file mode 100644 index 0000000000000..c8f9bf1ea45d0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReplicationLinks.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ReplicationLinks. */ +public interface ReplicationLinks { + /** + * Gets a list of replication links on database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of replication links on database as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase(String resourceGroupName, String serverName, String databaseName); + + /** + * Gets a list of replication links on database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of replication links on database as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Gets a 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. + * @param linkId The name of the replication link. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a replication link along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, String linkId, Context context); + + /** + * Gets a 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. + * @param linkId The name of the replication link. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a replication link. + */ + ReplicationLink get(String resourceGroupName, String serverName, String databaseName, String linkId); + + /** + * Deletes the 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. + * @param linkId The linkId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, String databaseName, String linkId); + + /** + * Deletes the 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. + * @param linkId The linkId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, String databaseName, String linkId, Context context); + + /** + * 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 databaseName The name of the database. + * @param linkId The name of the replication link. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a replication link. + */ + ReplicationLink failover(String resourceGroupName, String serverName, String databaseName, String linkId); + + /** + * 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 databaseName The name of the database. + * @param linkId The name of the replication link. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a replication link. + */ + ReplicationLink failover( + String resourceGroupName, String serverName, String databaseName, String linkId, Context context); + + /** + * Fails over from the current primary server to this server allowing 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. + * @param linkId The name of the replication link. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a replication link. + */ + ReplicationLink failoverAllowDataLoss( + String resourceGroupName, String serverName, String databaseName, String linkId); + + /** + * Fails over from the current primary server to this server allowing 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. + * @param linkId The name of the replication link. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a replication link. + */ + ReplicationLink failoverAllowDataLoss( + String resourceGroupName, String serverName, String databaseName, String linkId, Context context); + + /** + * Gets a list of 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of replication links as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets a list of 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of replication links as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReplicationMode.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReplicationMode.java new file mode 100644 index 0000000000000..fe2c60bffe498 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReplicationMode.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The replication mode of a distributed availability group. Parameter will be ignored during link creation. */ +public final class ReplicationMode extends ExpandableStringEnum { + /** Static value Async for ReplicationMode. */ + public static final ReplicationMode ASYNC = fromString("Async"); + + /** Static value Sync for ReplicationMode. */ + public static final ReplicationMode SYNC = fromString("Sync"); + + /** + * Creates or finds a ReplicationMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding ReplicationMode. + */ + @JsonCreator + public static ReplicationMode fromString(String name) { + return fromString(name, ReplicationMode.class); + } + + /** + * Gets known ReplicationMode values. + * + * @return known ReplicationMode values. + */ + public static Collection values() { + return values(ReplicationMode.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReplicationRole.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReplicationRole.java new file mode 100644 index 0000000000000..045267e9c5eb6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReplicationRole.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Local replication role. */ +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 final 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) { + if (value == null) { + return null; + } + ReplicationRole[] items = ReplicationRole.values(); + for (ReplicationRole item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReplicationState.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReplicationState.java new file mode 100644 index 0000000000000..834e2b80d64f6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ReplicationState.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Replication state (PENDING, SEEDING, CATCHUP, SUSPENDED). */ +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); + } + + /** + * Gets known ReplicationState values. + * + * @return known ReplicationState values. + */ + public static Collection values() { + return values(ReplicationState.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ResourceIdentity.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ResourceIdentity.java new file mode 100644 index 0000000000000..65ee96e8ed126 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ResourceIdentity.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; +import java.util.UUID; + +/** Azure Active Directory identity configuration for a resource. */ +@Fluent +public class ResourceIdentity { + /* + * The resource ids of the user assigned identities to use + */ + @JsonProperty(value = "userAssignedIdentities") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map userAssignedIdentities; + + /* + * 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. + */ + @JsonProperty(value = "type") + private IdentityType type; + + /* + * The Azure Active Directory tenant id. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private UUID tenantId; + + /** Creates an instance of ResourceIdentity class. */ + public ResourceIdentity() { + } + + /** + * Get the userAssignedIdentities property: The resource ids of the user assigned identities to use. + * + * @return the userAssignedIdentities value. + */ + public Map userAssignedIdentities() { + return this.userAssignedIdentities; + } + + /** + * Set the userAssignedIdentities property: The resource ids of the user assigned identities to use. + * + * @param userAssignedIdentities the userAssignedIdentities value to set. + * @return the ResourceIdentity object itself. + */ + public ResourceIdentity withUserAssignedIdentities(Map userAssignedIdentities) { + this.userAssignedIdentities = userAssignedIdentities; + return this; + } + + /** + * Get the principalId property: The Azure Active Directory principal id. + * + * @return the principalId value. + */ + public UUID principalId() { + return this.principalId; + } + + /** + * Get the type property: The identity type. Set this to 'SystemAssigned' in order to automatically create and + * assign an Azure Active Directory principal for the resource. + * + * @return the type value. + */ + public IdentityType type() { + return this.type; + } + + /** + * Set the type property: The identity type. Set this to 'SystemAssigned' in order to automatically create and + * assign an Azure Active Directory principal for the resource. + * + * @param type the type value to set. + * @return the ResourceIdentity object itself. + */ + public ResourceIdentity withType(IdentityType type) { + this.type = type; + return this; + } + + /** + * Get the tenantId property: The Azure Active Directory tenant id. + * + * @return the tenantId value. + */ + public UUID tenantId() { + return this.tenantId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (userAssignedIdentities() != null) { + userAssignedIdentities() + .values() + .forEach( + e -> { + if (e != null) { + e.validate(); + } + }); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ResourceMoveDefinition.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ResourceMoveDefinition.java new file mode 100644 index 0000000000000..cde2d5736ca6b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ResourceMoveDefinition.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Contains the information necessary to perform a resource move (rename). */ +@Fluent +public final class ResourceMoveDefinition { + /* + * The target ID for the resource + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** Creates an instance of ResourceMoveDefinition class. */ + public ResourceMoveDefinition() { + } + + /** + * Get the id property: The target ID for the resource. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property id in model ResourceMoveDefinition")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ResourceMoveDefinition.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ResourceWithWritableName.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ResourceWithWritableName.java new file mode 100644 index 0000000000000..c629e7e74cc61 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ResourceWithWritableName.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** ARM resource. */ +@Fluent +public class ResourceWithWritableName extends ProxyResource { + /* + * Resource name. + */ + @JsonProperty(value = "name") + private String name; + + /** Creates an instance of ResourceWithWritableName class. */ + public ResourceWithWritableName() { + } + + /** + * Get the name property: Resource name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Resource name. + * + * @param name the name value to set. + * @return the ResourceWithWritableName object itself. + */ + public ResourceWithWritableName withName(String name) { + this.name = name; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorableDroppedDatabase.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorableDroppedDatabase.java new file mode 100644 index 0000000000000..16f73abf07659 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorableDroppedDatabase.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.RestorableDroppedDatabaseInner; +import java.time.OffsetDateTime; +import java.util.Map; + +/** An immutable client-side representation of RestorableDroppedDatabase. */ +public interface RestorableDroppedDatabase { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the sku property: The name and tier of the SKU. + * + * @return the sku value. + */ + Sku sku(); + + /** + * Gets the location property: Resource location. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the databaseName property: The name of the database. + * + * @return the databaseName value. + */ + String databaseName(); + + /** + * Gets the maxSizeBytes property: The max size of the database expressed in bytes. + * + * @return the maxSizeBytes value. + */ + Long maxSizeBytes(); + + /** + * Gets the creationDate property: The creation date of the database (ISO8601 format). + * + * @return the creationDate value. + */ + OffsetDateTime creationDate(); + + /** + * Gets the deletionDate property: The deletion date of the database (ISO8601 format). + * + * @return the deletionDate value. + */ + OffsetDateTime deletionDate(); + + /** + * Gets the earliestRestoreDate property: The earliest restore date of the database (ISO8601 format). + * + * @return the earliestRestoreDate value. + */ + OffsetDateTime earliestRestoreDate(); + + /** + * Gets the backupStorageRedundancy property: The storage account type used to store backups for this database. + * + * @return the backupStorageRedundancy value. + */ + BackupStorageRedundancy backupStorageRedundancy(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.RestorableDroppedDatabaseInner object. + * + * @return the inner object. + */ + RestorableDroppedDatabaseInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorableDroppedDatabaseListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorableDroppedDatabaseListResult.java new file mode 100644 index 0000000000000..18596e116f269 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorableDroppedDatabaseListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.RestorableDroppedDatabaseInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of restorable dropped databases. */ +@Immutable +public final class RestorableDroppedDatabaseListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of RestorableDroppedDatabaseListResult class. */ + public RestorableDroppedDatabaseListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorableDroppedDatabases.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorableDroppedDatabases.java new file mode 100644 index 0000000000000..58ed80b18d8e1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorableDroppedDatabases.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of RestorableDroppedDatabases. */ +public interface RestorableDroppedDatabases { + /** + * Gets a list of restorable dropped 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of restorable dropped databases as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets a list of restorable dropped 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of restorable dropped databases as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * Gets a restorable dropped database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a restorable dropped database along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String restorableDroppedDatabaseId, Context context); + + /** + * Gets a restorable dropped database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param restorableDroppedDatabaseId The restorableDroppedDatabaseId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a restorable dropped database. + */ + RestorableDroppedDatabase get(String resourceGroupName, String serverName, String restorableDroppedDatabaseId); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorableDroppedManagedDatabase.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorableDroppedManagedDatabase.java new file mode 100644 index 0000000000000..eeb5b85264146 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorableDroppedManagedDatabase.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.RestorableDroppedManagedDatabaseInner; +import java.time.OffsetDateTime; +import java.util.Map; + +/** An immutable client-side representation of RestorableDroppedManagedDatabase. */ +public interface RestorableDroppedManagedDatabase { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the databaseName property: The name of the database. + * + * @return the databaseName value. + */ + String databaseName(); + + /** + * Gets the creationDate property: The creation date of the database (ISO8601 format). + * + * @return the creationDate value. + */ + OffsetDateTime creationDate(); + + /** + * Gets the deletionDate property: The deletion date of the database (ISO8601 format). + * + * @return the deletionDate value. + */ + OffsetDateTime deletionDate(); + + /** + * Gets the earliestRestoreDate property: The earliest restore date of the database (ISO8601 format). + * + * @return the earliestRestoreDate value. + */ + OffsetDateTime earliestRestoreDate(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.RestorableDroppedManagedDatabaseInner + * object. + * + * @return the inner object. + */ + RestorableDroppedManagedDatabaseInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorableDroppedManagedDatabaseListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorableDroppedManagedDatabaseListResult.java new file mode 100644 index 0000000000000..ae69221f73c7d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorableDroppedManagedDatabaseListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.RestorableDroppedManagedDatabaseInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of restorable dropped managed databases. */ +@Immutable +public final class RestorableDroppedManagedDatabaseListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of RestorableDroppedManagedDatabaseListResult class. */ + public RestorableDroppedManagedDatabaseListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorableDroppedManagedDatabases.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorableDroppedManagedDatabases.java new file mode 100644 index 0000000000000..680233a78a4f7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorableDroppedManagedDatabases.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of RestorableDroppedManagedDatabases. */ +public interface RestorableDroppedManagedDatabases { + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of restorable dropped managed databases as paginated response with {@link PagedIterable}. + */ + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of restorable dropped managed databases as paginated response with {@link PagedIterable}. + */ + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * 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 restorableDroppedDatabaseId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a restorable dropped managed database along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId, Context context); + + /** + * 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 restorableDroppedDatabaseId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a restorable dropped managed database. + */ + RestorableDroppedManagedDatabase get( + String resourceGroupName, String managedInstanceName, String restorableDroppedDatabaseId); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestoreDetailsName.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestoreDetailsName.java new file mode 100644 index 0000000000000..02751aec5e38f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestoreDetailsName.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for RestoreDetailsName. */ +public final class RestoreDetailsName extends ExpandableStringEnum { + /** Static value Default for RestoreDetailsName. */ + public static final RestoreDetailsName DEFAULT = fromString("Default"); + + /** + * Creates or finds a RestoreDetailsName from its string representation. + * + * @param name a name to look for. + * @return the corresponding RestoreDetailsName. + */ + @JsonCreator + public static RestoreDetailsName fromString(String name) { + return fromString(name, RestoreDetailsName.class); + } + + /** + * Gets known RestoreDetailsName values. + * + * @return known RestoreDetailsName values. + */ + public static Collection values() { + return values(RestoreDetailsName.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorePoint.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorePoint.java new file mode 100644 index 0000000000000..a56b9323b12aa --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorePoint.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.RestorePointInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of RestorePoint. */ +public interface RestorePoint { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: Resource location. + * + * @return the location value. + */ + String location(); + + /** + * Gets the restorePointType property: The type of restore point. + * + * @return the restorePointType value. + */ + RestorePointType restorePointType(); + + /** + * Gets the earliestRestoreDate property: The earliest time to which this database can be restored. + * + * @return the earliestRestoreDate value. + */ + OffsetDateTime earliestRestoreDate(); + + /** + * Gets the restorePointCreationDate property: The time the backup was taken. + * + * @return the restorePointCreationDate value. + */ + OffsetDateTime restorePointCreationDate(); + + /** + * Gets the restorePointLabel property: The label of restore point for backup request by user. + * + * @return the restorePointLabel value. + */ + String restorePointLabel(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.RestorePointInner object. + * + * @return the inner object. + */ + RestorePointInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorePointListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorePointListResult.java new file mode 100644 index 0000000000000..af164a6e34fd3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorePointListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.RestorePointInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of long term retention backups. */ +@Immutable +public final class RestorePointListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of RestorePointListResult class. */ + public RestorePointListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorePointType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorePointType.java new file mode 100644 index 0000000000000..a106de3715ddc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorePointType.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** The type of restore point. */ +public enum RestorePointType { + /** Enum value CONTINUOUS. */ + CONTINUOUS("CONTINUOUS"), + + /** Enum value DISCRETE. */ + DISCRETE("DISCRETE"); + + /** The actual serialized value for a RestorePointType instance. */ + private final 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) { + if (value == null) { + return null; + } + RestorePointType[] items = RestorePointType.values(); + for (RestorePointType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorePoints.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorePoints.java new file mode 100644 index 0000000000000..86263fe7ac245 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RestorePoints.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of RestorePoints. */ +public interface RestorePoints { + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database restore points as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase(String resourceGroupName, String serverName, String databaseName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database restore points as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * 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 parameters The definition for creating the restore point of this database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database restore points. + */ + RestorePoint create( + String resourceGroupName, + String serverName, + String databaseName, + CreateDatabaseRestorePointDefinition parameters); + + /** + * 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 parameters The definition for creating the restore point of this database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database restore points. + */ + RestorePoint create( + String resourceGroupName, + String serverName, + String databaseName, + CreateDatabaseRestorePointDefinition parameters, + Context context); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a restore point along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, String restorePointName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a restore point. + */ + RestorePoint get(String resourceGroupName, String serverName, String databaseName, String restorePointName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse( + String resourceGroupName, String serverName, String databaseName, String restorePointName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, String databaseName, String restorePointName); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RuleSeverity.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RuleSeverity.java new file mode 100644 index 0000000000000..571fbdb1e577e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RuleSeverity.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** SQL Vulnerability Assessment rule severity. */ +public final class RuleSeverity extends ExpandableStringEnum { + /** Static value High for RuleSeverity. */ + public static final RuleSeverity HIGH = fromString("High"); + + /** Static value Medium for RuleSeverity. */ + public static final RuleSeverity MEDIUM = fromString("Medium"); + + /** Static value Low for RuleSeverity. */ + public static final RuleSeverity LOW = fromString("Low"); + + /** Static value Informational for RuleSeverity. */ + public static final RuleSeverity INFORMATIONAL = fromString("Informational"); + + /** Static value Obsolete for RuleSeverity. */ + public static final RuleSeverity OBSOLETE = fromString("Obsolete"); + + /** + * Creates or finds a RuleSeverity from its string representation. + * + * @param name a name to look for. + * @return the corresponding RuleSeverity. + */ + @JsonCreator + public static RuleSeverity fromString(String name) { + return fromString(name, RuleSeverity.class); + } + + /** + * Gets known RuleSeverity values. + * + * @return known RuleSeverity values. + */ + public static Collection values() { + return values(RuleSeverity.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RuleStatus.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RuleStatus.java new file mode 100644 index 0000000000000..5ba98862a87fa --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RuleStatus.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** SQL Vulnerability Assessment baseline status. */ +public final class RuleStatus extends ExpandableStringEnum { + /** Static value NonFinding for RuleStatus. */ + public static final RuleStatus NON_FINDING = fromString("NonFinding"); + + /** Static value Finding for RuleStatus. */ + public static final RuleStatus FINDING = fromString("Finding"); + + /** Static value InternalError for RuleStatus. */ + public static final RuleStatus INTERNAL_ERROR = fromString("InternalError"); + + /** + * Creates or finds a RuleStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding RuleStatus. + */ + @JsonCreator + public static RuleStatus fromString(String name) { + return fromString(name, RuleStatus.class); + } + + /** + * Gets known RuleStatus values. + * + * @return known RuleStatus values. + */ + public static Collection values() { + return values(RuleStatus.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RuleType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RuleType.java new file mode 100644 index 0000000000000..19582b91b3358 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/RuleType.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** SQL Vulnerability Assessment rule type. */ +public final class RuleType extends ExpandableStringEnum { + /** Static value Binary for RuleType. */ + public static final RuleType BINARY = fromString("Binary"); + + /** Static value BaselineExpected for RuleType. */ + public static final RuleType BASELINE_EXPECTED = fromString("BaselineExpected"); + + /** Static value PositiveList for RuleType. */ + public static final RuleType POSITIVE_LIST = fromString("PositiveList"); + + /** Static value NegativeList for RuleType. */ + public static final RuleType NEGATIVE_LIST = fromString("NegativeList"); + + /** + * Creates or finds a RuleType from its string representation. + * + * @param name a name to look for. + * @return the corresponding RuleType. + */ + @JsonCreator + public static RuleType fromString(String name) { + return fromString(name, RuleType.class); + } + + /** + * Gets known RuleType values. + * + * @return known RuleType values. + */ + public static Collection values() { + return values(RuleType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SampleName.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SampleName.java new file mode 100644 index 0000000000000..126038f23ada7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SampleName.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The name of the sample schema to apply when creating this database. */ +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); + } + + /** + * Gets known SampleName values. + * + * @return known SampleName values. + */ + public static Collection values() { + return values(SampleName.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecondaryType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecondaryType.java new file mode 100644 index 0000000000000..b0a10673eac95 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecondaryType.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The secondary type of the database if it is a secondary. Valid values are Geo, Named and Standby. */ +public final class SecondaryType extends ExpandableStringEnum { + /** Static value Geo for SecondaryType. */ + public static final SecondaryType GEO = fromString("Geo"); + + /** Static value Named for SecondaryType. */ + public static final SecondaryType NAMED = fromString("Named"); + + /** Static value Standby for SecondaryType. */ + public static final SecondaryType STANDBY = fromString("Standby"); + + /** + * Creates or finds a SecondaryType from its string representation. + * + * @param name a name to look for. + * @return the corresponding SecondaryType. + */ + @JsonCreator + public static SecondaryType fromString(String name) { + return fromString(name, SecondaryType.class); + } + + /** + * Gets known SecondaryType values. + * + * @return known SecondaryType values. + */ + public static Collection values() { + return values(SecondaryType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecurityAlertPolicyName.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecurityAlertPolicyName.java new file mode 100644 index 0000000000000..defd0b780188f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecurityAlertPolicyName.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SecurityAlertPolicyName. */ +public final class SecurityAlertPolicyName extends ExpandableStringEnum { + /** Static value Default for SecurityAlertPolicyName. */ + public static final SecurityAlertPolicyName DEFAULT = fromString("Default"); + + /** + * Creates or finds a SecurityAlertPolicyName from its string representation. + * + * @param name a name to look for. + * @return the corresponding SecurityAlertPolicyName. + */ + @JsonCreator + public static SecurityAlertPolicyName fromString(String name) { + return fromString(name, SecurityAlertPolicyName.class); + } + + /** + * Gets known SecurityAlertPolicyName values. + * + * @return known SecurityAlertPolicyName values. + */ + public static Collection values() { + return values(SecurityAlertPolicyName.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecurityAlertPolicyState.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecurityAlertPolicyState.java new file mode 100644 index 0000000000000..5195b3bc2bda9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecurityAlertPolicyState.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Specifies the state of the policy, whether it is enabled or disabled or a policy has not been applied yet on the + * specific database. + */ +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 final 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) { + if (value == null) { + return null; + } + SecurityAlertPolicyState[] items = SecurityAlertPolicyState.values(); + for (SecurityAlertPolicyState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecurityAlertsPolicyState.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecurityAlertsPolicyState.java new file mode 100644 index 0000000000000..fd1180e10edde --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecurityAlertsPolicyState.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Specifies the state of the policy, whether it is enabled or disabled or a policy has not been applied yet on the + * specific database. + */ +public enum SecurityAlertsPolicyState { + /** Enum value Enabled. */ + ENABLED("Enabled"), + + /** Enum value Disabled. */ + DISABLED("Disabled"); + + /** The actual serialized value for a SecurityAlertsPolicyState instance. */ + private final String value; + + SecurityAlertsPolicyState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SecurityAlertsPolicyState instance. + * + * @param value the serialized value to parse. + * @return the parsed SecurityAlertsPolicyState object, or null if unable to parse. + */ + @JsonCreator + public static SecurityAlertsPolicyState fromString(String value) { + if (value == null) { + return null; + } + SecurityAlertsPolicyState[] items = SecurityAlertsPolicyState.values(); + for (SecurityAlertsPolicyState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecurityEvent.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecurityEvent.java new file mode 100644 index 0000000000000..beef7616ba444 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecurityEvent.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.SecurityEventInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of SecurityEvent. */ +public interface SecurityEvent { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the eventTime property: The time when the security event occurred. + * + * @return the eventTime value. + */ + OffsetDateTime eventTime(); + + /** + * Gets the securityEventType property: The type of the security event. + * + * @return the securityEventType value. + */ + SecurityEventType securityEventType(); + + /** + * Gets the subscription property: The subscription name. + * + * @return the subscription value. + */ + String subscription(); + + /** + * Gets the server property: The server name. + * + * @return the server value. + */ + String server(); + + /** + * Gets the database property: The database name. + * + * @return the database value. + */ + String database(); + + /** + * Gets the clientIp property: The IP address of the client who executed the statement. + * + * @return the clientIp value. + */ + String clientIp(); + + /** + * Gets the applicationName property: The application used to execute the statement. + * + * @return the applicationName value. + */ + String applicationName(); + + /** + * Gets the principalName property: The principal user who executed the statement. + * + * @return the principalName value. + */ + String principalName(); + + /** + * Gets the securityEventSqlInjectionAdditionalProperties property: The sql injection additional properties, + * populated only if the type of the security event is sql injection. + * + * @return the securityEventSqlInjectionAdditionalProperties value. + */ + SecurityEventSqlInjectionAdditionalProperties securityEventSqlInjectionAdditionalProperties(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.SecurityEventInner object. + * + * @return the inner object. + */ + SecurityEventInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecurityEventCollection.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecurityEventCollection.java new file mode 100644 index 0000000000000..95174d77042a2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecurityEventCollection.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.SecurityEventInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of security events. */ +@Immutable +public final class SecurityEventCollection { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of SecurityEventCollection class. */ + public SecurityEventCollection() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecurityEventSqlInjectionAdditionalProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecurityEventSqlInjectionAdditionalProperties.java new file mode 100644 index 0000000000000..e8ffaa13a1437 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecurityEventSqlInjectionAdditionalProperties.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of a security event sql injection additional properties. */ +@Immutable +public final class SecurityEventSqlInjectionAdditionalProperties { + /* + * The threat ID. + */ + @JsonProperty(value = "threatId", access = JsonProperty.Access.WRITE_ONLY) + private String threatId; + + /* + * The statement + */ + @JsonProperty(value = "statement", access = JsonProperty.Access.WRITE_ONLY) + private String statement; + + /* + * The statement highlight offset + */ + @JsonProperty(value = "statementHighlightOffset", access = JsonProperty.Access.WRITE_ONLY) + private Integer statementHighlightOffset; + + /* + * The statement highlight length + */ + @JsonProperty(value = "statementHighlightLength", access = JsonProperty.Access.WRITE_ONLY) + private Integer statementHighlightLength; + + /* + * The sql error code + */ + @JsonProperty(value = "errorCode", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorCode; + + /* + * The sql error severity + */ + @JsonProperty(value = "errorSeverity", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorSeverity; + + /* + * The sql error message + */ + @JsonProperty(value = "errorMessage", access = JsonProperty.Access.WRITE_ONLY) + private String errorMessage; + + /** Creates an instance of SecurityEventSqlInjectionAdditionalProperties class. */ + public SecurityEventSqlInjectionAdditionalProperties() { + } + + /** + * Get the threatId property: The threat ID. + * + * @return the threatId value. + */ + public String threatId() { + return this.threatId; + } + + /** + * Get the statement property: The statement. + * + * @return the statement value. + */ + public String statement() { + return this.statement; + } + + /** + * Get the statementHighlightOffset property: The statement highlight offset. + * + * @return the statementHighlightOffset value. + */ + public Integer statementHighlightOffset() { + return this.statementHighlightOffset; + } + + /** + * Get the statementHighlightLength property: The statement highlight length. + * + * @return the statementHighlightLength value. + */ + public Integer statementHighlightLength() { + return this.statementHighlightLength; + } + + /** + * Get the errorCode property: The sql error code. + * + * @return the errorCode value. + */ + public Integer errorCode() { + return this.errorCode; + } + + /** + * Get the errorSeverity property: The sql error severity. + * + * @return the errorSeverity value. + */ + public Integer errorSeverity() { + return this.errorSeverity; + } + + /** + * Get the errorMessage property: The sql error message. + * + * @return the errorMessage value. + */ + public String errorMessage() { + return this.errorMessage; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecurityEventType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecurityEventType.java new file mode 100644 index 0000000000000..202665ce36328 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SecurityEventType.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** The type of the security event. */ +public enum SecurityEventType { + /** Enum value Undefined. */ + UNDEFINED("Undefined"), + + /** Enum value SqlInjectionVulnerability. */ + SQL_INJECTION_VULNERABILITY("SqlInjectionVulnerability"), + + /** Enum value SqlInjectionExploit. */ + SQL_INJECTION_EXPLOIT("SqlInjectionExploit"); + + /** The actual serialized value for a SecurityEventType instance. */ + private final String value; + + SecurityEventType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SecurityEventType instance. + * + * @param value the serialized value to parse. + * @return the parsed SecurityEventType object, or null if unable to parse. + */ + @JsonCreator + public static SecurityEventType fromString(String value) { + if (value == null) { + return null; + } + SecurityEventType[] items = SecurityEventType.values(); + for (SecurityEventType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabel.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabel.java new file mode 100644 index 0000000000000..7158ca6f02010 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabel.java @@ -0,0 +1,345 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.SensitivityLabelInner; + +/** An immutable client-side representation of SensitivityLabel. */ +public interface SensitivityLabel { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the managedBy property: Resource that manages the sensitivity label. + * + * @return the managedBy value. + */ + String managedBy(); + + /** + * Gets the schemaName property: The schema name. + * + * @return the schemaName value. + */ + String schemaName(); + + /** + * Gets the tableName property: The table name. + * + * @return the tableName value. + */ + String tableName(); + + /** + * Gets the columnName property: The column name. + * + * @return the columnName value. + */ + String columnName(); + + /** + * Gets the labelName property: The label name. + * + * @return the labelName value. + */ + String labelName(); + + /** + * Gets the labelId property: The label ID. + * + * @return the labelId value. + */ + String labelId(); + + /** + * Gets the informationType property: The information type. + * + * @return the informationType value. + */ + String informationType(); + + /** + * Gets the informationTypeId property: The information type ID. + * + * @return the informationTypeId value. + */ + String informationTypeId(); + + /** + * Gets the isDisabled property: Is sensitivity recommendation disabled. Applicable for recommended sensitivity + * label only. Specifies whether the sensitivity recommendation on this column is disabled (dismissed) or not. + * + * @return the isDisabled value. + */ + Boolean isDisabled(); + + /** + * Gets the rank property: The rank property. + * + * @return the rank value. + */ + SensitivityLabelRank rank(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.SensitivityLabelInner object. + * + * @return the inner object. + */ + SensitivityLabelInner innerModel(); + + /** The entirety of the SensitivityLabel definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The SensitivityLabel definition stages. */ + interface DefinitionStages { + /** The first stage of the SensitivityLabel definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the SensitivityLabel definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, managedInstanceName, databaseName, schemaName, tableName, columnName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @param databaseName The name of the database. + * @param schemaName The name of the schema. + * @param tableName The name of the table. + * @param columnName The name of the column. + * @return the next definition stage. + */ + WithCreate withExistingColumn( + String resourceGroupName, + String managedInstanceName, + String databaseName, + String schemaName, + String tableName, + String columnName); + } + /** + * The stage of the SensitivityLabel definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithLabelName, + DefinitionStages.WithLabelId, + DefinitionStages.WithInformationType, + DefinitionStages.WithInformationTypeId, + DefinitionStages.WithRank { + /** + * Executes the create request. + * + * @return the created resource. + */ + SensitivityLabel create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + SensitivityLabel create(Context context); + } + /** The stage of the SensitivityLabel definition allowing to specify labelName. */ + interface WithLabelName { + /** + * Specifies the labelName property: The label name.. + * + * @param labelName The label name. + * @return the next definition stage. + */ + WithCreate withLabelName(String labelName); + } + /** The stage of the SensitivityLabel definition allowing to specify labelId. */ + interface WithLabelId { + /** + * Specifies the labelId property: The label ID.. + * + * @param labelId The label ID. + * @return the next definition stage. + */ + WithCreate withLabelId(String labelId); + } + /** The stage of the SensitivityLabel definition allowing to specify informationType. */ + interface WithInformationType { + /** + * Specifies the informationType property: The information type.. + * + * @param informationType The information type. + * @return the next definition stage. + */ + WithCreate withInformationType(String informationType); + } + /** The stage of the SensitivityLabel definition allowing to specify informationTypeId. */ + interface WithInformationTypeId { + /** + * Specifies the informationTypeId property: The information type ID.. + * + * @param informationTypeId The information type ID. + * @return the next definition stage. + */ + WithCreate withInformationTypeId(String informationTypeId); + } + /** The stage of the SensitivityLabel definition allowing to specify rank. */ + interface WithRank { + /** + * Specifies the rank property: The rank property.. + * + * @param rank The rank property. + * @return the next definition stage. + */ + WithCreate withRank(SensitivityLabelRank rank); + } + } + /** + * Begins update for the SensitivityLabel resource. + * + * @return the stage of resource update. + */ + SensitivityLabel.Update update(); + + /** The template for SensitivityLabel update. */ + interface Update + extends UpdateStages.WithLabelName, + UpdateStages.WithLabelId, + UpdateStages.WithInformationType, + UpdateStages.WithInformationTypeId, + UpdateStages.WithRank { + /** + * Executes the update request. + * + * @return the updated resource. + */ + SensitivityLabel apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + SensitivityLabel apply(Context context); + } + /** The SensitivityLabel update stages. */ + interface UpdateStages { + /** The stage of the SensitivityLabel update allowing to specify labelName. */ + interface WithLabelName { + /** + * Specifies the labelName property: The label name.. + * + * @param labelName The label name. + * @return the next definition stage. + */ + Update withLabelName(String labelName); + } + /** The stage of the SensitivityLabel update allowing to specify labelId. */ + interface WithLabelId { + /** + * Specifies the labelId property: The label ID.. + * + * @param labelId The label ID. + * @return the next definition stage. + */ + Update withLabelId(String labelId); + } + /** The stage of the SensitivityLabel update allowing to specify informationType. */ + interface WithInformationType { + /** + * Specifies the informationType property: The information type.. + * + * @param informationType The information type. + * @return the next definition stage. + */ + Update withInformationType(String informationType); + } + /** The stage of the SensitivityLabel update allowing to specify informationTypeId. */ + interface WithInformationTypeId { + /** + * Specifies the informationTypeId property: The information type ID.. + * + * @param informationTypeId The information type ID. + * @return the next definition stage. + */ + Update withInformationTypeId(String informationTypeId); + } + /** The stage of the SensitivityLabel update allowing to specify rank. */ + interface WithRank { + /** + * Specifies the rank property: The rank property.. + * + * @param rank The rank property. + * @return the next definition stage. + */ + Update withRank(SensitivityLabelRank rank); + } + } + /** + * Disables sensitivity recommendations on a given column. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response disableRecommendationWithResponse(Context context); + + /** + * Disables sensitivity recommendations on a given column. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void disableRecommendation(); + + /** + * Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response enableRecommendationWithResponse(Context context); + + /** + * Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void enableRecommendation(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabelListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabelListResult.java new file mode 100644 index 0000000000000..4cef678f0a5fe --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabelListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.SensitivityLabelInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of sensitivity labels. */ +@Immutable +public final class SensitivityLabelListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of SensitivityLabelListResult class. */ + public SensitivityLabelListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabelRank.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabelRank.java new file mode 100644 index 0000000000000..1e8025f8e2d07 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabelRank.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for SensitivityLabelRank. */ +public enum SensitivityLabelRank { + /** Enum value None. */ + NONE("None"), + + /** Enum value Low. */ + LOW("Low"), + + /** Enum value Medium. */ + MEDIUM("Medium"), + + /** Enum value High. */ + HIGH("High"), + + /** Enum value Critical. */ + CRITICAL("Critical"); + + /** The actual serialized value for a SensitivityLabelRank instance. */ + private final String value; + + SensitivityLabelRank(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SensitivityLabelRank instance. + * + * @param value the serialized value to parse. + * @return the parsed SensitivityLabelRank object, or null if unable to parse. + */ + @JsonCreator + public static SensitivityLabelRank fromString(String value) { + if (value == null) { + return null; + } + SensitivityLabelRank[] items = SensitivityLabelRank.values(); + for (SensitivityLabelRank item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabelSource.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabelSource.java new file mode 100644 index 0000000000000..45142d4f75811 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabelSource.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +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 final 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) { + if (value == null) { + return null; + } + SensitivityLabelSource[] items = SensitivityLabelSource.values(); + for (SensitivityLabelSource item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabelUpdate.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabelUpdate.java new file mode 100644 index 0000000000000..514d6e5eb776d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabelUpdate.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.SensitivityLabelUpdateInner; + +/** An immutable client-side representation of SensitivityLabelUpdate. */ +public interface SensitivityLabelUpdate { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the op property: The op property. + * + * @return the op value. + */ + SensitivityLabelUpdateKind op(); + + /** + * Gets the schema property: Schema name of the column to update. + * + * @return the schema value. + */ + String schema(); + + /** + * Gets the table property: Table name of the column to update. + * + * @return the table value. + */ + String table(); + + /** + * Gets the column property: Column name to update. + * + * @return the column value. + */ + String column(); + + /** + * Gets the sensitivityLabel property: The sensitivity label information to apply on a column. + * + * @return the sensitivityLabel value. + */ + SensitivityLabel sensitivityLabel(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.SensitivityLabelUpdateInner object. + * + * @return the inner object. + */ + SensitivityLabelUpdateInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabelUpdateKind.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabelUpdateKind.java new file mode 100644 index 0000000000000..328483f2e51fe --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabelUpdateKind.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for SensitivityLabelUpdateKind. */ +public enum SensitivityLabelUpdateKind { + /** Enum value set. */ + SET("set"), + + /** Enum value remove. */ + REMOVE("remove"); + + /** The actual serialized value for a SensitivityLabelUpdateKind instance. */ + private final String value; + + SensitivityLabelUpdateKind(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SensitivityLabelUpdateKind instance. + * + * @param value the serialized value to parse. + * @return the parsed SensitivityLabelUpdateKind object, or null if unable to parse. + */ + @JsonCreator + public static SensitivityLabelUpdateKind fromString(String value) { + if (value == null) { + return null; + } + SensitivityLabelUpdateKind[] items = SensitivityLabelUpdateKind.values(); + for (SensitivityLabelUpdateKind item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabelUpdateList.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabelUpdateList.java new file mode 100644 index 0000000000000..c0af30557384b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabelUpdateList.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.fluent.models.SensitivityLabelUpdateInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of sensitivity label update operations. */ +@Fluent +public final class SensitivityLabelUpdateList { + /* + * The operations property. + */ + @JsonProperty(value = "operations") + private List operations; + + /** Creates an instance of SensitivityLabelUpdateList class. */ + public SensitivityLabelUpdateList() { + } + + /** + * Get the operations property: The operations property. + * + * @return the operations value. + */ + public List operations() { + return this.operations; + } + + /** + * Set the operations property: The operations property. + * + * @param operations the operations value to set. + * @return the SensitivityLabelUpdateList object itself. + */ + public SensitivityLabelUpdateList withOperations(List operations) { + this.operations = operations; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (operations() != null) { + operations().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabelUpdateProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabelUpdateProperties.java new file mode 100644 index 0000000000000..3e37925f6110e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabelUpdateProperties.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.SensitivityLabelUpdatePropertiesInner; + +/** An immutable client-side representation of SensitivityLabelUpdateProperties. */ +public interface SensitivityLabelUpdateProperties { + /** + * Gets the op property: The op property. + * + * @return the op value. + */ + SensitivityLabelUpdateKind op(); + + /** + * Gets the schema property: Schema name of the column to update. + * + * @return the schema value. + */ + String schema(); + + /** + * Gets the table property: Table name of the column to update. + * + * @return the table value. + */ + String table(); + + /** + * Gets the column property: Column name to update. + * + * @return the column value. + */ + String column(); + + /** + * Gets the sensitivityLabel property: The sensitivity label information to apply on a column. + * + * @return the sensitivityLabel value. + */ + SensitivityLabel sensitivityLabel(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.SensitivityLabelUpdatePropertiesInner + * object. + * + * @return the inner object. + */ + SensitivityLabelUpdatePropertiesInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabels.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabels.java new file mode 100644 index 0000000000000..c61a178b6bd9c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SensitivityLabels.java @@ -0,0 +1,374 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.SensitivityLabelInner; + +/** Resource collection API of SensitivityLabels. */ +public interface SensitivityLabels { + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity labels of a given database as paginated response with {@link PagedIterable}. + */ + PagedIterable listCurrentByDatabase( + String resourceGroupName, String serverName, String databaseName); + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param skipToken The skipToken parameter. + * @param count The count parameter. + * @param filter An OData filter expression that filters elements in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity labels of a given database as paginated response with {@link PagedIterable}. + */ + PagedIterable listCurrentByDatabase( + String resourceGroupName, + String serverName, + String databaseName, + String skipToken, + Boolean count, + String filter, + Context context); + + /** + * Update sensitivity labels of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of sensitivity label update operations. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response updateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + SensitivityLabelUpdateList parameters, + Context context); + + /** + * Update sensitivity labels of a given database using an operations batch. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 A list of sensitivity label update operations. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void update( + String resourceGroupName, String serverName, String databaseName, SensitivityLabelUpdateList parameters); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity labels of a given database as paginated response with {@link PagedIterable}. + */ + PagedIterable listRecommendedByDatabase( + String resourceGroupName, String serverName, String databaseName); + + /** + * Gets the sensitivity labels of a given database. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param skipToken The skipToken parameter. + * @param includeDisabledRecommendations Specifies whether to include disabled recommendations or not. + * @param filter An OData filter expression that filters elements in the collection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity labels of a given database as paginated response with {@link PagedIterable}. + */ + PagedIterable listRecommendedByDatabase( + String resourceGroupName, + String serverName, + String databaseName, + String skipToken, + Boolean includeDisabledRecommendations, + String filter, + Context context); + + /** + * Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response enableRecommendationWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context); + + /** + * Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void enableRecommendation( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName); + + /** + * Disables sensitivity recommendations on a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response disableRecommendationWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context); + + /** + * Disables sensitivity recommendations on a given column. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void disableRecommendation( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName); + + /** + * 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity label of a given column along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelSource sensitivityLabelSource, + Context context); + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the sensitivity label of a given column. + */ + SensitivityLabel get( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelSource sensitivityLabelSource); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sensitivity label along with {@link Response}. + */ + Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelInner parameters, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sensitivity label. + */ + SensitivityLabel createOrUpdate( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + SensitivityLabelInner parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete( + String resourceGroupName, + String serverName, + String databaseName, + String schemaName, + String tableName, + String columnName); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Server.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Server.java new file mode 100644 index 0000000000000..0c331768a7024 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Server.java @@ -0,0 +1,576 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerInner; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +/** An immutable client-side representation of Server. */ +public interface Server { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the identity property: The Azure Active Directory identity of the server. + * + * @return the identity value. + */ + ResourceIdentity identity(); + + /** + * Gets the kind property: Kind of sql server. This is metadata used for the Azure portal experience. + * + * @return the kind value. + */ + String kind(); + + /** + * Gets the administratorLogin property: Administrator username for the server. Once created it cannot be changed. + * + * @return the administratorLogin value. + */ + String administratorLogin(); + + /** + * Gets the administratorLoginPassword property: The administrator login password (required for server creation). + * + * @return the administratorLoginPassword value. + */ + String administratorLoginPassword(); + + /** + * Gets the version property: The version of the server. + * + * @return the version value. + */ + String version(); + + /** + * Gets the state property: The state of the server. + * + * @return the state value. + */ + String state(); + + /** + * Gets the fullyQualifiedDomainName property: The fully qualified domain name of the server. + * + * @return the fullyQualifiedDomainName value. + */ + String fullyQualifiedDomainName(); + + /** + * Gets the privateEndpointConnections property: List of private endpoint connections on a server. + * + * @return the privateEndpointConnections value. + */ + List privateEndpointConnections(); + + /** + * Gets the minimalTlsVersion property: Minimal TLS version. Allowed values: '1.0', '1.1', '1.2'. + * + * @return the minimalTlsVersion value. + */ + String minimalTlsVersion(); + + /** + * Gets the publicNetworkAccess property: Whether or not public endpoint access is allowed for this server. Value is + * optional but if passed in, must be 'Enabled' or 'Disabled'. + * + * @return the publicNetworkAccess value. + */ + ServerNetworkAccessFlag publicNetworkAccess(); + + /** + * Gets the workspaceFeature property: Whether or not existing server has a workspace created and if it allows + * connection from workspace. + * + * @return the workspaceFeature value. + */ + ServerWorkspaceFeature workspaceFeature(); + + /** + * Gets the primaryUserAssignedIdentityId property: The resource id of a user assigned identity to be used by + * default. + * + * @return the primaryUserAssignedIdentityId value. + */ + String primaryUserAssignedIdentityId(); + + /** + * Gets the federatedClientId property: The Client id used for cross tenant CMK scenario. + * + * @return the federatedClientId value. + */ + UUID federatedClientId(); + + /** + * Gets the keyId property: A CMK URI of the key to use for encryption. + * + * @return the keyId value. + */ + String keyId(); + + /** + * Gets the administrators property: The Azure Active Directory identity of the server. + * + * @return the administrators value. + */ + ServerExternalAdministrator administrators(); + + /** + * Gets the restrictOutboundNetworkAccess property: Whether or not to restrict outbound network access for this + * server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. + * + * @return the restrictOutboundNetworkAccess value. + */ + ServerNetworkAccessFlag restrictOutboundNetworkAccess(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ServerInner object. + * + * @return the inner object. + */ + ServerInner innerModel(); + + /** The entirety of the Server definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The Server definition stages. */ + interface DefinitionStages { + /** The first stage of the Server definition. */ + interface Blank extends WithLocation { + } + /** The stage of the Server definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the Server definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the Server definition which contains all the minimum required properties for the resource to be + * created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithIdentity, + DefinitionStages.WithAdministratorLogin, + DefinitionStages.WithAdministratorLoginPassword, + DefinitionStages.WithVersion, + DefinitionStages.WithMinimalTlsVersion, + DefinitionStages.WithPublicNetworkAccess, + DefinitionStages.WithPrimaryUserAssignedIdentityId, + DefinitionStages.WithFederatedClientId, + DefinitionStages.WithKeyId, + DefinitionStages.WithAdministrators, + DefinitionStages.WithRestrictOutboundNetworkAccess { + /** + * Executes the create request. + * + * @return the created resource. + */ + Server create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Server create(Context context); + } + /** The stage of the Server definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the Server definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: The Azure Active Directory identity of the server.. + * + * @param identity The Azure Active Directory identity of the server. + * @return the next definition stage. + */ + WithCreate withIdentity(ResourceIdentity identity); + } + /** The stage of the Server definition allowing to specify administratorLogin. */ + interface WithAdministratorLogin { + /** + * Specifies the administratorLogin property: Administrator username for the server. Once created it cannot + * be changed.. + * + * @param administratorLogin Administrator username for the server. Once created it cannot be changed. + * @return the next definition stage. + */ + WithCreate withAdministratorLogin(String administratorLogin); + } + /** The stage of the Server definition allowing to specify administratorLoginPassword. */ + interface WithAdministratorLoginPassword { + /** + * Specifies the administratorLoginPassword property: The administrator login password (required for server + * creation).. + * + * @param administratorLoginPassword The administrator login password (required for server creation). + * @return the next definition stage. + */ + WithCreate withAdministratorLoginPassword(String administratorLoginPassword); + } + /** The stage of the Server definition allowing to specify version. */ + interface WithVersion { + /** + * Specifies the version property: The version of the server.. + * + * @param version The version of the server. + * @return the next definition stage. + */ + WithCreate withVersion(String version); + } + /** The stage of the Server definition allowing to specify minimalTlsVersion. */ + interface WithMinimalTlsVersion { + /** + * Specifies the minimalTlsVersion property: Minimal TLS version. Allowed values: '1.0', '1.1', '1.2'. + * + * @param minimalTlsVersion Minimal TLS version. Allowed values: '1.0', '1.1', '1.2'. + * @return the next definition stage. + */ + WithCreate withMinimalTlsVersion(String minimalTlsVersion); + } + /** The stage of the Server definition allowing to specify publicNetworkAccess. */ + interface WithPublicNetworkAccess { + /** + * Specifies the publicNetworkAccess property: Whether or not public endpoint access is allowed for this + * server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. + * + * @param publicNetworkAccess Whether or not public endpoint access is allowed for this server. Value is + * optional but if passed in, must be 'Enabled' or 'Disabled'. + * @return the next definition stage. + */ + WithCreate withPublicNetworkAccess(ServerNetworkAccessFlag publicNetworkAccess); + } + /** The stage of the Server definition allowing to specify primaryUserAssignedIdentityId. */ + interface WithPrimaryUserAssignedIdentityId { + /** + * Specifies the primaryUserAssignedIdentityId property: The resource id of a user assigned identity to be + * used by default.. + * + * @param primaryUserAssignedIdentityId The resource id of a user assigned identity to be used by default. + * @return the next definition stage. + */ + WithCreate withPrimaryUserAssignedIdentityId(String primaryUserAssignedIdentityId); + } + /** The stage of the Server definition allowing to specify federatedClientId. */ + interface WithFederatedClientId { + /** + * Specifies the federatedClientId property: The Client id used for cross tenant CMK scenario. + * + * @param federatedClientId The Client id used for cross tenant CMK scenario. + * @return the next definition stage. + */ + WithCreate withFederatedClientId(UUID federatedClientId); + } + /** The stage of the Server definition allowing to specify keyId. */ + interface WithKeyId { + /** + * Specifies the keyId property: A CMK URI of the key to use for encryption.. + * + * @param keyId A CMK URI of the key to use for encryption. + * @return the next definition stage. + */ + WithCreate withKeyId(String keyId); + } + /** The stage of the Server definition allowing to specify administrators. */ + interface WithAdministrators { + /** + * Specifies the administrators property: The Azure Active Directory identity of the server.. + * + * @param administrators The Azure Active Directory identity of the server. + * @return the next definition stage. + */ + WithCreate withAdministrators(ServerExternalAdministrator administrators); + } + /** The stage of the Server definition allowing to specify restrictOutboundNetworkAccess. */ + interface WithRestrictOutboundNetworkAccess { + /** + * Specifies the restrictOutboundNetworkAccess property: Whether or not to restrict outbound network access + * for this server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. + * + * @param restrictOutboundNetworkAccess Whether or not to restrict outbound network access for this server. + * Value is optional but if passed in, must be 'Enabled' or 'Disabled'. + * @return the next definition stage. + */ + WithCreate withRestrictOutboundNetworkAccess(ServerNetworkAccessFlag restrictOutboundNetworkAccess); + } + } + /** + * Begins update for the Server resource. + * + * @return the stage of resource update. + */ + Server.Update update(); + + /** The template for Server update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithIdentity, + UpdateStages.WithAdministratorLoginPassword, + UpdateStages.WithVersion, + UpdateStages.WithMinimalTlsVersion, + UpdateStages.WithPublicNetworkAccess, + UpdateStages.WithPrimaryUserAssignedIdentityId, + UpdateStages.WithFederatedClientId, + UpdateStages.WithKeyId, + UpdateStages.WithRestrictOutboundNetworkAccess { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Server apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Server apply(Context context); + } + /** The Server update stages. */ + interface UpdateStages { + /** The stage of the Server update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the Server update allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Server identity. + * + * @param identity Server identity. + * @return the next definition stage. + */ + Update withIdentity(ResourceIdentity identity); + } + /** The stage of the Server update allowing to specify administratorLoginPassword. */ + interface WithAdministratorLoginPassword { + /** + * Specifies the administratorLoginPassword property: The administrator login password (required for server + * creation).. + * + * @param administratorLoginPassword The administrator login password (required for server creation). + * @return the next definition stage. + */ + Update withAdministratorLoginPassword(String administratorLoginPassword); + } + /** The stage of the Server update allowing to specify version. */ + interface WithVersion { + /** + * Specifies the version property: The version of the server.. + * + * @param version The version of the server. + * @return the next definition stage. + */ + Update withVersion(String version); + } + /** The stage of the Server update allowing to specify minimalTlsVersion. */ + interface WithMinimalTlsVersion { + /** + * Specifies the minimalTlsVersion property: Minimal TLS version. Allowed values: '1.0', '1.1', '1.2'. + * + * @param minimalTlsVersion Minimal TLS version. Allowed values: '1.0', '1.1', '1.2'. + * @return the next definition stage. + */ + Update withMinimalTlsVersion(String minimalTlsVersion); + } + /** The stage of the Server update allowing to specify publicNetworkAccess. */ + interface WithPublicNetworkAccess { + /** + * Specifies the publicNetworkAccess property: Whether or not public endpoint access is allowed for this + * server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. + * + * @param publicNetworkAccess Whether or not public endpoint access is allowed for this server. Value is + * optional but if passed in, must be 'Enabled' or 'Disabled'. + * @return the next definition stage. + */ + Update withPublicNetworkAccess(ServerNetworkAccessFlag publicNetworkAccess); + } + /** The stage of the Server update allowing to specify primaryUserAssignedIdentityId. */ + interface WithPrimaryUserAssignedIdentityId { + /** + * Specifies the primaryUserAssignedIdentityId property: The resource id of a user assigned identity to be + * used by default.. + * + * @param primaryUserAssignedIdentityId The resource id of a user assigned identity to be used by default. + * @return the next definition stage. + */ + Update withPrimaryUserAssignedIdentityId(String primaryUserAssignedIdentityId); + } + /** The stage of the Server update allowing to specify federatedClientId. */ + interface WithFederatedClientId { + /** + * Specifies the federatedClientId property: The Client id used for cross tenant CMK scenario. + * + * @param federatedClientId The Client id used for cross tenant CMK scenario. + * @return the next definition stage. + */ + Update withFederatedClientId(UUID federatedClientId); + } + /** The stage of the Server update allowing to specify keyId. */ + interface WithKeyId { + /** + * Specifies the keyId property: A CMK URI of the key to use for encryption.. + * + * @param keyId A CMK URI of the key to use for encryption. + * @return the next definition stage. + */ + Update withKeyId(String keyId); + } + /** The stage of the Server update allowing to specify restrictOutboundNetworkAccess. */ + interface WithRestrictOutboundNetworkAccess { + /** + * Specifies the restrictOutboundNetworkAccess property: Whether or not to restrict outbound network access + * for this server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. + * + * @param restrictOutboundNetworkAccess Whether or not to restrict outbound network access for this server. + * Value is optional but if passed in, must be 'Enabled' or 'Disabled'. + * @return the next definition stage. + */ + Update withRestrictOutboundNetworkAccess(ServerNetworkAccessFlag restrictOutboundNetworkAccess); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Server refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Server refresh(Context context); + + /** + * Imports a bacpac into a new database. + * + * @param parameters The database import request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + ImportExportOperationResult importDatabase(ImportNewDatabaseDefinition parameters); + + /** + * Imports a bacpac into a new database. + * + * @param parameters The database import request parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + ImportExportOperationResult importDatabase(ImportNewDatabaseDefinition parameters, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAdvancedThreatProtection.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAdvancedThreatProtection.java new file mode 100644 index 0000000000000..3cdff257edc2c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAdvancedThreatProtection.java @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerAdvancedThreatProtectionInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of ServerAdvancedThreatProtection. */ +public interface ServerAdvancedThreatProtection { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: SystemData of AdvancedThreatProtectionResource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the state property: Specifies the state of the Advanced Threat Protection, whether it is enabled or disabled + * or a state has not been applied yet on the specific database or server. + * + * @return the state value. + */ + AdvancedThreatProtectionState state(); + + /** + * Gets the creationTime property: Specifies the UTC creation time of the policy. + * + * @return the creationTime value. + */ + OffsetDateTime creationTime(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ServerAdvancedThreatProtectionInner object. + * + * @return the inner object. + */ + ServerAdvancedThreatProtectionInner innerModel(); + + /** The entirety of the ServerAdvancedThreatProtection definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ServerAdvancedThreatProtection definition stages. */ + interface DefinitionStages { + /** The first stage of the ServerAdvancedThreatProtection definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ServerAdvancedThreatProtection definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @return the next definition stage. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + /** + * The stage of the ServerAdvancedThreatProtection definition which contains all the minimum required properties + * for the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithState { + /** + * Executes the create request. + * + * @return the created resource. + */ + ServerAdvancedThreatProtection create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ServerAdvancedThreatProtection create(Context context); + } + /** The stage of the ServerAdvancedThreatProtection definition allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the Advanced Threat Protection, whether it is + * enabled or disabled or a state has not been applied yet on the specific database or server.. + * + * @param state Specifies the state of the Advanced Threat Protection, whether it is enabled or disabled or + * a state has not been applied yet on the specific database or server. + * @return the next definition stage. + */ + WithCreate withState(AdvancedThreatProtectionState state); + } + } + /** + * Begins update for the ServerAdvancedThreatProtection resource. + * + * @return the stage of resource update. + */ + ServerAdvancedThreatProtection.Update update(); + + /** The template for ServerAdvancedThreatProtection update. */ + interface Update extends UpdateStages.WithState { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ServerAdvancedThreatProtection apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ServerAdvancedThreatProtection apply(Context context); + } + /** The ServerAdvancedThreatProtection update stages. */ + interface UpdateStages { + /** The stage of the ServerAdvancedThreatProtection update allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the Advanced Threat Protection, whether it is + * enabled or disabled or a state has not been applied yet on the specific database or server.. + * + * @param state Specifies the state of the Advanced Threat Protection, whether it is enabled or disabled or + * a state has not been applied yet on the specific database or server. + * @return the next definition stage. + */ + Update withState(AdvancedThreatProtectionState state); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ServerAdvancedThreatProtection refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ServerAdvancedThreatProtection refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAdvancedThreatProtectionSettings.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAdvancedThreatProtectionSettings.java new file mode 100644 index 0000000000000..badc6f28ca3f3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAdvancedThreatProtectionSettings.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ServerAdvancedThreatProtectionSettings. */ +public interface ServerAdvancedThreatProtectionSettings { + /** + * Get a list of the server's Advanced Threat Protection states. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the server's Advanced Threat Protection states as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Get a list of the server's Advanced Threat Protection states. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the server's Advanced Threat Protection states as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByServer( + String resourceGroupName, String serverName, Context context); + + /** + * Get a server's Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's Advanced Threat Protection state along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + AdvancedThreatProtectionName advancedThreatProtectionName, + Context context); + + /** + * Get a server's Advanced Threat Protection state. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param advancedThreatProtectionName The name of the Advanced Threat Protection state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's Advanced Threat Protection state. + */ + ServerAdvancedThreatProtection get( + String resourceGroupName, String serverName, AdvancedThreatProtectionName advancedThreatProtectionName); + + /** + * Get a server's Advanced Threat Protection state. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's Advanced Threat Protection state along with {@link Response}. + */ + ServerAdvancedThreatProtection getById(String id); + + /** + * Get a server's Advanced Threat Protection state. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's Advanced Threat Protection state along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ServerAdvancedThreatProtection resource. + * + * @param name resource name. + * @return the first stage of the new ServerAdvancedThreatProtection definition. + */ + ServerAdvancedThreatProtection.DefinitionStages.Blank define(AdvancedThreatProtectionName name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAdvisors.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAdvisors.java new file mode 100644 index 0000000000000..dcad96b7df288 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAdvisors.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.AdvisorInner; +import java.util.List; + +/** Resource collection API of ServerAdvisors. */ +public interface ServerAdvisors { + /** + * 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 expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server advisors along with {@link Response}. + */ + Response> listByServerWithResponse( + String resourceGroupName, String serverName, String expand, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server advisors. + */ + List listByServer(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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server advisor along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String serverName, String advisorName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server advisor. + */ + Advisor get(String resourceGroupName, String serverName, String advisorName); + + /** + * 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 parameters The requested advisor resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database, Server or Elastic Pool Advisor along with {@link Response}. + */ + Response updateWithResponse( + String resourceGroupName, String serverName, String advisorName, AdvisorInner parameters, Context context); + + /** + * 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 parameters The requested advisor resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return database, Server or Elastic Pool Advisor. + */ + Advisor update(String resourceGroupName, String serverName, String advisorName, AdvisorInner parameters); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAutomaticTuning.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAutomaticTuning.java new file mode 100644 index 0000000000000..2f5e445f3a9bb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAutomaticTuning.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.ServerAutomaticTuningInner; +import java.util.Map; + +/** An immutable client-side representation of ServerAutomaticTuning. */ +public interface ServerAutomaticTuning { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the desiredState property: Automatic tuning desired state. + * + * @return the desiredState value. + */ + AutomaticTuningServerMode desiredState(); + + /** + * Gets the actualState property: Automatic tuning actual state. + * + * @return the actualState value. + */ + AutomaticTuningServerMode actualState(); + + /** + * Gets the options property: Automatic tuning options definition. + * + * @return the options value. + */ + Map options(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ServerAutomaticTuningInner object. + * + * @return the inner object. + */ + ServerAutomaticTuningInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAutomaticTunings.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAutomaticTunings.java new file mode 100644 index 0000000000000..f6886b1cd4c27 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAutomaticTunings.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerAutomaticTuningInner; + +/** Resource collection API of ServerAutomaticTunings. */ +public interface ServerAutomaticTunings { + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return server-level Automatic Tuning along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String serverName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return server-level Automatic Tuning. + */ + ServerAutomaticTuning get(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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return server-level Automatic Tuning along with {@link Response}. + */ + Response updateWithResponse( + String resourceGroupName, String serverName, ServerAutomaticTuningInner parameters, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return server-level Automatic Tuning. + */ + ServerAutomaticTuning update(String resourceGroupName, String serverName, ServerAutomaticTuningInner parameters); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAzureADAdministrator.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAzureADAdministrator.java new file mode 100644 index 0000000000000..27428abf52fab --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAzureADAdministrator.java @@ -0,0 +1,254 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerAzureADAdministratorInner; +import java.util.UUID; + +/** An immutable client-side representation of ServerAzureADAdministrator. */ +public interface ServerAzureADAdministrator { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the administratorType property: Type of the sever administrator. + * + * @return the administratorType value. + */ + AdministratorType administratorType(); + + /** + * Gets the login property: Login name of the server administrator. + * + * @return the login value. + */ + String login(); + + /** + * Gets the sid property: SID (object ID) of the server administrator. + * + * @return the sid value. + */ + UUID sid(); + + /** + * Gets the tenantId property: Tenant ID of the administrator. + * + * @return the tenantId value. + */ + UUID tenantId(); + + /** + * Gets the azureADOnlyAuthentication property: Azure Active Directory only Authentication enabled. + * + * @return the azureADOnlyAuthentication value. + */ + Boolean azureADOnlyAuthentication(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ServerAzureADAdministratorInner object. + * + * @return the inner object. + */ + ServerAzureADAdministratorInner innerModel(); + + /** The entirety of the ServerAzureADAdministrator definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ServerAzureADAdministrator definition stages. */ + interface DefinitionStages { + /** The first stage of the ServerAzureADAdministrator definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ServerAzureADAdministrator definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @return the next definition stage. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + /** + * The stage of the ServerAzureADAdministrator definition which contains all the minimum required properties for + * the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithAdministratorType, + DefinitionStages.WithLogin, + DefinitionStages.WithSid, + DefinitionStages.WithTenantId { + /** + * Executes the create request. + * + * @return the created resource. + */ + ServerAzureADAdministrator create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ServerAzureADAdministrator create(Context context); + } + /** The stage of the ServerAzureADAdministrator definition allowing to specify administratorType. */ + interface WithAdministratorType { + /** + * Specifies the administratorType property: Type of the sever administrator.. + * + * @param administratorType Type of the sever administrator. + * @return the next definition stage. + */ + WithCreate withAdministratorType(AdministratorType administratorType); + } + /** The stage of the ServerAzureADAdministrator definition allowing to specify login. */ + interface WithLogin { + /** + * Specifies the login property: Login name of the server administrator.. + * + * @param login Login name of the server administrator. + * @return the next definition stage. + */ + WithCreate withLogin(String login); + } + /** The stage of the ServerAzureADAdministrator definition allowing to specify sid. */ + interface WithSid { + /** + * Specifies the sid property: SID (object ID) of the server administrator.. + * + * @param sid SID (object ID) of the server administrator. + * @return the next definition stage. + */ + WithCreate withSid(UUID sid); + } + /** The stage of the ServerAzureADAdministrator definition allowing to specify tenantId. */ + interface WithTenantId { + /** + * Specifies the tenantId property: Tenant ID of the administrator.. + * + * @param tenantId Tenant ID of the administrator. + * @return the next definition stage. + */ + WithCreate withTenantId(UUID tenantId); + } + } + /** + * Begins update for the ServerAzureADAdministrator resource. + * + * @return the stage of resource update. + */ + ServerAzureADAdministrator.Update update(); + + /** The template for ServerAzureADAdministrator update. */ + interface Update + extends UpdateStages.WithAdministratorType, + UpdateStages.WithLogin, + UpdateStages.WithSid, + UpdateStages.WithTenantId { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ServerAzureADAdministrator apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ServerAzureADAdministrator apply(Context context); + } + /** The ServerAzureADAdministrator update stages. */ + interface UpdateStages { + /** The stage of the ServerAzureADAdministrator update allowing to specify administratorType. */ + interface WithAdministratorType { + /** + * Specifies the administratorType property: Type of the sever administrator.. + * + * @param administratorType Type of the sever administrator. + * @return the next definition stage. + */ + Update withAdministratorType(AdministratorType administratorType); + } + /** The stage of the ServerAzureADAdministrator update allowing to specify login. */ + interface WithLogin { + /** + * Specifies the login property: Login name of the server administrator.. + * + * @param login Login name of the server administrator. + * @return the next definition stage. + */ + Update withLogin(String login); + } + /** The stage of the ServerAzureADAdministrator update allowing to specify sid. */ + interface WithSid { + /** + * Specifies the sid property: SID (object ID) of the server administrator.. + * + * @param sid SID (object ID) of the server administrator. + * @return the next definition stage. + */ + Update withSid(UUID sid); + } + /** The stage of the ServerAzureADAdministrator update allowing to specify tenantId. */ + interface WithTenantId { + /** + * Specifies the tenantId property: Tenant ID of the administrator.. + * + * @param tenantId Tenant ID of the administrator. + * @return the next definition stage. + */ + Update withTenantId(UUID tenantId); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ServerAzureADAdministrator refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ServerAzureADAdministrator refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAzureADAdministrators.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAzureADAdministrators.java new file mode 100644 index 0000000000000..9197e143310ff --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAzureADAdministrators.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ServerAzureADAdministrators. */ +public interface ServerAzureADAdministrators { + /** + * Gets a Azure 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 administratorName The name of server active directory administrator. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Azure Active Directory administrator along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, AdministratorName administratorName, Context context); + + /** + * Gets a Azure 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 administratorName The name of server active directory administrator. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Azure Active Directory administrator. + */ + ServerAzureADAdministrator get(String resourceGroupName, String serverName, AdministratorName administratorName); + + /** + * Deletes the Azure Active Directory administrator 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 administratorName The name of server active directory administrator. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, AdministratorName administratorName); + + /** + * Deletes the Azure Active Directory administrator 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 administratorName The name of server active directory administrator. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, AdministratorName administratorName, Context context); + + /** + * Gets a list of Azure Active Directory administrators 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Azure Active Directory administrators in a server as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets a list of Azure Active Directory administrators 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Azure Active Directory administrators in a server as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByServer( + String resourceGroupName, String serverName, Context context); + + /** + * Gets a Azure Active Directory administrator. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Azure Active Directory administrator along with {@link Response}. + */ + ServerAzureADAdministrator getById(String id); + + /** + * Gets a Azure Active Directory administrator. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Azure Active Directory administrator along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the Azure Active Directory administrator with the given name. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes the Azure Active Directory administrator with the given name. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ServerAzureADAdministrator resource. + * + * @param name resource name. + * @return the first stage of the new ServerAzureADAdministrator definition. + */ + ServerAzureADAdministrator.DefinitionStages.Blank define(AdministratorName name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAzureADOnlyAuthentication.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAzureADOnlyAuthentication.java new file mode 100644 index 0000000000000..e80fda53e2d0d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAzureADOnlyAuthentication.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerAzureADOnlyAuthenticationInner; + +/** An immutable client-side representation of ServerAzureADOnlyAuthentication. */ +public interface ServerAzureADOnlyAuthentication { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the azureADOnlyAuthentication property: Azure Active Directory only Authentication enabled. + * + * @return the azureADOnlyAuthentication value. + */ + boolean azureADOnlyAuthentication(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ServerAzureADOnlyAuthenticationInner object. + * + * @return the inner object. + */ + ServerAzureADOnlyAuthenticationInner innerModel(); + + /** The entirety of the ServerAzureADOnlyAuthentication definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ServerAzureADOnlyAuthentication definition stages. */ + interface DefinitionStages { + /** The first stage of the ServerAzureADOnlyAuthentication definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ServerAzureADOnlyAuthentication definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @return the next definition stage. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + /** + * The stage of the ServerAzureADOnlyAuthentication definition which contains all the minimum required + * properties for the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithAzureADOnlyAuthentication { + /** + * Executes the create request. + * + * @return the created resource. + */ + ServerAzureADOnlyAuthentication create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ServerAzureADOnlyAuthentication create(Context context); + } + /** + * The stage of the ServerAzureADOnlyAuthentication definition allowing to specify azureADOnlyAuthentication. + */ + interface WithAzureADOnlyAuthentication { + /** + * Specifies the azureADOnlyAuthentication property: Azure Active Directory only Authentication enabled.. + * + * @param azureADOnlyAuthentication Azure Active Directory only Authentication enabled. + * @return the next definition stage. + */ + WithCreate withAzureADOnlyAuthentication(boolean azureADOnlyAuthentication); + } + } + /** + * Begins update for the ServerAzureADOnlyAuthentication resource. + * + * @return the stage of resource update. + */ + ServerAzureADOnlyAuthentication.Update update(); + + /** The template for ServerAzureADOnlyAuthentication update. */ + interface Update extends UpdateStages.WithAzureADOnlyAuthentication { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ServerAzureADOnlyAuthentication apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ServerAzureADOnlyAuthentication apply(Context context); + } + /** The ServerAzureADOnlyAuthentication update stages. */ + interface UpdateStages { + /** The stage of the ServerAzureADOnlyAuthentication update allowing to specify azureADOnlyAuthentication. */ + interface WithAzureADOnlyAuthentication { + /** + * Specifies the azureADOnlyAuthentication property: Azure Active Directory only Authentication enabled.. + * + * @param azureADOnlyAuthentication Azure Active Directory only Authentication enabled. + * @return the next definition stage. + */ + Update withAzureADOnlyAuthentication(boolean azureADOnlyAuthentication); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ServerAzureADOnlyAuthentication refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ServerAzureADOnlyAuthentication refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAzureADOnlyAuthentications.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAzureADOnlyAuthentications.java new file mode 100644 index 0000000000000..f3433aa972db3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerAzureADOnlyAuthentications.java @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ServerAzureADOnlyAuthentications. */ +public interface ServerAzureADOnlyAuthentications { + /** + * Gets a specific Azure Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific Azure Active Directory only authentication property along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, AuthenticationName authenticationName, Context context); + + /** + * Gets a specific Azure Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific Azure Active Directory only authentication property. + */ + ServerAzureADOnlyAuthentication get( + String resourceGroupName, String serverName, AuthenticationName authenticationName); + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, AuthenticationName authenticationName); + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param authenticationName The name of server azure active directory only authentication. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, AuthenticationName authenticationName, Context context); + + /** + * Gets a list of server Azure Active Directory only authentications. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server Azure Active Directory only authentications as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets a list of server Azure Active Directory only authentications. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server Azure Active Directory only authentications as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByServer( + String resourceGroupName, String serverName, Context context); + + /** + * Gets a specific Azure Active Directory only authentication property. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific Azure Active Directory only authentication property along with {@link Response}. + */ + ServerAzureADOnlyAuthentication getById(String id); + + /** + * Gets a specific Azure Active Directory only authentication property. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific Azure Active Directory only authentication property along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes an existing server Active Directory only authentication property. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ServerAzureADOnlyAuthentication resource. + * + * @param name resource name. + * @return the first stage of the new ServerAzureADOnlyAuthentication definition. + */ + ServerAzureADOnlyAuthentication.DefinitionStages.Blank define(AuthenticationName name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerBlobAuditingPolicies.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerBlobAuditingPolicies.java new file mode 100644 index 0000000000000..2fd1ff5763e27 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerBlobAuditingPolicies.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ServerBlobAuditingPolicies. */ +public interface ServerBlobAuditingPolicies { + /** + * Lists auditing settings of 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server auditing settings as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Lists auditing settings of 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server auditing settings as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's blob auditing policy along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String serverName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's blob auditing policy. + */ + ServerBlobAuditingPolicy get(String resourceGroupName, String serverName); + + /** + * Gets a server's blob auditing policy. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's blob auditing policy along with {@link Response}. + */ + ServerBlobAuditingPolicy getById(String id); + + /** + * Gets a server's blob auditing policy. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's blob auditing policy along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ServerBlobAuditingPolicy resource. + * + * @return the first stage of the new ServerBlobAuditingPolicy definition. + */ + ServerBlobAuditingPolicy.DefinitionStages.Blank define(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerBlobAuditingPolicy.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerBlobAuditingPolicy.java new file mode 100644 index 0000000000000..0fea762aec339 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerBlobAuditingPolicy.java @@ -0,0 +1,815 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerBlobAuditingPolicyInner; +import java.util.List; +import java.util.UUID; + +/** An immutable client-side representation of ServerBlobAuditingPolicy. */ +public interface ServerBlobAuditingPolicy { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the isDevopsAuditEnabled property: Specifies the state of devops audit. If state is Enabled, devops logs + * will be sent to Azure Monitor. In order to send the events to Azure Monitor, specify 'State' as 'Enabled', + * 'IsAzureMonitorTargetEnabled' as true and 'IsDevopsAuditEnabled' as true + * + *

When using REST API to configure auditing, Diagnostic Settings with 'DevOpsOperationsAudit' diagnostic logs + * category on the master database should also be created. + * + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/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 isDevopsAuditEnabled value. + */ + Boolean isDevopsAuditEnabled(); + + /** + * Gets the retentionDays property: Specifies the number of days to keep in the audit logs in the storage account. + * + * @return the retentionDays value. + */ + Integer retentionDays(); + + /** + * Gets the auditActionsAndGroups property: 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 + * DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP LEDGER_OPERATION_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. + */ + List auditActionsAndGroups(); + + /** + * Gets the isStorageSecondaryKeyInUse property: Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + * + * @return the isStorageSecondaryKeyInUse value. + */ + Boolean isStorageSecondaryKeyInUse(); + + /** + * Gets the isAzureMonitorTargetEnabled property: 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. + */ + Boolean isAzureMonitorTargetEnabled(); + + /** + * Gets the queueDelayMs property: Specifies the amount of time in milliseconds that can elapse before audit actions + * are forced to be processed. The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + * + * @return the queueDelayMs value. + */ + Integer queueDelayMs(); + + /** + * Gets the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob storage. + * + * @return the isManagedIdentityInUse value. + */ + Boolean isManagedIdentityInUse(); + + /** + * Gets the state property: Specifies the state of the audit. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * + * @return the state value. + */ + BlobAuditingPolicyState state(); + + /** + * Gets the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is + * required. + * + * @return the storageEndpoint value. + */ + String storageEndpoint(); + + /** + * Gets the storageAccountAccessKey property: Specifies the identifier key of the auditing storage account. If state + * is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server + * system-assigned managed identity to access the storage. Prerequisites for using managed identity authentication: + * 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). 2. Grant SQL Server + * identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server + * identity. For more information, see [Auditing to storage using Managed Identity + * authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @return the storageAccountAccessKey value. + */ + String storageAccountAccessKey(); + + /** + * Gets the storageAccountSubscriptionId property: Specifies the blob storage subscription Id. + * + * @return the storageAccountSubscriptionId value. + */ + UUID storageAccountSubscriptionId(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ServerBlobAuditingPolicyInner object. + * + * @return the inner object. + */ + ServerBlobAuditingPolicyInner innerModel(); + + /** The entirety of the ServerBlobAuditingPolicy definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ServerBlobAuditingPolicy definition stages. */ + interface DefinitionStages { + /** The first stage of the ServerBlobAuditingPolicy definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ServerBlobAuditingPolicy definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @return the next definition stage. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + /** + * The stage of the ServerBlobAuditingPolicy definition which contains all the minimum required properties for + * the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithIsDevopsAuditEnabled, + DefinitionStages.WithRetentionDays, + DefinitionStages.WithAuditActionsAndGroups, + DefinitionStages.WithIsStorageSecondaryKeyInUse, + DefinitionStages.WithIsAzureMonitorTargetEnabled, + DefinitionStages.WithQueueDelayMs, + DefinitionStages.WithIsManagedIdentityInUse, + DefinitionStages.WithState, + DefinitionStages.WithStorageEndpoint, + DefinitionStages.WithStorageAccountAccessKey, + DefinitionStages.WithStorageAccountSubscriptionId { + /** + * Executes the create request. + * + * @return the created resource. + */ + ServerBlobAuditingPolicy create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ServerBlobAuditingPolicy create(Context context); + } + /** The stage of the ServerBlobAuditingPolicy definition allowing to specify isDevopsAuditEnabled. */ + interface WithIsDevopsAuditEnabled { + /** + * Specifies the isDevopsAuditEnabled property: Specifies the state of devops audit. If state is Enabled, + * devops logs will be sent to Azure Monitor. In order to send the events to Azure Monitor, specify 'State' + * as 'Enabled', 'IsAzureMonitorTargetEnabled' as true and 'IsDevopsAuditEnabled' as true + * + *

When using REST API to configure auditing, Diagnostic Settings with 'DevOpsOperationsAudit' diagnostic + * logs category on the master database should also be created. + * + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/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 isDevopsAuditEnabled Specifies the state of devops audit. If state is Enabled, devops logs will be + * sent to Azure Monitor. In order to send the events to Azure Monitor, specify 'State' as 'Enabled', + * 'IsAzureMonitorTargetEnabled' as true and 'IsDevopsAuditEnabled' as true + *

When using REST API to configure auditing, Diagnostic Settings with 'DevOpsOperationsAudit' + * diagnostic logs category on the master database should also be created. + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/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 next definition stage. + */ + WithCreate withIsDevopsAuditEnabled(Boolean isDevopsAuditEnabled); + } + /** The stage of the ServerBlobAuditingPolicy definition allowing to specify retentionDays. */ + interface WithRetentionDays { + /** + * Specifies the retentionDays property: Specifies the number of days to keep in the audit logs in the + * storage account.. + * + * @param retentionDays Specifies the number of days to keep in the audit logs in the storage account. + * @return the next definition stage. + */ + WithCreate withRetentionDays(Integer retentionDays); + } + /** The stage of the ServerBlobAuditingPolicy definition allowing to specify auditActionsAndGroups. */ + interface WithAuditActionsAndGroups { + /** + * Specifies the auditActionsAndGroups property: 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 DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP + * LEDGER_OPERATION_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 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 DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP + * LEDGER_OPERATION_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 next definition stage. + */ + WithCreate withAuditActionsAndGroups(List auditActionsAndGroups); + } + /** The stage of the ServerBlobAuditingPolicy definition allowing to specify isStorageSecondaryKeyInUse. */ + interface WithIsStorageSecondaryKeyInUse { + /** + * Specifies the isStorageSecondaryKeyInUse property: Specifies whether storageAccountAccessKey value is the + * storage's secondary key.. + * + * @param isStorageSecondaryKeyInUse Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + * @return the next definition stage. + */ + WithCreate withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse); + } + /** The stage of the ServerBlobAuditingPolicy definition allowing to specify isAzureMonitorTargetEnabled. */ + interface WithIsAzureMonitorTargetEnabled { + /** + * Specifies the isAzureMonitorTargetEnabled property: 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 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 next definition stage. + */ + WithCreate withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled); + } + /** The stage of the ServerBlobAuditingPolicy definition allowing to specify queueDelayMs. */ + interface WithQueueDelayMs { + /** + * Specifies the queueDelayMs property: Specifies the amount of time in milliseconds that can elapse before + * audit actions are forced to be processed. The default minimum value is 1000 (1 second). The maximum is + * 2,147,483,647.. + * + * @param queueDelayMs Specifies the amount of time in milliseconds that can elapse before audit actions are + * forced to be processed. The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + * @return the next definition stage. + */ + WithCreate withQueueDelayMs(Integer queueDelayMs); + } + /** The stage of the ServerBlobAuditingPolicy definition allowing to specify isManagedIdentityInUse. */ + interface WithIsManagedIdentityInUse { + /** + * Specifies the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob + * storage. + * + * @param isManagedIdentityInUse Specifies whether Managed Identity is used to access blob storage. + * @return the next definition stage. + */ + WithCreate withIsManagedIdentityInUse(Boolean isManagedIdentityInUse); + } + /** The stage of the ServerBlobAuditingPolicy definition allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the audit. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required.. + * + * @param state Specifies the state of the audit. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * @return the next definition stage. + */ + WithCreate withState(BlobAuditingPolicyState state); + } + /** The stage of the ServerBlobAuditingPolicy definition allowing to specify storageEndpoint. */ + interface WithStorageEndpoint { + /** + * Specifies the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled is required.. + * + * @param storageEndpoint Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled is required. + * @return the next definition stage. + */ + WithCreate withStorageEndpoint(String storageEndpoint); + } + /** The stage of the ServerBlobAuditingPolicy definition allowing to specify storageAccountAccessKey. */ + interface WithStorageAccountAccessKey { + /** + * Specifies the storageAccountAccessKey property: Specifies the identifier key of the auditing storage + * account. If state is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey + * will use SQL server system-assigned managed identity to access the storage. Prerequisites for using + * managed identity authentication: 1. Assign SQL Server a system-assigned managed identity in Azure Active + * Directory (AAD). 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data + * Contributor' RBAC role to the server identity. For more information, see [Auditing to storage using + * Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @param storageAccountAccessKey Specifies the identifier key of the auditing storage account. If state is + * Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL + * server system-assigned managed identity to access the storage. Prerequisites for using managed + * identity authentication: 1. Assign SQL Server a system-assigned managed identity in Azure Active + * Directory (AAD). 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob + * Data Contributor' RBAC role to the server identity. For more information, see [Auditing to storage + * using Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * @return the next definition stage. + */ + WithCreate withStorageAccountAccessKey(String storageAccountAccessKey); + } + /** The stage of the ServerBlobAuditingPolicy definition allowing to specify storageAccountSubscriptionId. */ + interface WithStorageAccountSubscriptionId { + /** + * Specifies the storageAccountSubscriptionId property: Specifies the blob storage subscription Id.. + * + * @param storageAccountSubscriptionId Specifies the blob storage subscription Id. + * @return the next definition stage. + */ + WithCreate withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId); + } + } + /** + * Begins update for the ServerBlobAuditingPolicy resource. + * + * @return the stage of resource update. + */ + ServerBlobAuditingPolicy.Update update(); + + /** The template for ServerBlobAuditingPolicy update. */ + interface Update + extends UpdateStages.WithIsDevopsAuditEnabled, + UpdateStages.WithRetentionDays, + UpdateStages.WithAuditActionsAndGroups, + UpdateStages.WithIsStorageSecondaryKeyInUse, + UpdateStages.WithIsAzureMonitorTargetEnabled, + UpdateStages.WithQueueDelayMs, + UpdateStages.WithIsManagedIdentityInUse, + UpdateStages.WithState, + UpdateStages.WithStorageEndpoint, + UpdateStages.WithStorageAccountAccessKey, + UpdateStages.WithStorageAccountSubscriptionId { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ServerBlobAuditingPolicy apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ServerBlobAuditingPolicy apply(Context context); + } + /** The ServerBlobAuditingPolicy update stages. */ + interface UpdateStages { + /** The stage of the ServerBlobAuditingPolicy update allowing to specify isDevopsAuditEnabled. */ + interface WithIsDevopsAuditEnabled { + /** + * Specifies the isDevopsAuditEnabled property: Specifies the state of devops audit. If state is Enabled, + * devops logs will be sent to Azure Monitor. In order to send the events to Azure Monitor, specify 'State' + * as 'Enabled', 'IsAzureMonitorTargetEnabled' as true and 'IsDevopsAuditEnabled' as true + * + *

When using REST API to configure auditing, Diagnostic Settings with 'DevOpsOperationsAudit' diagnostic + * logs category on the master database should also be created. + * + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/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 isDevopsAuditEnabled Specifies the state of devops audit. If state is Enabled, devops logs will be + * sent to Azure Monitor. In order to send the events to Azure Monitor, specify 'State' as 'Enabled', + * 'IsAzureMonitorTargetEnabled' as true and 'IsDevopsAuditEnabled' as true + *

When using REST API to configure auditing, Diagnostic Settings with 'DevOpsOperationsAudit' + * diagnostic logs category on the master database should also be created. + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/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 next definition stage. + */ + Update withIsDevopsAuditEnabled(Boolean isDevopsAuditEnabled); + } + /** The stage of the ServerBlobAuditingPolicy update allowing to specify retentionDays. */ + interface WithRetentionDays { + /** + * Specifies the retentionDays property: Specifies the number of days to keep in the audit logs in the + * storage account.. + * + * @param retentionDays Specifies the number of days to keep in the audit logs in the storage account. + * @return the next definition stage. + */ + Update withRetentionDays(Integer retentionDays); + } + /** The stage of the ServerBlobAuditingPolicy update allowing to specify auditActionsAndGroups. */ + interface WithAuditActionsAndGroups { + /** + * Specifies the auditActionsAndGroups property: 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 DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP + * LEDGER_OPERATION_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 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 DBCC_GROUP DATABASE_OWNERSHIP_CHANGE_GROUP DATABASE_CHANGE_GROUP + * LEDGER_OPERATION_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 next definition stage. + */ + Update withAuditActionsAndGroups(List auditActionsAndGroups); + } + /** The stage of the ServerBlobAuditingPolicy update allowing to specify isStorageSecondaryKeyInUse. */ + interface WithIsStorageSecondaryKeyInUse { + /** + * Specifies the isStorageSecondaryKeyInUse property: Specifies whether storageAccountAccessKey value is the + * storage's secondary key.. + * + * @param isStorageSecondaryKeyInUse Specifies whether storageAccountAccessKey value is the storage's + * secondary key. + * @return the next definition stage. + */ + Update withIsStorageSecondaryKeyInUse(Boolean isStorageSecondaryKeyInUse); + } + /** The stage of the ServerBlobAuditingPolicy update allowing to specify isAzureMonitorTargetEnabled. */ + interface WithIsAzureMonitorTargetEnabled { + /** + * Specifies the isAzureMonitorTargetEnabled property: 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 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 next definition stage. + */ + Update withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled); + } + /** The stage of the ServerBlobAuditingPolicy update allowing to specify queueDelayMs. */ + interface WithQueueDelayMs { + /** + * Specifies the queueDelayMs property: Specifies the amount of time in milliseconds that can elapse before + * audit actions are forced to be processed. The default minimum value is 1000 (1 second). The maximum is + * 2,147,483,647.. + * + * @param queueDelayMs Specifies the amount of time in milliseconds that can elapse before audit actions are + * forced to be processed. The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + * @return the next definition stage. + */ + Update withQueueDelayMs(Integer queueDelayMs); + } + /** The stage of the ServerBlobAuditingPolicy update allowing to specify isManagedIdentityInUse. */ + interface WithIsManagedIdentityInUse { + /** + * Specifies the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob + * storage. + * + * @param isManagedIdentityInUse Specifies whether Managed Identity is used to access blob storage. + * @return the next definition stage. + */ + Update withIsManagedIdentityInUse(Boolean isManagedIdentityInUse); + } + /** The stage of the ServerBlobAuditingPolicy update allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the audit. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required.. + * + * @param state Specifies the state of the audit. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * @return the next definition stage. + */ + Update withState(BlobAuditingPolicyState state); + } + /** The stage of the ServerBlobAuditingPolicy update allowing to specify storageEndpoint. */ + interface WithStorageEndpoint { + /** + * Specifies the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled is required.. + * + * @param storageEndpoint Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled is required. + * @return the next definition stage. + */ + Update withStorageEndpoint(String storageEndpoint); + } + /** The stage of the ServerBlobAuditingPolicy update allowing to specify storageAccountAccessKey. */ + interface WithStorageAccountAccessKey { + /** + * Specifies the storageAccountAccessKey property: Specifies the identifier key of the auditing storage + * account. If state is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey + * will use SQL server system-assigned managed identity to access the storage. Prerequisites for using + * managed identity authentication: 1. Assign SQL Server a system-assigned managed identity in Azure Active + * Directory (AAD). 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data + * Contributor' RBAC role to the server identity. For more information, see [Auditing to storage using + * Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @param storageAccountAccessKey Specifies the identifier key of the auditing storage account. If state is + * Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL + * server system-assigned managed identity to access the storage. Prerequisites for using managed + * identity authentication: 1. Assign SQL Server a system-assigned managed identity in Azure Active + * Directory (AAD). 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob + * Data Contributor' RBAC role to the server identity. For more information, see [Auditing to storage + * using Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * @return the next definition stage. + */ + Update withStorageAccountAccessKey(String storageAccountAccessKey); + } + /** The stage of the ServerBlobAuditingPolicy update allowing to specify storageAccountSubscriptionId. */ + interface WithStorageAccountSubscriptionId { + /** + * Specifies the storageAccountSubscriptionId property: Specifies the blob storage subscription Id.. + * + * @param storageAccountSubscriptionId Specifies the blob storage subscription Id. + * @return the next definition stage. + */ + Update withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ServerBlobAuditingPolicy refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ServerBlobAuditingPolicy refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerBlobAuditingPolicyListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerBlobAuditingPolicyListResult.java new file mode 100644 index 0000000000000..16fec2d407324 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerBlobAuditingPolicyListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerBlobAuditingPolicyInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of server auditing settings. */ +@Immutable +public final class ServerBlobAuditingPolicyListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of ServerBlobAuditingPolicyListResult class. */ + public ServerBlobAuditingPolicyListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerCommunicationLink.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerCommunicationLink.java new file mode 100644 index 0000000000000..3e858cf58bd81 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerCommunicationLink.java @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerCommunicationLinkInner; + +/** An immutable client-side representation of ServerCommunicationLink. */ +public interface ServerCommunicationLink { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: Communication link location. + * + * @return the location value. + */ + String location(); + + /** + * Gets the kind property: Communication link kind. This property is used for Azure Portal metadata. + * + * @return the kind value. + */ + String kind(); + + /** + * Gets the state property: The state. + * + * @return the state value. + */ + String state(); + + /** + * Gets the partnerServer property: The name of the partner server. + * + * @return the partnerServer value. + */ + String partnerServer(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ServerCommunicationLinkInner object. + * + * @return the inner object. + */ + ServerCommunicationLinkInner innerModel(); + + /** The entirety of the ServerCommunicationLink definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ServerCommunicationLink definition stages. */ + interface DefinitionStages { + /** The first stage of the ServerCommunicationLink definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ServerCommunicationLink definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @return the next definition stage. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + /** + * The stage of the ServerCommunicationLink definition which contains all the minimum required properties for + * the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithPartnerServer { + /** + * Executes the create request. + * + * @return the created resource. + */ + ServerCommunicationLink create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ServerCommunicationLink create(Context context); + } + /** The stage of the ServerCommunicationLink definition allowing to specify partnerServer. */ + interface WithPartnerServer { + /** + * Specifies the partnerServer property: The name of the partner server.. + * + * @param partnerServer The name of the partner server. + * @return the next definition stage. + */ + WithCreate withPartnerServer(String partnerServer); + } + } + /** + * Begins update for the ServerCommunicationLink resource. + * + * @return the stage of resource update. + */ + ServerCommunicationLink.Update update(); + + /** The template for ServerCommunicationLink update. */ + interface Update { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ServerCommunicationLink apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ServerCommunicationLink apply(Context context); + } + /** The ServerCommunicationLink update stages. */ + interface UpdateStages { + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ServerCommunicationLink refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ServerCommunicationLink refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerCommunicationLinkListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerCommunicationLinkListResult.java new file mode 100644 index 0000000000000..f04244cded5bf --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerCommunicationLinkListResult.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerCommunicationLinkInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of server communication links. */ +@Fluent +public final class ServerCommunicationLinkListResult { + /* + * The list of server communication links. + */ + @JsonProperty(value = "value") + private List value; + + /** Creates an instance of ServerCommunicationLinkListResult class. */ + public ServerCommunicationLinkListResult() { + } + + /** + * Get the value property: The list of server communication links. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of server communication links. + * + * @param value the value value to set. + * @return the ServerCommunicationLinkListResult object itself. + */ + public ServerCommunicationLinkListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerCommunicationLinks.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerCommunicationLinks.java new file mode 100644 index 0000000000000..6f7a717ca9f74 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerCommunicationLinks.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ServerCommunicationLinks. */ +public interface ServerCommunicationLinks { + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse( + String resourceGroupName, String serverName, String communicationLinkName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, String communicationLinkName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return server communication link along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String communicationLinkName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return server communication link. + */ + ServerCommunicationLink get(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. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server communication links as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server communication links as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * Returns a server communication link. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return server communication link along with {@link Response}. + */ + ServerCommunicationLink getById(String id); + + /** + * Returns a server communication link. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return server communication link along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a server communication link. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a server communication link. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ServerCommunicationLink resource. + * + * @param name resource name. + * @return the first stage of the new ServerCommunicationLink definition. + */ + ServerCommunicationLink.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerConnectionPolicies.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerConnectionPolicies.java new file mode 100644 index 0000000000000..c544023628feb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerConnectionPolicies.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ServerConnectionPolicies. */ +public interface ServerConnectionPolicies { + /** + * Gets a server 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 connectionPolicyName The name of the connection policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server connection policy along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, ConnectionPolicyName connectionPolicyName, Context context); + + /** + * Gets a server 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 connectionPolicyName The name of the connection policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server connection policy. + */ + ServerConnectionPolicy get(String resourceGroupName, String serverName, ConnectionPolicyName connectionPolicyName); + + /** + * Lists 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server connection policy objects as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Lists 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server connection policy objects as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * Gets a server connection policy. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server connection policy along with {@link Response}. + */ + ServerConnectionPolicy getById(String id); + + /** + * Gets a server connection policy. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server connection policy along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ServerConnectionPolicy resource. + * + * @param name resource name. + * @return the first stage of the new ServerConnectionPolicy definition. + */ + ServerConnectionPolicy.DefinitionStages.Blank define(ConnectionPolicyName name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerConnectionPolicy.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerConnectionPolicy.java new file mode 100644 index 0000000000000..4948718a86cfa --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerConnectionPolicy.java @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerConnectionPolicyInner; + +/** An immutable client-side representation of ServerConnectionPolicy. */ +public interface ServerConnectionPolicy { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: Resource location. + * + * @return the location value. + */ + String location(); + + /** + * Gets the kind property: Metadata used for the Azure portal experience. + * + * @return the kind value. + */ + String kind(); + + /** + * Gets the connectionType property: The server connection type. + * + * @return the connectionType value. + */ + ServerConnectionType connectionType(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ServerConnectionPolicyInner object. + * + * @return the inner object. + */ + ServerConnectionPolicyInner innerModel(); + + /** The entirety of the ServerConnectionPolicy definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ServerConnectionPolicy definition stages. */ + interface DefinitionStages { + /** The first stage of the ServerConnectionPolicy definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ServerConnectionPolicy definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @return the next definition stage. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + /** + * The stage of the ServerConnectionPolicy definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithConnectionType { + /** + * Executes the create request. + * + * @return the created resource. + */ + ServerConnectionPolicy create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ServerConnectionPolicy create(Context context); + } + /** The stage of the ServerConnectionPolicy definition allowing to specify connectionType. */ + interface WithConnectionType { + /** + * Specifies the connectionType property: The server connection type.. + * + * @param connectionType The server connection type. + * @return the next definition stage. + */ + WithCreate withConnectionType(ServerConnectionType connectionType); + } + } + /** + * Begins update for the ServerConnectionPolicy resource. + * + * @return the stage of resource update. + */ + ServerConnectionPolicy.Update update(); + + /** The template for ServerConnectionPolicy update. */ + interface Update extends UpdateStages.WithConnectionType { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ServerConnectionPolicy apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ServerConnectionPolicy apply(Context context); + } + /** The ServerConnectionPolicy update stages. */ + interface UpdateStages { + /** The stage of the ServerConnectionPolicy update allowing to specify connectionType. */ + interface WithConnectionType { + /** + * Specifies the connectionType property: The server connection type.. + * + * @param connectionType The server connection type. + * @return the next definition stage. + */ + Update withConnectionType(ServerConnectionType connectionType); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ServerConnectionPolicy refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ServerConnectionPolicy refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerConnectionPolicyListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerConnectionPolicyListResult.java new file mode 100644 index 0000000000000..04754fd15539f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerConnectionPolicyListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerConnectionPolicyInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of server connection policy objects. */ +@Immutable +public final class ServerConnectionPolicyListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of ServerConnectionPolicyListResult class. */ + public ServerConnectionPolicyListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerConnectionType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerConnectionType.java new file mode 100644 index 0000000000000..8003354d35eba --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerConnectionType.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The server connection type. */ +public final class ServerConnectionType extends ExpandableStringEnum { + /** Static value Default for ServerConnectionType. */ + public static final ServerConnectionType DEFAULT = fromString("Default"); + + /** Static value Redirect for ServerConnectionType. */ + public static final ServerConnectionType REDIRECT = fromString("Redirect"); + + /** Static value Proxy for ServerConnectionType. */ + public static final ServerConnectionType PROXY = fromString("Proxy"); + + /** + * Creates or finds a ServerConnectionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ServerConnectionType. + */ + @JsonCreator + public static ServerConnectionType fromString(String name) { + return fromString(name, ServerConnectionType.class); + } + + /** + * Gets known ServerConnectionType values. + * + * @return known ServerConnectionType values. + */ + public static Collection values() { + return values(ServerConnectionType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerDevOpsAuditSettings.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerDevOpsAuditSettings.java new file mode 100644 index 0000000000000..bbab4cbfc9150 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerDevOpsAuditSettings.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ServerDevOpsAuditSettings. */ +public interface ServerDevOpsAuditSettings { + /** + * Lists DevOps audit settings of 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server DevOps audit settings as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Lists DevOps audit settings of 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server DevOps audit settings as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer( + String resourceGroupName, String serverName, Context context); + + /** + * Gets a server's DevOps audit settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param devOpsAuditingSettingsName The devOpsAuditingSettingsName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's DevOps audit settings along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + DevOpsAuditingSettingsName devOpsAuditingSettingsName, + Context context); + + /** + * Gets a server's DevOps audit settings. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param devOpsAuditingSettingsName The devOpsAuditingSettingsName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's DevOps audit settings. + */ + ServerDevOpsAuditingSettings get( + String resourceGroupName, String serverName, DevOpsAuditingSettingsName devOpsAuditingSettingsName); + + /** + * Gets a server's DevOps audit settings. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's DevOps audit settings along with {@link Response}. + */ + ServerDevOpsAuditingSettings getById(String id); + + /** + * Gets a server's DevOps audit settings. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's DevOps audit settings along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ServerDevOpsAuditingSettings resource. + * + * @param name resource name. + * @return the first stage of the new ServerDevOpsAuditingSettings definition. + */ + ServerDevOpsAuditingSettings.DefinitionStages.Blank define(DevOpsAuditingSettingsName name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerDevOpsAuditSettingsListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerDevOpsAuditSettingsListResult.java new file mode 100644 index 0000000000000..68eeda6084dd7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerDevOpsAuditSettingsListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerDevOpsAuditingSettingsInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of server DevOps audit settings. */ +@Immutable +public final class ServerDevOpsAuditSettingsListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of ServerDevOpsAuditSettingsListResult class. */ + public ServerDevOpsAuditSettingsListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerDevOpsAuditingSettings.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerDevOpsAuditingSettings.java new file mode 100644 index 0000000000000..deaa9875837da --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerDevOpsAuditingSettings.java @@ -0,0 +1,415 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerDevOpsAuditingSettingsInner; +import java.util.UUID; + +/** An immutable client-side representation of ServerDevOpsAuditingSettings. */ +public interface ServerDevOpsAuditingSettings { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: SystemData of ServerDevOpsAuditSettingsResource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the isAzureMonitorTargetEnabled property: Specifies whether DevOps 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 DevOps audit, Diagnostic Settings with 'DevOpsOperationsAudit' diagnostic + * logs category on the master database should be also created. + * + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/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. + */ + Boolean isAzureMonitorTargetEnabled(); + + /** + * Gets the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob storage. + * + * @return the isManagedIdentityInUse value. + */ + Boolean isManagedIdentityInUse(); + + /** + * Gets the state property: Specifies the state of the audit. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * + * @return the state value. + */ + BlobAuditingPolicyState state(); + + /** + * Gets the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is + * required. + * + * @return the storageEndpoint value. + */ + String storageEndpoint(); + + /** + * Gets the storageAccountAccessKey property: Specifies the identifier key of the auditing storage account. If state + * is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server + * system-assigned managed identity to access the storage. Prerequisites for using managed identity authentication: + * 1. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). 2. Grant SQL Server + * identity access to the storage account by adding 'Storage Blob Data Contributor' RBAC role to the server + * identity. For more information, see [Auditing to storage using Managed Identity + * authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @return the storageAccountAccessKey value. + */ + String storageAccountAccessKey(); + + /** + * Gets the storageAccountSubscriptionId property: Specifies the blob storage subscription Id. + * + * @return the storageAccountSubscriptionId value. + */ + UUID storageAccountSubscriptionId(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ServerDevOpsAuditingSettingsInner object. + * + * @return the inner object. + */ + ServerDevOpsAuditingSettingsInner innerModel(); + + /** The entirety of the ServerDevOpsAuditingSettings definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ServerDevOpsAuditingSettings definition stages. */ + interface DefinitionStages { + /** The first stage of the ServerDevOpsAuditingSettings definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ServerDevOpsAuditingSettings definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @return the next definition stage. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + /** + * The stage of the ServerDevOpsAuditingSettings definition which contains all the minimum required properties + * for the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithIsAzureMonitorTargetEnabled, + DefinitionStages.WithIsManagedIdentityInUse, + DefinitionStages.WithState, + DefinitionStages.WithStorageEndpoint, + DefinitionStages.WithStorageAccountAccessKey, + DefinitionStages.WithStorageAccountSubscriptionId { + /** + * Executes the create request. + * + * @return the created resource. + */ + ServerDevOpsAuditingSettings create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ServerDevOpsAuditingSettings create(Context context); + } + /** The stage of the ServerDevOpsAuditingSettings definition allowing to specify isAzureMonitorTargetEnabled. */ + interface WithIsAzureMonitorTargetEnabled { + /** + * Specifies the isAzureMonitorTargetEnabled property: Specifies whether DevOps 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 DevOps audit, Diagnostic Settings with 'DevOpsOperationsAudit' + * diagnostic logs category on the master database should be also created. + * + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/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 Specifies whether DevOps 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 DevOps audit, Diagnostic Settings with 'DevOpsOperationsAudit' + * diagnostic logs category on the master database should be also created. + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/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 next definition stage. + */ + WithCreate withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled); + } + /** The stage of the ServerDevOpsAuditingSettings definition allowing to specify isManagedIdentityInUse. */ + interface WithIsManagedIdentityInUse { + /** + * Specifies the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob + * storage. + * + * @param isManagedIdentityInUse Specifies whether Managed Identity is used to access blob storage. + * @return the next definition stage. + */ + WithCreate withIsManagedIdentityInUse(Boolean isManagedIdentityInUse); + } + /** The stage of the ServerDevOpsAuditingSettings definition allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the audit. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required.. + * + * @param state Specifies the state of the audit. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * @return the next definition stage. + */ + WithCreate withState(BlobAuditingPolicyState state); + } + /** The stage of the ServerDevOpsAuditingSettings definition allowing to specify storageEndpoint. */ + interface WithStorageEndpoint { + /** + * Specifies the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled is required.. + * + * @param storageEndpoint Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled is required. + * @return the next definition stage. + */ + WithCreate withStorageEndpoint(String storageEndpoint); + } + /** The stage of the ServerDevOpsAuditingSettings definition allowing to specify storageAccountAccessKey. */ + interface WithStorageAccountAccessKey { + /** + * Specifies the storageAccountAccessKey property: Specifies the identifier key of the auditing storage + * account. If state is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey + * will use SQL server system-assigned managed identity to access the storage. Prerequisites for using + * managed identity authentication: 1. Assign SQL Server a system-assigned managed identity in Azure Active + * Directory (AAD). 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data + * Contributor' RBAC role to the server identity. For more information, see [Auditing to storage using + * Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @param storageAccountAccessKey Specifies the identifier key of the auditing storage account. If state is + * Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL + * server system-assigned managed identity to access the storage. Prerequisites for using managed + * identity authentication: 1. Assign SQL Server a system-assigned managed identity in Azure Active + * Directory (AAD). 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob + * Data Contributor' RBAC role to the server identity. For more information, see [Auditing to storage + * using Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * @return the next definition stage. + */ + WithCreate withStorageAccountAccessKey(String storageAccountAccessKey); + } + /** + * The stage of the ServerDevOpsAuditingSettings definition allowing to specify storageAccountSubscriptionId. + */ + interface WithStorageAccountSubscriptionId { + /** + * Specifies the storageAccountSubscriptionId property: Specifies the blob storage subscription Id.. + * + * @param storageAccountSubscriptionId Specifies the blob storage subscription Id. + * @return the next definition stage. + */ + WithCreate withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId); + } + } + /** + * Begins update for the ServerDevOpsAuditingSettings resource. + * + * @return the stage of resource update. + */ + ServerDevOpsAuditingSettings.Update update(); + + /** The template for ServerDevOpsAuditingSettings update. */ + interface Update + extends UpdateStages.WithIsAzureMonitorTargetEnabled, + UpdateStages.WithIsManagedIdentityInUse, + UpdateStages.WithState, + UpdateStages.WithStorageEndpoint, + UpdateStages.WithStorageAccountAccessKey, + UpdateStages.WithStorageAccountSubscriptionId { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ServerDevOpsAuditingSettings apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ServerDevOpsAuditingSettings apply(Context context); + } + /** The ServerDevOpsAuditingSettings update stages. */ + interface UpdateStages { + /** The stage of the ServerDevOpsAuditingSettings update allowing to specify isAzureMonitorTargetEnabled. */ + interface WithIsAzureMonitorTargetEnabled { + /** + * Specifies the isAzureMonitorTargetEnabled property: Specifies whether DevOps 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 DevOps audit, Diagnostic Settings with 'DevOpsOperationsAudit' + * diagnostic logs category on the master database should be also created. + * + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/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 Specifies whether DevOps 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 DevOps audit, Diagnostic Settings with 'DevOpsOperationsAudit' + * diagnostic logs category on the master database should be also created. + *

Diagnostic Settings URI format: PUT + * https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/master/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 next definition stage. + */ + Update withIsAzureMonitorTargetEnabled(Boolean isAzureMonitorTargetEnabled); + } + /** The stage of the ServerDevOpsAuditingSettings update allowing to specify isManagedIdentityInUse. */ + interface WithIsManagedIdentityInUse { + /** + * Specifies the isManagedIdentityInUse property: Specifies whether Managed Identity is used to access blob + * storage. + * + * @param isManagedIdentityInUse Specifies whether Managed Identity is used to access blob storage. + * @return the next definition stage. + */ + Update withIsManagedIdentityInUse(Boolean isManagedIdentityInUse); + } + /** The stage of the ServerDevOpsAuditingSettings update allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the audit. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required.. + * + * @param state Specifies the state of the audit. If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled are required. + * @return the next definition stage. + */ + Update withState(BlobAuditingPolicyState state); + } + /** The stage of the ServerDevOpsAuditingSettings update allowing to specify storageEndpoint. */ + interface WithStorageEndpoint { + /** + * Specifies the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled is required.. + * + * @param storageEndpoint Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or + * isAzureMonitorTargetEnabled is required. + * @return the next definition stage. + */ + Update withStorageEndpoint(String storageEndpoint); + } + /** The stage of the ServerDevOpsAuditingSettings update allowing to specify storageAccountAccessKey. */ + interface WithStorageAccountAccessKey { + /** + * Specifies the storageAccountAccessKey property: Specifies the identifier key of the auditing storage + * account. If state is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey + * will use SQL server system-assigned managed identity to access the storage. Prerequisites for using + * managed identity authentication: 1. Assign SQL Server a system-assigned managed identity in Azure Active + * Directory (AAD). 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data + * Contributor' RBAC role to the server identity. For more information, see [Auditing to storage using + * Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * + * @param storageAccountAccessKey Specifies the identifier key of the auditing storage account. If state is + * Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL + * server system-assigned managed identity to access the storage. Prerequisites for using managed + * identity authentication: 1. Assign SQL Server a system-assigned managed identity in Azure Active + * Directory (AAD). 2. Grant SQL Server identity access to the storage account by adding 'Storage Blob + * Data Contributor' RBAC role to the server identity. For more information, see [Auditing to storage + * using Managed Identity authentication](https://go.microsoft.com/fwlink/?linkid=2114355). + * @return the next definition stage. + */ + Update withStorageAccountAccessKey(String storageAccountAccessKey); + } + /** The stage of the ServerDevOpsAuditingSettings update allowing to specify storageAccountSubscriptionId. */ + interface WithStorageAccountSubscriptionId { + /** + * Specifies the storageAccountSubscriptionId property: Specifies the blob storage subscription Id.. + * + * @param storageAccountSubscriptionId Specifies the blob storage subscription Id. + * @return the next definition stage. + */ + Update withStorageAccountSubscriptionId(UUID storageAccountSubscriptionId); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ServerDevOpsAuditingSettings refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ServerDevOpsAuditingSettings refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerDnsAlias.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerDnsAlias.java new file mode 100644 index 0000000000000..4082a0195e7cc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerDnsAlias.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.ServerDnsAliasInner; + +/** An immutable client-side representation of ServerDnsAlias. */ +public interface ServerDnsAlias { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the azureDnsRecord property: The fully qualified DNS record for alias. + * + * @return the azureDnsRecord value. + */ + String azureDnsRecord(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ServerDnsAliasInner object. + * + * @return the inner object. + */ + ServerDnsAliasInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerDnsAliasAcquisition.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerDnsAliasAcquisition.java new file mode 100644 index 0000000000000..4cdc3a365e93b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerDnsAliasAcquisition.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A server dns alias acquisition request. */ +@Fluent +public final class ServerDnsAliasAcquisition { + /* + * The id of the server alias that will be acquired to point to this server instead. + */ + @JsonProperty(value = "oldServerDnsAliasId", required = true) + private String oldServerDnsAliasId; + + /** Creates an instance of ServerDnsAliasAcquisition class. */ + public ServerDnsAliasAcquisition() { + } + + /** + * Get the oldServerDnsAliasId property: 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 oldServerDnsAliasId property: 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (oldServerDnsAliasId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property oldServerDnsAliasId in model ServerDnsAliasAcquisition")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ServerDnsAliasAcquisition.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerDnsAliasListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerDnsAliasListResult.java new file mode 100644 index 0000000000000..c6d02ad73ab09 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerDnsAliasListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerDnsAliasInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of server DNS aliases. */ +@Immutable +public final class ServerDnsAliasListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of ServerDnsAliasListResult class. */ + public ServerDnsAliasListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerDnsAliases.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerDnsAliases.java new file mode 100644 index 0000000000000..65c7f2c839c69 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerDnsAliases.java @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ServerDnsAliases. */ +public interface ServerDnsAliases { + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server DNS alias along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String dnsAliasName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server DNS alias. + */ + ServerDnsAlias get(String resourceGroupName, String serverName, String dnsAliasName); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server DNS alias. + */ + ServerDnsAlias createOrUpdate(String resourceGroupName, String serverName, String dnsAliasName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server DNS alias. + */ + ServerDnsAlias createOrUpdate(String resourceGroupName, String serverName, String dnsAliasName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, String dnsAliasName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, String dnsAliasName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server DNS aliases for a server as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server DNS aliases for a server as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * 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 parameters A server dns alias acquisition request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server DNS alias. + */ + ServerDnsAlias acquire( + String resourceGroupName, String serverName, String dnsAliasName, ServerDnsAliasAcquisition parameters); + + /** + * 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 parameters A server dns alias acquisition request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server DNS alias. + */ + ServerDnsAlias acquire( + String resourceGroupName, + String serverName, + String dnsAliasName, + ServerDnsAliasAcquisition parameters, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerExternalAdministrator.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerExternalAdministrator.java new file mode 100644 index 0000000000000..d19d7eb8cf507 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerExternalAdministrator.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +/** Properties of a active directory administrator. */ +@Fluent +public final class ServerExternalAdministrator { + /* + * Type of the sever administrator. + */ + @JsonProperty(value = "administratorType") + private AdministratorType administratorType; + + /* + * Principal Type of the sever administrator. + */ + @JsonProperty(value = "principalType") + private PrincipalType principalType; + + /* + * Login name of the server administrator. + */ + @JsonProperty(value = "login") + private String login; + + /* + * SID (object ID) of the server administrator. + */ + @JsonProperty(value = "sid") + private UUID sid; + + /* + * Tenant ID of the administrator. + */ + @JsonProperty(value = "tenantId") + private UUID tenantId; + + /* + * Azure Active Directory only Authentication enabled. + */ + @JsonProperty(value = "azureADOnlyAuthentication") + private Boolean azureADOnlyAuthentication; + + /** Creates an instance of ServerExternalAdministrator class. */ + public ServerExternalAdministrator() { + } + + /** + * Get the administratorType property: Type of the sever administrator. + * + * @return the administratorType value. + */ + public AdministratorType administratorType() { + return this.administratorType; + } + + /** + * Set the administratorType property: Type of the sever administrator. + * + * @param administratorType the administratorType value to set. + * @return the ServerExternalAdministrator object itself. + */ + public ServerExternalAdministrator withAdministratorType(AdministratorType administratorType) { + this.administratorType = administratorType; + return this; + } + + /** + * Get the principalType property: Principal Type of the sever administrator. + * + * @return the principalType value. + */ + public PrincipalType principalType() { + return this.principalType; + } + + /** + * Set the principalType property: Principal Type of the sever administrator. + * + * @param principalType the principalType value to set. + * @return the ServerExternalAdministrator object itself. + */ + public ServerExternalAdministrator withPrincipalType(PrincipalType principalType) { + this.principalType = principalType; + return this; + } + + /** + * Get the login property: Login name of the server administrator. + * + * @return the login value. + */ + public String login() { + return this.login; + } + + /** + * Set the login property: Login name of the server administrator. + * + * @param login the login value to set. + * @return the ServerExternalAdministrator object itself. + */ + public ServerExternalAdministrator withLogin(String login) { + this.login = login; + return this; + } + + /** + * Get the sid property: SID (object ID) of the server administrator. + * + * @return the sid value. + */ + public UUID sid() { + return this.sid; + } + + /** + * Set the sid property: SID (object ID) of the server administrator. + * + * @param sid the sid value to set. + * @return the ServerExternalAdministrator object itself. + */ + public ServerExternalAdministrator withSid(UUID sid) { + this.sid = sid; + return this; + } + + /** + * Get the tenantId property: Tenant ID of the administrator. + * + * @return the tenantId value. + */ + public UUID tenantId() { + return this.tenantId; + } + + /** + * Set the tenantId property: Tenant ID of the administrator. + * + * @param tenantId the tenantId value to set. + * @return the ServerExternalAdministrator object itself. + */ + public ServerExternalAdministrator withTenantId(UUID tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Get the azureADOnlyAuthentication property: Azure Active Directory only Authentication enabled. + * + * @return the azureADOnlyAuthentication value. + */ + public Boolean azureADOnlyAuthentication() { + return this.azureADOnlyAuthentication; + } + + /** + * Set the azureADOnlyAuthentication property: Azure Active Directory only Authentication enabled. + * + * @param azureADOnlyAuthentication the azureADOnlyAuthentication value to set. + * @return the ServerExternalAdministrator object itself. + */ + public ServerExternalAdministrator withAzureADOnlyAuthentication(Boolean azureADOnlyAuthentication) { + this.azureADOnlyAuthentication = azureADOnlyAuthentication; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerInfo.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerInfo.java new file mode 100644 index 0000000000000..a20f276e36a8a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerInfo.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Server info for the server trust group. */ +@Fluent +public final class ServerInfo { + /* + * Server Id. + */ + @JsonProperty(value = "serverId", required = true) + private String serverId; + + /** Creates an instance of ServerInfo class. */ + public ServerInfo() { + } + + /** + * Get the serverId property: Server Id. + * + * @return the serverId value. + */ + public String serverId() { + return this.serverId; + } + + /** + * Set the serverId property: Server Id. + * + * @param serverId the serverId value to set. + * @return the ServerInfo object itself. + */ + public ServerInfo withServerId(String serverId) { + this.serverId = serverId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (serverId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property serverId in model ServerInfo")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ServerInfo.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerKey.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerKey.java new file mode 100644 index 0000000000000..11a8598cfaecd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerKey.java @@ -0,0 +1,224 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerKeyInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of ServerKey. */ +public interface ServerKey { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the kind property: Kind of encryption protector. This is metadata used for the Azure portal experience. + * + * @return the kind value. + */ + String kind(); + + /** + * Gets the location property: Resource location. + * + * @return the location value. + */ + String location(); + + /** + * Gets the subregion property: Subregion of the server key. + * + * @return the subregion value. + */ + String subregion(); + + /** + * Gets the serverKeyType property: The server key type like 'ServiceManaged', 'AzureKeyVault'. + * + * @return the serverKeyType value. + */ + ServerKeyType serverKeyType(); + + /** + * Gets the uri property: The URI of the server key. If the ServerKeyType is AzureKeyVault, then the URI is + * required. + * + * @return the uri value. + */ + String uri(); + + /** + * Gets the thumbprint property: Thumbprint of the server key. + * + * @return the thumbprint value. + */ + String thumbprint(); + + /** + * Gets the creationDate property: The server key creation date. + * + * @return the creationDate value. + */ + OffsetDateTime creationDate(); + + /** + * Gets the autoRotationEnabled property: Key auto rotation opt-in flag. Either true or false. + * + * @return the autoRotationEnabled value. + */ + Boolean autoRotationEnabled(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ServerKeyInner object. + * + * @return the inner object. + */ + ServerKeyInner innerModel(); + + /** The entirety of the ServerKey definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ServerKey definition stages. */ + interface DefinitionStages { + /** The first stage of the ServerKey definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ServerKey definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @return the next definition stage. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + /** + * The stage of the ServerKey definition which contains all the minimum required properties for the resource to + * be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithServerKeyType, DefinitionStages.WithUri { + /** + * Executes the create request. + * + * @return the created resource. + */ + ServerKey create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ServerKey create(Context context); + } + /** The stage of the ServerKey definition allowing to specify serverKeyType. */ + interface WithServerKeyType { + /** + * Specifies the serverKeyType property: The server key type like 'ServiceManaged', 'AzureKeyVault'.. + * + * @param serverKeyType The server key type like 'ServiceManaged', 'AzureKeyVault'. + * @return the next definition stage. + */ + WithCreate withServerKeyType(ServerKeyType serverKeyType); + } + /** The stage of the ServerKey definition allowing to specify uri. */ + interface WithUri { + /** + * Specifies the uri property: The URI of the server key. If the ServerKeyType is AzureKeyVault, then the + * URI is required.. + * + * @param uri The URI of the server key. If the ServerKeyType is AzureKeyVault, then the URI is required. + * @return the next definition stage. + */ + WithCreate withUri(String uri); + } + } + /** + * Begins update for the ServerKey resource. + * + * @return the stage of resource update. + */ + ServerKey.Update update(); + + /** The template for ServerKey update. */ + interface Update { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ServerKey apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ServerKey apply(Context context); + } + /** The ServerKey update stages. */ + interface UpdateStages { + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ServerKey refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ServerKey refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerKeyListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerKeyListResult.java new file mode 100644 index 0000000000000..795b2f3188c61 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerKeyListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerKeyInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of server keys. */ +@Immutable +public final class ServerKeyListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of ServerKeyListResult class. */ + public ServerKeyListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerKeyType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerKeyType.java new file mode 100644 index 0000000000000..7f15192de3c01 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerKeyType.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The encryption protector type like 'ServiceManaged', 'AzureKeyVault'. */ +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); + } + + /** + * Gets known ServerKeyType values. + * + * @return known ServerKeyType values. + */ + public static Collection values() { + return values(ServerKeyType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerKeys.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerKeys.java new file mode 100644 index 0000000000000..5aee22becc6c0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerKeys.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ServerKeys. */ +public interface ServerKeys { + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server keys as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server keys as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server key along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String serverName, String keyName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server key. + */ + ServerKey get(String resourceGroupName, String serverName, String keyName); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, String keyName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, String keyName, Context context); + + /** + * Gets a server key. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server key along with {@link Response}. + */ + ServerKey getById(String id); + + /** + * Gets a server key. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server key along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the server key with the given name. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes the server key with the given name. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ServerKey resource. + * + * @param name resource name. + * @return the first stage of the new ServerKey definition. + */ + ServerKey.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerListResult.java new file mode 100644 index 0000000000000..17bc88a59eac2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of servers. */ +@Immutable +public final class ServerListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of ServerListResult class. */ + public ServerListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerNetworkAccessFlag.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerNetworkAccessFlag.java new file mode 100644 index 0000000000000..fda4621019a48 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerNetworkAccessFlag.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * Whether or not public endpoint access is allowed for this server. Value is optional but if passed in, must be + * 'Enabled' or 'Disabled'. + */ +public final class ServerNetworkAccessFlag extends ExpandableStringEnum { + /** Static value Enabled for ServerNetworkAccessFlag. */ + public static final ServerNetworkAccessFlag ENABLED = fromString("Enabled"); + + /** Static value Disabled for ServerNetworkAccessFlag. */ + public static final ServerNetworkAccessFlag DISABLED = fromString("Disabled"); + + /** + * Creates or finds a ServerNetworkAccessFlag from its string representation. + * + * @param name a name to look for. + * @return the corresponding ServerNetworkAccessFlag. + */ + @JsonCreator + public static ServerNetworkAccessFlag fromString(String name) { + return fromString(name, ServerNetworkAccessFlag.class); + } + + /** + * Gets known ServerNetworkAccessFlag values. + * + * @return known ServerNetworkAccessFlag values. + */ + public static Collection values() { + return values(ServerNetworkAccessFlag.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerOperation.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerOperation.java new file mode 100644 index 0000000000000..2f220f9aa4a82 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerOperation.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.ServerOperationInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of ServerOperation. */ +public interface ServerOperation { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the operation property: The name of operation. + * + * @return the operation value. + */ + String operation(); + + /** + * Gets the operationFriendlyName property: The friendly name of operation. + * + * @return the operationFriendlyName value. + */ + String operationFriendlyName(); + + /** + * Gets the percentComplete property: The percentage of the operation completed. + * + * @return the percentComplete value. + */ + Integer percentComplete(); + + /** + * Gets the serverName property: The name of the server. + * + * @return the serverName value. + */ + String serverName(); + + /** + * Gets the startTime property: The operation start time. + * + * @return the startTime value. + */ + OffsetDateTime startTime(); + + /** + * Gets the state property: The operation state. + * + * @return the state value. + */ + ManagementOperationState state(); + + /** + * Gets the errorCode property: The operation error code. + * + * @return the errorCode value. + */ + Integer errorCode(); + + /** + * Gets the errorDescription property: The operation error description. + * + * @return the errorDescription value. + */ + String errorDescription(); + + /** + * Gets the errorSeverity property: The operation error severity. + * + * @return the errorSeverity value. + */ + Integer errorSeverity(); + + /** + * Gets the isUserError property: Whether or not the error is a user error. + * + * @return the isUserError value. + */ + Boolean isUserError(); + + /** + * Gets the estimatedCompletionTime property: The estimated completion time of the operation. + * + * @return the estimatedCompletionTime value. + */ + OffsetDateTime estimatedCompletionTime(); + + /** + * Gets the description property: The operation description. + * + * @return the description value. + */ + String description(); + + /** + * Gets the isCancellable property: Whether the operation can be cancelled. + * + * @return the isCancellable value. + */ + Boolean isCancellable(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ServerOperationInner object. + * + * @return the inner object. + */ + ServerOperationInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerOperationListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerOperationListResult.java new file mode 100644 index 0000000000000..b59c3a73a5c95 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerOperationListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerOperationInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response to a list server operations request. */ +@Immutable +public final class ServerOperationListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of ServerOperationListResult class. */ + public ServerOperationListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerOperations.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerOperations.java new file mode 100644 index 0000000000000..e80fa66133a7c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerOperations.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of ServerOperations. */ +public interface ServerOperations { + /** + * Gets a list of operations performed 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of operations performed on the server as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets a list of operations performed 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of operations performed on the server as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerPrivateEndpointConnection.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerPrivateEndpointConnection.java new file mode 100644 index 0000000000000..add201108d633 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerPrivateEndpointConnection.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.PrivateEndpointConnectionProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A private endpoint connection under a server. */ +@Immutable +public final class ServerPrivateEndpointConnection { + /* + * Resource ID. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * Private endpoint connection properties + */ + @JsonProperty(value = "properties", access = JsonProperty.Access.WRITE_ONLY) + private PrivateEndpointConnectionProperties properties; + + /** Creates an instance of ServerPrivateEndpointConnection class. */ + public ServerPrivateEndpointConnection() { + } + + /** + * Get the id property: Resource ID. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the properties property: Private endpoint connection properties. + * + * @return the properties value. + */ + public PrivateEndpointConnectionProperties properties() { + return this.properties; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerSecurityAlertPolicies.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerSecurityAlertPolicies.java new file mode 100644 index 0000000000000..1ea20f4e54920 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerSecurityAlertPolicies.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ServerSecurityAlertPolicies. */ +public interface ServerSecurityAlertPolicies { + /** + * 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 securityAlertPolicyName The name of the security alert policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's security alert policy along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, SecurityAlertPolicyName securityAlertPolicyName, Context context); + + /** + * 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 securityAlertPolicyName The name of the security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's security alert policy. + */ + ServerSecurityAlertPolicy get( + String resourceGroupName, String serverName, SecurityAlertPolicyName securityAlertPolicyName); + + /** + * Get the server's threat detection 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the server's threat detection policies as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Get the server's threat detection 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the server's threat detection policies as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * Get a server's security alert policy. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's security alert policy along with {@link Response}. + */ + ServerSecurityAlertPolicy getById(String id); + + /** + * Get a server's security alert policy. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's security alert policy along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ServerSecurityAlertPolicy resource. + * + * @param name resource name. + * @return the first stage of the new ServerSecurityAlertPolicy definition. + */ + ServerSecurityAlertPolicy.DefinitionStages.Blank define(SecurityAlertPolicyName name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerSecurityAlertPolicy.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerSecurityAlertPolicy.java new file mode 100644 index 0000000000000..dfe21156616dc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerSecurityAlertPolicy.java @@ -0,0 +1,380 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerSecurityAlertPolicyInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of ServerSecurityAlertPolicy. */ +public interface ServerSecurityAlertPolicy { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: SystemData of SecurityAlertPolicyResource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the state property: Specifies the state of the policy, whether it is enabled or disabled or a policy has not + * been applied yet on the specific database. + * + * @return the state value. + */ + SecurityAlertsPolicyState state(); + + /** + * Gets the disabledAlerts property: Specifies an array of alerts that are disabled. Allowed values are: + * Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action, Brute_Force. + * + * @return the disabledAlerts value. + */ + List disabledAlerts(); + + /** + * Gets the emailAddresses property: Specifies an array of e-mail addresses to which the alert is sent. + * + * @return the emailAddresses value. + */ + List emailAddresses(); + + /** + * Gets the emailAccountAdmins property: Specifies that the alert is sent to the account administrators. + * + * @return the emailAccountAdmins value. + */ + Boolean emailAccountAdmins(); + + /** + * Gets the storageEndpoint property: 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. + */ + String storageEndpoint(); + + /** + * Gets the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection audit storage + * account. + * + * @return the storageAccountAccessKey value. + */ + String storageAccountAccessKey(); + + /** + * Gets the retentionDays property: Specifies the number of days to keep in the Threat Detection audit logs. + * + * @return the retentionDays value. + */ + Integer retentionDays(); + + /** + * Gets the creationTime property: Specifies the UTC creation time of the policy. + * + * @return the creationTime value. + */ + OffsetDateTime creationTime(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ServerSecurityAlertPolicyInner object. + * + * @return the inner object. + */ + ServerSecurityAlertPolicyInner innerModel(); + + /** The entirety of the ServerSecurityAlertPolicy definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ServerSecurityAlertPolicy definition stages. */ + interface DefinitionStages { + /** The first stage of the ServerSecurityAlertPolicy definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ServerSecurityAlertPolicy definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @return the next definition stage. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + /** + * The stage of the ServerSecurityAlertPolicy definition which contains all the minimum required properties for + * the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithState, + DefinitionStages.WithDisabledAlerts, + DefinitionStages.WithEmailAddresses, + DefinitionStages.WithEmailAccountAdmins, + DefinitionStages.WithStorageEndpoint, + DefinitionStages.WithStorageAccountAccessKey, + DefinitionStages.WithRetentionDays { + /** + * Executes the create request. + * + * @return the created resource. + */ + ServerSecurityAlertPolicy create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ServerSecurityAlertPolicy create(Context context); + } + /** The stage of the ServerSecurityAlertPolicy definition allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the policy, whether it is enabled or disabled or a + * policy has not been applied yet on the specific database.. + * + * @param state Specifies the state of the policy, whether it is enabled or disabled or a policy has not + * been applied yet on the specific database. + * @return the next definition stage. + */ + WithCreate withState(SecurityAlertsPolicyState state); + } + /** The stage of the ServerSecurityAlertPolicy definition allowing to specify disabledAlerts. */ + interface WithDisabledAlerts { + /** + * Specifies the disabledAlerts property: Specifies an array of alerts that are disabled. Allowed values + * are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action, + * Brute_Force. + * + * @param disabledAlerts Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, + * Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action, Brute_Force. + * @return the next definition stage. + */ + WithCreate withDisabledAlerts(List disabledAlerts); + } + /** The stage of the ServerSecurityAlertPolicy definition allowing to specify emailAddresses. */ + interface WithEmailAddresses { + /** + * Specifies the emailAddresses property: Specifies an array of e-mail addresses to which the alert is + * sent.. + * + * @param emailAddresses Specifies an array of e-mail addresses to which the alert is sent. + * @return the next definition stage. + */ + WithCreate withEmailAddresses(List emailAddresses); + } + /** The stage of the ServerSecurityAlertPolicy definition allowing to specify emailAccountAdmins. */ + interface WithEmailAccountAdmins { + /** + * Specifies the emailAccountAdmins property: Specifies that the alert is sent to the account + * administrators.. + * + * @param emailAccountAdmins Specifies that the alert is sent to the account administrators. + * @return the next definition stage. + */ + WithCreate withEmailAccountAdmins(Boolean emailAccountAdmins); + } + /** The stage of the ServerSecurityAlertPolicy definition allowing to specify storageEndpoint. */ + interface WithStorageEndpoint { + /** + * Specifies the storageEndpoint property: 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 Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit + * logs. + * @return the next definition stage. + */ + WithCreate withStorageEndpoint(String storageEndpoint); + } + /** The stage of the ServerSecurityAlertPolicy definition allowing to specify storageAccountAccessKey. */ + interface WithStorageAccountAccessKey { + /** + * Specifies the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection + * audit storage account.. + * + * @param storageAccountAccessKey Specifies the identifier key of the Threat Detection audit storage + * account. + * @return the next definition stage. + */ + WithCreate withStorageAccountAccessKey(String storageAccountAccessKey); + } + /** The stage of the ServerSecurityAlertPolicy definition allowing to specify retentionDays. */ + interface WithRetentionDays { + /** + * Specifies the retentionDays property: Specifies the number of days to keep in the Threat Detection audit + * logs.. + * + * @param retentionDays Specifies the number of days to keep in the Threat Detection audit logs. + * @return the next definition stage. + */ + WithCreate withRetentionDays(Integer retentionDays); + } + } + /** + * Begins update for the ServerSecurityAlertPolicy resource. + * + * @return the stage of resource update. + */ + ServerSecurityAlertPolicy.Update update(); + + /** The template for ServerSecurityAlertPolicy update. */ + interface Update + extends UpdateStages.WithState, + UpdateStages.WithDisabledAlerts, + UpdateStages.WithEmailAddresses, + UpdateStages.WithEmailAccountAdmins, + UpdateStages.WithStorageEndpoint, + UpdateStages.WithStorageAccountAccessKey, + UpdateStages.WithRetentionDays { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ServerSecurityAlertPolicy apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ServerSecurityAlertPolicy apply(Context context); + } + /** The ServerSecurityAlertPolicy update stages. */ + interface UpdateStages { + /** The stage of the ServerSecurityAlertPolicy update allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the policy, whether it is enabled or disabled or a + * policy has not been applied yet on the specific database.. + * + * @param state Specifies the state of the policy, whether it is enabled or disabled or a policy has not + * been applied yet on the specific database. + * @return the next definition stage. + */ + Update withState(SecurityAlertsPolicyState state); + } + /** The stage of the ServerSecurityAlertPolicy update allowing to specify disabledAlerts. */ + interface WithDisabledAlerts { + /** + * Specifies the disabledAlerts property: Specifies an array of alerts that are disabled. Allowed values + * are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action, + * Brute_Force. + * + * @param disabledAlerts Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, + * Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action, Brute_Force. + * @return the next definition stage. + */ + Update withDisabledAlerts(List disabledAlerts); + } + /** The stage of the ServerSecurityAlertPolicy update allowing to specify emailAddresses. */ + interface WithEmailAddresses { + /** + * Specifies the emailAddresses property: Specifies an array of e-mail addresses to which the alert is + * sent.. + * + * @param emailAddresses Specifies an array of e-mail addresses to which the alert is sent. + * @return the next definition stage. + */ + Update withEmailAddresses(List emailAddresses); + } + /** The stage of the ServerSecurityAlertPolicy update allowing to specify emailAccountAdmins. */ + interface WithEmailAccountAdmins { + /** + * Specifies the emailAccountAdmins property: Specifies that the alert is sent to the account + * administrators.. + * + * @param emailAccountAdmins Specifies that the alert is sent to the account administrators. + * @return the next definition stage. + */ + Update withEmailAccountAdmins(Boolean emailAccountAdmins); + } + /** The stage of the ServerSecurityAlertPolicy update allowing to specify storageEndpoint. */ + interface WithStorageEndpoint { + /** + * Specifies the storageEndpoint property: 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 Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit + * logs. + * @return the next definition stage. + */ + Update withStorageEndpoint(String storageEndpoint); + } + /** The stage of the ServerSecurityAlertPolicy update allowing to specify storageAccountAccessKey. */ + interface WithStorageAccountAccessKey { + /** + * Specifies the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection + * audit storage account.. + * + * @param storageAccountAccessKey Specifies the identifier key of the Threat Detection audit storage + * account. + * @return the next definition stage. + */ + Update withStorageAccountAccessKey(String storageAccountAccessKey); + } + /** The stage of the ServerSecurityAlertPolicy update allowing to specify retentionDays. */ + interface WithRetentionDays { + /** + * Specifies the retentionDays property: Specifies the number of days to keep in the Threat Detection audit + * logs.. + * + * @param retentionDays Specifies the number of days to keep in the Threat Detection audit logs. + * @return the next definition stage. + */ + Update withRetentionDays(Integer retentionDays); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ServerSecurityAlertPolicy refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ServerSecurityAlertPolicy refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerTrustCertificate.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerTrustCertificate.java new file mode 100644 index 0000000000000..f25e71682aa94 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerTrustCertificate.java @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerTrustCertificateInner; + +/** An immutable client-side representation of ServerTrustCertificate. */ +public interface ServerTrustCertificate { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the publicBlob property: The certificate public blob. + * + * @return the publicBlob value. + */ + String publicBlob(); + + /** + * Gets the thumbprint property: The certificate thumbprint. + * + * @return the thumbprint value. + */ + String thumbprint(); + + /** + * Gets the certificateName property: The certificate name. + * + * @return the certificateName value. + */ + String certificateName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ServerTrustCertificateInner object. + * + * @return the inner object. + */ + ServerTrustCertificateInner innerModel(); + + /** The entirety of the ServerTrustCertificate definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ServerTrustCertificate definition stages. */ + interface DefinitionStages { + /** The first stage of the ServerTrustCertificate definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ServerTrustCertificate definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, managedInstanceName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param managedInstanceName The name of the managed instance. + * @return the next definition stage. + */ + WithCreate withExistingManagedInstance(String resourceGroupName, String managedInstanceName); + } + /** + * The stage of the ServerTrustCertificate definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithPublicBlob { + /** + * Executes the create request. + * + * @return the created resource. + */ + ServerTrustCertificate create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ServerTrustCertificate create(Context context); + } + /** The stage of the ServerTrustCertificate definition allowing to specify publicBlob. */ + interface WithPublicBlob { + /** + * Specifies the publicBlob property: The certificate public blob. + * + * @param publicBlob The certificate public blob. + * @return the next definition stage. + */ + WithCreate withPublicBlob(String publicBlob); + } + } + /** + * Begins update for the ServerTrustCertificate resource. + * + * @return the stage of resource update. + */ + ServerTrustCertificate.Update update(); + + /** The template for ServerTrustCertificate update. */ + interface Update extends UpdateStages.WithPublicBlob { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ServerTrustCertificate apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ServerTrustCertificate apply(Context context); + } + /** The ServerTrustCertificate update stages. */ + interface UpdateStages { + /** The stage of the ServerTrustCertificate update allowing to specify publicBlob. */ + interface WithPublicBlob { + /** + * Specifies the publicBlob property: The certificate public blob. + * + * @param publicBlob The certificate public blob. + * @return the next definition stage. + */ + Update withPublicBlob(String publicBlob); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ServerTrustCertificate refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ServerTrustCertificate refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerTrustCertificates.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerTrustCertificates.java new file mode 100644 index 0000000000000..34f858ad0c38f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerTrustCertificates.java @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ServerTrustCertificates. */ +public interface ServerTrustCertificates { + /** + * Gets a list of server trust certificates that were uploaded from box to the given Sql 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server trust certificates that were uploaded from box to the given Sql Managed Instance as + * paginated response with {@link PagedIterable}. + */ + PagedIterable listByInstance(String resourceGroupName, String managedInstanceName); + + /** + * Gets a list of server trust certificates that were uploaded from box to the given Sql 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server trust certificates that were uploaded from box to the given Sql Managed Instance as + * paginated response with {@link PagedIterable}. + */ + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * Gets a server trust certificate that was uploaded from box to Sql 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 certificateName Name of of the certificate to get. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust certificate that was uploaded from box to Sql Managed Instance along with {@link + * Response}. + */ + Response getWithResponse( + String resourceGroupName, String managedInstanceName, String certificateName, Context context); + + /** + * Gets a server trust certificate that was uploaded from box to Sql 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 certificateName Name of of the certificate to get. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust certificate that was uploaded from box to Sql Managed Instance. + */ + ServerTrustCertificate get(String resourceGroupName, String managedInstanceName, String certificateName); + + /** + * Deletes a server trust certificate that was uploaded from box to Sql 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 certificateName Name of of the certificate to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String managedInstanceName, String certificateName); + + /** + * Deletes a server trust certificate that was uploaded from box to Sql 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 certificateName Name of of the certificate to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String managedInstanceName, String certificateName, Context context); + + /** + * Gets a server trust certificate that was uploaded from box to Sql Managed Instance. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust certificate that was uploaded from box to Sql Managed Instance along with {@link + * Response}. + */ + ServerTrustCertificate getById(String id); + + /** + * Gets a server trust certificate that was uploaded from box to Sql Managed Instance. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust certificate that was uploaded from box to Sql Managed Instance along with {@link + * Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a server trust certificate that was uploaded from box to Sql Managed Instance. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a server trust certificate that was uploaded from box to Sql Managed Instance. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ServerTrustCertificate resource. + * + * @param name resource name. + * @return the first stage of the new ServerTrustCertificate definition. + */ + ServerTrustCertificate.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerTrustCertificatesListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerTrustCertificatesListResult.java new file mode 100644 index 0000000000000..6e68af67c0400 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerTrustCertificatesListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerTrustCertificateInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of server trust certificates in instance. */ +@Immutable +public final class ServerTrustCertificatesListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of ServerTrustCertificatesListResult class. */ + public ServerTrustCertificatesListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerTrustGroup.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerTrustGroup.java new file mode 100644 index 0000000000000..cf9c03e0afdd0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerTrustGroup.java @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerTrustGroupInner; +import java.util.List; + +/** An immutable client-side representation of ServerTrustGroup. */ +public interface ServerTrustGroup { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the groupMembers property: Group members information for the server trust group. + * + * @return the groupMembers value. + */ + List groupMembers(); + + /** + * Gets the trustScopes property: Trust scope of the server trust group. + * + * @return the trustScopes value. + */ + List trustScopes(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ServerTrustGroupInner object. + * + * @return the inner object. + */ + ServerTrustGroupInner innerModel(); + + /** The entirety of the ServerTrustGroup definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ServerTrustGroup definition stages. */ + interface DefinitionStages { + /** The first stage of the ServerTrustGroup definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ServerTrustGroup definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, locationName. + * + * @param resourceGroupName The 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. + * @return the next definition stage. + */ + WithCreate withExistingLocation(String resourceGroupName, String locationName); + } + /** + * The stage of the ServerTrustGroup definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithGroupMembers, DefinitionStages.WithTrustScopes { + /** + * Executes the create request. + * + * @return the created resource. + */ + ServerTrustGroup create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ServerTrustGroup create(Context context); + } + /** The stage of the ServerTrustGroup definition allowing to specify groupMembers. */ + interface WithGroupMembers { + /** + * Specifies the groupMembers property: Group members information for the server trust group.. + * + * @param groupMembers Group members information for the server trust group. + * @return the next definition stage. + */ + WithCreate withGroupMembers(List groupMembers); + } + /** The stage of the ServerTrustGroup definition allowing to specify trustScopes. */ + interface WithTrustScopes { + /** + * Specifies the trustScopes property: Trust scope of the server trust group.. + * + * @param trustScopes Trust scope of the server trust group. + * @return the next definition stage. + */ + WithCreate withTrustScopes(List trustScopes); + } + } + /** + * Begins update for the ServerTrustGroup resource. + * + * @return the stage of resource update. + */ + ServerTrustGroup.Update update(); + + /** The template for ServerTrustGroup update. */ + interface Update extends UpdateStages.WithGroupMembers, UpdateStages.WithTrustScopes { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ServerTrustGroup apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ServerTrustGroup apply(Context context); + } + /** The ServerTrustGroup update stages. */ + interface UpdateStages { + /** The stage of the ServerTrustGroup update allowing to specify groupMembers. */ + interface WithGroupMembers { + /** + * Specifies the groupMembers property: Group members information for the server trust group.. + * + * @param groupMembers Group members information for the server trust group. + * @return the next definition stage. + */ + Update withGroupMembers(List groupMembers); + } + /** The stage of the ServerTrustGroup update allowing to specify trustScopes. */ + interface WithTrustScopes { + /** + * Specifies the trustScopes property: Trust scope of the server trust group.. + * + * @param trustScopes Trust scope of the server trust group. + * @return the next definition stage. + */ + Update withTrustScopes(List trustScopes); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ServerTrustGroup refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ServerTrustGroup refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerTrustGroupListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerTrustGroupListResult.java new file mode 100644 index 0000000000000..3c6b264091797 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerTrustGroupListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerTrustGroupInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of server trust groups. */ +@Immutable +public final class ServerTrustGroupListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of ServerTrustGroupListResult class. */ + public ServerTrustGroupListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerTrustGroupPropertiesTrustScopesItem.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerTrustGroupPropertiesTrustScopesItem.java new file mode 100644 index 0000000000000..516679977efdf --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerTrustGroupPropertiesTrustScopesItem.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ServerTrustGroupPropertiesTrustScopesItem. */ +public final class ServerTrustGroupPropertiesTrustScopesItem + extends ExpandableStringEnum { + /** Static value GlobalTransactions for ServerTrustGroupPropertiesTrustScopesItem. */ + public static final ServerTrustGroupPropertiesTrustScopesItem GLOBAL_TRANSACTIONS = + fromString("GlobalTransactions"); + + /** Static value ServiceBroker for ServerTrustGroupPropertiesTrustScopesItem. */ + public static final ServerTrustGroupPropertiesTrustScopesItem SERVICE_BROKER = fromString("ServiceBroker"); + + /** + * Creates or finds a ServerTrustGroupPropertiesTrustScopesItem from its string representation. + * + * @param name a name to look for. + * @return the corresponding ServerTrustGroupPropertiesTrustScopesItem. + */ + @JsonCreator + public static ServerTrustGroupPropertiesTrustScopesItem fromString(String name) { + return fromString(name, ServerTrustGroupPropertiesTrustScopesItem.class); + } + + /** + * Gets known ServerTrustGroupPropertiesTrustScopesItem values. + * + * @return known ServerTrustGroupPropertiesTrustScopesItem values. + */ + public static Collection values() { + return values(ServerTrustGroupPropertiesTrustScopesItem.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerTrustGroups.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerTrustGroups.java new file mode 100644 index 0000000000000..4765d2fe0e28b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerTrustGroups.java @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ServerTrustGroups. */ +public interface ServerTrustGroups { + /** + * Gets a server trust 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 serverTrustGroupName The name of the server trust group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust group along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String locationName, String serverTrustGroupName, Context context); + + /** + * Gets a server trust 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 serverTrustGroupName The name of the server trust group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust group. + */ + ServerTrustGroup get(String resourceGroupName, String locationName, String serverTrustGroupName); + + /** + * Deletes a server trust 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 serverTrustGroupName The name of the server trust group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String locationName, String serverTrustGroupName); + + /** + * Deletes a server trust 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 serverTrustGroupName The name of the server trust group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String locationName, String serverTrustGroupName, Context context); + + /** + * Lists a server trust 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server trust groups as paginated response with {@link PagedIterable}. + */ + PagedIterable listByLocation(String resourceGroupName, String locationName); + + /** + * Lists a server trust 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server trust groups as paginated response with {@link PagedIterable}. + */ + PagedIterable listByLocation(String resourceGroupName, String locationName, Context context); + + /** + * Gets a server trust groups by instance 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust groups by instance name as paginated response with {@link PagedIterable}. + */ + PagedIterable listByInstance(String resourceGroupName, String managedInstanceName); + + /** + * Gets a server trust groups by instance 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust groups by instance name as paginated response with {@link PagedIterable}. + */ + PagedIterable listByInstance( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * Gets a server trust group. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust group along with {@link Response}. + */ + ServerTrustGroup getById(String id); + + /** + * Gets a server trust group. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server trust group along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a server trust group. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a server trust group. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ServerTrustGroup resource. + * + * @param name resource name. + * @return the first stage of the new ServerTrustGroup definition. + */ + ServerTrustGroup.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerUpdate.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerUpdate.java new file mode 100644 index 0000000000000..140eca6ae21a7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerUpdate.java @@ -0,0 +1,376 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +/** An update request for an Azure SQL Database server. */ +@Fluent +public final class ServerUpdate { + /* + * Server identity + */ + @JsonProperty(value = "identity") + private ResourceIdentity identity; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ServerProperties innerProperties; + + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** Creates an instance of ServerUpdate class. */ + public ServerUpdate() { + } + + /** + * Get the identity property: Server identity. + * + * @return the identity value. + */ + public ResourceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: Server identity. + * + * @param identity the identity value to set. + * @return the ServerUpdate object itself. + */ + public ServerUpdate withIdentity(ResourceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ServerProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the ServerUpdate object itself. + */ + public ServerUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the administratorLogin property: Administrator username for the server. Once created it cannot be changed. + * + * @return the administratorLogin value. + */ + public String administratorLogin() { + return this.innerProperties() == null ? null : this.innerProperties().administratorLogin(); + } + + /** + * Set the administratorLogin property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerProperties(); + } + this.innerProperties().withAdministratorLogin(administratorLogin); + return this; + } + + /** + * Get the administratorLoginPassword property: The administrator login password (required for server creation). + * + * @return the administratorLoginPassword value. + */ + public String administratorLoginPassword() { + return this.innerProperties() == null ? null : this.innerProperties().administratorLoginPassword(); + } + + /** + * Set the administratorLoginPassword property: 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) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerProperties(); + } + this.innerProperties().withAdministratorLoginPassword(administratorLoginPassword); + return this; + } + + /** + * Get the version property: The version of the server. + * + * @return the version value. + */ + public String version() { + return this.innerProperties() == null ? null : this.innerProperties().version(); + } + + /** + * Set the version property: The version of the server. + * + * @param version the version value to set. + * @return the ServerUpdate object itself. + */ + public ServerUpdate withVersion(String version) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerProperties(); + } + this.innerProperties().withVersion(version); + return this; + } + + /** + * Get the state property: The state of the server. + * + * @return the state value. + */ + public String state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Get the fullyQualifiedDomainName property: The fully qualified domain name of the server. + * + * @return the fullyQualifiedDomainName value. + */ + public String fullyQualifiedDomainName() { + return this.innerProperties() == null ? null : this.innerProperties().fullyQualifiedDomainName(); + } + + /** + * Get the privateEndpointConnections property: List of private endpoint connections on a server. + * + * @return the privateEndpointConnections value. + */ + public List privateEndpointConnections() { + return this.innerProperties() == null ? null : this.innerProperties().privateEndpointConnections(); + } + + /** + * Get the minimalTlsVersion property: Minimal TLS version. Allowed values: '1.0', '1.1', '1.2'. + * + * @return the minimalTlsVersion value. + */ + public String minimalTlsVersion() { + return this.innerProperties() == null ? null : this.innerProperties().minimalTlsVersion(); + } + + /** + * Set the minimalTlsVersion property: Minimal TLS version. Allowed values: '1.0', '1.1', '1.2'. + * + * @param minimalTlsVersion the minimalTlsVersion value to set. + * @return the ServerUpdate object itself. + */ + public ServerUpdate withMinimalTlsVersion(String minimalTlsVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerProperties(); + } + this.innerProperties().withMinimalTlsVersion(minimalTlsVersion); + return this; + } + + /** + * Get the publicNetworkAccess property: Whether or not public endpoint access is allowed for this server. Value is + * optional but if passed in, must be 'Enabled' or 'Disabled'. + * + * @return the publicNetworkAccess value. + */ + public ServerNetworkAccessFlag publicNetworkAccess() { + return this.innerProperties() == null ? null : this.innerProperties().publicNetworkAccess(); + } + + /** + * Set the publicNetworkAccess property: Whether or not public endpoint access is allowed for this server. Value is + * optional but if passed in, must be 'Enabled' or 'Disabled'. + * + * @param publicNetworkAccess the publicNetworkAccess value to set. + * @return the ServerUpdate object itself. + */ + public ServerUpdate withPublicNetworkAccess(ServerNetworkAccessFlag publicNetworkAccess) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerProperties(); + } + this.innerProperties().withPublicNetworkAccess(publicNetworkAccess); + return this; + } + + /** + * Get the workspaceFeature property: Whether or not existing server has a workspace created and if it allows + * connection from workspace. + * + * @return the workspaceFeature value. + */ + public ServerWorkspaceFeature workspaceFeature() { + return this.innerProperties() == null ? null : this.innerProperties().workspaceFeature(); + } + + /** + * Get the primaryUserAssignedIdentityId property: The resource id of a user assigned identity to be used by + * default. + * + * @return the primaryUserAssignedIdentityId value. + */ + public String primaryUserAssignedIdentityId() { + return this.innerProperties() == null ? null : this.innerProperties().primaryUserAssignedIdentityId(); + } + + /** + * Set the primaryUserAssignedIdentityId property: The resource id of a user assigned identity to be used by + * default. + * + * @param primaryUserAssignedIdentityId the primaryUserAssignedIdentityId value to set. + * @return the ServerUpdate object itself. + */ + public ServerUpdate withPrimaryUserAssignedIdentityId(String primaryUserAssignedIdentityId) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerProperties(); + } + this.innerProperties().withPrimaryUserAssignedIdentityId(primaryUserAssignedIdentityId); + return this; + } + + /** + * Get the federatedClientId property: The Client id used for cross tenant CMK scenario. + * + * @return the federatedClientId value. + */ + public UUID federatedClientId() { + return this.innerProperties() == null ? null : this.innerProperties().federatedClientId(); + } + + /** + * Set the federatedClientId property: The Client id used for cross tenant CMK scenario. + * + * @param federatedClientId the federatedClientId value to set. + * @return the ServerUpdate object itself. + */ + public ServerUpdate withFederatedClientId(UUID federatedClientId) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerProperties(); + } + this.innerProperties().withFederatedClientId(federatedClientId); + return this; + } + + /** + * Get the keyId property: A CMK URI of the key to use for encryption. + * + * @return the keyId value. + */ + public String keyId() { + return this.innerProperties() == null ? null : this.innerProperties().keyId(); + } + + /** + * Set the keyId property: A CMK URI of the key to use for encryption. + * + * @param keyId the keyId value to set. + * @return the ServerUpdate object itself. + */ + public ServerUpdate withKeyId(String keyId) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerProperties(); + } + this.innerProperties().withKeyId(keyId); + return this; + } + + /** + * Get the administrators property: The Azure Active Directory identity of the server. + * + * @return the administrators value. + */ + public ServerExternalAdministrator administrators() { + return this.innerProperties() == null ? null : this.innerProperties().administrators(); + } + + /** + * Set the administrators property: The Azure Active Directory identity of the server. + * + * @param administrators the administrators value to set. + * @return the ServerUpdate object itself. + */ + public ServerUpdate withAdministrators(ServerExternalAdministrator administrators) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerProperties(); + } + this.innerProperties().withAdministrators(administrators); + return this; + } + + /** + * Get the restrictOutboundNetworkAccess property: Whether or not to restrict outbound network access for this + * server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. + * + * @return the restrictOutboundNetworkAccess value. + */ + public ServerNetworkAccessFlag restrictOutboundNetworkAccess() { + return this.innerProperties() == null ? null : this.innerProperties().restrictOutboundNetworkAccess(); + } + + /** + * Set the restrictOutboundNetworkAccess property: Whether or not to restrict outbound network access for this + * server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. + * + * @param restrictOutboundNetworkAccess the restrictOutboundNetworkAccess value to set. + * @return the ServerUpdate object itself. + */ + public ServerUpdate withRestrictOutboundNetworkAccess(ServerNetworkAccessFlag restrictOutboundNetworkAccess) { + if (this.innerProperties() == null) { + this.innerProperties = new ServerProperties(); + } + this.innerProperties().withRestrictOutboundNetworkAccess(restrictOutboundNetworkAccess); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (identity() != null) { + identity().validate(); + } + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerUsage.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerUsage.java new file mode 100644 index 0000000000000..540e09a6336a6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerUsage.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.ServerUsageInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of ServerUsage. */ +public interface ServerUsage { + /** + * Gets the name property: Name of the server usage metric. + * + * @return the name value. + */ + String name(); + + /** + * Gets the resourceName property: The name of the resource. + * + * @return the resourceName value. + */ + String resourceName(); + + /** + * Gets the displayName property: The metric display name. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the currentValue property: The current value of the metric. + * + * @return the currentValue value. + */ + Double currentValue(); + + /** + * Gets the limit property: The current limit of the metric. + * + * @return the limit value. + */ + Double limit(); + + /** + * Gets the unit property: The units of the metric. + * + * @return the unit value. + */ + String unit(); + + /** + * Gets the nextResetTime property: The next reset time for the metric (ISO8601 format). + * + * @return the nextResetTime value. + */ + OffsetDateTime nextResetTime(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ServerUsageInner object. + * + * @return the inner object. + */ + ServerUsageInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerUsageListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerUsageListResult.java new file mode 100644 index 0000000000000..78cb4decb50b8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerUsageListResult.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerUsageInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Represents the response to a list server metrics request. */ +@Fluent +public final class ServerUsageListResult { + /* + * The list of server metrics for the server. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /** Creates an instance of ServerUsageListResult class. */ + public ServerUsageListResult() { + } + + /** + * Get the value property: The list of server metrics for the server. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of server metrics for the server. + * + * @param value the value value to set. + * @return the ServerUsageListResult object itself. + */ + public ServerUsageListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model ServerUsageListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ServerUsageListResult.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerUsages.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerUsages.java new file mode 100644 index 0000000000000..84aa678dfb6ac --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerUsages.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of ServerUsages. */ +public interface ServerUsages { + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a list server metrics request as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a list server metrics request as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerVersionCapability.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerVersionCapability.java new file mode 100644 index 0000000000000..c58804a2adc93 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerVersionCapability.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The server capability. */ +@Fluent +public final 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. + */ + @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; + + /** Creates an instance of ServerVersionCapability class. */ + public ServerVersionCapability() { + } + + /** + * Get the name property: The server version name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the supportedEditions property: The list of supported database editions. + * + * @return the supportedEditions value. + */ + public List supportedEditions() { + return this.supportedEditions; + } + + /** + * Get the supportedElasticPoolEditions property: The list of supported elastic pool editions. + * + * @return the supportedElasticPoolEditions value. + */ + public List supportedElasticPoolEditions() { + return this.supportedElasticPoolEditions; + } + + /** + * Get the status property: The status of the capability. + * + * @return the status value. + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason property: The reason for the capability not being available. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (supportedEditions() != null) { + supportedEditions().forEach(e -> e.validate()); + } + if (supportedElasticPoolEditions() != null) { + supportedElasticPoolEditions().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerVulnerabilityAssessment.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerVulnerabilityAssessment.java new file mode 100644 index 0000000000000..016587d41f5d6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerVulnerabilityAssessment.java @@ -0,0 +1,277 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerVulnerabilityAssessmentInner; + +/** An immutable client-side representation of ServerVulnerabilityAssessment. */ +public interface ServerVulnerabilityAssessment { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the storageContainerPath property: A blob storage container path to hold the scan results (e.g. + * https://myStorage.blob.core.windows.net/VaScans/). + * + * @return the storageContainerPath value. + */ + String storageContainerPath(); + + /** + * Gets the storageContainerSasKey property: 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. Applies only if the storage account is not behind a Vnet or a firewall. + * + * @return the storageContainerSasKey value. + */ + String storageContainerSasKey(); + + /** + * Gets the storageAccountAccessKey property: Specifies the identifier key of the storage account for vulnerability + * assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. + * Applies only if the storage account is not behind a Vnet or a firewall. + * + * @return the storageAccountAccessKey value. + */ + String storageAccountAccessKey(); + + /** + * Gets the recurringScans property: The recurring scans settings. + * + * @return the recurringScans value. + */ + VulnerabilityAssessmentRecurringScansProperties recurringScans(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ServerVulnerabilityAssessmentInner object. + * + * @return the inner object. + */ + ServerVulnerabilityAssessmentInner innerModel(); + + /** The entirety of the ServerVulnerabilityAssessment definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ServerVulnerabilityAssessment definition stages. */ + interface DefinitionStages { + /** The first stage of the ServerVulnerabilityAssessment definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ServerVulnerabilityAssessment definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server for which the vulnerability assessment is defined. + * @return the next definition stage. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + /** + * The stage of the ServerVulnerabilityAssessment definition which contains all the minimum required properties + * for the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithStorageContainerPath, + DefinitionStages.WithStorageContainerSasKey, + DefinitionStages.WithStorageAccountAccessKey, + DefinitionStages.WithRecurringScans { + /** + * Executes the create request. + * + * @return the created resource. + */ + ServerVulnerabilityAssessment create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ServerVulnerabilityAssessment create(Context context); + } + /** The stage of the ServerVulnerabilityAssessment definition allowing to specify storageContainerPath. */ + interface WithStorageContainerPath { + /** + * Specifies the storageContainerPath property: A blob storage container path to hold the scan results (e.g. + * https://myStorage.blob.core.windows.net/VaScans/).. + * + * @param storageContainerPath A blob storage container path to hold the scan results (e.g. + * https://myStorage.blob.core.windows.net/VaScans/). + * @return the next definition stage. + */ + WithCreate withStorageContainerPath(String storageContainerPath); + } + /** The stage of the ServerVulnerabilityAssessment definition allowing to specify storageContainerSasKey. */ + interface WithStorageContainerSasKey { + /** + * Specifies the storageContainerSasKey property: 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. Applies only if the storage account is not behind a Vnet + * or a firewall. + * + * @param storageContainerSasKey A shared access signature (SAS Key) that has write access to the blob + * container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't + * specified, StorageContainerSasKey is required. Applies only if the storage account is not behind a + * Vnet or a firewall. + * @return the next definition stage. + */ + WithCreate withStorageContainerSasKey(String storageContainerSasKey); + } + /** The stage of the ServerVulnerabilityAssessment definition allowing to specify storageAccountAccessKey. */ + interface WithStorageAccountAccessKey { + /** + * Specifies the storageAccountAccessKey property: Specifies the identifier key of the storage account for + * vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified, + * storageAccountAccessKey is required. Applies only if the storage account is not behind a Vnet or a + * firewall. + * + * @param storageAccountAccessKey Specifies the identifier key of the storage account for vulnerability + * assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is + * required. Applies only if the storage account is not behind a Vnet or a firewall. + * @return the next definition stage. + */ + WithCreate withStorageAccountAccessKey(String storageAccountAccessKey); + } + /** The stage of the ServerVulnerabilityAssessment definition allowing to specify recurringScans. */ + interface WithRecurringScans { + /** + * Specifies the recurringScans property: The recurring scans settings. + * + * @param recurringScans The recurring scans settings. + * @return the next definition stage. + */ + WithCreate withRecurringScans(VulnerabilityAssessmentRecurringScansProperties recurringScans); + } + } + /** + * Begins update for the ServerVulnerabilityAssessment resource. + * + * @return the stage of resource update. + */ + ServerVulnerabilityAssessment.Update update(); + + /** The template for ServerVulnerabilityAssessment update. */ + interface Update + extends UpdateStages.WithStorageContainerPath, + UpdateStages.WithStorageContainerSasKey, + UpdateStages.WithStorageAccountAccessKey, + UpdateStages.WithRecurringScans { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ServerVulnerabilityAssessment apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ServerVulnerabilityAssessment apply(Context context); + } + /** The ServerVulnerabilityAssessment update stages. */ + interface UpdateStages { + /** The stage of the ServerVulnerabilityAssessment update allowing to specify storageContainerPath. */ + interface WithStorageContainerPath { + /** + * Specifies the storageContainerPath property: A blob storage container path to hold the scan results (e.g. + * https://myStorage.blob.core.windows.net/VaScans/).. + * + * @param storageContainerPath A blob storage container path to hold the scan results (e.g. + * https://myStorage.blob.core.windows.net/VaScans/). + * @return the next definition stage. + */ + Update withStorageContainerPath(String storageContainerPath); + } + /** The stage of the ServerVulnerabilityAssessment update allowing to specify storageContainerSasKey. */ + interface WithStorageContainerSasKey { + /** + * Specifies the storageContainerSasKey property: 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. Applies only if the storage account is not behind a Vnet + * or a firewall. + * + * @param storageContainerSasKey A shared access signature (SAS Key) that has write access to the blob + * container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't + * specified, StorageContainerSasKey is required. Applies only if the storage account is not behind a + * Vnet or a firewall. + * @return the next definition stage. + */ + Update withStorageContainerSasKey(String storageContainerSasKey); + } + /** The stage of the ServerVulnerabilityAssessment update allowing to specify storageAccountAccessKey. */ + interface WithStorageAccountAccessKey { + /** + * Specifies the storageAccountAccessKey property: Specifies the identifier key of the storage account for + * vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified, + * storageAccountAccessKey is required. Applies only if the storage account is not behind a Vnet or a + * firewall. + * + * @param storageAccountAccessKey Specifies the identifier key of the storage account for vulnerability + * assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is + * required. Applies only if the storage account is not behind a Vnet or a firewall. + * @return the next definition stage. + */ + Update withStorageAccountAccessKey(String storageAccountAccessKey); + } + /** The stage of the ServerVulnerabilityAssessment update allowing to specify recurringScans. */ + interface WithRecurringScans { + /** + * Specifies the recurringScans property: The recurring scans settings. + * + * @param recurringScans The recurring scans settings. + * @return the next definition stage. + */ + Update withRecurringScans(VulnerabilityAssessmentRecurringScansProperties recurringScans); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ServerVulnerabilityAssessment refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ServerVulnerabilityAssessment refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerVulnerabilityAssessmentListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerVulnerabilityAssessmentListResult.java new file mode 100644 index 0000000000000..94edc7e48ff97 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerVulnerabilityAssessmentListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerVulnerabilityAssessmentInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of the server's vulnerability assessments. */ +@Immutable +public final class ServerVulnerabilityAssessmentListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of ServerVulnerabilityAssessmentListResult class. */ + public ServerVulnerabilityAssessmentListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerVulnerabilityAssessments.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerVulnerabilityAssessments.java new file mode 100644 index 0000000000000..240556fbfffd4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerVulnerabilityAssessments.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ServerVulnerabilityAssessments. */ +public interface ServerVulnerabilityAssessments { + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the server's vulnerability assessment along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the server's vulnerability assessment. + */ + ServerVulnerabilityAssessment get( + String resourceGroupName, String serverName, VulnerabilityAssessmentName vulnerabilityAssessmentName); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, VulnerabilityAssessmentName vulnerabilityAssessmentName); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the server's vulnerability assessments as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the server's vulnerability assessments as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer( + String resourceGroupName, String serverName, Context context); + + /** + * Gets the server's vulnerability assessment. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the server's vulnerability assessment along with {@link Response}. + */ + ServerVulnerabilityAssessment getById(String id); + + /** + * Gets the server's vulnerability assessment. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the server's vulnerability assessment along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Removes the server's vulnerability assessment. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Removes the server's vulnerability assessment. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ServerVulnerabilityAssessment resource. + * + * @param name resource name. + * @return the first stage of the new ServerVulnerabilityAssessment definition. + */ + ServerVulnerabilityAssessment.DefinitionStages.Blank define(VulnerabilityAssessmentName name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerWorkspaceFeature.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerWorkspaceFeature.java new file mode 100644 index 0000000000000..90556b5e57b7c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServerWorkspaceFeature.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Whether or not existing server has a workspace created and if it allows connection from workspace. */ +public final class ServerWorkspaceFeature extends ExpandableStringEnum { + /** Static value Connected for ServerWorkspaceFeature. */ + public static final ServerWorkspaceFeature CONNECTED = fromString("Connected"); + + /** Static value Disconnected for ServerWorkspaceFeature. */ + public static final ServerWorkspaceFeature DISCONNECTED = fromString("Disconnected"); + + /** + * Creates or finds a ServerWorkspaceFeature from its string representation. + * + * @param name a name to look for. + * @return the corresponding ServerWorkspaceFeature. + */ + @JsonCreator + public static ServerWorkspaceFeature fromString(String name) { + return fromString(name, ServerWorkspaceFeature.class); + } + + /** + * Gets known ServerWorkspaceFeature values. + * + * @return known ServerWorkspaceFeature values. + */ + public static Collection values() { + return values(ServerWorkspaceFeature.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Servers.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Servers.java new file mode 100644 index 0000000000000..b760512957585 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Servers.java @@ -0,0 +1,221 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Servers. */ +public interface Servers { + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of servers in a resource groups as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * 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 expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of servers in a resource groups as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, String expand, Context context); + + /** + * 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 expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String serverName, String expand, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server. + */ + Server getByResourceGroup(String resourceGroupName, String serverName); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String serverName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, Context context); + + /** + * Gets a list of all servers in the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all servers in the subscription as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Gets a list of all servers in the subscription. + * + * @param expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all servers in the subscription as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String expand, Context context); + + /** + * 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 database import request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + ImportExportOperationResult importDatabase( + String resourceGroupName, String serverName, ImportNewDatabaseDefinition 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 database import request parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an ImportExport operation result resource. + */ + ImportExportOperationResult importDatabase( + String resourceGroupName, String serverName, ImportNewDatabaseDefinition parameters, Context context); + + /** + * Determines whether a resource can be created with the specified name. + * + * @param parameters The name availability request parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a name availability check along with {@link Response}. + */ + Response checkNameAvailabilityWithResponse( + CheckNameAvailabilityRequest parameters, Context context); + + /** + * Determines whether a resource can be created with the specified name. + * + * @param parameters The name availability request parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of a name availability check. + */ + CheckNameAvailabilityResponse checkNameAvailability(CheckNameAvailabilityRequest parameters); + + /** + * Gets a server. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server along with {@link Response}. + */ + Server getById(String id); + + /** + * Gets a server. + * + * @param id the resource ID. + * @param expand The child resources to include in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server along with {@link Response}. + */ + Response getByIdWithResponse(String id, String expand, Context context); + + /** + * Deletes a server. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a server. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Server resource. + * + * @param name resource name. + * @return the first stage of the new Server definition. + */ + Server.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServiceObjective.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServiceObjective.java new file mode 100644 index 0000000000000..6a595d9dce279 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServiceObjective.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.ServiceObjectiveInner; + +/** An immutable client-side representation of ServiceObjective. */ +public interface ServiceObjective { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the serviceObjectiveName property: The name for the service objective. + * + * @return the serviceObjectiveName value. + */ + String serviceObjectiveName(); + + /** + * Gets the isDefault property: Gets whether the service level objective is the default service objective. + * + * @return the isDefault value. + */ + Boolean isDefault(); + + /** + * Gets the isSystem property: Gets whether the service level objective is a system service objective. + * + * @return the isSystem value. + */ + Boolean isSystem(); + + /** + * Gets the description property: The description for the service level objective. + * + * @return the description value. + */ + String description(); + + /** + * Gets the enabled property: Gets whether the service level objective is enabled. + * + * @return the enabled value. + */ + Boolean enabled(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.ServiceObjectiveInner object. + * + * @return the inner object. + */ + ServiceObjectiveInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServiceObjectiveCapability.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServiceObjectiveCapability.java new file mode 100644 index 0000000000000..c73f47cecda42 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServiceObjectiveCapability.java @@ -0,0 +1,271 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.UUID; + +/** The service objectives capability. */ +@Fluent +public final 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; + + /* + * Whether or not zone redundancy is supported for the service objective. + */ + @JsonProperty(value = "zoneRedundant", access = JsonProperty.Access.WRITE_ONLY) + private Boolean zoneRedundant; + + /* + * Supported time range for auto pause delay + */ + @JsonProperty(value = "supportedAutoPauseDelay", access = JsonProperty.Access.WRITE_ONLY) + private AutoPauseDelayTimeRange supportedAutoPauseDelay; + + /* + * List of supported min capacities + */ + @JsonProperty(value = "supportedMinCapacities", access = JsonProperty.Access.WRITE_ONLY) + private List supportedMinCapacities; + + /* + * The compute model + */ + @JsonProperty(value = "computeModel", access = JsonProperty.Access.WRITE_ONLY) + private String computeModel; + + /* + * List of supported maintenance configurations + */ + @JsonProperty(value = "supportedMaintenanceConfigurations", access = JsonProperty.Access.WRITE_ONLY) + private List supportedMaintenanceConfigurations; + + /* + * The status of the capability. + */ + @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; + + /** Creates an instance of ServiceObjectiveCapability class. */ + public ServiceObjectiveCapability() { + } + + /** + * Get the id property: The unique ID of the service objective. + * + * @return the id value. + */ + public UUID id() { + return this.id; + } + + /** + * Get the name property: The service objective name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the supportedMaxSizes property: The list of supported maximum database sizes. + * + * @return the supportedMaxSizes value. + */ + public List supportedMaxSizes() { + return this.supportedMaxSizes; + } + + /** + * Get the performanceLevel property: The performance level. + * + * @return the performanceLevel value. + */ + public PerformanceLevelCapability performanceLevel() { + return this.performanceLevel; + } + + /** + * Get the sku property: The sku. + * + * @return the sku value. + */ + public Sku sku() { + return this.sku; + } + + /** + * Get the supportedLicenseTypes property: List of supported license types. + * + * @return the supportedLicenseTypes value. + */ + public List supportedLicenseTypes() { + return this.supportedLicenseTypes; + } + + /** + * Get the includedMaxSize property: The included (free) max size. + * + * @return the includedMaxSize value. + */ + public MaxSizeCapability includedMaxSize() { + return this.includedMaxSize; + } + + /** + * Get the zoneRedundant property: Whether or not zone redundancy is supported for the service objective. + * + * @return the zoneRedundant value. + */ + public Boolean zoneRedundant() { + return this.zoneRedundant; + } + + /** + * Get the supportedAutoPauseDelay property: Supported time range for auto pause delay. + * + * @return the supportedAutoPauseDelay value. + */ + public AutoPauseDelayTimeRange supportedAutoPauseDelay() { + return this.supportedAutoPauseDelay; + } + + /** + * Get the supportedMinCapacities property: List of supported min capacities. + * + * @return the supportedMinCapacities value. + */ + public List supportedMinCapacities() { + return this.supportedMinCapacities; + } + + /** + * Get the computeModel property: The compute model. + * + * @return the computeModel value. + */ + public String computeModel() { + return this.computeModel; + } + + /** + * Get the supportedMaintenanceConfigurations property: List of supported maintenance configurations. + * + * @return the supportedMaintenanceConfigurations value. + */ + public List supportedMaintenanceConfigurations() { + return this.supportedMaintenanceConfigurations; + } + + /** + * Get the status property: The status of the capability. + * + * @return the status value. + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason property: The reason for the capability not being available. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (supportedMaxSizes() != null) { + supportedMaxSizes().forEach(e -> e.validate()); + } + if (performanceLevel() != null) { + performanceLevel().validate(); + } + if (sku() != null) { + sku().validate(); + } + if (supportedLicenseTypes() != null) { + supportedLicenseTypes().forEach(e -> e.validate()); + } + if (includedMaxSize() != null) { + includedMaxSize().validate(); + } + if (supportedAutoPauseDelay() != null) { + supportedAutoPauseDelay().validate(); + } + if (supportedMinCapacities() != null) { + supportedMinCapacities().forEach(e -> e.validate()); + } + if (supportedMaintenanceConfigurations() != null) { + supportedMaintenanceConfigurations().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServiceObjectiveListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServiceObjectiveListResult.java new file mode 100644 index 0000000000000..e3012b678a3ea --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServiceObjectiveListResult.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.sql.generated.fluent.models.ServiceObjectiveInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Represents the response to a get database service objectives request. */ +@Fluent +public final class ServiceObjectiveListResult { + /* + * The list of database service objectives. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /** Creates an instance of ServiceObjectiveListResult class. */ + public ServiceObjectiveListResult() { + } + + /** + * Get the value property: The list of database service objectives. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of database service objectives. + * + * @param value the value value to set. + * @return the ServiceObjectiveListResult object itself. + */ + public ServiceObjectiveListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property value in model ServiceObjectiveListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ServiceObjectiveListResult.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServiceObjectives.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServiceObjectives.java new file mode 100644 index 0000000000000..4a1e98e93c656 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServiceObjectives.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ServiceObjectives. */ +public interface ServiceObjectives { + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database service objective along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String serviceObjectiveName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database service objective. + */ + ServiceObjective get(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. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a get database service objectives request as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response to a get database service objectives request as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServicePrincipal.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServicePrincipal.java new file mode 100644 index 0000000000000..65cc647940adc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServicePrincipal.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The managed instance's service principal configuration for a resource. */ +@Fluent +public final class ServicePrincipal { + /* + * The Azure Active Directory application object id. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /* + * The Azure Active Directory application client id. + */ + @JsonProperty(value = "clientId", access = JsonProperty.Access.WRITE_ONLY) + private String clientId; + + /* + * The Azure Active Directory tenant id. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /* + * Service principal type. + */ + @JsonProperty(value = "type") + private ServicePrincipalType type; + + /** Creates an instance of ServicePrincipal class. */ + public ServicePrincipal() { + } + + /** + * Get the principalId property: The Azure Active Directory application object id. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the clientId property: The Azure Active Directory application client id. + * + * @return the clientId value. + */ + public String clientId() { + return this.clientId; + } + + /** + * Get the tenantId property: The Azure Active Directory tenant id. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the type property: Service principal type. + * + * @return the type value. + */ + public ServicePrincipalType type() { + return this.type; + } + + /** + * Set the type property: Service principal type. + * + * @param type the type value to set. + * @return the ServicePrincipal object itself. + */ + public ServicePrincipal withType(ServicePrincipalType type) { + this.type = type; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServicePrincipalType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServicePrincipalType.java new file mode 100644 index 0000000000000..3d0262e9635b4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ServicePrincipalType.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Service principal type. */ +public final class ServicePrincipalType extends ExpandableStringEnum { + /** Static value None for ServicePrincipalType. */ + public static final ServicePrincipalType NONE = fromString("None"); + + /** Static value SystemAssigned for ServicePrincipalType. */ + public static final ServicePrincipalType SYSTEM_ASSIGNED = fromString("SystemAssigned"); + + /** + * Creates or finds a ServicePrincipalType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ServicePrincipalType. + */ + @JsonCreator + public static ServicePrincipalType fromString(String name) { + return fromString(name, ServicePrincipalType.class); + } + + /** + * Gets known ServicePrincipalType values. + * + * @return known ServicePrincipalType values. + */ + public static Collection values() { + return values(ServicePrincipalType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ShortTermRetentionPolicyName.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ShortTermRetentionPolicyName.java new file mode 100644 index 0000000000000..54cb9c3736789 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/ShortTermRetentionPolicyName.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ShortTermRetentionPolicyName. */ +public final class ShortTermRetentionPolicyName extends ExpandableStringEnum { + /** Static value default for ShortTermRetentionPolicyName. */ + public static final ShortTermRetentionPolicyName DEFAULT = fromString("default"); + + /** + * Creates or finds a ShortTermRetentionPolicyName from its string representation. + * + * @param name a name to look for. + * @return the corresponding ShortTermRetentionPolicyName. + */ + @JsonCreator + public static ShortTermRetentionPolicyName fromString(String name) { + return fromString(name, ShortTermRetentionPolicyName.class); + } + + /** + * Gets known ShortTermRetentionPolicyName values. + * + * @return known ShortTermRetentionPolicyName values. + */ + public static Collection values() { + return values(ShortTermRetentionPolicyName.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Sku.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Sku.java new file mode 100644 index 0000000000000..1e964998a76b8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Sku.java @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An ARM Resource SKU. */ +@Fluent +public final class Sku { + /* + * The name of the SKU, typically, a letter + Number code, e.g. P3. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The tier or edition of the particular SKU, e.g. Basic, Premium. + */ + @JsonProperty(value = "tier") + private String tier; + + /* + * Size of the particular SKU + */ + @JsonProperty(value = "size") + private String size; + + /* + * If the service has different generations of hardware, for the same SKU, then that can be captured here. + */ + @JsonProperty(value = "family") + private String family; + + /* + * Capacity of the particular SKU. + */ + @JsonProperty(value = "capacity") + private Integer capacity; + + /** Creates an instance of Sku class. */ + public Sku() { + } + + /** + * Get the name property: The name of the SKU, typically, a letter + Number code, e.g. P3. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the SKU, typically, a letter + Number code, e.g. P3. + * + * @param name the name value to set. + * @return the Sku object itself. + */ + public Sku withName(String name) { + this.name = name; + return this; + } + + /** + * Get the tier property: The tier or edition of the particular SKU, e.g. Basic, Premium. + * + * @return the tier value. + */ + public String tier() { + return this.tier; + } + + /** + * Set the tier property: The tier or edition of the particular SKU, e.g. Basic, Premium. + * + * @param tier the tier value to set. + * @return the Sku object itself. + */ + public Sku withTier(String tier) { + this.tier = tier; + return this; + } + + /** + * Get the size property: Size of the particular SKU. + * + * @return the size value. + */ + public String size() { + return this.size; + } + + /** + * Set the size property: Size of the particular SKU. + * + * @param size the size value to set. + * @return the Sku object itself. + */ + public Sku withSize(String size) { + this.size = size; + return this; + } + + /** + * Get the family property: If the service has different generations of hardware, for the same SKU, then that can be + * captured here. + * + * @return the family value. + */ + public String family() { + return this.family; + } + + /** + * Set the family property: If the service has different generations of hardware, for the same SKU, then that can be + * captured here. + * + * @param family the family value to set. + * @return the Sku object itself. + */ + public Sku withFamily(String family) { + this.family = family; + return this; + } + + /** + * Get the capacity property: Capacity of the particular SKU. + * + * @return the capacity value. + */ + public Integer capacity() { + return this.capacity; + } + + /** + * Set the capacity property: Capacity of the particular SKU. + * + * @param capacity the capacity value to set. + * @return the Sku object itself. + */ + public Sku withCapacity(Integer capacity) { + this.capacity = capacity; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("Missing required property name in model Sku")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(Sku.class); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlAgentConfiguration.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlAgentConfiguration.java new file mode 100644 index 0000000000000..6a2b15a8b7edf --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlAgentConfiguration.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.SqlAgentConfigurationInner; + +/** An immutable client-side representation of SqlAgentConfiguration. */ +public interface SqlAgentConfiguration { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the state property: The state of Sql Agent. + * + * @return the state value. + */ + SqlAgentConfigurationPropertiesState state(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.SqlAgentConfigurationInner object. + * + * @return the inner object. + */ + SqlAgentConfigurationInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlAgentConfigurationPropertiesState.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlAgentConfigurationPropertiesState.java new file mode 100644 index 0000000000000..e6d2e02bc3ae3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlAgentConfigurationPropertiesState.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The state of Sql Agent. */ +public final class SqlAgentConfigurationPropertiesState + extends ExpandableStringEnum { + /** Static value Enabled for SqlAgentConfigurationPropertiesState. */ + public static final SqlAgentConfigurationPropertiesState ENABLED = fromString("Enabled"); + + /** Static value Disabled for SqlAgentConfigurationPropertiesState. */ + public static final SqlAgentConfigurationPropertiesState DISABLED = fromString("Disabled"); + + /** + * Creates or finds a SqlAgentConfigurationPropertiesState from its string representation. + * + * @param name a name to look for. + * @return the corresponding SqlAgentConfigurationPropertiesState. + */ + @JsonCreator + public static SqlAgentConfigurationPropertiesState fromString(String name) { + return fromString(name, SqlAgentConfigurationPropertiesState.class); + } + + /** + * Gets known SqlAgentConfigurationPropertiesState values. + * + * @return known SqlAgentConfigurationPropertiesState values. + */ + public static Collection values() { + return values(SqlAgentConfigurationPropertiesState.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlAgents.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlAgents.java new file mode 100644 index 0000000000000..2e0475cc34f8d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlAgents.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.SqlAgentConfigurationInner; + +/** Resource collection API of SqlAgents. */ +public interface SqlAgents { + /** + * Gets current instance sql agent 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 managedInstanceName The name of the managed instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return current instance sql agent configuration along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String managedInstanceName, Context context); + + /** + * Gets current instance sql agent 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 managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return current instance sql agent configuration. + */ + SqlAgentConfiguration get(String resourceGroupName, String managedInstanceName); + + /** + * Puts new sql agent configuration to 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 A recoverable managed database resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a recoverable managed database resource along with {@link Response}. + */ + Response createOrUpdateWithResponse( + String resourceGroupName, String managedInstanceName, SqlAgentConfigurationInner parameters, Context context); + + /** + * Puts new sql agent configuration to 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 A recoverable managed database resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a recoverable managed database resource. + */ + SqlAgentConfiguration createOrUpdate( + String resourceGroupName, String managedInstanceName, SqlAgentConfigurationInner parameters); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessment.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessment.java new file mode 100644 index 0000000000000..76d1b45ddbdfb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessment.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.SqlVulnerabilityAssessmentInner; + +/** An immutable client-side representation of SqlVulnerabilityAssessment. */ +public interface SqlVulnerabilityAssessment { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: SystemData of SqlVulnerabilityAssessmentResource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the state property: Specifies the state of the SQL Vulnerability Assessment, whether it is enabled or + * disabled or a state has not been applied yet on the specific database or server. + * + * @return the state value. + */ + SqlVulnerabilityAssessmentState state(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.SqlVulnerabilityAssessmentInner object. + * + * @return the inner object. + */ + SqlVulnerabilityAssessmentInner innerModel(); + + /** The entirety of the SqlVulnerabilityAssessment definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The SqlVulnerabilityAssessment definition stages. */ + interface DefinitionStages { + /** The first stage of the SqlVulnerabilityAssessment definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the SqlVulnerabilityAssessment definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @return the next definition stage. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + /** + * The stage of the SqlVulnerabilityAssessment definition which contains all the minimum required properties for + * the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithState { + /** + * Executes the create request. + * + * @return the created resource. + */ + SqlVulnerabilityAssessment create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + SqlVulnerabilityAssessment create(Context context); + } + /** The stage of the SqlVulnerabilityAssessment definition allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the SQL Vulnerability Assessment, whether it is + * enabled or disabled or a state has not been applied yet on the specific database or server.. + * + * @param state Specifies the state of the SQL Vulnerability Assessment, whether it is enabled or disabled + * or a state has not been applied yet on the specific database or server. + * @return the next definition stage. + */ + WithCreate withState(SqlVulnerabilityAssessmentState state); + } + } + /** + * Begins update for the SqlVulnerabilityAssessment resource. + * + * @return the stage of resource update. + */ + SqlVulnerabilityAssessment.Update update(); + + /** The template for SqlVulnerabilityAssessment update. */ + interface Update extends UpdateStages.WithState { + /** + * Executes the update request. + * + * @return the updated resource. + */ + SqlVulnerabilityAssessment apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + SqlVulnerabilityAssessment apply(Context context); + } + /** The SqlVulnerabilityAssessment update stages. */ + interface UpdateStages { + /** The stage of the SqlVulnerabilityAssessment update allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the SQL Vulnerability Assessment, whether it is + * enabled or disabled or a state has not been applied yet on the specific database or server.. + * + * @param state Specifies the state of the SQL Vulnerability Assessment, whether it is enabled or disabled + * or a state has not been applied yet on the specific database or server. + * @return the next definition stage. + */ + Update withState(SqlVulnerabilityAssessmentState state); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + SqlVulnerabilityAssessment refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + SqlVulnerabilityAssessment refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentBaselines.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentBaselines.java new file mode 100644 index 0000000000000..c87d77ff9ea87 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentBaselines.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of SqlVulnerabilityAssessmentBaselines. */ +public interface SqlVulnerabilityAssessmentBaselines { + /** + * Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's sql vulnerability assessment rule baselines as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listBySqlVulnerabilityAssessment( + String resourceGroupName, String serverName, VulnerabilityAssessmentName vulnerabilityAssessmentName); + + /** + * Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's sql vulnerability assessment rule baselines as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listBySqlVulnerabilityAssessment( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context); + + /** + * Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's sql vulnerability assessment rule baselines along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + Context context); + + /** + * Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of database's sql vulnerability assessment rule baselines. + */ + DatabaseSqlVulnerabilityAssessmentBaselineSet get( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentBaselinesOperations.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentBaselinesOperations.java new file mode 100644 index 0000000000000..806bf09f160f6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentBaselinesOperations.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of SqlVulnerabilityAssessmentBaselinesOperations. */ +public interface SqlVulnerabilityAssessmentBaselinesOperations { + /** + * Add a database's vulnerability assessment rule baseline 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 serverName The name of the server. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param parameters The requested rule baseline resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database sql vulnerability assessment baseline set along with {@link Response}. + */ + Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + DatabaseSqlVulnerabilityAssessmentRuleBaselineListInput parameters, + Context context); + + /** + * Add a database's vulnerability assessment rule baseline 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 serverName The name of the server. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param parameters The requested rule baseline resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database sql vulnerability assessment baseline set. + */ + DatabaseSqlVulnerabilityAssessmentBaselineSet createOrUpdate( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + DatabaseSqlVulnerabilityAssessmentRuleBaselineListInput parameters); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentExecuteScans.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentExecuteScans.java new file mode 100644 index 0000000000000..0173151f95f00 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentExecuteScans.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; + +/** Resource collection API of SqlVulnerabilityAssessmentExecuteScans. */ +public interface SqlVulnerabilityAssessmentExecuteScans { + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void execute(String resourceGroupName, String serverName, VulnerabilityAssessmentName vulnerabilityAssessmentName); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void execute( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentListResult.java new file mode 100644 index 0000000000000..9fea155fba7b4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.SqlVulnerabilityAssessmentInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of SQL Vulnerability Assessments. */ +@Immutable +public final class SqlVulnerabilityAssessmentListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of SqlVulnerabilityAssessmentListResult class. */ + public SqlVulnerabilityAssessmentListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentName.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentName.java new file mode 100644 index 0000000000000..311492c027168 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentName.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SqlVulnerabilityAssessmentName. */ +public final class SqlVulnerabilityAssessmentName extends ExpandableStringEnum { + /** Static value default for SqlVulnerabilityAssessmentName. */ + public static final SqlVulnerabilityAssessmentName DEFAULT = fromString("default"); + + /** + * Creates or finds a SqlVulnerabilityAssessmentName from its string representation. + * + * @param name a name to look for. + * @return the corresponding SqlVulnerabilityAssessmentName. + */ + @JsonCreator + public static SqlVulnerabilityAssessmentName fromString(String name) { + return fromString(name, SqlVulnerabilityAssessmentName.class); + } + + /** + * Gets known SqlVulnerabilityAssessmentName values. + * + * @return known SqlVulnerabilityAssessmentName values. + */ + public static Collection values() { + return values(SqlVulnerabilityAssessmentName.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentNameAutoGenerated.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentNameAutoGenerated.java new file mode 100644 index 0000000000000..3648870d348e6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentNameAutoGenerated.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SqlVulnerabilityAssessmentNameAutoGenerated. */ +public final class SqlVulnerabilityAssessmentNameAutoGenerated + extends ExpandableStringEnum { + /** Static value default for SqlVulnerabilityAssessmentNameAutoGenerated. */ + public static final SqlVulnerabilityAssessmentNameAutoGenerated DEFAULT = fromString("default"); + + /** + * Creates or finds a SqlVulnerabilityAssessmentNameAutoGenerated from its string representation. + * + * @param name a name to look for. + * @return the corresponding SqlVulnerabilityAssessmentNameAutoGenerated. + */ + @JsonCreator + public static SqlVulnerabilityAssessmentNameAutoGenerated fromString(String name) { + return fromString(name, SqlVulnerabilityAssessmentNameAutoGenerated.class); + } + + /** + * Gets known SqlVulnerabilityAssessmentNameAutoGenerated values. + * + * @return known SqlVulnerabilityAssessmentNameAutoGenerated values. + */ + public static Collection values() { + return values(SqlVulnerabilityAssessmentNameAutoGenerated.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentRuleBaselines.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentRuleBaselines.java new file mode 100644 index 0000000000000..81f730b435ec2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentRuleBaselines.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of SqlVulnerabilityAssessmentRuleBaselines. */ +public interface SqlVulnerabilityAssessmentRuleBaselines { + /** + * Gets a system database's sql 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a system database's sql vulnerability assessment rule baseline as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByBaseline( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName); + + /** + * Gets a system database's sql 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a system database's sql vulnerability assessment rule baseline as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByBaseline( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + Context context); + + /** + * Gets a system database's sql 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param ruleId The vulnerability assessment rule ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a system database's sql vulnerability assessment rule baseline along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId, + Context context); + + /** + * Gets a system database's sql 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param ruleId The vulnerability assessment rule ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a system database's sql vulnerability assessment rule baseline. + */ + DatabaseSqlVulnerabilityAssessmentRuleBaseline get( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param ruleId The vulnerability assessment rule ID. + * @param parameters The requested rule baseline resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database sql vulnerability assessment rule baseline along with {@link Response}. + */ + Response createOrUpdateWithResponse( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId, + DatabaseSqlVulnerabilityAssessmentRuleBaselineInput parameters, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param ruleId The vulnerability assessment rule ID. + * @param parameters The requested rule baseline resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a database sql vulnerability assessment rule baseline. + */ + DatabaseSqlVulnerabilityAssessmentRuleBaseline createOrUpdate( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId, + DatabaseSqlVulnerabilityAssessmentRuleBaselineInput parameters); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentRuleBaselinesOperations.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentRuleBaselinesOperations.java new file mode 100644 index 0000000000000..31d1fb932b7a6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentRuleBaselinesOperations.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of SqlVulnerabilityAssessmentRuleBaselinesOperations. */ +public interface SqlVulnerabilityAssessmentRuleBaselinesOperations { + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param ruleId The vulnerability assessment rule ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param baselineName The baselineName parameter. + * @param ruleId The vulnerability assessment rule ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + BaselineName baselineName, + String ruleId); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentScanError.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentScanError.java new file mode 100644 index 0000000000000..e2c4239126948 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentScanError.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a vulnerability assessment scan error. */ +@Immutable +public final class SqlVulnerabilityAssessmentScanError { + /* + * 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; + + /** Creates an instance of SqlVulnerabilityAssessmentScanError class. */ + public SqlVulnerabilityAssessmentScanError() { + } + + /** + * Get the code property: The error code. + * + * @return the code value. + */ + public String code() { + return this.code; + } + + /** + * Get the message property: The error message. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentScanListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentScanListResult.java new file mode 100644 index 0000000000000..af430f4fa3d95 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentScanListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.SqlVulnerabilityAssessmentScanResultsInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of vulnerability assessment scan results. */ +@Immutable +public final class SqlVulnerabilityAssessmentScanListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of SqlVulnerabilityAssessmentScanListResult class. */ + public SqlVulnerabilityAssessmentScanListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentScanRecord.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentScanRecord.java new file mode 100644 index 0000000000000..b182760ce4c69 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentScanRecord.java @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.sql.generated.fluent.models.SqlVulnerabilityAssessmentScanRecordInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of SqlVulnerabilityAssessmentScanRecord. */ +public interface SqlVulnerabilityAssessmentScanRecord { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: SystemData of SqlVulnerabilityAssessmentScanRecordResource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the scanId property: The scan ID. + * + * @return the scanId value. + */ + String scanId(); + + /** + * Gets the triggerType property: The scan trigger type. + * + * @return the triggerType value. + */ + VulnerabilityAssessmentScanTriggerType triggerType(); + + /** + * Gets the state property: The scan status. + * + * @return the state value. + */ + VulnerabilityAssessmentScanState state(); + + /** + * Gets the startTime property: The scan start time (UTC). + * + * @return the startTime value. + */ + OffsetDateTime startTime(); + + /** + * Gets the endTime property: The scan end time (UTC). + * + * @return the endTime value. + */ + OffsetDateTime endTime(); + + /** + * Gets the errors property: The scan errors. + * + * @return the errors value. + */ + List errors(); + + /** + * Gets the server property: The server name. + * + * @return the server value. + */ + String server(); + + /** + * Gets the database property: The database name. + * + * @return the database value. + */ + String database(); + + /** + * Gets the sqlVersion property: The SQL version. + * + * @return the sqlVersion value. + */ + String sqlVersion(); + + /** + * Gets the highSeverityFailedRulesCount property: The number of failed rules with high severity. + * + * @return the highSeverityFailedRulesCount value. + */ + Integer highSeverityFailedRulesCount(); + + /** + * Gets the mediumSeverityFailedRulesCount property: The number of failed rules with medium severity. + * + * @return the mediumSeverityFailedRulesCount value. + */ + Integer mediumSeverityFailedRulesCount(); + + /** + * Gets the lowSeverityFailedRulesCount property: The number of failed rules with low severity. + * + * @return the lowSeverityFailedRulesCount value. + */ + Integer lowSeverityFailedRulesCount(); + + /** + * Gets the totalPassedRulesCount property: The number of total passed rules. + * + * @return the totalPassedRulesCount value. + */ + Integer totalPassedRulesCount(); + + /** + * Gets the totalFailedRulesCount property: The number of total failed rules. + * + * @return the totalFailedRulesCount value. + */ + Integer totalFailedRulesCount(); + + /** + * Gets the totalRulesCount property: The number of total rules assessed. + * + * @return the totalRulesCount value. + */ + Integer totalRulesCount(); + + /** + * Gets the isBaselineApplied property: Baseline created for this database, and has one or more rules. + * + * @return the isBaselineApplied value. + */ + Boolean isBaselineApplied(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.SqlVulnerabilityAssessmentScanRecordInner + * object. + * + * @return the inner object. + */ + SqlVulnerabilityAssessmentScanRecordInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentScanRecordListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentScanRecordListResult.java new file mode 100644 index 0000000000000..544d2cacb0f38 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentScanRecordListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.SqlVulnerabilityAssessmentScanRecordInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of vulnerability assessment scan records. */ +@Immutable +public final class SqlVulnerabilityAssessmentScanRecordListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of SqlVulnerabilityAssessmentScanRecordListResult class. */ + public SqlVulnerabilityAssessmentScanRecordListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentScanResultOperations.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentScanResultOperations.java new file mode 100644 index 0000000000000..9a0ebb4ec5034 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentScanResultOperations.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of SqlVulnerabilityAssessmentScanResultOperations. */ +public interface SqlVulnerabilityAssessmentScanResultOperations { + /** + * 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 vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @param scanId The scan id of the SQL Vulnerability Assessment scan to retrieve result from. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a vulnerability assessment scan record of a database as paginated response with {@link PagedIterable}. + */ + PagedIterable listByScan( + String resourceGroupName, + String serverName, + SqlVulnerabilityAssessmentName vulnerabilityAssessmentName, + 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 serverName The name of the server. + * @param vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @param scanId The scan id of the SQL Vulnerability Assessment scan to retrieve result from. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a vulnerability assessment scan record of a database as paginated response with {@link PagedIterable}. + */ + PagedIterable listByScan( + String resourceGroupName, + String serverName, + SqlVulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @param scanId The scan id of the SQL Vulnerability Assessment scan to retrieve result from. + * @param scanResultId The scan result id of the specific result to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a vulnerability assessment scan record of a database along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + SqlVulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + String scanResultId, + Context context); + + /** + * 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 vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @param scanId The scan id of the SQL Vulnerability Assessment scan to retrieve result from. + * @param scanResultId The scan result id of the specific result to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a vulnerability assessment scan record of a database. + */ + SqlVulnerabilityAssessmentScanResults get( + String resourceGroupName, + String serverName, + SqlVulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + String scanResultId); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentScanResults.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentScanResults.java new file mode 100644 index 0000000000000..d69ee996b50d2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentScanResults.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.sql.generated.fluent.models.SqlVulnerabilityAssessmentScanResultsInner; +import java.util.List; + +/** An immutable client-side representation of SqlVulnerabilityAssessmentScanResults. */ +public interface SqlVulnerabilityAssessmentScanResults { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: SystemData of AdvancedThreatProtectionResource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the ruleId property: SQL Vulnerability Assessment rule Id. + * + * @return the ruleId value. + */ + String ruleId(); + + /** + * Gets the status property: SQL Vulnerability Assessment rule result status. + * + * @return the status value. + */ + RuleStatus status(); + + /** + * Gets the errorMessage property: SQL Vulnerability Assessment error message. + * + * @return the errorMessage value. + */ + String errorMessage(); + + /** + * Gets the isTrimmed property: SQL Vulnerability Assessment is the query results trimmed. + * + * @return the isTrimmed value. + */ + Boolean isTrimmed(); + + /** + * Gets the queryResults property: SQL Vulnerability Assessment query results that was run. + * + * @return the queryResults value. + */ + List> queryResults(); + + /** + * Gets the remediation property: SQL Vulnerability Assessment the remediation details. + * + * @return the remediation value. + */ + Remediation remediation(); + + /** + * Gets the baselineAdjustedResult property: SQL Vulnerability Assessment rule result adjusted with baseline. + * + * @return the baselineAdjustedResult value. + */ + BaselineAdjustedResult baselineAdjustedResult(); + + /** + * Gets the ruleMetadata property: SQL Vulnerability Assessment rule metadata. + * + * @return the ruleMetadata value. + */ + VaRule ruleMetadata(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.SqlVulnerabilityAssessmentScanResultsInner + * object. + * + * @return the inner object. + */ + SqlVulnerabilityAssessmentScanResultsInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentScans.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentScans.java new file mode 100644 index 0000000000000..766a1ae3eaab8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentScans.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of SqlVulnerabilityAssessmentScans. */ +public interface SqlVulnerabilityAssessmentScans { + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan records as paginated response with {@link PagedIterable}. + */ + PagedIterable listBySqlVulnerabilityAssessments( + String resourceGroupName, String serverName, VulnerabilityAssessmentName vulnerabilityAssessmentName); + + /** + * 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 vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of vulnerability assessment scan records as paginated response with {@link PagedIterable}. + */ + PagedIterable listBySqlVulnerabilityAssessments( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context); + + /** + * Get a system database vulnerability assessment scan record. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The scanId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a system database vulnerability assessment scan record along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId, + Context context); + + /** + * Get a system database vulnerability assessment scan record. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param vulnerabilityAssessmentName The name of the vulnerability assessment. + * @param scanId The scanId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a system database vulnerability assessment scan record. + */ + SqlVulnerabilityAssessmentScanRecord get( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + String scanId); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentState.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentState.java new file mode 100644 index 0000000000000..cb3dfc5e908ae --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentState.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Specifies the state of the SQL Vulnerability Assessment, whether it is enabled or disabled or a state has not been + * applied yet on the specific database or server. + */ +public enum SqlVulnerabilityAssessmentState { + /** Enum value Enabled. */ + ENABLED("Enabled"), + + /** Enum value Disabled. */ + DISABLED("Disabled"); + + /** The actual serialized value for a SqlVulnerabilityAssessmentState instance. */ + private final String value; + + SqlVulnerabilityAssessmentState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SqlVulnerabilityAssessmentState instance. + * + * @param value the serialized value to parse. + * @return the parsed SqlVulnerabilityAssessmentState object, or null if unable to parse. + */ + @JsonCreator + public static SqlVulnerabilityAssessmentState fromString(String value) { + if (value == null) { + return null; + } + SqlVulnerabilityAssessmentState[] items = SqlVulnerabilityAssessmentState.values(); + for (SqlVulnerabilityAssessmentState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessments.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessments.java new file mode 100644 index 0000000000000..86f722cd1165d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessments.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of SqlVulnerabilityAssessments. */ +public interface SqlVulnerabilityAssessments { + /** + * Removes SQL 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 vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse( + String resourceGroupName, + String serverName, + VulnerabilityAssessmentName vulnerabilityAssessmentName, + Context context); + + /** + * Removes SQL 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 vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, VulnerabilityAssessmentName vulnerabilityAssessmentName); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentsSettings.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentsSettings.java new file mode 100644 index 0000000000000..aa81a5f618340 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SqlVulnerabilityAssessmentsSettings.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of SqlVulnerabilityAssessmentsSettings. */ +public interface SqlVulnerabilityAssessmentsSettings { + /** + * Lists SQL 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Vulnerability Assessments as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Lists SQL 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of SQL Vulnerability Assessments as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer( + String resourceGroupName, String serverName, Context context); + + /** + * Gets SQL Vulnerability Assessment policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return sQL Vulnerability Assessment policy along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + SqlVulnerabilityAssessmentNameAutoGenerated vulnerabilityAssessmentName, + Context context); + + /** + * Gets SQL Vulnerability Assessment policy. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param vulnerabilityAssessmentName The name of the SQL Vulnerability Assessment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return sQL Vulnerability Assessment policy. + */ + SqlVulnerabilityAssessment get( + String resourceGroupName, + String serverName, + SqlVulnerabilityAssessmentNameAutoGenerated vulnerabilityAssessmentName); + + /** + * Gets SQL Vulnerability Assessment policy. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return sQL Vulnerability Assessment policy along with {@link Response}. + */ + SqlVulnerabilityAssessment getById(String id); + + /** + * Gets SQL Vulnerability Assessment policy. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return sQL Vulnerability Assessment policy along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new SqlVulnerabilityAssessment resource. + * + * @param name resource name. + * @return the first stage of the new SqlVulnerabilityAssessment definition. + */ + SqlVulnerabilityAssessment.DefinitionStages.Blank define(VulnerabilityAssessmentName name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/StorageCapability.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/StorageCapability.java new file mode 100644 index 0000000000000..73029ff03eb40 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/StorageCapability.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The storage account type capability. */ +@Fluent +public final class StorageCapability { + /* + * The storage account type for the database's backups. + */ + @JsonProperty(value = "storageAccountType", access = JsonProperty.Access.WRITE_ONLY) + private StorageCapabilityStorageAccountType storageAccountType; + + /* + * The status of the capability. + */ + @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; + + /** Creates an instance of StorageCapability class. */ + public StorageCapability() { + } + + /** + * Get the storageAccountType property: The storage account type for the database's backups. + * + * @return the storageAccountType value. + */ + public StorageCapabilityStorageAccountType storageAccountType() { + return this.storageAccountType; + } + + /** + * Get the status property: The status of the capability. + * + * @return the status value. + */ + public CapabilityStatus status() { + return this.status; + } + + /** + * Get the reason property: The reason for the capability not being available. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: The reason for the capability not being available. + * + * @param reason the reason value to set. + * @return the StorageCapability object itself. + */ + public StorageCapability withReason(String reason) { + this.reason = reason; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/StorageCapabilityStorageAccountType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/StorageCapabilityStorageAccountType.java new file mode 100644 index 0000000000000..b7dc1b111843f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/StorageCapabilityStorageAccountType.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The storage account type for the database's backups. */ +public final class StorageCapabilityStorageAccountType + extends ExpandableStringEnum { + /** Static value GRS for StorageCapabilityStorageAccountType. */ + public static final StorageCapabilityStorageAccountType GRS = fromString("GRS"); + + /** Static value LRS for StorageCapabilityStorageAccountType. */ + public static final StorageCapabilityStorageAccountType LRS = fromString("LRS"); + + /** Static value ZRS for StorageCapabilityStorageAccountType. */ + public static final StorageCapabilityStorageAccountType ZRS = fromString("ZRS"); + + /** + * Creates or finds a StorageCapabilityStorageAccountType from its string representation. + * + * @param name a name to look for. + * @return the corresponding StorageCapabilityStorageAccountType. + */ + @JsonCreator + public static StorageCapabilityStorageAccountType fromString(String name) { + return fromString(name, StorageCapabilityStorageAccountType.class); + } + + /** + * Gets known StorageCapabilityStorageAccountType values. + * + * @return known StorageCapabilityStorageAccountType values. + */ + public static Collection values() { + return values(StorageCapabilityStorageAccountType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/StorageKeyType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/StorageKeyType.java new file mode 100644 index 0000000000000..5f73393db657a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/StorageKeyType.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Storage key type. */ +public final class StorageKeyType extends ExpandableStringEnum { + /** Static value SharedAccessKey for StorageKeyType. */ + public static final StorageKeyType SHARED_ACCESS_KEY = fromString("SharedAccessKey"); + + /** Static value StorageAccessKey for StorageKeyType. */ + public static final StorageKeyType STORAGE_ACCESS_KEY = fromString("StorageAccessKey"); + + /** + * Creates or finds a StorageKeyType from its string representation. + * + * @param name a name to look for. + * @return the corresponding StorageKeyType. + */ + @JsonCreator + public static StorageKeyType fromString(String name) { + return fromString(name, StorageKeyType.class); + } + + /** + * Gets known StorageKeyType values. + * + * @return known StorageKeyType values. + */ + public static Collection values() { + return values(StorageKeyType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SubscriptionUsage.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SubscriptionUsage.java new file mode 100644 index 0000000000000..2ef4d388b44ed --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SubscriptionUsage.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.SubscriptionUsageInner; + +/** An immutable client-side representation of SubscriptionUsage. */ +public interface SubscriptionUsage { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the displayName property: User-readable name of the metric. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the currentValue property: Current value of the metric. + * + * @return the currentValue value. + */ + Double currentValue(); + + /** + * Gets the limit property: Boundary value of the metric. + * + * @return the limit value. + */ + Double limit(); + + /** + * Gets the unit property: Unit of the metric. + * + * @return the unit value. + */ + String unit(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.SubscriptionUsageInner object. + * + * @return the inner object. + */ + SubscriptionUsageInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SubscriptionUsageListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SubscriptionUsageListResult.java new file mode 100644 index 0000000000000..f06cc9049b17c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SubscriptionUsageListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.SubscriptionUsageInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of subscription usage metrics in a location. */ +@Immutable +public final class SubscriptionUsageListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of SubscriptionUsageListResult class. */ + public SubscriptionUsageListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SubscriptionUsages.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SubscriptionUsages.java new file mode 100644 index 0000000000000..8d8c44b557692 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SubscriptionUsages.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of SubscriptionUsages. */ +public interface SubscriptionUsages { + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all subscription usage metrics in a given location as paginated response with {@link PagedIterable}. + */ + PagedIterable listByLocation(String locationName); + + /** + * Gets all subscription usage metrics in a given location. + * + * @param locationName The name of the region where the resource is located. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all subscription usage metrics in a given location as paginated response with {@link PagedIterable}. + */ + PagedIterable listByLocation(String locationName, Context context); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a subscription usage metric along with {@link Response}. + */ + Response getWithResponse(String locationName, String usageName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a subscription usage metric. + */ + SubscriptionUsage get(String locationName, String usageName); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SynapseLinkWorkspace.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SynapseLinkWorkspace.java new file mode 100644 index 0000000000000..24f8a2114a4ee --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SynapseLinkWorkspace.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.SynapseLinkWorkspaceInner; +import java.util.List; + +/** An immutable client-side representation of SynapseLinkWorkspace. */ +public interface SynapseLinkWorkspace { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the workspaces property: List of all synapselink workspaces. + * + * @return the workspaces value. + */ + List workspaces(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.SynapseLinkWorkspaceInner object. + * + * @return the inner object. + */ + SynapseLinkWorkspaceInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SynapseLinkWorkspaceInfoProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SynapseLinkWorkspaceInfoProperties.java new file mode 100644 index 0000000000000..b485d6ef1f6e6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SynapseLinkWorkspaceInfoProperties.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a Synapse link workspaces. */ +@Fluent +public final class SynapseLinkWorkspaceInfoProperties { + /* + * Synapse link workspace id. + */ + @JsonProperty(value = "workspaceId") + private String workspaceId; + + /* + * Link connection name. + */ + @JsonProperty(value = "linkConnectionName") + private String linkConnectionName; + + /** Creates an instance of SynapseLinkWorkspaceInfoProperties class. */ + public SynapseLinkWorkspaceInfoProperties() { + } + + /** + * Get the workspaceId property: Synapse link workspace id. + * + * @return the workspaceId value. + */ + public String workspaceId() { + return this.workspaceId; + } + + /** + * Set the workspaceId property: Synapse link workspace id. + * + * @param workspaceId the workspaceId value to set. + * @return the SynapseLinkWorkspaceInfoProperties object itself. + */ + public SynapseLinkWorkspaceInfoProperties withWorkspaceId(String workspaceId) { + this.workspaceId = workspaceId; + return this; + } + + /** + * Get the linkConnectionName property: Link connection name. + * + * @return the linkConnectionName value. + */ + public String linkConnectionName() { + return this.linkConnectionName; + } + + /** + * Set the linkConnectionName property: Link connection name. + * + * @param linkConnectionName the linkConnectionName value to set. + * @return the SynapseLinkWorkspaceInfoProperties object itself. + */ + public SynapseLinkWorkspaceInfoProperties withLinkConnectionName(String linkConnectionName) { + this.linkConnectionName = linkConnectionName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SynapseLinkWorkspaceListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SynapseLinkWorkspaceListResult.java new file mode 100644 index 0000000000000..dba67dd0c7817 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SynapseLinkWorkspaceListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.SynapseLinkWorkspaceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of synapselink workspaces. */ +@Immutable +public final class SynapseLinkWorkspaceListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of SynapseLinkWorkspaceListResult class. */ + public SynapseLinkWorkspaceListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SynapseLinkWorkspaces.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SynapseLinkWorkspaces.java new file mode 100644 index 0000000000000..3f9d4c763e0c2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SynapseLinkWorkspaces.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of SynapseLinkWorkspaces. */ +public interface SynapseLinkWorkspaces { + /** + * Gets all synapselink workspaces for 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all synapselink workspaces for a database as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName); + + /** + * Gets all synapselink workspaces for 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all synapselink workspaces for a database as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncAgent.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncAgent.java new file mode 100644 index 0000000000000..e4168edff99d3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncAgent.java @@ -0,0 +1,221 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncAgentInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of SyncAgent. */ +public interface SyncAgent { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the namePropertiesName property: Name of the sync agent. + * + * @return the namePropertiesName value. + */ + String namePropertiesName(); + + /** + * Gets the syncDatabaseId property: ARM resource id of the sync database in the sync agent. + * + * @return the syncDatabaseId value. + */ + String syncDatabaseId(); + + /** + * Gets the lastAliveTime property: Last alive time of the sync agent. + * + * @return the lastAliveTime value. + */ + OffsetDateTime lastAliveTime(); + + /** + * Gets the state property: State of the sync agent. + * + * @return the state value. + */ + SyncAgentState state(); + + /** + * Gets the isUpToDate property: If the sync agent version is up to date. + * + * @return the isUpToDate value. + */ + Boolean isUpToDate(); + + /** + * Gets the expiryTime property: Expiration time of the sync agent version. + * + * @return the expiryTime value. + */ + OffsetDateTime expiryTime(); + + /** + * Gets the version property: Version of the sync agent. + * + * @return the version value. + */ + String version(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.SyncAgentInner object. + * + * @return the inner object. + */ + SyncAgentInner innerModel(); + + /** The entirety of the SyncAgent definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The SyncAgent definition stages. */ + interface DefinitionStages { + /** The first stage of the SyncAgent definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the SyncAgent definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server on which the sync agent is hosted. + * @return the next definition stage. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + /** + * The stage of the SyncAgent definition which contains all the minimum required properties for the resource to + * be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithSyncDatabaseId { + /** + * Executes the create request. + * + * @return the created resource. + */ + SyncAgent create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + SyncAgent create(Context context); + } + /** The stage of the SyncAgent definition allowing to specify syncDatabaseId. */ + interface WithSyncDatabaseId { + /** + * Specifies the syncDatabaseId property: ARM resource id of the sync database in the sync agent.. + * + * @param syncDatabaseId ARM resource id of the sync database in the sync agent. + * @return the next definition stage. + */ + WithCreate withSyncDatabaseId(String syncDatabaseId); + } + } + /** + * Begins update for the SyncAgent resource. + * + * @return the stage of resource update. + */ + SyncAgent.Update update(); + + /** The template for SyncAgent update. */ + interface Update extends UpdateStages.WithSyncDatabaseId { + /** + * Executes the update request. + * + * @return the updated resource. + */ + SyncAgent apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + SyncAgent apply(Context context); + } + /** The SyncAgent update stages. */ + interface UpdateStages { + /** The stage of the SyncAgent update allowing to specify syncDatabaseId. */ + interface WithSyncDatabaseId { + /** + * Specifies the syncDatabaseId property: ARM resource id of the sync database in the sync agent.. + * + * @param syncDatabaseId ARM resource id of the sync database in the sync agent. + * @return the next definition stage. + */ + Update withSyncDatabaseId(String syncDatabaseId); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + SyncAgent refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + SyncAgent refresh(Context context); + + /** + * Generates a sync agent key. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of an Azure SQL Database sync agent key along with {@link Response}. + */ + Response generateKeyWithResponse(Context context); + + /** + * Generates a sync agent key. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of an Azure SQL Database sync agent key. + */ + SyncAgentKeyProperties generateKey(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncAgentKeyProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncAgentKeyProperties.java new file mode 100644 index 0000000000000..a851f3c3d55b5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncAgentKeyProperties.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.SyncAgentKeyPropertiesInner; + +/** An immutable client-side representation of SyncAgentKeyProperties. */ +public interface SyncAgentKeyProperties { + /** + * Gets the syncAgentKey property: Key of sync agent. + * + * @return the syncAgentKey value. + */ + String syncAgentKey(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.SyncAgentKeyPropertiesInner object. + * + * @return the inner object. + */ + SyncAgentKeyPropertiesInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncAgentLinkedDatabase.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncAgentLinkedDatabase.java new file mode 100644 index 0000000000000..37c5db2f9ba2e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncAgentLinkedDatabase.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.SyncAgentLinkedDatabaseInner; + +/** An immutable client-side representation of SyncAgentLinkedDatabase. */ +public interface SyncAgentLinkedDatabase { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the databaseType property: Type of the sync agent linked database. + * + * @return the databaseType value. + */ + SyncMemberDbType databaseType(); + + /** + * Gets the databaseId property: Id of the sync agent linked database. + * + * @return the databaseId value. + */ + String databaseId(); + + /** + * Gets the description property: Description of the sync agent linked database. + * + * @return the description value. + */ + String description(); + + /** + * Gets the serverName property: Server name of the sync agent linked database. + * + * @return the serverName value. + */ + String serverName(); + + /** + * Gets the databaseName property: Database name of the sync agent linked database. + * + * @return the databaseName value. + */ + String databaseName(); + + /** + * Gets the username property: User name of the sync agent linked database. + * + * @return the username value. + */ + String username(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.SyncAgentLinkedDatabaseInner object. + * + * @return the inner object. + */ + SyncAgentLinkedDatabaseInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncAgentLinkedDatabaseListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncAgentLinkedDatabaseListResult.java new file mode 100644 index 0000000000000..ef90bcf6e5447 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncAgentLinkedDatabaseListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncAgentLinkedDatabaseInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of sync agent linked databases. */ +@Immutable +public final class SyncAgentLinkedDatabaseListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of SyncAgentLinkedDatabaseListResult class. */ + public SyncAgentLinkedDatabaseListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncAgentListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncAgentListResult.java new file mode 100644 index 0000000000000..bc970d1ba0a1a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncAgentListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncAgentInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of sync agents. */ +@Immutable +public final class SyncAgentListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of SyncAgentListResult class. */ + public SyncAgentListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncAgentState.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncAgentState.java new file mode 100644 index 0000000000000..69629c30196fa --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncAgentState.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** State of the sync agent. */ +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); + } + + /** + * Gets known SyncAgentState values. + * + * @return known SyncAgentState values. + */ + public static Collection values() { + return values(SyncAgentState.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncAgents.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncAgents.java new file mode 100644 index 0000000000000..90366394a677e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncAgents.java @@ -0,0 +1,209 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of SyncAgents. */ +public interface SyncAgents { + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sync agent along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String syncAgentName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sync agent. + */ + SyncAgent get(String resourceGroupName, String serverName, String syncAgentName); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, String syncAgentName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, String syncAgentName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync agents as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync agents as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of an Azure SQL Database sync agent key along with {@link Response}. + */ + Response generateKeyWithResponse( + String resourceGroupName, String serverName, String syncAgentName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of an Azure SQL Database sync agent key. + */ + SyncAgentKeyProperties generateKey(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. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync agent linked databases as paginated response with {@link PagedIterable}. + */ + PagedIterable listLinkedDatabases( + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync agent linked databases as paginated response with {@link PagedIterable}. + */ + PagedIterable listLinkedDatabases( + String resourceGroupName, String serverName, String syncAgentName, Context context); + + /** + * Gets a sync agent. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sync agent along with {@link Response}. + */ + SyncAgent getById(String id); + + /** + * Gets a sync agent. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sync agent along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a sync agent. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a sync agent. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new SyncAgent resource. + * + * @param name resource name. + * @return the first stage of the new SyncAgent definition. + */ + SyncAgent.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncConflictResolutionPolicy.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncConflictResolutionPolicy.java new file mode 100644 index 0000000000000..c248bab34b5dc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncConflictResolutionPolicy.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Conflict resolution policy of the sync group. */ +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); + } + + /** + * Gets known SyncConflictResolutionPolicy values. + * + * @return known SyncConflictResolutionPolicy values. + */ + public static Collection values() { + return values(SyncConflictResolutionPolicy.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncDatabaseIdListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncDatabaseIdListResult.java new file mode 100644 index 0000000000000..de36fc51d91e2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncDatabaseIdListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncDatabaseIdPropertiesInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of sync database ID properties. */ +@Immutable +public final class SyncDatabaseIdListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of SyncDatabaseIdListResult class. */ + public SyncDatabaseIdListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncDatabaseIdProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncDatabaseIdProperties.java new file mode 100644 index 0000000000000..f5247afba90bf --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncDatabaseIdProperties.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.SyncDatabaseIdPropertiesInner; + +/** An immutable client-side representation of SyncDatabaseIdProperties. */ +public interface SyncDatabaseIdProperties { + /** + * Gets the id property: ARM resource id of sync database. + * + * @return the id value. + */ + String id(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.SyncDatabaseIdPropertiesInner object. + * + * @return the inner object. + */ + SyncDatabaseIdPropertiesInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncDirection.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncDirection.java new file mode 100644 index 0000000000000..1b389ca347bad --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncDirection.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Sync direction of the sync member. */ +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); + } + + /** + * Gets known SyncDirection values. + * + * @return known SyncDirection values. + */ + public static Collection values() { + return values(SyncDirection.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncFullSchemaProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncFullSchemaProperties.java new file mode 100644 index 0000000000000..860c32c7f9bc3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncFullSchemaProperties.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.SyncFullSchemaPropertiesInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of SyncFullSchemaProperties. */ +public interface SyncFullSchemaProperties { + /** + * Gets the tables property: List of tables in the database full schema. + * + * @return the tables value. + */ + List tables(); + + /** + * Gets the lastUpdateTime property: Last update time of the database schema. + * + * @return the lastUpdateTime value. + */ + OffsetDateTime lastUpdateTime(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.SyncFullSchemaPropertiesInner object. + * + * @return the inner object. + */ + SyncFullSchemaPropertiesInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncFullSchemaPropertiesListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncFullSchemaPropertiesListResult.java new file mode 100644 index 0000000000000..a3f43fc647d45 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncFullSchemaPropertiesListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncFullSchemaPropertiesInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of sync schema properties. */ +@Immutable +public final class SyncFullSchemaPropertiesListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of SyncFullSchemaPropertiesListResult class. */ + public SyncFullSchemaPropertiesListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncFullSchemaTable.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncFullSchemaTable.java new file mode 100644 index 0000000000000..4ce5e9f65b578 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncFullSchemaTable.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of the table in the database full schema. */ +@Immutable +public final 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; + + /** Creates an instance of SyncFullSchemaTable class. */ + public SyncFullSchemaTable() { + } + + /** + * Get the columns property: List of columns in the table of database full schema. + * + * @return the columns value. + */ + public List columns() { + return this.columns; + } + + /** + * Get the errorId property: Error id of the table. + * + * @return the errorId value. + */ + public String errorId() { + return this.errorId; + } + + /** + * Get the hasError property: If there is error in the table. + * + * @return the hasError value. + */ + public Boolean hasError() { + return this.hasError; + } + + /** + * Get the name property: Name of the table. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the quotedName property: Quoted name of the table. + * + * @return the quotedName value. + */ + public String quotedName() { + return this.quotedName; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (columns() != null) { + columns().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncFullSchemaTableColumn.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncFullSchemaTableColumn.java new file mode 100644 index 0000000000000..f5047f9bbefa9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncFullSchemaTableColumn.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of the column in the table of database full schema. */ +@Immutable +public final 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; + + /** Creates an instance of SyncFullSchemaTableColumn class. */ + public SyncFullSchemaTableColumn() { + } + + /** + * Get the dataSize property: Data size of the column. + * + * @return the dataSize value. + */ + public String dataSize() { + return this.dataSize; + } + + /** + * Get the dataType property: Data type of the column. + * + * @return the dataType value. + */ + public String dataType() { + return this.dataType; + } + + /** + * Get the errorId property: Error id of the column. + * + * @return the errorId value. + */ + public String errorId() { + return this.errorId; + } + + /** + * Get the hasError property: If there is error in the table. + * + * @return the hasError value. + */ + public Boolean hasError() { + return this.hasError; + } + + /** + * Get the isPrimaryKey property: If it is the primary key of the table. + * + * @return the isPrimaryKey value. + */ + public Boolean isPrimaryKey() { + return this.isPrimaryKey; + } + + /** + * Get the name property: Name of the column. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the quotedName property: Quoted name of the column. + * + * @return the quotedName value. + */ + public String quotedName() { + return this.quotedName; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroup.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroup.java new file mode 100644 index 0000000000000..780bcd995658c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroup.java @@ -0,0 +1,501 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncGroupInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of SyncGroup. */ +public interface SyncGroup { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the sku property: The name and capacity of the SKU. + * + * @return the sku value. + */ + Sku sku(); + + /** + * Gets the interval property: Sync interval of the sync group. + * + * @return the interval value. + */ + Integer interval(); + + /** + * Gets the lastSyncTime property: Last sync time of the sync group. + * + * @return the lastSyncTime value. + */ + OffsetDateTime lastSyncTime(); + + /** + * Gets the conflictResolutionPolicy property: Conflict resolution policy of the sync group. + * + * @return the conflictResolutionPolicy value. + */ + SyncConflictResolutionPolicy conflictResolutionPolicy(); + + /** + * Gets the syncDatabaseId property: ARM resource id of the sync database in the sync group. + * + * @return the syncDatabaseId value. + */ + String syncDatabaseId(); + + /** + * Gets the hubDatabaseUsername property: User name for the sync group hub database credential. + * + * @return the hubDatabaseUsername value. + */ + String hubDatabaseUsername(); + + /** + * Gets the hubDatabasePassword property: Password for the sync group hub database credential. + * + * @return the hubDatabasePassword value. + */ + String hubDatabasePassword(); + + /** + * Gets the syncState property: Sync state of the sync group. + * + * @return the syncState value. + */ + SyncGroupState syncState(); + + /** + * Gets the schema property: Sync schema of the sync group. + * + * @return the schema value. + */ + SyncGroupSchema schema(); + + /** + * Gets the enableConflictLogging property: If conflict logging is enabled. + * + * @return the enableConflictLogging value. + */ + Boolean enableConflictLogging(); + + /** + * Gets the conflictLoggingRetentionInDays property: Conflict logging retention period. + * + * @return the conflictLoggingRetentionInDays value. + */ + Integer conflictLoggingRetentionInDays(); + + /** + * Gets the usePrivateLinkConnection property: If use private link connection is enabled. + * + * @return the usePrivateLinkConnection value. + */ + Boolean usePrivateLinkConnection(); + + /** + * Gets the privateEndpointName property: Private endpoint name of the sync group if use private link connection is + * enabled. + * + * @return the privateEndpointName value. + */ + String privateEndpointName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.SyncGroupInner object. + * + * @return the inner object. + */ + SyncGroupInner innerModel(); + + /** The entirety of the SyncGroup definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The SyncGroup definition stages. */ + interface DefinitionStages { + /** The first stage of the SyncGroup definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the SyncGroup definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName, databaseName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database on which the sync group is hosted. + * @return the next definition stage. + */ + WithCreate withExistingDatabase(String resourceGroupName, String serverName, String databaseName); + } + /** + * The stage of the SyncGroup definition which contains all the minimum required properties for the resource to + * be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithSku, + DefinitionStages.WithInterval, + DefinitionStages.WithConflictResolutionPolicy, + DefinitionStages.WithSyncDatabaseId, + DefinitionStages.WithHubDatabaseUsername, + DefinitionStages.WithHubDatabasePassword, + DefinitionStages.WithSchema, + DefinitionStages.WithEnableConflictLogging, + DefinitionStages.WithConflictLoggingRetentionInDays, + DefinitionStages.WithUsePrivateLinkConnection { + /** + * Executes the create request. + * + * @return the created resource. + */ + SyncGroup create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + SyncGroup create(Context context); + } + /** The stage of the SyncGroup definition allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: The name and capacity of the SKU.. + * + * @param sku The name and capacity of the SKU. + * @return the next definition stage. + */ + WithCreate withSku(Sku sku); + } + /** The stage of the SyncGroup definition allowing to specify interval. */ + interface WithInterval { + /** + * Specifies the interval property: Sync interval of the sync group.. + * + * @param interval Sync interval of the sync group. + * @return the next definition stage. + */ + WithCreate withInterval(Integer interval); + } + /** The stage of the SyncGroup definition allowing to specify conflictResolutionPolicy. */ + interface WithConflictResolutionPolicy { + /** + * Specifies the conflictResolutionPolicy property: Conflict resolution policy of the sync group.. + * + * @param conflictResolutionPolicy Conflict resolution policy of the sync group. + * @return the next definition stage. + */ + WithCreate withConflictResolutionPolicy(SyncConflictResolutionPolicy conflictResolutionPolicy); + } + /** The stage of the SyncGroup definition allowing to specify syncDatabaseId. */ + interface WithSyncDatabaseId { + /** + * Specifies the syncDatabaseId property: ARM resource id of the sync database in the sync group.. + * + * @param syncDatabaseId ARM resource id of the sync database in the sync group. + * @return the next definition stage. + */ + WithCreate withSyncDatabaseId(String syncDatabaseId); + } + /** The stage of the SyncGroup definition allowing to specify hubDatabaseUsername. */ + interface WithHubDatabaseUsername { + /** + * Specifies the hubDatabaseUsername property: User name for the sync group hub database credential.. + * + * @param hubDatabaseUsername User name for the sync group hub database credential. + * @return the next definition stage. + */ + WithCreate withHubDatabaseUsername(String hubDatabaseUsername); + } + /** The stage of the SyncGroup definition allowing to specify hubDatabasePassword. */ + interface WithHubDatabasePassword { + /** + * Specifies the hubDatabasePassword property: Password for the sync group hub database credential.. + * + * @param hubDatabasePassword Password for the sync group hub database credential. + * @return the next definition stage. + */ + WithCreate withHubDatabasePassword(String hubDatabasePassword); + } + /** The stage of the SyncGroup definition allowing to specify schema. */ + interface WithSchema { + /** + * Specifies the schema property: Sync schema of the sync group.. + * + * @param schema Sync schema of the sync group. + * @return the next definition stage. + */ + WithCreate withSchema(SyncGroupSchema schema); + } + /** The stage of the SyncGroup definition allowing to specify enableConflictLogging. */ + interface WithEnableConflictLogging { + /** + * Specifies the enableConflictLogging property: If conflict logging is enabled.. + * + * @param enableConflictLogging If conflict logging is enabled. + * @return the next definition stage. + */ + WithCreate withEnableConflictLogging(Boolean enableConflictLogging); + } + /** The stage of the SyncGroup definition allowing to specify conflictLoggingRetentionInDays. */ + interface WithConflictLoggingRetentionInDays { + /** + * Specifies the conflictLoggingRetentionInDays property: Conflict logging retention period.. + * + * @param conflictLoggingRetentionInDays Conflict logging retention period. + * @return the next definition stage. + */ + WithCreate withConflictLoggingRetentionInDays(Integer conflictLoggingRetentionInDays); + } + /** The stage of the SyncGroup definition allowing to specify usePrivateLinkConnection. */ + interface WithUsePrivateLinkConnection { + /** + * Specifies the usePrivateLinkConnection property: If use private link connection is enabled.. + * + * @param usePrivateLinkConnection If use private link connection is enabled. + * @return the next definition stage. + */ + WithCreate withUsePrivateLinkConnection(Boolean usePrivateLinkConnection); + } + } + /** + * Begins update for the SyncGroup resource. + * + * @return the stage of resource update. + */ + SyncGroup.Update update(); + + /** The template for SyncGroup update. */ + interface Update + extends UpdateStages.WithSku, + UpdateStages.WithInterval, + UpdateStages.WithConflictResolutionPolicy, + UpdateStages.WithSyncDatabaseId, + UpdateStages.WithHubDatabaseUsername, + UpdateStages.WithHubDatabasePassword, + UpdateStages.WithSchema, + UpdateStages.WithEnableConflictLogging, + UpdateStages.WithConflictLoggingRetentionInDays, + UpdateStages.WithUsePrivateLinkConnection { + /** + * Executes the update request. + * + * @return the updated resource. + */ + SyncGroup apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + SyncGroup apply(Context context); + } + /** The SyncGroup update stages. */ + interface UpdateStages { + /** The stage of the SyncGroup update allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: The name and capacity of the SKU.. + * + * @param sku The name and capacity of the SKU. + * @return the next definition stage. + */ + Update withSku(Sku sku); + } + /** The stage of the SyncGroup update allowing to specify interval. */ + interface WithInterval { + /** + * Specifies the interval property: Sync interval of the sync group.. + * + * @param interval Sync interval of the sync group. + * @return the next definition stage. + */ + Update withInterval(Integer interval); + } + /** The stage of the SyncGroup update allowing to specify conflictResolutionPolicy. */ + interface WithConflictResolutionPolicy { + /** + * Specifies the conflictResolutionPolicy property: Conflict resolution policy of the sync group.. + * + * @param conflictResolutionPolicy Conflict resolution policy of the sync group. + * @return the next definition stage. + */ + Update withConflictResolutionPolicy(SyncConflictResolutionPolicy conflictResolutionPolicy); + } + /** The stage of the SyncGroup update allowing to specify syncDatabaseId. */ + interface WithSyncDatabaseId { + /** + * Specifies the syncDatabaseId property: ARM resource id of the sync database in the sync group.. + * + * @param syncDatabaseId ARM resource id of the sync database in the sync group. + * @return the next definition stage. + */ + Update withSyncDatabaseId(String syncDatabaseId); + } + /** The stage of the SyncGroup update allowing to specify hubDatabaseUsername. */ + interface WithHubDatabaseUsername { + /** + * Specifies the hubDatabaseUsername property: User name for the sync group hub database credential.. + * + * @param hubDatabaseUsername User name for the sync group hub database credential. + * @return the next definition stage. + */ + Update withHubDatabaseUsername(String hubDatabaseUsername); + } + /** The stage of the SyncGroup update allowing to specify hubDatabasePassword. */ + interface WithHubDatabasePassword { + /** + * Specifies the hubDatabasePassword property: Password for the sync group hub database credential.. + * + * @param hubDatabasePassword Password for the sync group hub database credential. + * @return the next definition stage. + */ + Update withHubDatabasePassword(String hubDatabasePassword); + } + /** The stage of the SyncGroup update allowing to specify schema. */ + interface WithSchema { + /** + * Specifies the schema property: Sync schema of the sync group.. + * + * @param schema Sync schema of the sync group. + * @return the next definition stage. + */ + Update withSchema(SyncGroupSchema schema); + } + /** The stage of the SyncGroup update allowing to specify enableConflictLogging. */ + interface WithEnableConflictLogging { + /** + * Specifies the enableConflictLogging property: If conflict logging is enabled.. + * + * @param enableConflictLogging If conflict logging is enabled. + * @return the next definition stage. + */ + Update withEnableConflictLogging(Boolean enableConflictLogging); + } + /** The stage of the SyncGroup update allowing to specify conflictLoggingRetentionInDays. */ + interface WithConflictLoggingRetentionInDays { + /** + * Specifies the conflictLoggingRetentionInDays property: Conflict logging retention period.. + * + * @param conflictLoggingRetentionInDays Conflict logging retention period. + * @return the next definition stage. + */ + Update withConflictLoggingRetentionInDays(Integer conflictLoggingRetentionInDays); + } + /** The stage of the SyncGroup update allowing to specify usePrivateLinkConnection. */ + interface WithUsePrivateLinkConnection { + /** + * Specifies the usePrivateLinkConnection property: If use private link connection is enabled.. + * + * @param usePrivateLinkConnection If use private link connection is enabled. + * @return the next definition stage. + */ + Update withUsePrivateLinkConnection(Boolean usePrivateLinkConnection); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + SyncGroup refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + SyncGroup refresh(Context context); + + /** + * Refreshes a hub database schema. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void refreshHubSchema(); + + /** + * Refreshes a hub database schema. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void refreshHubSchema(Context context); + + /** + * Cancels a sync group synchronization. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response cancelSyncWithResponse(Context context); + + /** + * Cancels a sync group synchronization. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void cancelSync(); + + /** + * Triggers a sync group synchronization. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response triggerSyncWithResponse(Context context); + + /** + * Triggers a sync group synchronization. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void triggerSync(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupListResult.java new file mode 100644 index 0000000000000..8477d14401dae --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncGroupInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of sync groups. */ +@Immutable +public final class SyncGroupListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of SyncGroupListResult class. */ + public SyncGroupListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupLogListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupLogListResult.java new file mode 100644 index 0000000000000..c3590d1ac609f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupLogListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncGroupLogPropertiesInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of sync group log properties. */ +@Immutable +public final class SyncGroupLogListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of SyncGroupLogListResult class. */ + public SyncGroupLogListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupLogProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupLogProperties.java new file mode 100644 index 0000000000000..4cde7c4cee48c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupLogProperties.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.SyncGroupLogPropertiesInner; +import java.time.OffsetDateTime; +import java.util.UUID; + +/** An immutable client-side representation of SyncGroupLogProperties. */ +public interface SyncGroupLogProperties { + /** + * Gets the timestamp property: Timestamp of the sync group log. + * + * @return the timestamp value. + */ + OffsetDateTime timestamp(); + + /** + * Gets the type property: Type of the sync group log. + * + * @return the type value. + */ + SyncGroupLogType type(); + + /** + * Gets the source property: Source of the sync group log. + * + * @return the source value. + */ + String source(); + + /** + * Gets the details property: Details of the sync group log. + * + * @return the details value. + */ + String details(); + + /** + * Gets the tracingId property: TracingId of the sync group log. + * + * @return the tracingId value. + */ + UUID tracingId(); + + /** + * Gets the operationStatus property: OperationStatus of the sync group log. + * + * @return the operationStatus value. + */ + String operationStatus(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.SyncGroupLogPropertiesInner object. + * + * @return the inner object. + */ + SyncGroupLogPropertiesInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupLogType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupLogType.java new file mode 100644 index 0000000000000..cbd9f3ce0f2e4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupLogType.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Type of the sync group log. */ +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); + } + + /** + * Gets known SyncGroupLogType values. + * + * @return known SyncGroupLogType values. + */ + public static Collection values() { + return values(SyncGroupLogType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupSchema.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupSchema.java new file mode 100644 index 0000000000000..f366e87b43521 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupSchema.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of sync group schema. */ +@Fluent +public final 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; + + /** Creates an instance of SyncGroupSchema class. */ + public SyncGroupSchema() { + } + + /** + * Get the tables property: List of tables in sync group schema. + * + * @return the tables value. + */ + public List tables() { + return this.tables; + } + + /** + * Set the tables property: 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 the masterSyncMemberName property: Name of master sync member where the schema is from. + * + * @return the masterSyncMemberName value. + */ + public String masterSyncMemberName() { + return this.masterSyncMemberName; + } + + /** + * Set the masterSyncMemberName property: 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (tables() != null) { + tables().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupSchemaTable.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupSchemaTable.java new file mode 100644 index 0000000000000..7b20d5e1fbc87 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupSchemaTable.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of table in sync group schema. */ +@Fluent +public final 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; + + /** Creates an instance of SyncGroupSchemaTable class. */ + public SyncGroupSchemaTable() { + } + + /** + * Get the columns property: List of columns in sync group schema. + * + * @return the columns value. + */ + public List columns() { + return this.columns; + } + + /** + * Set the columns property: 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 the quotedName property: Quoted name of sync group schema table. + * + * @return the quotedName value. + */ + public String quotedName() { + return this.quotedName; + } + + /** + * Set the quotedName property: 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (columns() != null) { + columns().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupSchemaTableColumn.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupSchemaTableColumn.java new file mode 100644 index 0000000000000..f7dbb5d1ed807 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupSchemaTableColumn.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of column in sync group table. */ +@Fluent +public final 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; + + /** Creates an instance of SyncGroupSchemaTableColumn class. */ + public SyncGroupSchemaTableColumn() { + } + + /** + * Get the quotedName property: Quoted name of sync group table column. + * + * @return the quotedName value. + */ + public String quotedName() { + return this.quotedName; + } + + /** + * Set the quotedName property: 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 the dataSize property: Data size of the column. + * + * @return the dataSize value. + */ + public String dataSize() { + return this.dataSize; + } + + /** + * Set the dataSize property: 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 the dataType property: Data type of the column. + * + * @return the dataType value. + */ + public String dataType() { + return this.dataType; + } + + /** + * Set the dataType property: 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupState.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupState.java new file mode 100644 index 0000000000000..357dbaf15346b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupState.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Sync state of the sync group. */ +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); + } + + /** + * Gets known SyncGroupState values. + * + * @return known SyncGroupState values. + */ + public static Collection values() { + return values(SyncGroupState.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroups.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroups.java new file mode 100644 index 0000000000000..74d1594ba8cfd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroups.java @@ -0,0 +1,358 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of SyncGroups. */ +public interface SyncGroups { + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a collection of sync database ids as paginated response with {@link PagedIterable}. + */ + PagedIterable listSyncDatabaseIds(String locationName); + + /** + * Gets a collection of sync database ids. + * + * @param locationName The name of the region where the resource is located. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a collection of sync database ids as paginated response with {@link PagedIterable}. + */ + PagedIterable listSyncDatabaseIds(String locationName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void refreshHubSchema(String resourceGroupName, String serverName, String databaseName, String syncGroupName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void refreshHubSchema( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a collection of hub database schemas as paginated response with {@link PagedIterable}. + */ + PagedIterable listHubSchemas( + String resourceGroupName, String serverName, String databaseName, String syncGroupName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a collection of hub database schemas as paginated response with {@link PagedIterable}. + */ + PagedIterable listHubSchemas( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context); + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a collection of sync group logs as paginated response with {@link PagedIterable}. + */ + PagedIterable listLogs( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String startTime, + String endTime, + SyncGroupsType type); + + /** + * 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. + * @param continuationToken The continuation token for this operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a collection of sync group logs as paginated response with {@link PagedIterable}. + */ + PagedIterable listLogs( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String startTime, + String endTime, + SyncGroupsType type, + String continuationToken, + Context context); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response cancelSyncWithResponse( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void cancelSync(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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response triggerSyncWithResponse( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void triggerSync(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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sync group along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sync group. + */ + SyncGroup get(String resourceGroupName, String serverName, String databaseName, String syncGroupName); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, String databaseName, String syncGroupName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync groups as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase(String resourceGroupName, String serverName, String databaseName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of sync groups as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Gets a sync group. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sync group along with {@link Response}. + */ + SyncGroup getById(String id); + + /** + * Gets a sync group. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sync group along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a sync group. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a sync group. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new SyncGroup resource. + * + * @param name resource name. + * @return the first stage of the new SyncGroup definition. + */ + SyncGroup.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupsType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupsType.java new file mode 100644 index 0000000000000..73643108fcff4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncGroupsType.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SyncGroupsType. */ +public final class SyncGroupsType extends ExpandableStringEnum { + /** Static value All for SyncGroupsType. */ + public static final SyncGroupsType ALL = fromString("All"); + + /** Static value Error for SyncGroupsType. */ + public static final SyncGroupsType ERROR = fromString("Error"); + + /** Static value Warning for SyncGroupsType. */ + public static final SyncGroupsType WARNING = fromString("Warning"); + + /** Static value Success for SyncGroupsType. */ + public static final SyncGroupsType SUCCESS = fromString("Success"); + + /** + * Creates or finds a SyncGroupsType from its string representation. + * + * @param name a name to look for. + * @return the corresponding SyncGroupsType. + */ + @JsonCreator + public static SyncGroupsType fromString(String name) { + return fromString(name, SyncGroupsType.class); + } + + /** + * Gets known SyncGroupsType values. + * + * @return known SyncGroupsType values. + */ + public static Collection values() { + return values(SyncGroupsType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncMember.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncMember.java new file mode 100644 index 0000000000000..55a6261b334a2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncMember.java @@ -0,0 +1,462 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncMemberInner; +import java.util.UUID; + +/** An immutable client-side representation of SyncMember. */ +public interface SyncMember { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the databaseType property: Database type of the sync member. + * + * @return the databaseType value. + */ + SyncMemberDbType databaseType(); + + /** + * Gets the syncAgentId property: ARM resource id of the sync agent in the sync member. + * + * @return the syncAgentId value. + */ + String syncAgentId(); + + /** + * Gets the sqlServerDatabaseId property: SQL Server database id of the sync member. + * + * @return the sqlServerDatabaseId value. + */ + UUID sqlServerDatabaseId(); + + /** + * Gets the syncMemberAzureDatabaseResourceId property: ARM resource id of the sync member logical database, for + * sync members in Azure. + * + * @return the syncMemberAzureDatabaseResourceId value. + */ + String syncMemberAzureDatabaseResourceId(); + + /** + * Gets the usePrivateLinkConnection property: Whether to use private link connection. + * + * @return the usePrivateLinkConnection value. + */ + Boolean usePrivateLinkConnection(); + + /** + * Gets the privateEndpointName property: Private endpoint name of the sync member if use private link connection is + * enabled, for sync members in Azure. + * + * @return the privateEndpointName value. + */ + String privateEndpointName(); + + /** + * Gets the serverName property: Server name of the member database in the sync member. + * + * @return the serverName value. + */ + String serverName(); + + /** + * Gets the databaseName property: Database name of the member database in the sync member. + * + * @return the databaseName value. + */ + String databaseName(); + + /** + * Gets the username property: User name of the member database in the sync member. + * + * @return the username value. + */ + String username(); + + /** + * Gets the password property: Password of the member database in the sync member. + * + * @return the password value. + */ + String password(); + + /** + * Gets the syncDirection property: Sync direction of the sync member. + * + * @return the syncDirection value. + */ + SyncDirection syncDirection(); + + /** + * Gets the syncState property: Sync state of the sync member. + * + * @return the syncState value. + */ + SyncMemberState syncState(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.SyncMemberInner object. + * + * @return the inner object. + */ + SyncMemberInner innerModel(); + + /** The entirety of the SyncMember definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The SyncMember definition stages. */ + interface DefinitionStages { + /** The first stage of the SyncMember definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the SyncMember definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName, databaseName, syncGroupName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * 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. + * @return the next definition stage. + */ + WithCreate withExistingSyncGroup( + String resourceGroupName, String serverName, String databaseName, String syncGroupName); + } + /** + * The stage of the SyncMember definition which contains all the minimum required properties for the resource to + * be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithDatabaseType, + DefinitionStages.WithSyncAgentId, + DefinitionStages.WithSqlServerDatabaseId, + DefinitionStages.WithSyncMemberAzureDatabaseResourceId, + DefinitionStages.WithUsePrivateLinkConnection, + DefinitionStages.WithServerName, + DefinitionStages.WithDatabaseName, + DefinitionStages.WithUsername, + DefinitionStages.WithPassword, + DefinitionStages.WithSyncDirection { + /** + * Executes the create request. + * + * @return the created resource. + */ + SyncMember create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + SyncMember create(Context context); + } + /** The stage of the SyncMember definition allowing to specify databaseType. */ + interface WithDatabaseType { + /** + * Specifies the databaseType property: Database type of the sync member.. + * + * @param databaseType Database type of the sync member. + * @return the next definition stage. + */ + WithCreate withDatabaseType(SyncMemberDbType databaseType); + } + /** The stage of the SyncMember definition allowing to specify syncAgentId. */ + interface WithSyncAgentId { + /** + * Specifies the syncAgentId property: ARM resource id of the sync agent in the sync member.. + * + * @param syncAgentId ARM resource id of the sync agent in the sync member. + * @return the next definition stage. + */ + WithCreate withSyncAgentId(String syncAgentId); + } + /** The stage of the SyncMember definition allowing to specify sqlServerDatabaseId. */ + interface WithSqlServerDatabaseId { + /** + * Specifies the sqlServerDatabaseId property: SQL Server database id of the sync member.. + * + * @param sqlServerDatabaseId SQL Server database id of the sync member. + * @return the next definition stage. + */ + WithCreate withSqlServerDatabaseId(UUID sqlServerDatabaseId); + } + /** The stage of the SyncMember definition allowing to specify syncMemberAzureDatabaseResourceId. */ + interface WithSyncMemberAzureDatabaseResourceId { + /** + * Specifies the syncMemberAzureDatabaseResourceId property: ARM resource id of the sync member logical + * database, for sync members in Azure.. + * + * @param syncMemberAzureDatabaseResourceId ARM resource id of the sync member logical database, for sync + * members in Azure. + * @return the next definition stage. + */ + WithCreate withSyncMemberAzureDatabaseResourceId(String syncMemberAzureDatabaseResourceId); + } + /** The stage of the SyncMember definition allowing to specify usePrivateLinkConnection. */ + interface WithUsePrivateLinkConnection { + /** + * Specifies the usePrivateLinkConnection property: Whether to use private link connection.. + * + * @param usePrivateLinkConnection Whether to use private link connection. + * @return the next definition stage. + */ + WithCreate withUsePrivateLinkConnection(Boolean usePrivateLinkConnection); + } + /** The stage of the SyncMember definition allowing to specify serverName. */ + interface WithServerName { + /** + * Specifies the serverName property: Server name of the member database in the sync member. + * + * @param serverName Server name of the member database in the sync member. + * @return the next definition stage. + */ + WithCreate withServerName(String serverName); + } + /** The stage of the SyncMember definition allowing to specify databaseName. */ + interface WithDatabaseName { + /** + * Specifies the databaseName property: Database name of the member database in the sync member.. + * + * @param databaseName Database name of the member database in the sync member. + * @return the next definition stage. + */ + WithCreate withDatabaseName(String databaseName); + } + /** The stage of the SyncMember definition allowing to specify username. */ + interface WithUsername { + /** + * Specifies the username property: User name of the member database in the sync member.. + * + * @param username User name of the member database in the sync member. + * @return the next definition stage. + */ + WithCreate withUsername(String username); + } + /** The stage of the SyncMember definition allowing to specify password. */ + interface WithPassword { + /** + * Specifies the password property: Password of the member database in the sync member.. + * + * @param password Password of the member database in the sync member. + * @return the next definition stage. + */ + WithCreate withPassword(String password); + } + /** The stage of the SyncMember definition allowing to specify syncDirection. */ + interface WithSyncDirection { + /** + * Specifies the syncDirection property: Sync direction of the sync member.. + * + * @param syncDirection Sync direction of the sync member. + * @return the next definition stage. + */ + WithCreate withSyncDirection(SyncDirection syncDirection); + } + } + /** + * Begins update for the SyncMember resource. + * + * @return the stage of resource update. + */ + SyncMember.Update update(); + + /** The template for SyncMember update. */ + interface Update + extends UpdateStages.WithDatabaseType, + UpdateStages.WithSyncAgentId, + UpdateStages.WithSqlServerDatabaseId, + UpdateStages.WithSyncMemberAzureDatabaseResourceId, + UpdateStages.WithUsePrivateLinkConnection, + UpdateStages.WithServerName, + UpdateStages.WithDatabaseName, + UpdateStages.WithUsername, + UpdateStages.WithPassword, + UpdateStages.WithSyncDirection { + /** + * Executes the update request. + * + * @return the updated resource. + */ + SyncMember apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + SyncMember apply(Context context); + } + /** The SyncMember update stages. */ + interface UpdateStages { + /** The stage of the SyncMember update allowing to specify databaseType. */ + interface WithDatabaseType { + /** + * Specifies the databaseType property: Database type of the sync member.. + * + * @param databaseType Database type of the sync member. + * @return the next definition stage. + */ + Update withDatabaseType(SyncMemberDbType databaseType); + } + /** The stage of the SyncMember update allowing to specify syncAgentId. */ + interface WithSyncAgentId { + /** + * Specifies the syncAgentId property: ARM resource id of the sync agent in the sync member.. + * + * @param syncAgentId ARM resource id of the sync agent in the sync member. + * @return the next definition stage. + */ + Update withSyncAgentId(String syncAgentId); + } + /** The stage of the SyncMember update allowing to specify sqlServerDatabaseId. */ + interface WithSqlServerDatabaseId { + /** + * Specifies the sqlServerDatabaseId property: SQL Server database id of the sync member.. + * + * @param sqlServerDatabaseId SQL Server database id of the sync member. + * @return the next definition stage. + */ + Update withSqlServerDatabaseId(UUID sqlServerDatabaseId); + } + /** The stage of the SyncMember update allowing to specify syncMemberAzureDatabaseResourceId. */ + interface WithSyncMemberAzureDatabaseResourceId { + /** + * Specifies the syncMemberAzureDatabaseResourceId property: ARM resource id of the sync member logical + * database, for sync members in Azure.. + * + * @param syncMemberAzureDatabaseResourceId ARM resource id of the sync member logical database, for sync + * members in Azure. + * @return the next definition stage. + */ + Update withSyncMemberAzureDatabaseResourceId(String syncMemberAzureDatabaseResourceId); + } + /** The stage of the SyncMember update allowing to specify usePrivateLinkConnection. */ + interface WithUsePrivateLinkConnection { + /** + * Specifies the usePrivateLinkConnection property: Whether to use private link connection.. + * + * @param usePrivateLinkConnection Whether to use private link connection. + * @return the next definition stage. + */ + Update withUsePrivateLinkConnection(Boolean usePrivateLinkConnection); + } + /** The stage of the SyncMember update allowing to specify serverName. */ + interface WithServerName { + /** + * Specifies the serverName property: Server name of the member database in the sync member. + * + * @param serverName Server name of the member database in the sync member. + * @return the next definition stage. + */ + Update withServerName(String serverName); + } + /** The stage of the SyncMember update allowing to specify databaseName. */ + interface WithDatabaseName { + /** + * Specifies the databaseName property: Database name of the member database in the sync member.. + * + * @param databaseName Database name of the member database in the sync member. + * @return the next definition stage. + */ + Update withDatabaseName(String databaseName); + } + /** The stage of the SyncMember update allowing to specify username. */ + interface WithUsername { + /** + * Specifies the username property: User name of the member database in the sync member.. + * + * @param username User name of the member database in the sync member. + * @return the next definition stage. + */ + Update withUsername(String username); + } + /** The stage of the SyncMember update allowing to specify password. */ + interface WithPassword { + /** + * Specifies the password property: Password of the member database in the sync member.. + * + * @param password Password of the member database in the sync member. + * @return the next definition stage. + */ + Update withPassword(String password); + } + /** The stage of the SyncMember update allowing to specify syncDirection. */ + interface WithSyncDirection { + /** + * Specifies the syncDirection property: Sync direction of the sync member.. + * + * @param syncDirection Sync direction of the sync member. + * @return the next definition stage. + */ + Update withSyncDirection(SyncDirection syncDirection); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + SyncMember refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + SyncMember refresh(Context context); + + /** + * Refreshes a sync member database schema. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void refreshMemberSchema(); + + /** + * Refreshes a sync member database schema. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void refreshMemberSchema(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncMemberDbType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncMemberDbType.java new file mode 100644 index 0000000000000..697d80202fdd0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncMemberDbType.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Type of the sync agent linked database. */ +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); + } + + /** + * Gets known SyncMemberDbType values. + * + * @return known SyncMemberDbType values. + */ + public static Collection values() { + return values(SyncMemberDbType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncMemberListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncMemberListResult.java new file mode 100644 index 0000000000000..f8b76f47a9521 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncMemberListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.SyncMemberInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of Azure SQL Database sync members. */ +@Immutable +public final class SyncMemberListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of SyncMemberListResult class. */ + public SyncMemberListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncMemberState.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncMemberState.java new file mode 100644 index 0000000000000..e3f3419d0fdd4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncMemberState.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Sync state of the sync member. */ +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); + } + + /** + * Gets known SyncMemberState values. + * + * @return known SyncMemberState values. + */ + public static Collection values() { + return values(SyncMemberState.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncMembers.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncMembers.java new file mode 100644 index 0000000000000..d2212bb89ee3c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/SyncMembers.java @@ -0,0 +1,253 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of SyncMembers. */ +public interface SyncMembers { + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sync member along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sync member. + */ + SyncMember get( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Azure SQL Database sync members as paginated response with {@link PagedIterable}. + */ + PagedIterable listBySyncGroup( + String resourceGroupName, String serverName, String databaseName, String syncGroupName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Azure SQL Database sync members as paginated response with {@link PagedIterable}. + */ + PagedIterable listBySyncGroup( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sync member database schema as paginated response with {@link PagedIterable}. + */ + PagedIterable listMemberSchemas( + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sync member database schema as paginated response with {@link PagedIterable}. + */ + PagedIterable listMemberSchemas( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void refreshMemberSchema( + String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void refreshMemberSchema( + String resourceGroupName, + String serverName, + String databaseName, + String syncGroupName, + String syncMemberName, + Context context); + + /** + * Gets a sync member. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sync member along with {@link Response}. + */ + SyncMember getById(String id); + + /** + * Gets a sync member. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a sync member along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a sync member. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a sync member. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new SyncMember resource. + * + * @param name resource name. + * @return the first stage of the new SyncMember definition. + */ + SyncMember.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TableTemporalType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TableTemporalType.java new file mode 100644 index 0000000000000..6ea92576aa14d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TableTemporalType.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The table temporal type. */ +public final class TableTemporalType extends ExpandableStringEnum { + /** Static value NonTemporalTable for TableTemporalType. */ + public static final TableTemporalType NON_TEMPORAL_TABLE = fromString("NonTemporalTable"); + + /** Static value HistoryTable for TableTemporalType. */ + public static final TableTemporalType HISTORY_TABLE = fromString("HistoryTable"); + + /** Static value SystemVersionedTemporalTable for TableTemporalType. */ + public static final TableTemporalType SYSTEM_VERSIONED_TEMPORAL_TABLE = fromString("SystemVersionedTemporalTable"); + + /** + * Creates or finds a TableTemporalType from its string representation. + * + * @param name a name to look for. + * @return the corresponding TableTemporalType. + */ + @JsonCreator + public static TableTemporalType fromString(String name) { + return fromString(name, TableTemporalType.class); + } + + /** + * Gets known TableTemporalType values. + * + * @return known TableTemporalType values. + */ + public static Collection values() { + return values(TableTemporalType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TdeCertificate.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TdeCertificate.java new file mode 100644 index 0000000000000..5748b504375cb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TdeCertificate.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.sql.generated.fluent.models.TdeCertificateProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A TDE certificate that can be uploaded into a server. */ +@Fluent +public final class TdeCertificate extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private TdeCertificateProperties innerProperties; + + /** Creates an instance of TdeCertificate class. */ + public TdeCertificate() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private TdeCertificateProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the privateBlob property: The base64 encoded certificate private blob. + * + * @return the privateBlob value. + */ + public String privateBlob() { + return this.innerProperties() == null ? null : this.innerProperties().privateBlob(); + } + + /** + * Set the privateBlob property: The base64 encoded certificate private blob. + * + * @param privateBlob the privateBlob value to set. + * @return the TdeCertificate object itself. + */ + public TdeCertificate withPrivateBlob(String privateBlob) { + if (this.innerProperties() == null) { + this.innerProperties = new TdeCertificateProperties(); + } + this.innerProperties().withPrivateBlob(privateBlob); + return this; + } + + /** + * Get the certPassword property: The certificate password. + * + * @return the certPassword value. + */ + public String certPassword() { + return this.innerProperties() == null ? null : this.innerProperties().certPassword(); + } + + /** + * Set the certPassword property: The certificate password. + * + * @param certPassword the certPassword value to set. + * @return the TdeCertificate object itself. + */ + public TdeCertificate withCertPassword(String certPassword) { + if (this.innerProperties() == null) { + this.innerProperties = new TdeCertificateProperties(); + } + this.innerProperties().withCertPassword(certPassword); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TdeCertificates.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TdeCertificates.java new file mode 100644 index 0000000000000..9f902f7cc49eb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TdeCertificates.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; + +/** Resource collection API of TdeCertificates. */ +public interface TdeCertificates { + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void create(String resourceGroupName, String serverName, TdeCertificate parameters); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void create(String resourceGroupName, String serverName, TdeCertificate parameters, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TimeZone.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TimeZone.java new file mode 100644 index 0000000000000..238ffb58a9882 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TimeZone.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.TimeZoneInner; + +/** An immutable client-side representation of TimeZone. */ +public interface TimeZone { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the timeZoneId property: The time zone id. + * + * @return the timeZoneId value. + */ + String timeZoneId(); + + /** + * Gets the displayName property: The time zone display name. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.TimeZoneInner object. + * + * @return the inner object. + */ + TimeZoneInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TimeZoneListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TimeZoneListResult.java new file mode 100644 index 0000000000000..1bb9a18014b74 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TimeZoneListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.TimeZoneInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of time zones. */ +@Immutable +public final class TimeZoneListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of TimeZoneListResult class. */ + public TimeZoneListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TimeZones.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TimeZones.java new file mode 100644 index 0000000000000..b4889b82a4ba7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TimeZones.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of TimeZones. */ +public interface TimeZones { + /** + * Gets a list of managed instance time zones by location. + * + * @param locationName The locationName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance time zones by location as paginated response with {@link PagedIterable}. + */ + PagedIterable listByLocation(String locationName); + + /** + * Gets a list of managed instance time zones by location. + * + * @param locationName The locationName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of managed instance time zones by location as paginated response with {@link PagedIterable}. + */ + PagedIterable listByLocation(String locationName, Context context); + + /** + * Gets a managed instance time zone. + * + * @param locationName The locationName parameter. + * @param timeZoneId The timeZoneId parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance time zone along with {@link Response}. + */ + Response getWithResponse(String locationName, String timeZoneId, Context context); + + /** + * Gets a managed instance time zone. + * + * @param locationName The locationName parameter. + * @param timeZoneId The timeZoneId parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a managed instance time zone. + */ + TimeZone get(String locationName, String timeZoneId); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TopQueries.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TopQueries.java new file mode 100644 index 0000000000000..f406f36e07bce --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TopQueries.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.QueryStatisticsProperties; +import com.azure.resourcemanager.sql.generated.fluent.models.TopQueriesInner; +import java.util.List; + +/** An immutable client-side representation of TopQueries. */ +public interface TopQueries { + /** + * Gets the numberOfQueries property: Requested number of top queries. + * + * @return the numberOfQueries value. + */ + Integer numberOfQueries(); + + /** + * Gets the aggregationFunction property: Aggregation function used to calculate query metrics. + * + * @return the aggregationFunction value. + */ + String aggregationFunction(); + + /** + * Gets the observationMetric property: Metric used to rank queries. + * + * @return the observationMetric value. + */ + String observationMetric(); + + /** + * Gets the intervalType property: Interval type (length). + * + * @return the intervalType value. + */ + QueryTimeGrainType intervalType(); + + /** + * Gets the startTime property: The start time for the metric (ISO-8601 format). + * + * @return the startTime value. + */ + String startTime(); + + /** + * Gets the endTime property: The end time for the metric (ISO-8601 format). + * + * @return the endTime value. + */ + String endTime(); + + /** + * Gets the queries property: List of top resource consuming queries with appropriate metric data. + * + * @return the queries value. + */ + List queries(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.TopQueriesInner object. + * + * @return the inner object. + */ + TopQueriesInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TopQueriesListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TopQueriesListResult.java new file mode 100644 index 0000000000000..c6d5f8abd6e0a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TopQueriesListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.TopQueriesInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of top resource consuming queries on managed instance. */ +@Immutable +public final class TopQueriesListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of TopQueriesListResult class. */ + public TopQueriesListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TransparentDataEncryptionName.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TransparentDataEncryptionName.java new file mode 100644 index 0000000000000..4c8b148195fa2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TransparentDataEncryptionName.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for TransparentDataEncryptionName. */ +public final class TransparentDataEncryptionName extends ExpandableStringEnum { + /** Static value current for TransparentDataEncryptionName. */ + public static final TransparentDataEncryptionName CURRENT = fromString("current"); + + /** + * Creates or finds a TransparentDataEncryptionName from its string representation. + * + * @param name a name to look for. + * @return the corresponding TransparentDataEncryptionName. + */ + @JsonCreator + public static TransparentDataEncryptionName fromString(String name) { + return fromString(name, TransparentDataEncryptionName.class); + } + + /** + * Gets known TransparentDataEncryptionName values. + * + * @return known TransparentDataEncryptionName values. + */ + public static Collection values() { + return values(TransparentDataEncryptionName.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TransparentDataEncryptionState.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TransparentDataEncryptionState.java new file mode 100644 index 0000000000000..60b2290f52e36 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TransparentDataEncryptionState.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Specifies the state of the transparent data encryption. */ +public enum TransparentDataEncryptionState { + /** Enum value Enabled. */ + ENABLED("Enabled"), + + /** Enum value Disabled. */ + DISABLED("Disabled"); + + /** The actual serialized value for a TransparentDataEncryptionState instance. */ + private final String value; + + TransparentDataEncryptionState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a TransparentDataEncryptionState instance. + * + * @param value the serialized value to parse. + * @return the parsed TransparentDataEncryptionState object, or null if unable to parse. + */ + @JsonCreator + public static TransparentDataEncryptionState fromString(String value) { + if (value == null) { + return null; + } + TransparentDataEncryptionState[] items = TransparentDataEncryptionState.values(); + for (TransparentDataEncryptionState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TransparentDataEncryptions.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TransparentDataEncryptions.java new file mode 100644 index 0000000000000..d7dbae377e250 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/TransparentDataEncryptions.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of TransparentDataEncryptions. */ +public interface TransparentDataEncryptions { + /** + * Gets a logical database's transparent data encryption. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the logical database for which the transparent data encryption is defined. + * @param tdeName The name of the transparent data encryption configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a logical database's transparent data encryption along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + TransparentDataEncryptionName tdeName, + Context context); + + /** + * Gets a logical database's transparent data encryption. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the logical database for which the transparent data encryption is defined. + * @param tdeName The name of the transparent data encryption configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a logical database's transparent data encryption. + */ + LogicalDatabaseTransparentDataEncryption get( + String resourceGroupName, String serverName, String databaseName, TransparentDataEncryptionName tdeName); + + /** + * Gets a list of the logical database's transparent data encryption. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the logical database for which the transparent data encryption is defined. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the logical database's transparent data encryption as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName); + + /** + * Gets a list of the logical database's transparent data encryption. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the logical database for which the transparent data encryption is defined. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the logical database's transparent data encryption as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Gets a logical database's transparent data encryption. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a logical database's transparent data encryption along with {@link Response}. + */ + LogicalDatabaseTransparentDataEncryption getById(String id); + + /** + * Gets a logical database's transparent data encryption. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a logical database's transparent data encryption along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new LogicalDatabaseTransparentDataEncryption resource. + * + * @param name resource name. + * @return the first stage of the new LogicalDatabaseTransparentDataEncryption definition. + */ + LogicalDatabaseTransparentDataEncryption.DefinitionStages.Blank define(TransparentDataEncryptionName name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UnitDefinitionType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UnitDefinitionType.java new file mode 100644 index 0000000000000..e7e0a303f7186 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UnitDefinitionType.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The unit of the metric. */ +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); + } + + /** + * Gets known UnitDefinitionType values. + * + * @return known UnitDefinitionType values. + */ + public static Collection values() { + return values(UnitDefinitionType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UnitType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UnitType.java new file mode 100644 index 0000000000000..2e3d5f641ba95 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UnitType.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The unit of the metric. */ +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); + } + + /** + * Gets known UnitType values. + * + * @return known UnitType values. + */ + public static Collection values() { + return values(UnitType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UpdateLongTermRetentionBackupParameters.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UpdateLongTermRetentionBackupParameters.java new file mode 100644 index 0000000000000..4a83c330137a4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UpdateLongTermRetentionBackupParameters.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.fluent.models.UpdateLongTermRetentionBackupParametersProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Contains the information necessary to perform long term retention backup update operation. */ +@Fluent +public final class UpdateLongTermRetentionBackupParameters { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private UpdateLongTermRetentionBackupParametersProperties innerProperties; + + /** Creates an instance of UpdateLongTermRetentionBackupParameters class. */ + public UpdateLongTermRetentionBackupParameters() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private UpdateLongTermRetentionBackupParametersProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the requestedBackupStorageRedundancy property: The storage redundancy type of the copied backup. + * + * @return the requestedBackupStorageRedundancy value. + */ + public BackupStorageRedundancy requestedBackupStorageRedundancy() { + return this.innerProperties() == null ? null : this.innerProperties().requestedBackupStorageRedundancy(); + } + + /** + * Set the requestedBackupStorageRedundancy property: The storage redundancy type of the copied backup. + * + * @param requestedBackupStorageRedundancy the requestedBackupStorageRedundancy value to set. + * @return the UpdateLongTermRetentionBackupParameters object itself. + */ + public UpdateLongTermRetentionBackupParameters withRequestedBackupStorageRedundancy( + BackupStorageRedundancy requestedBackupStorageRedundancy) { + if (this.innerProperties() == null) { + this.innerProperties = new UpdateLongTermRetentionBackupParametersProperties(); + } + this.innerProperties().withRequestedBackupStorageRedundancy(requestedBackupStorageRedundancy); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UpdateVirtualClusterDnsServersOperation.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UpdateVirtualClusterDnsServersOperation.java new file mode 100644 index 0000000000000..f7584619d048d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UpdateVirtualClusterDnsServersOperation.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.UpdateVirtualClusterDnsServersOperationInner; + +/** An immutable client-side representation of UpdateVirtualClusterDnsServersOperation. */ +public interface UpdateVirtualClusterDnsServersOperation { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the status property: The status of the DNS refresh operation. + * + * @return the status value. + */ + DnsRefreshOperationStatus status(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.UpdateVirtualClusterDnsServersOperationInner + * object. + * + * @return the inner object. + */ + UpdateVirtualClusterDnsServersOperationInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UpsertManagedServerOperationParameters.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UpsertManagedServerOperationParameters.java new file mode 100644 index 0000000000000..8728e2cd5ebab --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UpsertManagedServerOperationParameters.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The UpsertManagedServerOperationParameters model. */ +@Fluent +public final class UpsertManagedServerOperationParameters { + /* + * The family property. + */ + @JsonProperty(value = "family") + private String family; + + /* + * The tier property. + */ + @JsonProperty(value = "tier") + private String tier; + + /* + * The vCores property. + */ + @JsonProperty(value = "vCores") + private Integer vCores; + + /* + * The storageSizeInGB property. + */ + @JsonProperty(value = "storageSizeInGB") + private Integer storageSizeInGB; + + /** Creates an instance of UpsertManagedServerOperationParameters class. */ + public UpsertManagedServerOperationParameters() { + } + + /** + * Get the family property: The family property. + * + * @return the family value. + */ + public String family() { + return this.family; + } + + /** + * Set the family property: The family property. + * + * @param family the family value to set. + * @return the UpsertManagedServerOperationParameters object itself. + */ + public UpsertManagedServerOperationParameters withFamily(String family) { + this.family = family; + return this; + } + + /** + * Get the tier property: The tier property. + * + * @return the tier value. + */ + public String tier() { + return this.tier; + } + + /** + * Set the tier property: The tier property. + * + * @param tier the tier value to set. + * @return the UpsertManagedServerOperationParameters object itself. + */ + public UpsertManagedServerOperationParameters withTier(String tier) { + this.tier = tier; + return this; + } + + /** + * Get the vCores property: The vCores property. + * + * @return the vCores value. + */ + public Integer vCores() { + return this.vCores; + } + + /** + * Set the vCores property: The vCores property. + * + * @param vCores the vCores value to set. + * @return the UpsertManagedServerOperationParameters object itself. + */ + public UpsertManagedServerOperationParameters withVCores(Integer vCores) { + this.vCores = vCores; + return this; + } + + /** + * Get the storageSizeInGB property: The storageSizeInGB property. + * + * @return the storageSizeInGB value. + */ + public Integer storageSizeInGB() { + return this.storageSizeInGB; + } + + /** + * Set the storageSizeInGB property: The storageSizeInGB property. + * + * @param storageSizeInGB the storageSizeInGB value to set. + * @return the UpsertManagedServerOperationParameters object itself. + */ + public UpsertManagedServerOperationParameters withStorageSizeInGB(Integer storageSizeInGB) { + this.storageSizeInGB = storageSizeInGB; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UpsertManagedServerOperationStep.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UpsertManagedServerOperationStep.java new file mode 100644 index 0000000000000..5e6cf68db3218 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UpsertManagedServerOperationStep.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The UpsertManagedServerOperationStep model. */ +@Fluent +public final class UpsertManagedServerOperationStep { + /* + * The order property. + */ + @JsonProperty(value = "order") + private Integer order; + + /* + * The name property. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The status property. + */ + @JsonProperty(value = "status") + private UpsertManagedServerOperationStepStatus status; + + /** Creates an instance of UpsertManagedServerOperationStep class. */ + public UpsertManagedServerOperationStep() { + } + + /** + * Get the order property: The order property. + * + * @return the order value. + */ + public Integer order() { + return this.order; + } + + /** + * Set the order property: The order property. + * + * @param order the order value to set. + * @return the UpsertManagedServerOperationStep object itself. + */ + public UpsertManagedServerOperationStep withOrder(Integer order) { + this.order = order; + return this; + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name property. + * + * @param name the name value to set. + * @return the UpsertManagedServerOperationStep object itself. + */ + public UpsertManagedServerOperationStep withName(String name) { + this.name = name; + return this; + } + + /** + * Get the status property: The status property. + * + * @return the status value. + */ + public UpsertManagedServerOperationStepStatus status() { + return this.status; + } + + /** + * Set the status property: The status property. + * + * @param status the status value to set. + * @return the UpsertManagedServerOperationStep object itself. + */ + public UpsertManagedServerOperationStep withStatus(UpsertManagedServerOperationStepStatus status) { + this.status = status; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UpsertManagedServerOperationStepStatus.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UpsertManagedServerOperationStepStatus.java new file mode 100644 index 0000000000000..259a70c575619 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UpsertManagedServerOperationStepStatus.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for UpsertManagedServerOperationStepStatus. */ +public final class UpsertManagedServerOperationStepStatus + extends ExpandableStringEnum { + /** Static value NotStarted for UpsertManagedServerOperationStepStatus. */ + public static final UpsertManagedServerOperationStepStatus NOT_STARTED = fromString("NotStarted"); + + /** Static value InProgress for UpsertManagedServerOperationStepStatus. */ + public static final UpsertManagedServerOperationStepStatus IN_PROGRESS = fromString("InProgress"); + + /** Static value SlowedDown for UpsertManagedServerOperationStepStatus. */ + public static final UpsertManagedServerOperationStepStatus SLOWED_DOWN = fromString("SlowedDown"); + + /** Static value Completed for UpsertManagedServerOperationStepStatus. */ + public static final UpsertManagedServerOperationStepStatus COMPLETED = fromString("Completed"); + + /** Static value Failed for UpsertManagedServerOperationStepStatus. */ + public static final UpsertManagedServerOperationStepStatus FAILED = fromString("Failed"); + + /** Static value Canceled for UpsertManagedServerOperationStepStatus. */ + public static final UpsertManagedServerOperationStepStatus CANCELED = fromString("Canceled"); + + /** + * Creates or finds a UpsertManagedServerOperationStepStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding UpsertManagedServerOperationStepStatus. + */ + @JsonCreator + public static UpsertManagedServerOperationStepStatus fromString(String name) { + return fromString(name, UpsertManagedServerOperationStepStatus.class); + } + + /** + * Gets known UpsertManagedServerOperationStepStatus values. + * + * @return known UpsertManagedServerOperationStepStatus values. + */ + public static Collection values() { + return values(UpsertManagedServerOperationStepStatus.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Usage.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Usage.java new file mode 100644 index 0000000000000..430b5f558d3ec --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Usage.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.UsageInner; + +/** An immutable client-side representation of Usage. */ +public interface Usage { + /** + * Gets the id property: Resource ID. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: Resource name. + * + * @return the name value. + */ + Name name(); + + /** + * Gets the type property: Resource type. + * + * @return the type value. + */ + String type(); + + /** + * Gets the unit property: Usage unit. + * + * @return the unit value. + */ + String unit(); + + /** + * Gets the currentValue property: Usage current value. + * + * @return the currentValue value. + */ + Integer currentValue(); + + /** + * Gets the limit property: Usage limit. + * + * @return the limit value. + */ + Integer limit(); + + /** + * Gets the requestedLimit property: Usage requested limit. + * + * @return the requestedLimit value. + */ + Integer requestedLimit(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.UsageInner object. + * + * @return the inner object. + */ + UsageInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UsageListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UsageListResult.java new file mode 100644 index 0000000000000..b10c9d83ad612 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UsageListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.UsageInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of usages. */ +@Immutable +public final class UsageListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of UsageListResult class. */ + public UsageListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Usages.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Usages.java new file mode 100644 index 0000000000000..d48ad3b225259 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/Usages.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Usages. */ +public interface Usages { + /** + * Gets all instance pool usage metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all instance pool usage metrics as paginated response with {@link PagedIterable}. + */ + PagedIterable listByInstancePool(String resourceGroupName, String instancePoolName); + + /** + * Gets all instance pool usage metrics. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param instancePoolName The name of the instance pool to be retrieved. + * @param expandChildren Optional request parameter to include managed instance usages within the instance pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all instance pool usage metrics as paginated response with {@link PagedIterable}. + */ + PagedIterable listByInstancePool( + String resourceGroupName, String instancePoolName, Boolean expandChildren, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UserIdentity.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UserIdentity.java new file mode 100644 index 0000000000000..16207b721b470 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/UserIdentity.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +/** Azure Active Directory identity configuration for a resource. */ +@Immutable +public class UserIdentity { + /* + * The Azure Active Directory principal id. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private UUID principalId; + + /* + * The Azure Active Directory client id. + */ + @JsonProperty(value = "clientId", access = JsonProperty.Access.WRITE_ONLY) + private UUID clientId; + + /** Creates an instance of UserIdentity class. */ + public UserIdentity() { + } + + /** + * Get the principalId property: The Azure Active Directory principal id. + * + * @return the principalId value. + */ + public UUID principalId() { + return this.principalId; + } + + /** + * Get the clientId property: The Azure Active Directory client id. + * + * @return the clientId value. + */ + public UUID clientId() { + return this.clientId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VaRule.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VaRule.java new file mode 100644 index 0000000000000..dea955c02fff1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VaRule.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** SQL Vulnerability Assessment rule metadata details. */ +@Immutable +public final class VaRule { + /* + * SQL Vulnerability Assessment rule Id. + */ + @JsonProperty(value = "ruleId", access = JsonProperty.Access.WRITE_ONLY) + private String ruleId; + + /* + * SQL Vulnerability Assessment rule severity. + */ + @JsonProperty(value = "severity", access = JsonProperty.Access.WRITE_ONLY) + private RuleSeverity severity; + + /* + * SQL Vulnerability Assessment rule category. + */ + @JsonProperty(value = "category", access = JsonProperty.Access.WRITE_ONLY) + private String category; + + /* + * SQL Vulnerability Assessment rule type. + */ + @JsonProperty(value = "ruleType", access = JsonProperty.Access.WRITE_ONLY) + private RuleType ruleType; + + /* + * SQL Vulnerability Assessment rule title. + */ + @JsonProperty(value = "title", access = JsonProperty.Access.WRITE_ONLY) + private String title; + + /* + * SQL Vulnerability Assessment rule description. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /* + * SQL Vulnerability Assessment rule rationale. + */ + @JsonProperty(value = "rationale", access = JsonProperty.Access.WRITE_ONLY) + private String rationale; + + /* + * SQL Vulnerability Assessment rule query details. + */ + @JsonProperty(value = "queryCheck", access = JsonProperty.Access.WRITE_ONLY) + private QueryCheck queryCheck; + + /* + * SQL Vulnerability Assessment benchmark references. + */ + @JsonProperty(value = "benchmarkReferences", access = JsonProperty.Access.WRITE_ONLY) + private List benchmarkReferences; + + /** Creates an instance of VaRule class. */ + public VaRule() { + } + + /** + * Get the ruleId property: SQL Vulnerability Assessment rule Id. + * + * @return the ruleId value. + */ + public String ruleId() { + return this.ruleId; + } + + /** + * Get the severity property: SQL Vulnerability Assessment rule severity. + * + * @return the severity value. + */ + public RuleSeverity severity() { + return this.severity; + } + + /** + * Get the category property: SQL Vulnerability Assessment rule category. + * + * @return the category value. + */ + public String category() { + return this.category; + } + + /** + * Get the ruleType property: SQL Vulnerability Assessment rule type. + * + * @return the ruleType value. + */ + public RuleType ruleType() { + return this.ruleType; + } + + /** + * Get the title property: SQL Vulnerability Assessment rule title. + * + * @return the title value. + */ + public String title() { + return this.title; + } + + /** + * Get the description property: SQL Vulnerability Assessment rule description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the rationale property: SQL Vulnerability Assessment rule rationale. + * + * @return the rationale value. + */ + public String rationale() { + return this.rationale; + } + + /** + * Get the queryCheck property: SQL Vulnerability Assessment rule query details. + * + * @return the queryCheck value. + */ + public QueryCheck queryCheck() { + return this.queryCheck; + } + + /** + * Get the benchmarkReferences property: SQL Vulnerability Assessment benchmark references. + * + * @return the benchmarkReferences value. + */ + public List benchmarkReferences() { + return this.benchmarkReferences; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (queryCheck() != null) { + queryCheck().validate(); + } + if (benchmarkReferences() != null) { + benchmarkReferences().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualCluster.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualCluster.java new file mode 100644 index 0000000000000..c523a5ac43e19 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualCluster.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.VirtualClusterInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of VirtualCluster. */ +public interface VirtualCluster { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the subnetId property: Subnet resource ID for the virtual cluster. + * + * @return the subnetId value. + */ + String subnetId(); + + /** + * Gets the version property: Virtual cluster version. + * + * @return the version value. + */ + String version(); + + /** + * Gets the childResources property: List of resources in this virtual cluster. + * + * @return the childResources value. + */ + List childResources(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.VirtualClusterInner object. + * + * @return the inner object. + */ + VirtualClusterInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualClusterListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualClusterListResult.java new file mode 100644 index 0000000000000..9ad7e608bbcce --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualClusterListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.VirtualClusterInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of virtual clusters. */ +@Immutable +public final class VirtualClusterListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of VirtualClusterListResult class. */ + public VirtualClusterListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualClusterUpdate.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualClusterUpdate.java new file mode 100644 index 0000000000000..20c822548370b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualClusterUpdate.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.sql.generated.fluent.models.VirtualClusterProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** An update request for virtual cluster. */ +@Fluent +public final class VirtualClusterUpdate { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private VirtualClusterProperties innerProperties; + + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** Creates an instance of VirtualClusterUpdate class. */ + public VirtualClusterUpdate() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private VirtualClusterProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the VirtualClusterUpdate object itself. + */ + public VirtualClusterUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the subnetId property: Subnet resource ID for the virtual cluster. + * + * @return the subnetId value. + */ + public String subnetId() { + return this.innerProperties() == null ? null : this.innerProperties().subnetId(); + } + + /** + * Get the version property: Virtual cluster version. + * + * @return the version value. + */ + public String version() { + return this.innerProperties() == null ? null : this.innerProperties().version(); + } + + /** + * Set the version property: Virtual cluster version. + * + * @param version the version value to set. + * @return the VirtualClusterUpdate object itself. + */ + public VirtualClusterUpdate withVersion(String version) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualClusterProperties(); + } + this.innerProperties().withVersion(version); + return this; + } + + /** + * Get the childResources property: List of resources in this virtual cluster. + * + * @return the childResources value. + */ + public List childResources() { + return this.innerProperties() == null ? null : this.innerProperties().childResources(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualClusters.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualClusters.java new file mode 100644 index 0000000000000..44ff7372ea6fb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualClusters.java @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of VirtualClusters. */ +public interface VirtualClusters { + /** + * Gets a list of all virtualClusters in the subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all virtualClusters in the subscription as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Gets a list of all virtualClusters in the subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all virtualClusters in the subscription as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual clusters in a resource group as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual clusters in a resource group as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual cluster along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String virtualClusterName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual cluster. + */ + VirtualCluster getByResourceGroup(String resourceGroupName, String virtualClusterName); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String virtualClusterName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String virtualClusterName, Context context); + + /** + * Updates an existing 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 virtual cluster resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL virtual cluster. + */ + VirtualCluster update(String resourceGroupName, String virtualClusterName, VirtualClusterUpdate parameters); + + /** + * Updates an existing 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 virtual cluster resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure SQL virtual cluster. + */ + VirtualCluster update( + String resourceGroupName, String virtualClusterName, VirtualClusterUpdate parameters, Context context); + + /** + * Synchronizes the DNS server settings used by the managed instances inside the given 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a refresh DNS servers operation. + */ + UpdateVirtualClusterDnsServersOperation updateDnsServers(String resourceGroupName, String virtualClusterName); + + /** + * Synchronizes the DNS server settings used by the managed instances inside the given 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a refresh DNS servers operation. + */ + UpdateVirtualClusterDnsServersOperation updateDnsServers( + String resourceGroupName, String virtualClusterName, Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualNetworkRule.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualNetworkRule.java new file mode 100644 index 0000000000000..7bf116a64b740 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualNetworkRule.java @@ -0,0 +1,198 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.VirtualNetworkRuleInner; + +/** An immutable client-side representation of VirtualNetworkRule. */ +public interface VirtualNetworkRule { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the virtualNetworkSubnetId property: The ARM resource id of the virtual network subnet. + * + * @return the virtualNetworkSubnetId value. + */ + String virtualNetworkSubnetId(); + + /** + * Gets the ignoreMissingVnetServiceEndpoint property: Create firewall rule before the virtual network has vnet + * service endpoint enabled. + * + * @return the ignoreMissingVnetServiceEndpoint value. + */ + Boolean ignoreMissingVnetServiceEndpoint(); + + /** + * Gets the state property: Virtual Network Rule State. + * + * @return the state value. + */ + VirtualNetworkRuleState state(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.VirtualNetworkRuleInner object. + * + * @return the inner object. + */ + VirtualNetworkRuleInner innerModel(); + + /** The entirety of the VirtualNetworkRule definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The VirtualNetworkRule definition stages. */ + interface DefinitionStages { + /** The first stage of the VirtualNetworkRule definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the VirtualNetworkRule definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @return the next definition stage. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + /** + * The stage of the VirtualNetworkRule definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithVirtualNetworkSubnetId, DefinitionStages.WithIgnoreMissingVnetServiceEndpoint { + /** + * Executes the create request. + * + * @return the created resource. + */ + VirtualNetworkRule create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + VirtualNetworkRule create(Context context); + } + /** The stage of the VirtualNetworkRule definition allowing to specify virtualNetworkSubnetId. */ + interface WithVirtualNetworkSubnetId { + /** + * Specifies the virtualNetworkSubnetId property: The ARM resource id of the virtual network subnet.. + * + * @param virtualNetworkSubnetId The ARM resource id of the virtual network subnet. + * @return the next definition stage. + */ + WithCreate withVirtualNetworkSubnetId(String virtualNetworkSubnetId); + } + /** The stage of the VirtualNetworkRule definition allowing to specify ignoreMissingVnetServiceEndpoint. */ + interface WithIgnoreMissingVnetServiceEndpoint { + /** + * Specifies the ignoreMissingVnetServiceEndpoint property: Create firewall rule before the virtual network + * has vnet service endpoint enabled.. + * + * @param ignoreMissingVnetServiceEndpoint Create firewall rule before the virtual network has vnet service + * endpoint enabled. + * @return the next definition stage. + */ + WithCreate withIgnoreMissingVnetServiceEndpoint(Boolean ignoreMissingVnetServiceEndpoint); + } + } + /** + * Begins update for the VirtualNetworkRule resource. + * + * @return the stage of resource update. + */ + VirtualNetworkRule.Update update(); + + /** The template for VirtualNetworkRule update. */ + interface Update + extends UpdateStages.WithVirtualNetworkSubnetId, UpdateStages.WithIgnoreMissingVnetServiceEndpoint { + /** + * Executes the update request. + * + * @return the updated resource. + */ + VirtualNetworkRule apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + VirtualNetworkRule apply(Context context); + } + /** The VirtualNetworkRule update stages. */ + interface UpdateStages { + /** The stage of the VirtualNetworkRule update allowing to specify virtualNetworkSubnetId. */ + interface WithVirtualNetworkSubnetId { + /** + * Specifies the virtualNetworkSubnetId property: The ARM resource id of the virtual network subnet.. + * + * @param virtualNetworkSubnetId The ARM resource id of the virtual network subnet. + * @return the next definition stage. + */ + Update withVirtualNetworkSubnetId(String virtualNetworkSubnetId); + } + /** The stage of the VirtualNetworkRule update allowing to specify ignoreMissingVnetServiceEndpoint. */ + interface WithIgnoreMissingVnetServiceEndpoint { + /** + * Specifies the ignoreMissingVnetServiceEndpoint property: Create firewall rule before the virtual network + * has vnet service endpoint enabled.. + * + * @param ignoreMissingVnetServiceEndpoint Create firewall rule before the virtual network has vnet service + * endpoint enabled. + * @return the next definition stage. + */ + Update withIgnoreMissingVnetServiceEndpoint(Boolean ignoreMissingVnetServiceEndpoint); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + VirtualNetworkRule refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + VirtualNetworkRule refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualNetworkRuleListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualNetworkRuleListResult.java new file mode 100644 index 0000000000000..ea2e91d44398a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualNetworkRuleListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.VirtualNetworkRuleInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of virtual network rules. */ +@Immutable +public final class VirtualNetworkRuleListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of VirtualNetworkRuleListResult class. */ + public VirtualNetworkRuleListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualNetworkRuleState.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualNetworkRuleState.java new file mode 100644 index 0000000000000..8ebee21ccd91c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualNetworkRuleState.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Virtual Network Rule State. */ +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 Failed for VirtualNetworkRuleState. */ + public static final VirtualNetworkRuleState FAILED = fromString("Failed"); + + /** 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); + } + + /** + * Gets known VirtualNetworkRuleState values. + * + * @return known VirtualNetworkRuleState values. + */ + public static Collection values() { + return values(VirtualNetworkRuleState.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualNetworkRules.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualNetworkRules.java new file mode 100644 index 0000000000000..9bf1c3c6a3ee9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VirtualNetworkRules.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of VirtualNetworkRules. */ +public interface VirtualNetworkRules { + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule. + */ + VirtualNetworkRule get(String resourceGroupName, String serverName, String virtualNetworkRuleName); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, String virtualNetworkRuleName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context); + + /** + * 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 com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual network rules in a server as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual network rules in a server as paginated response with {@link PagedIterable}. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * Gets a virtual network rule. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule along with {@link Response}. + */ + VirtualNetworkRule getById(String id); + + /** + * Gets a virtual network rule. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the virtual network rule with the given name. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes the virtual network rule with the given name. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new VirtualNetworkRule resource. + * + * @param name resource name. + * @return the first stage of the new VirtualNetworkRule definition. + */ + VirtualNetworkRule.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentName.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentName.java new file mode 100644 index 0000000000000..e7bde828d4625 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentName.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for VulnerabilityAssessmentName. */ +public final class VulnerabilityAssessmentName extends ExpandableStringEnum { + /** Static value default for VulnerabilityAssessmentName. */ + public static final VulnerabilityAssessmentName DEFAULT = fromString("default"); + + /** + * Creates or finds a VulnerabilityAssessmentName from its string representation. + * + * @param name a name to look for. + * @return the corresponding VulnerabilityAssessmentName. + */ + @JsonCreator + public static VulnerabilityAssessmentName fromString(String name) { + return fromString(name, VulnerabilityAssessmentName.class); + } + + /** + * Gets known VulnerabilityAssessmentName values. + * + * @return known VulnerabilityAssessmentName values. + */ + public static Collection values() { + return values(VulnerabilityAssessmentName.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentPolicyBaselineName.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentPolicyBaselineName.java new file mode 100644 index 0000000000000..e388090985051 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentPolicyBaselineName.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +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 final 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) { + if (value == null) { + return null; + } + VulnerabilityAssessmentPolicyBaselineName[] items = VulnerabilityAssessmentPolicyBaselineName.values(); + for (VulnerabilityAssessmentPolicyBaselineName item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentRecurringScansProperties.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentRecurringScansProperties.java new file mode 100644 index 0000000000000..6023cf8fbad3b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentRecurringScansProperties.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of a Vulnerability Assessment recurring scans. */ +@Fluent +public final 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; + + /** Creates an instance of VulnerabilityAssessmentRecurringScansProperties class. */ + public VulnerabilityAssessmentRecurringScansProperties() { + } + + /** + * Get the isEnabled property: Recurring scans state. + * + * @return the isEnabled value. + */ + public Boolean isEnabled() { + return this.isEnabled; + } + + /** + * Set the isEnabled property: 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 the emailSubscriptionAdmins property: 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 the emailSubscriptionAdmins property: 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 the emails property: 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 the emails property: 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentScanError.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentScanError.java new file mode 100644 index 0000000000000..f9f070f0e3f98 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentScanError.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a vulnerability assessment scan error. */ +@Immutable +public final 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; + + /** Creates an instance of VulnerabilityAssessmentScanError class. */ + public VulnerabilityAssessmentScanError() { + } + + /** + * Get the code property: The error code. + * + * @return the code value. + */ + public String code() { + return this.code; + } + + /** + * Get the message property: The error message. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentScanRecord.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentScanRecord.java new file mode 100644 index 0000000000000..3462920d35a60 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentScanRecord.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.resourcemanager.sql.generated.fluent.models.VulnerabilityAssessmentScanRecordInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of VulnerabilityAssessmentScanRecord. */ +public interface VulnerabilityAssessmentScanRecord { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the scanId property: The scan ID. + * + * @return the scanId value. + */ + String scanId(); + + /** + * Gets the triggerType property: The scan trigger type. + * + * @return the triggerType value. + */ + VulnerabilityAssessmentScanTriggerType triggerType(); + + /** + * Gets the state property: The scan status. + * + * @return the state value. + */ + VulnerabilityAssessmentScanState state(); + + /** + * Gets the startTime property: The scan start time (UTC). + * + * @return the startTime value. + */ + OffsetDateTime startTime(); + + /** + * Gets the endTime property: The scan end time (UTC). + * + * @return the endTime value. + */ + OffsetDateTime endTime(); + + /** + * Gets the errors property: The scan errors. + * + * @return the errors value. + */ + List errors(); + + /** + * Gets the storageContainerPath property: The scan results storage container path. + * + * @return the storageContainerPath value. + */ + String storageContainerPath(); + + /** + * Gets the numberOfFailedSecurityChecks property: The number of failed security checks. + * + * @return the numberOfFailedSecurityChecks value. + */ + Integer numberOfFailedSecurityChecks(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.VulnerabilityAssessmentScanRecordInner + * object. + * + * @return the inner object. + */ + VulnerabilityAssessmentScanRecordInner innerModel(); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentScanRecordListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentScanRecordListResult.java new file mode 100644 index 0000000000000..2ea3c8051151f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentScanRecordListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.VulnerabilityAssessmentScanRecordInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of vulnerability assessment scan records. */ +@Immutable +public final class VulnerabilityAssessmentScanRecordListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of VulnerabilityAssessmentScanRecordListResult class. */ + public VulnerabilityAssessmentScanRecordListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentScanState.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentScanState.java new file mode 100644 index 0000000000000..1dfe3c8d51803 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentScanState.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The scan status. */ +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); + } + + /** + * Gets known VulnerabilityAssessmentScanState values. + * + * @return known VulnerabilityAssessmentScanState values. + */ + public static Collection values() { + return values(VulnerabilityAssessmentScanState.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentScanTriggerType.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentScanTriggerType.java new file mode 100644 index 0000000000000..dc2bd8df9e16a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/VulnerabilityAssessmentScanTriggerType.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The scan trigger type. */ +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); + } + + /** + * Gets known VulnerabilityAssessmentScanTriggerType values. + * + * @return known VulnerabilityAssessmentScanTriggerType values. + */ + public static Collection values() { + return values(VulnerabilityAssessmentScanTriggerType.class); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/WorkloadClassifier.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/WorkloadClassifier.java new file mode 100644 index 0000000000000..8f4fcb5a1ba26 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/WorkloadClassifier.java @@ -0,0 +1,307 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.WorkloadClassifierInner; + +/** An immutable client-side representation of WorkloadClassifier. */ +public interface WorkloadClassifier { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the memberName property: The workload classifier member name. + * + * @return the memberName value. + */ + String memberName(); + + /** + * Gets the label property: The workload classifier label. + * + * @return the label value. + */ + String label(); + + /** + * Gets the context property: The workload classifier context. + * + * @return the context value. + */ + String context(); + + /** + * Gets the startTime property: The workload classifier start time for classification. + * + * @return the startTime value. + */ + String startTime(); + + /** + * Gets the endTime property: The workload classifier end time for classification. + * + * @return the endTime value. + */ + String endTime(); + + /** + * Gets the importance property: The workload classifier importance. + * + * @return the importance value. + */ + String importance(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.WorkloadClassifierInner object. + * + * @return the inner object. + */ + WorkloadClassifierInner innerModel(); + + /** The entirety of the WorkloadClassifier definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The WorkloadClassifier definition stages. */ + interface DefinitionStages { + /** The first stage of the WorkloadClassifier definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the WorkloadClassifier definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName, databaseName, workloadGroupName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @return the next definition stage. + */ + WithCreate withExistingWorkloadGroup( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName); + } + /** + * The stage of the WorkloadClassifier definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithMemberName, + DefinitionStages.WithLabel, + DefinitionStages.WithContext, + DefinitionStages.WithStartTime, + DefinitionStages.WithEndTime, + DefinitionStages.WithImportance { + /** + * Executes the create request. + * + * @return the created resource. + */ + WorkloadClassifier create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + WorkloadClassifier create(Context context); + } + /** The stage of the WorkloadClassifier definition allowing to specify memberName. */ + interface WithMemberName { + /** + * Specifies the memberName property: The workload classifier member name.. + * + * @param memberName The workload classifier member name. + * @return the next definition stage. + */ + WithCreate withMemberName(String memberName); + } + /** The stage of the WorkloadClassifier definition allowing to specify label. */ + interface WithLabel { + /** + * Specifies the label property: The workload classifier label.. + * + * @param label The workload classifier label. + * @return the next definition stage. + */ + WithCreate withLabel(String label); + } + /** The stage of the WorkloadClassifier definition allowing to specify context. */ + interface WithContext { + /** + * Specifies the context property: The workload classifier context.. + * + * @param context The workload classifier context. + * @return the next definition stage. + */ + WithCreate withContext(String context); + } + /** The stage of the WorkloadClassifier definition allowing to specify startTime. */ + interface WithStartTime { + /** + * Specifies the startTime property: The workload classifier start time for classification.. + * + * @param startTime The workload classifier start time for classification. + * @return the next definition stage. + */ + WithCreate withStartTime(String startTime); + } + /** The stage of the WorkloadClassifier definition allowing to specify endTime. */ + interface WithEndTime { + /** + * Specifies the endTime property: The workload classifier end time for classification.. + * + * @param endTime The workload classifier end time for classification. + * @return the next definition stage. + */ + WithCreate withEndTime(String endTime); + } + /** The stage of the WorkloadClassifier definition allowing to specify importance. */ + interface WithImportance { + /** + * Specifies the importance property: The workload classifier importance.. + * + * @param importance The workload classifier importance. + * @return the next definition stage. + */ + WithCreate withImportance(String importance); + } + } + /** + * Begins update for the WorkloadClassifier resource. + * + * @return the stage of resource update. + */ + WorkloadClassifier.Update update(); + + /** The template for WorkloadClassifier update. */ + interface Update + extends UpdateStages.WithMemberName, + UpdateStages.WithLabel, + UpdateStages.WithContext, + UpdateStages.WithStartTime, + UpdateStages.WithEndTime, + UpdateStages.WithImportance { + /** + * Executes the update request. + * + * @return the updated resource. + */ + WorkloadClassifier apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + WorkloadClassifier apply(Context context); + } + /** The WorkloadClassifier update stages. */ + interface UpdateStages { + /** The stage of the WorkloadClassifier update allowing to specify memberName. */ + interface WithMemberName { + /** + * Specifies the memberName property: The workload classifier member name.. + * + * @param memberName The workload classifier member name. + * @return the next definition stage. + */ + Update withMemberName(String memberName); + } + /** The stage of the WorkloadClassifier update allowing to specify label. */ + interface WithLabel { + /** + * Specifies the label property: The workload classifier label.. + * + * @param label The workload classifier label. + * @return the next definition stage. + */ + Update withLabel(String label); + } + /** The stage of the WorkloadClassifier update allowing to specify context. */ + interface WithContext { + /** + * Specifies the context property: The workload classifier context.. + * + * @param context The workload classifier context. + * @return the next definition stage. + */ + Update withContext(String context); + } + /** The stage of the WorkloadClassifier update allowing to specify startTime. */ + interface WithStartTime { + /** + * Specifies the startTime property: The workload classifier start time for classification.. + * + * @param startTime The workload classifier start time for classification. + * @return the next definition stage. + */ + Update withStartTime(String startTime); + } + /** The stage of the WorkloadClassifier update allowing to specify endTime. */ + interface WithEndTime { + /** + * Specifies the endTime property: The workload classifier end time for classification.. + * + * @param endTime The workload classifier end time for classification. + * @return the next definition stage. + */ + Update withEndTime(String endTime); + } + /** The stage of the WorkloadClassifier update allowing to specify importance. */ + interface WithImportance { + /** + * Specifies the importance property: The workload classifier importance.. + * + * @param importance The workload classifier importance. + * @return the next definition stage. + */ + Update withImportance(String importance); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + WorkloadClassifier refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + WorkloadClassifier refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/WorkloadClassifierListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/WorkloadClassifierListResult.java new file mode 100644 index 0000000000000..6862d16301703 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/WorkloadClassifierListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.WorkloadClassifierInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of workload classifiers for a workload group. */ +@Immutable +public final class WorkloadClassifierListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of WorkloadClassifierListResult class. */ + public WorkloadClassifierListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/WorkloadClassifiers.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/WorkloadClassifiers.java new file mode 100644 index 0000000000000..bfea85a94c333 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/WorkloadClassifiers.java @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of WorkloadClassifiers. */ +public interface WorkloadClassifiers { + /** + * Gets a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workload classifier along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName, + Context context); + + /** + * Gets a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workload classifier. + */ + WorkloadClassifier get( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName); + + /** + * Deletes a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName); + + /** + * Deletes a workload classifier. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param workloadGroupName The name of the workload group from which to receive the classifier from. + * @param workloadClassifierName The name of the workload classifier to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete( + String resourceGroupName, + String serverName, + String databaseName, + String workloadGroupName, + String workloadClassifierName, + Context context); + + /** + * Gets the list of workload classifiers for a workload 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. + * @param workloadGroupName The name of the workload group from which to receive the classifiers from. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 of workload classifiers for a workload group as paginated response with {@link PagedIterable}. + */ + PagedIterable listByWorkloadGroup( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName); + + /** + * Gets the list of workload classifiers for a workload 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. + * @param workloadGroupName The name of the workload group from which to receive the classifiers from. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 of workload classifiers for a workload group as paginated response with {@link PagedIterable}. + */ + PagedIterable listByWorkloadGroup( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName, Context context); + + /** + * Gets a workload classifier. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workload classifier along with {@link Response}. + */ + WorkloadClassifier getById(String id); + + /** + * Gets a workload classifier. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workload classifier along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a workload classifier. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a workload classifier. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new WorkloadClassifier resource. + * + * @param name resource name. + * @return the first stage of the new WorkloadClassifier definition. + */ + WorkloadClassifier.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/WorkloadGroup.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/WorkloadGroup.java new file mode 100644 index 0000000000000..c2d8b4531e7b6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/WorkloadGroup.java @@ -0,0 +1,309 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.WorkloadGroupInner; + +/** An immutable client-side representation of WorkloadGroup. */ +public interface WorkloadGroup { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the minResourcePercent property: The workload group minimum percentage resource. + * + * @return the minResourcePercent value. + */ + int minResourcePercent(); + + /** + * Gets the maxResourcePercent property: The workload group cap percentage resource. + * + * @return the maxResourcePercent value. + */ + int maxResourcePercent(); + + /** + * Gets the minResourcePercentPerRequest property: The workload group request minimum grant percentage. + * + * @return the minResourcePercentPerRequest value. + */ + double minResourcePercentPerRequest(); + + /** + * Gets the maxResourcePercentPerRequest property: The workload group request maximum grant percentage. + * + * @return the maxResourcePercentPerRequest value. + */ + Double maxResourcePercentPerRequest(); + + /** + * Gets the importance property: The workload group importance level. + * + * @return the importance value. + */ + String importance(); + + /** + * Gets the queryExecutionTimeout property: The workload group query execution timeout. + * + * @return the queryExecutionTimeout value. + */ + Integer queryExecutionTimeout(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.sql.generated.fluent.models.WorkloadGroupInner object. + * + * @return the inner object. + */ + WorkloadGroupInner innerModel(); + + /** The entirety of the WorkloadGroup definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The WorkloadGroup definition stages. */ + interface DefinitionStages { + /** The first stage of the WorkloadGroup definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the WorkloadGroup definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName, databaseName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @return the next definition stage. + */ + WithCreate withExistingDatabase(String resourceGroupName, String serverName, String databaseName); + } + /** + * The stage of the WorkloadGroup definition which contains all the minimum required properties for the resource + * to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithMinResourcePercent, + DefinitionStages.WithMaxResourcePercent, + DefinitionStages.WithMinResourcePercentPerRequest, + DefinitionStages.WithMaxResourcePercentPerRequest, + DefinitionStages.WithImportance, + DefinitionStages.WithQueryExecutionTimeout { + /** + * Executes the create request. + * + * @return the created resource. + */ + WorkloadGroup create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + WorkloadGroup create(Context context); + } + /** The stage of the WorkloadGroup definition allowing to specify minResourcePercent. */ + interface WithMinResourcePercent { + /** + * Specifies the minResourcePercent property: The workload group minimum percentage resource.. + * + * @param minResourcePercent The workload group minimum percentage resource. + * @return the next definition stage. + */ + WithCreate withMinResourcePercent(int minResourcePercent); + } + /** The stage of the WorkloadGroup definition allowing to specify maxResourcePercent. */ + interface WithMaxResourcePercent { + /** + * Specifies the maxResourcePercent property: The workload group cap percentage resource.. + * + * @param maxResourcePercent The workload group cap percentage resource. + * @return the next definition stage. + */ + WithCreate withMaxResourcePercent(int maxResourcePercent); + } + /** The stage of the WorkloadGroup definition allowing to specify minResourcePercentPerRequest. */ + interface WithMinResourcePercentPerRequest { + /** + * Specifies the minResourcePercentPerRequest property: The workload group request minimum grant + * percentage.. + * + * @param minResourcePercentPerRequest The workload group request minimum grant percentage. + * @return the next definition stage. + */ + WithCreate withMinResourcePercentPerRequest(double minResourcePercentPerRequest); + } + /** The stage of the WorkloadGroup definition allowing to specify maxResourcePercentPerRequest. */ + interface WithMaxResourcePercentPerRequest { + /** + * Specifies the maxResourcePercentPerRequest property: The workload group request maximum grant + * percentage.. + * + * @param maxResourcePercentPerRequest The workload group request maximum grant percentage. + * @return the next definition stage. + */ + WithCreate withMaxResourcePercentPerRequest(Double maxResourcePercentPerRequest); + } + /** The stage of the WorkloadGroup definition allowing to specify importance. */ + interface WithImportance { + /** + * Specifies the importance property: The workload group importance level.. + * + * @param importance The workload group importance level. + * @return the next definition stage. + */ + WithCreate withImportance(String importance); + } + /** The stage of the WorkloadGroup definition allowing to specify queryExecutionTimeout. */ + interface WithQueryExecutionTimeout { + /** + * Specifies the queryExecutionTimeout property: The workload group query execution timeout.. + * + * @param queryExecutionTimeout The workload group query execution timeout. + * @return the next definition stage. + */ + WithCreate withQueryExecutionTimeout(Integer queryExecutionTimeout); + } + } + /** + * Begins update for the WorkloadGroup resource. + * + * @return the stage of resource update. + */ + WorkloadGroup.Update update(); + + /** The template for WorkloadGroup update. */ + interface Update + extends UpdateStages.WithMinResourcePercent, + UpdateStages.WithMaxResourcePercent, + UpdateStages.WithMinResourcePercentPerRequest, + UpdateStages.WithMaxResourcePercentPerRequest, + UpdateStages.WithImportance, + UpdateStages.WithQueryExecutionTimeout { + /** + * Executes the update request. + * + * @return the updated resource. + */ + WorkloadGroup apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + WorkloadGroup apply(Context context); + } + /** The WorkloadGroup update stages. */ + interface UpdateStages { + /** The stage of the WorkloadGroup update allowing to specify minResourcePercent. */ + interface WithMinResourcePercent { + /** + * Specifies the minResourcePercent property: The workload group minimum percentage resource.. + * + * @param minResourcePercent The workload group minimum percentage resource. + * @return the next definition stage. + */ + Update withMinResourcePercent(int minResourcePercent); + } + /** The stage of the WorkloadGroup update allowing to specify maxResourcePercent. */ + interface WithMaxResourcePercent { + /** + * Specifies the maxResourcePercent property: The workload group cap percentage resource.. + * + * @param maxResourcePercent The workload group cap percentage resource. + * @return the next definition stage. + */ + Update withMaxResourcePercent(int maxResourcePercent); + } + /** The stage of the WorkloadGroup update allowing to specify minResourcePercentPerRequest. */ + interface WithMinResourcePercentPerRequest { + /** + * Specifies the minResourcePercentPerRequest property: The workload group request minimum grant + * percentage.. + * + * @param minResourcePercentPerRequest The workload group request minimum grant percentage. + * @return the next definition stage. + */ + Update withMinResourcePercentPerRequest(double minResourcePercentPerRequest); + } + /** The stage of the WorkloadGroup update allowing to specify maxResourcePercentPerRequest. */ + interface WithMaxResourcePercentPerRequest { + /** + * Specifies the maxResourcePercentPerRequest property: The workload group request maximum grant + * percentage.. + * + * @param maxResourcePercentPerRequest The workload group request maximum grant percentage. + * @return the next definition stage. + */ + Update withMaxResourcePercentPerRequest(Double maxResourcePercentPerRequest); + } + /** The stage of the WorkloadGroup update allowing to specify importance. */ + interface WithImportance { + /** + * Specifies the importance property: The workload group importance level.. + * + * @param importance The workload group importance level. + * @return the next definition stage. + */ + Update withImportance(String importance); + } + /** The stage of the WorkloadGroup update allowing to specify queryExecutionTimeout. */ + interface WithQueryExecutionTimeout { + /** + * Specifies the queryExecutionTimeout property: The workload group query execution timeout.. + * + * @param queryExecutionTimeout The workload group query execution timeout. + * @return the next definition stage. + */ + Update withQueryExecutionTimeout(Integer queryExecutionTimeout); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + WorkloadGroup refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + WorkloadGroup refresh(Context context); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/WorkloadGroupListResult.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/WorkloadGroupListResult.java new file mode 100644 index 0000000000000..b09bfffa6e00c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/WorkloadGroupListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.sql.generated.fluent.models.WorkloadGroupInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of workload groups. */ +@Immutable +public final class WorkloadGroupListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of WorkloadGroupListResult class. */ + public WorkloadGroupListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/WorkloadGroups.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/WorkloadGroups.java new file mode 100644 index 0000000000000..199cd2cd736b5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/WorkloadGroups.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of WorkloadGroups. */ +public interface WorkloadGroups { + /** + * Gets a workload 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. + * @param workloadGroupName The name of the workload group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workload group along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName, Context context); + + /** + * Gets a workload 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. + * @param workloadGroupName The name of the workload group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workload group. + */ + WorkloadGroup get(String resourceGroupName, String serverName, String databaseName, String workloadGroupName); + + /** + * Deletes a workload 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. + * @param workloadGroupName The name of the workload group to delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, String databaseName, String workloadGroupName); + + /** + * Deletes a workload 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. + * @param workloadGroupName The name of the workload group to delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete( + String resourceGroupName, String serverName, String databaseName, String workloadGroupName, Context context); + + /** + * Gets the list of workload 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 serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of workload groups as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase(String resourceGroupName, String serverName, String databaseName); + + /** + * Gets the list of workload 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 serverName The name of the server. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of workload groups as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDatabase( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * Gets a workload group. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workload group along with {@link Response}. + */ + WorkloadGroup getById(String id); + + /** + * Gets a workload group. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a workload group along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a workload group. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a workload group. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new WorkloadGroup resource. + * + * @param name resource name. + * @return the first stage of the new WorkloadGroup definition. + */ + WorkloadGroup.DefinitionStages.Blank define(String name); +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/package-info.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/package-info.java new file mode 100644 index 0000000000000..fb71684b644c0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/models/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the data models 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.azure.resourcemanager.sql.generated.models; diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/package-info.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/package-info.java new file mode 100644 index 0000000000000..fa68b1391785b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/com/azure/resourcemanager/sql/generated/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing 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.azure.resourcemanager.sql.generated; diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/module-info.java b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/module-info.java new file mode 100644 index 0000000000000..509be326e0f38 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/main/java/module-info.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.resourcemanager.sql.generated { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.sql.generated; + exports com.azure.resourcemanager.sql.generated.fluent; + exports com.azure.resourcemanager.sql.generated.fluent.models; + exports com.azure.resourcemanager.sql.generated.models; + + opens com.azure.resourcemanager.sql.generated.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.sql.generated.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/BackupShortTermRetentionPoliciesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/BackupShortTermRetentionPoliciesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..006a878496b38 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/BackupShortTermRetentionPoliciesCreateOrUpdateSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.resourcemanager.sql.generated.models.DiffBackupIntervalInHours; +import com.azure.resourcemanager.sql.generated.models.ShortTermRetentionPolicyName; + +/** Samples for BackupShortTermRetentionPolicies CreateOrUpdate. */ +public final class BackupShortTermRetentionPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/UpdateShortTermRetentionPolicy.json + */ + /** + * Sample code: Update the short term retention policy for the database. + * + * @param manager Entry point to SqlManager. + */ + public static void updateTheShortTermRetentionPolicyForTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .backupShortTermRetentionPolicies() + .define(ShortTermRetentionPolicyName.DEFAULT) + .withExistingDatabase("resourceGroup", "testsvr", "testdb") + .withRetentionDays(7) + .withDiffBackupIntervalInHours(DiffBackupIntervalInHours.TWO_FOUR) + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/BackupShortTermRetentionPoliciesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/BackupShortTermRetentionPoliciesGetSamples.java new file mode 100644 index 0000000000000..343afd4307cec --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/BackupShortTermRetentionPoliciesGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ShortTermRetentionPolicyName; + +/** Samples for BackupShortTermRetentionPolicies Get. */ +public final class BackupShortTermRetentionPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/GetShortTermRetentionPolicy.json + */ + /** + * Sample code: Get the short term retention policy for the database. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheShortTermRetentionPolicyForTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .backupShortTermRetentionPolicies() + .getWithResponse( + "Default-SQL-SouthEastAsia", "testsvr", "testdb", ShortTermRetentionPolicyName.DEFAULT, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/BackupShortTermRetentionPoliciesListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/BackupShortTermRetentionPoliciesListByDatabaseSamples.java new file mode 100644 index 0000000000000..452992631a9a2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/BackupShortTermRetentionPoliciesListByDatabaseSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for BackupShortTermRetentionPolicies ListByDatabase. */ +public final class BackupShortTermRetentionPoliciesListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ListShortTermRetentionPoliciesByDatabase.json + */ + /** + * Sample code: Get the short term retention policy for the database. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheShortTermRetentionPolicyForTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .backupShortTermRetentionPolicies() + .listByDatabase("Default-SQL-SouthEastAsia", "testsvr", "testdb", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/BackupShortTermRetentionPoliciesUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/BackupShortTermRetentionPoliciesUpdateSamples.java new file mode 100644 index 0000000000000..db82238ac2b49 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/BackupShortTermRetentionPoliciesUpdateSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.BackupShortTermRetentionPolicy; +import com.azure.resourcemanager.sql.generated.models.DiffBackupIntervalInHours; +import com.azure.resourcemanager.sql.generated.models.ShortTermRetentionPolicyName; + +/** Samples for BackupShortTermRetentionPolicies Update. */ +public final class BackupShortTermRetentionPoliciesUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/UpdateShortTermRetentionPolicy.json + */ + /** + * Sample code: Update the short term retention policy for the database. + * + * @param manager Entry point to SqlManager. + */ + public static void updateTheShortTermRetentionPolicyForTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + BackupShortTermRetentionPolicy resource = + manager + .backupShortTermRetentionPolicies() + .getWithResponse( + "resourceGroup", "testsvr", "testdb", ShortTermRetentionPolicyName.DEFAULT, Context.NONE) + .getValue(); + resource + .update() + .withRetentionDays(7) + .withDiffBackupIntervalInHours(DiffBackupIntervalInHours.TWO_FOUR) + .apply(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/CapabilitiesListByLocationSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/CapabilitiesListByLocationSamples.java new file mode 100644 index 0000000000000..65795b2c4df2b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/CapabilitiesListByLocationSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Capabilities ListByLocation. */ +public final class CapabilitiesListByLocationSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/LocationCapabilityListByLocation.json + */ + /** + * Sample code: List subscription capabilities in the given location. + * + * @param manager Entry point to SqlManager. + */ + public static void listSubscriptionCapabilitiesInTheGivenLocation( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.capabilities().listByLocationWithResponse("eastus", null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DataMaskingPoliciesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DataMaskingPoliciesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..899dd1dfbbefe --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DataMaskingPoliciesCreateOrUpdateSamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.resourcemanager.sql.generated.models.DataMaskingState; + +/** Samples for DataMaskingPolicies CreateOrUpdate. */ +public final class DataMaskingPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/DataMaskingPolicyCreateOrUpdateMin.json + */ + /** + * Sample code: Create or update data masking policy min. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateDataMaskingPolicyMin(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .dataMaskingPolicies() + .define() + .withExistingDatabase("sqlcrudtest-6852", "sqlcrudtest-2080", "sqlcrudtest-331") + .withDataMaskingState(DataMaskingState.ENABLED) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/DataMaskingPolicyCreateOrUpdateMax.json + */ + /** + * Sample code: Create or update data masking policy max. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateDataMaskingPolicyMax(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .dataMaskingPolicies() + .define() + .withExistingDatabase("sqlcrudtest-6852", "sqlcrudtest-2080", "sqlcrudtest-331") + .withDataMaskingState(DataMaskingState.ENABLED) + .withExemptPrincipals("testuser;") + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DataMaskingPoliciesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DataMaskingPoliciesGetSamples.java new file mode 100644 index 0000000000000..4b072ed497648 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DataMaskingPoliciesGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DataMaskingPolicies Get. */ +public final class DataMaskingPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/DataMaskingPolicyGet.json + */ + /** + * Sample code: Get data masking policy. + * + * @param manager Entry point to SqlManager. + */ + public static void getDataMaskingPolicy(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .dataMaskingPolicies() + .getWithResponse("sqlcrudtest-6852", "sqlcrudtest-2080", "sqlcrudtest-331", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DataMaskingRulesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DataMaskingRulesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..d6ec95f823cec --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DataMaskingRulesCreateOrUpdateSamples.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.resourcemanager.sql.generated.models.DataMaskingFunction; +import com.azure.resourcemanager.sql.generated.models.DataMaskingRuleState; + +/** Samples for DataMaskingRules CreateOrUpdate. */ +public final class DataMaskingRulesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/DataMaskingRuleCreateOrUpdateDefaultMin.json + */ + /** + * Sample code: Create/Update data masking rule for default min. + * + * @param manager Entry point to SqlManager. + */ + public static void createUpdateDataMaskingRuleForDefaultMin( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .dataMaskingRules() + .define("rule1") + .withExistingDatabase("sqlcrudtest-6852", "sqlcrudtest-2080", "sqlcrudtest-331") + .withSchemaName("dbo") + .withTableName("Table_1") + .withColumnName("test1") + .withMaskingFunction(DataMaskingFunction.DEFAULT) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/DataMaskingRuleCreateOrUpdateDefaultMax.json + */ + /** + * Sample code: Create/Update data masking rule for default max. + * + * @param manager Entry point to SqlManager. + */ + public static void createUpdateDataMaskingRuleForDefaultMax( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .dataMaskingRules() + .define("rule1") + .withExistingDatabase("sqlcrudtest-6852", "sqlcrudtest-2080", "sqlcrudtest-331") + .withAliasName("nickname") + .withRuleState(DataMaskingRuleState.ENABLED) + .withSchemaName("dbo") + .withTableName("Table_1") + .withColumnName("test1") + .withMaskingFunction(DataMaskingFunction.DEFAULT) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/DataMaskingRuleCreateOrUpdateText.json + */ + /** + * Sample code: Create/Update data masking rule for text. + * + * @param manager Entry point to SqlManager. + */ + public static void createUpdateDataMaskingRuleForText(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .dataMaskingRules() + .define("rule1") + .withExistingDatabase("sqlcrudtest-6852", "sqlcrudtest-2080", "sqlcrudtest-331") + .withSchemaName("dbo") + .withTableName("Table_1") + .withColumnName("test1") + .withMaskingFunction(DataMaskingFunction.TEXT) + .withPrefixSize("1") + .withSuffixSize("0") + .withReplacementString("asdf") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/DataMaskingRuleCreateOrUpdateNumber.json + */ + /** + * Sample code: Create/Update data masking rule for numbers. + * + * @param manager Entry point to SqlManager. + */ + public static void createUpdateDataMaskingRuleForNumbers( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .dataMaskingRules() + .define("rule1") + .withExistingDatabase("sqlcrudtest-6852", "sqlcrudtest-2080", "sqlcrudtest-331") + .withSchemaName("dbo") + .withTableName("Table_1") + .withColumnName("test1") + .withMaskingFunction(DataMaskingFunction.NUMBER) + .withNumberFrom("0") + .withNumberTo("2") + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DataMaskingRulesListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DataMaskingRulesListByDatabaseSamples.java new file mode 100644 index 0000000000000..dcd37974b4286 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DataMaskingRulesListByDatabaseSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DataMaskingRules ListByDatabase. */ +public final class DataMaskingRulesListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/DataMaskingRuleList.json + */ + /** + * Sample code: List data masking rules. + * + * @param manager Entry point to SqlManager. + */ + public static void listDataMaskingRules(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .dataMaskingRules() + .listByDatabase("sqlcrudtest-6852", "sqlcrudtest-2080", "sqlcrudtest-331", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DataWarehouseUserActivitiesOperationGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DataWarehouseUserActivitiesOperationGetSamples.java new file mode 100644 index 0000000000000..a69540b6a5148 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DataWarehouseUserActivitiesOperationGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.DataWarehouseUserActivityName; + +/** Samples for DataWarehouseUserActivitiesOperation Get. */ +public final class DataWarehouseUserActivitiesOperationGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetDataWarehouseUserActivities.json + */ + /** + * Sample code: Get the list of the user activities of a data warehouse. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheListOfTheUserActivitiesOfADataWarehouse( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .dataWarehouseUserActivitiesOperations() + .getWithResponse( + "Default-SQL-SouthEastAsia", "testsvr", "testdb", DataWarehouseUserActivityName.CURRENT, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DataWarehouseUserActivitiesOperationListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DataWarehouseUserActivitiesOperationListByDatabaseSamples.java new file mode 100644 index 0000000000000..4298d96a326d0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DataWarehouseUserActivitiesOperationListByDatabaseSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DataWarehouseUserActivitiesOperation ListByDatabase. */ +public final class DataWarehouseUserActivitiesOperationListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListDataWarehouseUserActivities.json + */ + /** + * Sample code: List of the user activities of a data warehouse. + * + * @param manager Entry point to SqlManager. + */ + public static void listOfTheUserActivitiesOfADataWarehouse( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .dataWarehouseUserActivitiesOperations() + .listByDatabase("Default-SQL-SouthEastAsia", "testsvr", "testdb", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseAdvancedThreatProtectionSettingsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseAdvancedThreatProtectionSettingsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..78ec52b0b1f38 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseAdvancedThreatProtectionSettingsCreateOrUpdateSamples.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.AdvancedThreatProtectionName; +import com.azure.resourcemanager.sql.generated.models.AdvancedThreatProtectionState; +import com.azure.resourcemanager.sql.generated.models.DatabaseAdvancedThreatProtection; + +/** Samples for DatabaseAdvancedThreatProtectionSettings CreateOrUpdate. */ +public final class DatabaseAdvancedThreatProtectionSettingsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DatabaseAdvancedThreatProtectionSettingsCreateMin.json + */ + /** + * Sample code: Update a database's Advanced Threat Protection settings with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateADatabaseSAdvancedThreatProtectionSettingsWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + DatabaseAdvancedThreatProtection resource = + manager + .databaseAdvancedThreatProtectionSettings() + .getWithResponse( + "threatprotection-4799", + "threatprotection-6440", + "testdb", + AdvancedThreatProtectionName.DEFAULT, + Context.NONE) + .getValue(); + resource.update().withState(AdvancedThreatProtectionState.DISABLED).apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DatabaseAdvancedThreatProtectionSettingsCreateMax.json + */ + /** + * Sample code: Update a database's Advanced Threat Protection settings with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateADatabaseSAdvancedThreatProtectionSettingsWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + DatabaseAdvancedThreatProtection resource = + manager + .databaseAdvancedThreatProtectionSettings() + .getWithResponse( + "threatprotection-4799", + "threatprotection-6440", + "testdb", + AdvancedThreatProtectionName.DEFAULT, + Context.NONE) + .getValue(); + resource.update().withState(AdvancedThreatProtectionState.ENABLED).apply(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseAdvancedThreatProtectionSettingsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseAdvancedThreatProtectionSettingsGetSamples.java new file mode 100644 index 0000000000000..20f6404316fa0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseAdvancedThreatProtectionSettingsGetSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.AdvancedThreatProtectionName; + +/** Samples for DatabaseAdvancedThreatProtectionSettings Get. */ +public final class DatabaseAdvancedThreatProtectionSettingsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DatabaseAdvancedThreatProtectionSettingsGet.json + */ + /** + * Sample code: Get a database's Advanced Threat Protection settings. + * + * @param manager Entry point to SqlManager. + */ + public static void getADatabaseSAdvancedThreatProtectionSettings( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseAdvancedThreatProtectionSettings() + .getWithResponse( + "threatprotection-6852", + "threatprotection-2080", + "testdb", + AdvancedThreatProtectionName.DEFAULT, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseAdvancedThreatProtectionSettingsListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseAdvancedThreatProtectionSettingsListByDatabaseSamples.java new file mode 100644 index 0000000000000..a1726cfb7e5f6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseAdvancedThreatProtectionSettingsListByDatabaseSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseAdvancedThreatProtectionSettings ListByDatabase. */ +public final class DatabaseAdvancedThreatProtectionSettingsListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DatabaseAdvancedThreatProtectionSettingsListByDatabase.json + */ + /** + * Sample code: Lists the database's Advanced Threat Protection settings. + * + * @param manager Entry point to SqlManager. + */ + public static void listsTheDatabaseSAdvancedThreatProtectionSettings( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseAdvancedThreatProtectionSettings() + .listByDatabase("threatprotection-6852", "threatprotection-2080", "testdb", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseAdvisorsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseAdvisorsGetSamples.java new file mode 100644 index 0000000000000..845b6d10643f0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseAdvisorsGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseAdvisors Get. */ +public final class DatabaseAdvisorsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseAdvisorGet.json + */ + /** + * Sample code: Get database advisor. + * + * @param manager Entry point to SqlManager. + */ + public static void getDatabaseAdvisor(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseAdvisors() + .getWithResponse("workloadinsight-demos", "misosisvr", "IndexAdvisor_test_3", "CreateIndex", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseAdvisorsListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseAdvisorsListByDatabaseSamples.java new file mode 100644 index 0000000000000..65cede458a8a7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseAdvisorsListByDatabaseSamples.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseAdvisors ListByDatabase. */ +public final class DatabaseAdvisorsListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseAdvisorList.json + */ + /** + * Sample code: List of database advisors. + * + * @param manager Entry point to SqlManager. + */ + public static void listOfDatabaseAdvisors(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseAdvisors() + .listByDatabaseWithResponse( + "workloadinsight-demos", "misosisvr", "IndexAdvisor_test_3", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseRecommendedActionListExpand.json + */ + /** + * Sample code: List of database recommended actions for all advisors. + * + * @param manager Entry point to SqlManager. + */ + public static void listOfDatabaseRecommendedActionsForAllAdvisors( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseAdvisors() + .listByDatabaseWithResponse( + "workloadinsight-demos", "misosisvr", "IndexAdvisor_test_3", "recommendedActions", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseAdvisorsUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseAdvisorsUpdateSamples.java new file mode 100644 index 0000000000000..d95de52526518 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseAdvisorsUpdateSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.AdvisorInner; +import com.azure.resourcemanager.sql.generated.models.AutoExecuteStatus; + +/** Samples for DatabaseAdvisors Update. */ +public final class DatabaseAdvisorsUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseAdvisorUpdate.json + */ + /** + * Sample code: Update database advisor. + * + * @param manager Entry point to SqlManager. + */ + public static void updateDatabaseAdvisor(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseAdvisors() + .updateWithResponse( + "workloadinsight-demos", + "misosisvr", + "IndexAdvisor_test_3", + "CreateIndex", + new AdvisorInner().withAutoExecuteStatus(AutoExecuteStatus.DISABLED), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseAutomaticTuningGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseAutomaticTuningGetSamples.java new file mode 100644 index 0000000000000..493131ef94e50 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseAutomaticTuningGetSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseAutomaticTuning Get. */ +public final class DatabaseAutomaticTuningGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseAutomaticTuningGet.json + */ + /** + * Sample code: Get a database's automatic tuning settings. + * + * @param manager Entry point to SqlManager. + */ + public static void getADatabaseSAutomaticTuningSettings( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databaseAutomaticTunings().getWithResponse("default-sql-onebox", "testsvr11", "db1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseAutomaticTuningUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseAutomaticTuningUpdateSamples.java new file mode 100644 index 0000000000000..dba62118f244a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseAutomaticTuningUpdateSamples.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseAutomaticTuningInner; +import com.azure.resourcemanager.sql.generated.models.AutomaticTuningMode; +import com.azure.resourcemanager.sql.generated.models.AutomaticTuningOptionModeDesired; +import com.azure.resourcemanager.sql.generated.models.AutomaticTuningOptions; +import java.util.HashMap; +import java.util.Map; + +/** Samples for DatabaseAutomaticTuning Update. */ +public final class DatabaseAutomaticTuningUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseAutomaticTuningUpdateMax.json + */ + /** + * Sample code: Updates database automatic tuning settings with all properties. + * + * @param manager Entry point to SqlManager. + */ + public static void updatesDatabaseAutomaticTuningSettingsWithAllProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseAutomaticTunings() + .updateWithResponse( + "default-sql-onebox", + "testsvr11", + "db1", + new DatabaseAutomaticTuningInner() + .withDesiredState(AutomaticTuningMode.AUTO) + .withOptions( + mapOf( + "createIndex", + new AutomaticTuningOptions().withDesiredState(AutomaticTuningOptionModeDesired.OFF), + "dropIndex", + new AutomaticTuningOptions().withDesiredState(AutomaticTuningOptionModeDesired.ON), + "forceLastGoodPlan", + new AutomaticTuningOptions().withDesiredState(AutomaticTuningOptionModeDesired.DEFAULT))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseAutomaticTuningUpdateMin.json + */ + /** + * Sample code: Updates database automatic tuning settings with minimal properties. + * + * @param manager Entry point to SqlManager. + */ + public static void updatesDatabaseAutomaticTuningSettingsWithMinimalProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseAutomaticTunings() + .updateWithResponse( + "default-sql-onebox", + "testsvr11", + "db1", + new DatabaseAutomaticTuningInner().withDesiredState(AutomaticTuningMode.AUTO), + Context.NONE); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseBlobAuditingPoliciesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseBlobAuditingPoliciesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..5ba15b597dc07 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseBlobAuditingPoliciesCreateOrUpdateSamples.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.resourcemanager.sql.generated.models.BlobAuditingPolicyState; +import java.util.Arrays; +import java.util.UUID; + +/** Samples for DatabaseBlobAuditingPolicies CreateOrUpdate. */ +public final class DatabaseBlobAuditingPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DatabaseAzureMonitorAuditingCreateMin.json + */ + /** + * Sample code: Create or update a database's azure monitor auditing policy with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateADatabaseSAzureMonitorAuditingPolicyWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseBlobAuditingPolicies() + .define() + .withExistingDatabase("blobauditingtest-4799", "blobauditingtest-6440", "testdb") + .withIsAzureMonitorTargetEnabled(true) + .withState(BlobAuditingPolicyState.ENABLED) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DatabaseBlobAuditingCreateMax.json + */ + /** + * Sample code: Create or update a database's blob auditing policy with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateADatabaseSBlobAuditingPolicyWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseBlobAuditingPolicies() + .define() + .withExistingDatabase("blobauditingtest-4799", "blobauditingtest-6440", "testdb") + .withRetentionDays(6) + .withAuditActionsAndGroups( + Arrays + .asList( + "DATABASE_LOGOUT_GROUP", + "DATABASE_ROLE_MEMBER_CHANGE_GROUP", + "UPDATE on database::TestDatabaseName by public")) + .withIsStorageSecondaryKeyInUse(false) + .withIsAzureMonitorTargetEnabled(true) + .withQueueDelayMs(4000) + .withState(BlobAuditingPolicyState.ENABLED) + .withStorageEndpoint("https://mystorage.blob.core.windows.net") + .withStorageAccountAccessKey( + "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==") + .withStorageAccountSubscriptionId(UUID.fromString("00000000-1234-0000-5678-000000000000")) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DatabaseBlobAuditingCreateMin.json + */ + /** + * Sample code: Create or update a database's blob auditing policy with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateADatabaseSBlobAuditingPolicyWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseBlobAuditingPolicies() + .define() + .withExistingDatabase("blobauditingtest-4799", "blobauditingtest-6440", "testdb") + .withState(BlobAuditingPolicyState.ENABLED) + .withStorageEndpoint("https://mystorage.blob.core.windows.net") + .withStorageAccountAccessKey( + "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==") + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseBlobAuditingPoliciesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseBlobAuditingPoliciesGetSamples.java new file mode 100644 index 0000000000000..0d8dd7a91b9d5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseBlobAuditingPoliciesGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseBlobAuditingPolicies Get. */ +public final class DatabaseBlobAuditingPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DatabaseBlobAuditingGet.json + */ + /** + * Sample code: Get a database's blob auditing policy. + * + * @param manager Entry point to SqlManager. + */ + public static void getADatabaseSBlobAuditingPolicy(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseBlobAuditingPolicies() + .getWithResponse("blobauditingtest-6852", "blobauditingtest-2080", "testdb", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseBlobAuditingPoliciesListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseBlobAuditingPoliciesListByDatabaseSamples.java new file mode 100644 index 0000000000000..c358322ca8ade --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseBlobAuditingPoliciesListByDatabaseSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseBlobAuditingPolicies ListByDatabase. */ +public final class DatabaseBlobAuditingPoliciesListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DatabaseAuditingSettingsList.json + */ + /** + * Sample code: List audit settings of a database. + * + * @param manager Entry point to SqlManager. + */ + public static void listAuditSettingsOfADatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseBlobAuditingPolicies() + .listByDatabase("blobauditingtest-6852", "blobauditingtest-2080", "testdb", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseColumnsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseColumnsGetSamples.java new file mode 100644 index 0000000000000..6a019910b9f00 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseColumnsGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseColumns Get. */ +public final class DatabaseColumnsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseColumnGet.json + */ + /** + * Sample code: Get database column. + * + * @param manager Entry point to SqlManager. + */ + public static void getDatabaseColumn(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseColumns() + .getWithResponse("myRG", "serverName", "myDatabase", "dbo", "table1", "column1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseColumnsListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseColumnsListByDatabaseSamples.java new file mode 100644 index 0000000000000..f185b3a042788 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseColumnsListByDatabaseSamples.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import java.util.Arrays; + +/** Samples for DatabaseColumns ListByDatabase. */ +public final class DatabaseColumnsListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ColumnsListByDatabaseMax.json + */ + /** + * Sample code: Filter database columns. + * + * @param manager Entry point to SqlManager. + */ + public static void filterDatabaseColumns(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseColumns() + .listByDatabase( + "myRG", + "serverName", + "myDatabase", + Arrays.asList("dbo"), + Arrays.asList("customer", "address"), + Arrays.asList("username"), + Arrays.asList("schema asc", "table", "column desc"), + null, + Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ColumnsListByDatabaseMin.json + */ + /** + * Sample code: List database columns. + * + * @param manager Entry point to SqlManager. + */ + public static void listDatabaseColumns(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseColumns() + .listByDatabase("myRG", "serverName", "myDatabase", null, null, null, null, null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseColumnsListByTableSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseColumnsListByTableSamples.java new file mode 100644 index 0000000000000..ffa4025759f5a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseColumnsListByTableSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseColumns ListByTable. */ +public final class DatabaseColumnsListByTableSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseColumnListByTable.json + */ + /** + * Sample code: List database columns. + * + * @param manager Entry point to SqlManager. + */ + public static void listDatabaseColumns(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databaseColumns().listByTable("myRG", "serverName", "myDatabase", "dbo", "table1", null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseExtensionsOperationCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseExtensionsOperationCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..0b10d5af07625 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseExtensionsOperationCreateOrUpdateSamples.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.resourcemanager.sql.generated.models.OperationMode; +import com.azure.resourcemanager.sql.generated.models.StorageKeyType; + +/** Samples for DatabaseExtensionsOperation CreateOrUpdate. */ +public final class DatabaseExtensionsOperationCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/CreateOrUpdateDatabaseExtensions.json + */ + /** + * Sample code: Create or Update database extensions. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateDatabaseExtensions(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseExtensionsOperations() + .define("polybaseimport") + .withExistingDatabase( + "rg_20cbe0f0-c2d9-4522-9177-5469aad53029", + "srv_1ffd1cf8-9951-47fb-807d-a9c384763849", + "878e303f-1ea0-4f17-aa3d-a22ac5e9da08") + .withOperationMode(OperationMode.POLYBASE_IMPORT) + .withStorageKeyType(StorageKeyType.STORAGE_ACCESS_KEY) + .withStorageKey("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx") + .withStorageUri("https://teststorage.blob.core.windows.net/testcontainer/Manifest.xml") + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseExtensionsOperationGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseExtensionsOperationGetSamples.java new file mode 100644 index 0000000000000..0b572135bb528 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseExtensionsOperationGetSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseExtensionsOperation Get. */ +public final class DatabaseExtensionsOperationGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/GetDatabaseExtensions.json + */ + /** + * Sample code: Get database extensions. + * + * @param manager Entry point to SqlManager. + */ + public static void getDatabaseExtensions(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseExtensionsOperations() + .getWithResponse( + "rg_a1f9d6f8-30d5-4228-9504-8a364361bca3", + "srv_65858e0f-b1d1-4bdc-8351-a7da86ca4939", + "11aa6c5e-58ed-4693-b303-3b8e3131deaa", + "polybaseimport", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseExtensionsOperationListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseExtensionsOperationListByDatabaseSamples.java new file mode 100644 index 0000000000000..10e2b687a99a0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseExtensionsOperationListByDatabaseSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseExtensionsOperation ListByDatabase. */ +public final class DatabaseExtensionsOperationListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ListDatabaseExtensions.json + */ + /** + * Sample code: List database extensions. + * + * @param manager Entry point to SqlManager. + */ + public static void listDatabaseExtensions(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseExtensionsOperations() + .listByDatabase( + "rg_4007c5a9-b3b0-41e1-bd46-9eef38768a4a", + "srv_3b67ec2a-519b-43a7-8533-fb62dce3431e", + "719d8fa4-bf0f-48fc-8cd3-ef40fe6ba1fe", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseOperationsCancelSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseOperationsCancelSamples.java new file mode 100644 index 0000000000000..f8220cbac596f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseOperationsCancelSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import java.util.UUID; + +/** Samples for DatabaseOperations Cancel. */ +public final class DatabaseOperationsCancelSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/CancelDatabaseOperation.json + */ + /** + * Sample code: Cancel the database management operation. + * + * @param manager Entry point to SqlManager. + */ + public static void cancelTheDatabaseManagementOperation( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseOperations() + .cancelWithResponse( + "sqlcrudtest-7398", + "sqlcrudtest-6661", + "testdb", + UUID.fromString("f779414b-e748-4925-8cfe-c8598f7660ae"), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseOperationsListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseOperationsListByDatabaseSamples.java new file mode 100644 index 0000000000000..4a4a264654e37 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseOperationsListByDatabaseSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseOperations ListByDatabase. */ +public final class DatabaseOperationsListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ListDatabaseOperations.json + */ + /** + * Sample code: List the database management operations. + * + * @param manager Entry point to SqlManager. + */ + public static void listTheDatabaseManagementOperations(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databaseOperations().listByDatabase("sqlcrudtest-7398", "sqlcrudtest-4645", "testdb", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseRecommendedActionsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseRecommendedActionsGetSamples.java new file mode 100644 index 0000000000000..700f54e5bc553 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseRecommendedActionsGetSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseRecommendedActions Get. */ +public final class DatabaseRecommendedActionsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseRecommendedActionGet.json + */ + /** + * Sample code: Get database recommended action. + * + * @param manager Entry point to SqlManager. + */ + public static void getDatabaseRecommendedAction(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseRecommendedActions() + .getWithResponse( + "workloadinsight-demos", + "misosisvr", + "IndexAdvisor_test_3", + "CreateIndex", + "IR_[CRM]_[DataPoints]_4821CD2F9510D98184BB", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseRecommendedActionsListByDatabaseAdvisorSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseRecommendedActionsListByDatabaseAdvisorSamples.java new file mode 100644 index 0000000000000..bb829923cef4c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseRecommendedActionsListByDatabaseAdvisorSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseRecommendedActions ListByDatabaseAdvisor. */ +public final class DatabaseRecommendedActionsListByDatabaseAdvisorSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseRecommendedActionList.json + */ + /** + * Sample code: List of database recommended actions. + * + * @param manager Entry point to SqlManager. + */ + public static void listOfDatabaseRecommendedActions(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseRecommendedActions() + .listByDatabaseAdvisorWithResponse( + "workloadinsight-demos", "misosisvr", "IndexAdvisor_test_3", "CreateIndex", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseRecommendedActionsUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseRecommendedActionsUpdateSamples.java new file mode 100644 index 0000000000000..13925e7994f35 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseRecommendedActionsUpdateSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.RecommendedActionInner; +import com.azure.resourcemanager.sql.generated.models.RecommendedActionCurrentState; +import com.azure.resourcemanager.sql.generated.models.RecommendedActionStateInfo; + +/** Samples for DatabaseRecommendedActions Update. */ +public final class DatabaseRecommendedActionsUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseRecommendedActionUpdate.json + */ + /** + * Sample code: Update database recommended action. + * + * @param manager Entry point to SqlManager. + */ + public static void updateDatabaseRecommendedAction(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseRecommendedActions() + .updateWithResponse( + "workloadinsight-demos", + "misosisvr", + "IndexAdvisor_test_3", + "CreateIndex", + "IR_[CRM]_[DataPoints]_4821CD2F9510D98184BB", + new RecommendedActionInner() + .withState( + new RecommendedActionStateInfo().withCurrentValue(RecommendedActionCurrentState.PENDING)), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSchemasGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSchemasGetSamples.java new file mode 100644 index 0000000000000..f0b4fb8acb6eb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSchemasGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseSchemas Get. */ +public final class DatabaseSchemasGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseSchemaGet.json + */ + /** + * Sample code: Get database schema. + * + * @param manager Entry point to SqlManager. + */ + public static void getDatabaseSchema(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databaseSchemas().getWithResponse("myRG", "serverName", "myDatabase", "dbo", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSchemasListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSchemasListByDatabaseSamples.java new file mode 100644 index 0000000000000..37be490f09ce7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSchemasListByDatabaseSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseSchemas ListByDatabase. */ +public final class DatabaseSchemasListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseSchemaListByDatabase.json + */ + /** + * Sample code: List database schemas. + * + * @param manager Entry point to SqlManager. + */ + public static void listDatabaseSchemas(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databaseSchemas().listByDatabase("myRG", "serverName", "myDatabase", null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSecurityAlertPoliciesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSecurityAlertPoliciesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..cbb577f9ccb9d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSecurityAlertPoliciesCreateOrUpdateSamples.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.DatabaseSecurityAlertPolicy; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyName; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertsPolicyState; +import java.util.Arrays; + +/** Samples for DatabaseSecurityAlertPolicies CreateOrUpdate. */ +public final class DatabaseSecurityAlertPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseSecurityAlertCreateMax.json + */ + /** + * Sample code: Update a database's threat detection policy with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateADatabaseSThreatDetectionPolicyWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + DatabaseSecurityAlertPolicy resource = + manager + .databaseSecurityAlertPolicies() + .getWithResponse( + "securityalert-4799", "securityalert-6440", "testdb", SecurityAlertPolicyName.DEFAULT, Context.NONE) + .getValue(); + resource + .update() + .withState(SecurityAlertsPolicyState.ENABLED) + .withDisabledAlerts(Arrays.asList("Sql_Injection", "Usage_Anomaly")) + .withEmailAddresses(Arrays.asList("test@microsoft.com", "user@microsoft.com")) + .withEmailAccountAdmins(true) + .withStorageEndpoint("https://mystorage.blob.core.windows.net") + .withStorageAccountAccessKey( + "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==") + .withRetentionDays(6) + .apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseSecurityAlertCreateMin.json + */ + /** + * Sample code: Update a database's threat detection policy with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateADatabaseSThreatDetectionPolicyWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + DatabaseSecurityAlertPolicy resource = + manager + .databaseSecurityAlertPolicies() + .getWithResponse( + "securityalert-4799", "securityalert-6440", "testdb", SecurityAlertPolicyName.DEFAULT, Context.NONE) + .getValue(); + resource.update().withState(SecurityAlertsPolicyState.ENABLED).apply(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSecurityAlertPoliciesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSecurityAlertPoliciesGetSamples.java new file mode 100644 index 0000000000000..9a71f7ecc45e5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSecurityAlertPoliciesGetSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyName; + +/** Samples for DatabaseSecurityAlertPolicies Get. */ +public final class DatabaseSecurityAlertPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseSecurityAlertGet.json + */ + /** + * Sample code: Get a database's threat detection policy. + * + * @param manager Entry point to SqlManager. + */ + public static void getADatabaseSThreatDetectionPolicy(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseSecurityAlertPolicies() + .getWithResponse( + "securityalert-6852", "securityalert-2080", "testdb", SecurityAlertPolicyName.DEFAULT, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSecurityAlertPoliciesListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSecurityAlertPoliciesListByDatabaseSamples.java new file mode 100644 index 0000000000000..7fdaacc927643 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSecurityAlertPoliciesListByDatabaseSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseSecurityAlertPolicies ListByDatabase. */ +public final class DatabaseSecurityAlertPoliciesListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseSecurityAlertListByDatabase.json + */ + /** + * Sample code: Get the database's threat detection policies. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheDatabaseSThreatDetectionPolicies( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseSecurityAlertPolicies() + .listByDatabase("securityalert-6852", "securityalert-2080", "testdb", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSqlVulnerabilityAssessmentBaselinesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSqlVulnerabilityAssessmentBaselinesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..82403971616a8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSqlVulnerabilityAssessmentBaselinesCreateOrUpdateSamples.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.resourcemanager.sql.generated.models.BaselineName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for DatabaseSqlVulnerabilityAssessmentBaselines CreateOrUpdate. */ +public final class DatabaseSqlVulnerabilityAssessmentBaselinesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/DatabaseSqlVulnerabilityAssessmentBaselineAddLatest.json + */ + /** + * Sample code: Add a database's vulnerability assessment rule baseline from the latest scan result. + * + * @param manager Entry point to SqlManager. + */ + public static void addADatabaseSVulnerabilityAssessmentRuleBaselineFromTheLatestScanResult( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseSqlVulnerabilityAssessmentBaselines() + .define(BaselineName.DEFAULT) + .withExistingSqlVulnerabilityAssessment( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + "testdb", + VulnerabilityAssessmentName.DEFAULT) + .withLatestScan(true) + .withResults(mapOf()) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/DatabaseSqlVulnerabilityAssessmentBaselineAdd.json + */ + /** + * Sample code: Add a database's vulnerability assessment rule baseline list. + * + * @param manager Entry point to SqlManager. + */ + public static void addADatabaseSVulnerabilityAssessmentRuleBaselineList( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseSqlVulnerabilityAssessmentBaselines() + .define(BaselineName.DEFAULT) + .withExistingSqlVulnerabilityAssessment( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + "testdb", + VulnerabilityAssessmentName.DEFAULT) + .withLatestScan(false) + .withResults( + mapOf( + "VA2063", + Arrays.asList(Arrays.asList("AllowAll", "0.0.0.0", "255.255.255.255")), + "VA2065", + Arrays.asList(Arrays.asList("AllowAll", "0.0.0.0", "255.255.255.255")))) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSqlVulnerabilityAssessmentBaselinesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSqlVulnerabilityAssessmentBaselinesGetSamples.java new file mode 100644 index 0000000000000..c7d7f2a8fe1ee --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSqlVulnerabilityAssessmentBaselinesGetSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.BaselineName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for DatabaseSqlVulnerabilityAssessmentBaselines Get. */ +public final class DatabaseSqlVulnerabilityAssessmentBaselinesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/DatabaseSqlVulnerabilityAssessmentBaselineGet.json + */ + /** + * Sample code: Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAListOfDatabaseSSqlVulnerabilityAssessmentRuleBaselines( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseSqlVulnerabilityAssessmentBaselines() + .getWithResponse( + "vulnerabilityaseessmenttest-4711", + "vulnerabilityaseessmenttest-6411", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + BaselineName.DEFAULT, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSqlVulnerabilityAssessmentBaselinesListBySqlVulnerabilityAssessmentSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSqlVulnerabilityAssessmentBaselinesListBySqlVulnerabilityAssessmentSamples.java new file mode 100644 index 0000000000000..b7916e28d85f8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSqlVulnerabilityAssessmentBaselinesListBySqlVulnerabilityAssessmentSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for DatabaseSqlVulnerabilityAssessmentBaselines ListBySqlVulnerabilityAssessment. */ +public final class DatabaseSqlVulnerabilityAssessmentBaselinesListBySqlVulnerabilityAssessmentSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/DatabaseSqlVulnerabilityAssessmentBaselineListBySqlVulnerabilityAssessment.json + */ + /** + * Sample code: Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAListOfDatabaseSSqlVulnerabilityAssessmentRuleBaselines( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseSqlVulnerabilityAssessmentBaselines() + .listBySqlVulnerabilityAssessment( + "vulnerabilityaseessmenttest-4711", + "vulnerabilityaseessmenttest-6411", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSqlVulnerabilityAssessmentExecuteScanExecuteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSqlVulnerabilityAssessmentExecuteScanExecuteSamples.java new file mode 100644 index 0000000000000..5dc00f3e0a096 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSqlVulnerabilityAssessmentExecuteScanExecuteSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for DatabaseSqlVulnerabilityAssessmentExecuteScan Execute. */ +public final class DatabaseSqlVulnerabilityAssessmentExecuteScanExecuteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/DatabaseSqlVulnerabilityAssessmentScansExecute.json + */ + /** + * Sample code: Executes a database's vulnerability assessment scan. + * + * @param manager Entry point to SqlManager. + */ + public static void executesADatabaseSVulnerabilityAssessmentScan( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseSqlVulnerabilityAssessmentExecuteScans() + .execute( + "vulnerabilityassessmenttest-4711", + "vulnerabilityassessmenttest-6411", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSqlVulnerabilityAssessmentRuleBaselinesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSqlVulnerabilityAssessmentRuleBaselinesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..66c0712dc4149 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSqlVulnerabilityAssessmentRuleBaselinesCreateOrUpdateSamples.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.resourcemanager.sql.generated.models.BaselineName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import java.util.Arrays; + +/** Samples for DatabaseSqlVulnerabilityAssessmentRuleBaselines CreateOrUpdate. */ +public final class DatabaseSqlVulnerabilityAssessmentRuleBaselinesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/DatabaseSqlVulnerabilityAssessmentRuleBaselineCreate.json + */ + /** + * Sample code: Creates or updates a database's vulnerability assessment rule baseline. + * + * @param manager Entry point to SqlManager. + */ + public static void createsOrUpdatesADatabaseSVulnerabilityAssessmentRuleBaseline( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseSqlVulnerabilityAssessmentRuleBaselines() + .define("VA1001") + .withExistingBaseline( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + BaselineName.DEFAULT) + .withLatestScan(false) + .withResults( + Arrays + .asList( + Arrays.asList("userA", "SELECT"), + Arrays.asList("userB", "SELECT"), + Arrays.asList("userC", "SELECT"))) + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSqlVulnerabilityAssessmentRuleBaselinesDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSqlVulnerabilityAssessmentRuleBaselinesDeleteSamples.java new file mode 100644 index 0000000000000..746d09684b219 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSqlVulnerabilityAssessmentRuleBaselinesDeleteSamples.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.BaselineName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for DatabaseSqlVulnerabilityAssessmentRuleBaselines Delete. */ +public final class DatabaseSqlVulnerabilityAssessmentRuleBaselinesDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/DatabaseSqlVulnerabilityAssessmentRuleBaselineDelete.json + */ + /** + * Sample code: Removes a database's vulnerability assessment rule baseline. + * + * @param manager Entry point to SqlManager. + */ + public static void removesADatabaseSVulnerabilityAssessmentRuleBaseline( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseSqlVulnerabilityAssessmentRuleBaselines() + .deleteWithResponse( + "vulnerabilityaseessmenttest-4711", + "vulnerabilityaseessmenttest-6411", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + BaselineName.DEFAULT, + "VA1001", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSqlVulnerabilityAssessmentRuleBaselinesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSqlVulnerabilityAssessmentRuleBaselinesGetSamples.java new file mode 100644 index 0000000000000..3407a994d97b8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSqlVulnerabilityAssessmentRuleBaselinesGetSamples.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.BaselineName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for DatabaseSqlVulnerabilityAssessmentRuleBaselines Get. */ +public final class DatabaseSqlVulnerabilityAssessmentRuleBaselinesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/DatabaseSqlVulnerabilityAssessmentRuleBaselineGet.json + */ + /** + * Sample code: Gets a database's sql vulnerability assessment rule baseline. + * + * @param manager Entry point to SqlManager. + */ + public static void getsADatabaseSSqlVulnerabilityAssessmentRuleBaseline( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseSqlVulnerabilityAssessmentRuleBaselines() + .getWithResponse( + "vulnerabilityaseessmenttest-4711", + "vulnerabilityaseessmenttest-6411", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + BaselineName.DEFAULT, + "VA1001", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSqlVulnerabilityAssessmentRuleBaselinesListByBaselineSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSqlVulnerabilityAssessmentRuleBaselinesListByBaselineSamples.java new file mode 100644 index 0000000000000..350bf2adb367a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSqlVulnerabilityAssessmentRuleBaselinesListByBaselineSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.BaselineName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for DatabaseSqlVulnerabilityAssessmentRuleBaselines ListByBaseline. */ +public final class DatabaseSqlVulnerabilityAssessmentRuleBaselinesListByBaselineSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/DatabaseSqlVulnerabilityAssessmentRuleBaselineListByBaseline.json + */ + /** + * Sample code: Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAListOfDatabaseSSqlVulnerabilityAssessmentRuleBaselines( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseSqlVulnerabilityAssessmentRuleBaselines() + .listByBaseline( + "vulnerabilityaseessmenttest-4711", + "vulnerabilityaseessmenttest-6411", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + BaselineName.DEFAULT, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSqlVulnerabilityAssessmentScanResultGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSqlVulnerabilityAssessmentScanResultGetSamples.java new file mode 100644 index 0000000000000..b355ef5e106ad --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSqlVulnerabilityAssessmentScanResultGetSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentName; + +/** Samples for DatabaseSqlVulnerabilityAssessmentScanResult Get. */ +public final class DatabaseSqlVulnerabilityAssessmentScanResultGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/DatabaseSqlVulnerabilityAssessmentScansResults.json + */ + /** + * Sample code: Get a database SQL Vulnerability Assessment scan result for scan id and scan result id. + * + * @param manager Entry point to SqlManager. + */ + public static void getADatabaseSQLVulnerabilityAssessmentScanResultForScanIdAndScanResultId( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseSqlVulnerabilityAssessmentScanResults() + .getWithResponse( + "vulnerabilityassessmenttest-4711", + "vulnerabilityassessmenttest-6411", + "master", + SqlVulnerabilityAssessmentName.DEFAULT, + "scanId1", + "VA1234", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSqlVulnerabilityAssessmentScanResultListByScanSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSqlVulnerabilityAssessmentScanResultListByScanSamples.java new file mode 100644 index 0000000000000..ece7618710adf --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSqlVulnerabilityAssessmentScanResultListByScanSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentName; + +/** Samples for DatabaseSqlVulnerabilityAssessmentScanResult ListByScan. */ +public final class DatabaseSqlVulnerabilityAssessmentScanResultListByScanSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/DatabaseSqlVulnerabilityAssessmentListScansResults.json + */ + /** + * Sample code: List database SQL Vulnerability Assessment scan results for scan id. + * + * @param manager Entry point to SqlManager. + */ + public static void listDatabaseSQLVulnerabilityAssessmentScanResultsForScanId( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseSqlVulnerabilityAssessmentScanResults() + .listByScan( + "vulnerabilityassessmenttest-4711", + "testsvr", + "master", + SqlVulnerabilityAssessmentName.DEFAULT, + "scanId1", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSqlVulnerabilityAssessmentScansGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSqlVulnerabilityAssessmentScansGetSamples.java new file mode 100644 index 0000000000000..2af5387d62de4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSqlVulnerabilityAssessmentScansGetSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for DatabaseSqlVulnerabilityAssessmentScans Get. */ +public final class DatabaseSqlVulnerabilityAssessmentScansGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/DatabaseSqlVulnerabilityAssessmentScan.json + */ + /** + * Sample code: Get a database's vulnerability assessment scan. + * + * @param manager Entry point to SqlManager. + */ + public static void getADatabaseSVulnerabilityAssessmentScan( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseSqlVulnerabilityAssessmentScans() + .getWithResponse( + "vulnerabilityassessmenttest-4711", + "vulnerabilityassessmenttest-6411", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + "scan001", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSqlVulnerabilityAssessmentScansListBySqlVulnerabilityAssessmentsSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSqlVulnerabilityAssessmentScansListBySqlVulnerabilityAssessmentsSamples.java new file mode 100644 index 0000000000000..bbbd2821c9b6e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSqlVulnerabilityAssessmentScansListBySqlVulnerabilityAssessmentsSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for DatabaseSqlVulnerabilityAssessmentScans ListBySqlVulnerabilityAssessments. */ +public final class DatabaseSqlVulnerabilityAssessmentScansListBySqlVulnerabilityAssessmentsSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/DatabaseSqlVulnerabilityAssessmentScanRecordsListByDatabase.json + */ + /** + * Sample code: Gets the list of a database vulnerability assessment scan records. + * + * @param manager Entry point to SqlManager. + */ + public static void getsTheListOfADatabaseVulnerabilityAssessmentScanRecords( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseSqlVulnerabilityAssessmentScans() + .listBySqlVulnerabilityAssessments( + "vulnerabilityassessmenttest-4711", + "vulnerabilityassessmenttest-6411", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSqlVulnerabilityAssessmentsSettingsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSqlVulnerabilityAssessmentsSettingsGetSamples.java new file mode 100644 index 0000000000000..41b96d51a6805 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSqlVulnerabilityAssessmentsSettingsGetSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentNameAutoGenerated; + +/** Samples for DatabaseSqlVulnerabilityAssessmentsSettings Get. */ +public final class DatabaseSqlVulnerabilityAssessmentsSettingsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/DatabaseSqlVulnerabilityAssessmentGet.json + */ + /** + * Sample code: Get SQL Vulnerability Assessment policy for database. + * + * @param manager Entry point to SqlManager. + */ + public static void getSQLVulnerabilityAssessmentPolicyForDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseSqlVulnerabilityAssessmentsSettings() + .getWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + "testdb", + SqlVulnerabilityAssessmentNameAutoGenerated.DEFAULT, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSqlVulnerabilityAssessmentsSettingsListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSqlVulnerabilityAssessmentsSettingsListByDatabaseSamples.java new file mode 100644 index 0000000000000..6ac20321aea24 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseSqlVulnerabilityAssessmentsSettingsListByDatabaseSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseSqlVulnerabilityAssessmentsSettings ListByDatabase. */ +public final class DatabaseSqlVulnerabilityAssessmentsSettingsListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/DatabaseSqlVulnerabilityAssessmentListByDatabase.json + */ + /** + * Sample code: Get SQL Vulnerability Assessment policies on a given database. + * + * @param manager Entry point to SqlManager. + */ + public static void getSQLVulnerabilityAssessmentPoliciesOnAGivenDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseSqlVulnerabilityAssessmentsSettings() + .listByDatabase( + "vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", "testdb", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseTablesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseTablesGetSamples.java new file mode 100644 index 0000000000000..4a0f6a86ac57e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseTablesGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseTables Get. */ +public final class DatabaseTablesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseTableGet.json + */ + /** + * Sample code: Get database table. + * + * @param manager Entry point to SqlManager. + */ + public static void getDatabaseTable(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databaseTables().getWithResponse("myRG", "serverName", "myDatabase", "dbo", "table1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseTablesListBySchemaSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseTablesListBySchemaSamples.java new file mode 100644 index 0000000000000..046cb732da989 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseTablesListBySchemaSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseTables ListBySchema. */ +public final class DatabaseTablesListBySchemaSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseTableListBySchema.json + */ + /** + * Sample code: List database tables. + * + * @param manager Entry point to SqlManager. + */ + public static void listDatabaseTables(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databaseTables().listBySchema("myRG", "serverName", "myDatabase", "dbo", null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseUsagesListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseUsagesListByDatabaseSamples.java new file mode 100644 index 0000000000000..b0f2c583d3e54 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseUsagesListByDatabaseSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseUsages ListByDatabase. */ +public final class DatabaseUsagesListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/GetDatabaseUsages.json + */ + /** + * Sample code: Gets database usages. + * + * @param manager Entry point to SqlManager. + */ + public static void getsDatabaseUsages(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databaseUsages().listByDatabase("Default-SQL-SouthEastAsia", "testsvr", "testdb", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentRuleBaselinesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentRuleBaselinesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..0900a4efeb711 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentRuleBaselinesCreateOrUpdateSamples.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.resourcemanager.sql.generated.models.DatabaseVulnerabilityAssessmentRuleBaselineItem; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentPolicyBaselineName; +import java.util.Arrays; + +/** Samples for DatabaseVulnerabilityAssessmentRuleBaselines CreateOrUpdate. */ +public final class DatabaseVulnerabilityAssessmentRuleBaselinesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentRuleBaselineCreate.json + */ + /** + * Sample code: Creates or updates a database's vulnerability assessment rule baseline. + * + * @param manager Entry point to SqlManager. + */ + public static void createsOrUpdatesADatabaseSVulnerabilityAssessmentRuleBaseline( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseVulnerabilityAssessmentRuleBaselines() + .define(VulnerabilityAssessmentPolicyBaselineName.DEFAULT) + .withExistingRule( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + "VA1001") + .withBaselineResults( + Arrays + .asList( + new DatabaseVulnerabilityAssessmentRuleBaselineItem() + .withResult(Arrays.asList("userA", "SELECT")), + new DatabaseVulnerabilityAssessmentRuleBaselineItem() + .withResult(Arrays.asList("userB", "SELECT")), + new DatabaseVulnerabilityAssessmentRuleBaselineItem() + .withResult(Arrays.asList("userC", "SELECT", "tableId_4")))) + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentRuleBaselinesDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentRuleBaselinesDeleteSamples.java new file mode 100644 index 0000000000000..3ecd8607e4e1d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentRuleBaselinesDeleteSamples.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentPolicyBaselineName; + +/** Samples for DatabaseVulnerabilityAssessmentRuleBaselines Delete. */ +public final class DatabaseVulnerabilityAssessmentRuleBaselinesDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentRuleBaselineDelete.json + */ + /** + * Sample code: Removes a database's vulnerability assessment rule baseline. + * + * @param manager Entry point to SqlManager. + */ + public static void removesADatabaseSVulnerabilityAssessmentRuleBaseline( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseVulnerabilityAssessmentRuleBaselines() + .deleteWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + "VA1001", + VulnerabilityAssessmentPolicyBaselineName.DEFAULT, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentRuleBaselinesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentRuleBaselinesGetSamples.java new file mode 100644 index 0000000000000..ade02b546919a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentRuleBaselinesGetSamples.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentPolicyBaselineName; + +/** Samples for DatabaseVulnerabilityAssessmentRuleBaselines Get. */ +public final class DatabaseVulnerabilityAssessmentRuleBaselinesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentRuleBaselineGet.json + */ + /** + * Sample code: Gets a database's vulnerability assessment rule baseline. + * + * @param manager Entry point to SqlManager. + */ + public static void getsADatabaseSVulnerabilityAssessmentRuleBaseline( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseVulnerabilityAssessmentRuleBaselines() + .getWithResponse( + "vulnerabilityaseessmenttest-4711", + "vulnerabilityaseessmenttest-6411", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + "VA1001", + VulnerabilityAssessmentPolicyBaselineName.MASTER, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentScansExportSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentScansExportSamples.java new file mode 100644 index 0000000000000..febe7ce360490 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentScansExportSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for DatabaseVulnerabilityAssessmentScans Export. */ +public final class DatabaseVulnerabilityAssessmentScansExportSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentScanExport.json + */ + /** + * Sample code: Export a database's vulnerability assessment scan results. + * + * @param manager Entry point to SqlManager. + */ + public static void exportADatabaseSVulnerabilityAssessmentScanResults( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseVulnerabilityAssessmentScans() + .exportWithResponse( + "vulnerabilityassessmenttest-4799", + "vulnerabilityassessmenttest-6440", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + "scan001", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentScansGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentScansGetSamples.java new file mode 100644 index 0000000000000..1dad5cf5376f8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentScansGetSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for DatabaseVulnerabilityAssessmentScans Get. */ +public final class DatabaseVulnerabilityAssessmentScansGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentScanRecordsGet.json + */ + /** + * Sample code: Gets a database vulnerability assessment scan record by scan ID. + * + * @param manager Entry point to SqlManager. + */ + public static void getsADatabaseVulnerabilityAssessmentScanRecordByScanID( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseVulnerabilityAssessmentScans() + .getWithResponse( + "vulnerabilityassessmenttest-4711", + "vulnerabilityassessmenttest-6411", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + "scan001", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentScansInitiateScanSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentScansInitiateScanSamples.java new file mode 100644 index 0000000000000..f2fdeb5f9a313 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentScansInitiateScanSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for DatabaseVulnerabilityAssessmentScans InitiateScan. */ +public final class DatabaseVulnerabilityAssessmentScansInitiateScanSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentScansExecute.json + */ + /** + * Sample code: Executes a database's vulnerability assessment scan. + * + * @param manager Entry point to SqlManager. + */ + public static void executesADatabaseSVulnerabilityAssessmentScan( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseVulnerabilityAssessmentScans() + .initiateScan( + "vulnerabilityassessmenttest-4711", + "vulnerabilityassessmenttest-6411", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + "scan01", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentScansListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentScansListByDatabaseSamples.java new file mode 100644 index 0000000000000..186e2f841947e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentScansListByDatabaseSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for DatabaseVulnerabilityAssessmentScans ListByDatabase. */ +public final class DatabaseVulnerabilityAssessmentScansListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentScanRecordsListByDatabase.json + */ + /** + * Sample code: Gets the list of a database vulnerability assessment scan records. + * + * @param manager Entry point to SqlManager. + */ + public static void getsTheListOfADatabaseVulnerabilityAssessmentScanRecords( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseVulnerabilityAssessmentScans() + .listByDatabase( + "vulnerabilityassessmenttest-4711", + "vulnerabilityassessmenttest-6411", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..f2beb86618c00 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentsCreateOrUpdateSamples.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentRecurringScansProperties; +import java.util.Arrays; + +/** Samples for DatabaseVulnerabilityAssessments CreateOrUpdate. */ +public final class DatabaseVulnerabilityAssessmentsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentCreateContainerSasKeyMin.json + */ + /** + * Sample code: Create a database's vulnerability assessment with minimal parameters, when storageContainerSasKey is + * specified. + * + * @param manager Entry point to SqlManager. + */ + public static void + createADatabaseSVulnerabilityAssessmentWithMinimalParametersWhenStorageContainerSasKeyIsSpecified( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseVulnerabilityAssessments() + .define(VulnerabilityAssessmentName.DEFAULT) + .withExistingDatabase("vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", "testdb") + .withStorageContainerPath("https://myStorage.blob.core.windows.net/vulnerability-assessment/") + .withStorageContainerSasKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentCreateMax.json + */ + /** + * Sample code: Create a database's vulnerability assessment with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void createADatabaseSVulnerabilityAssessmentWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseVulnerabilityAssessments() + .define(VulnerabilityAssessmentName.DEFAULT) + .withExistingDatabase("vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", "testdb") + .withStorageContainerPath("https://myStorage.blob.core.windows.net/vulnerability-assessment/") + .withStorageContainerSasKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + .withStorageAccountAccessKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + .withRecurringScans( + new VulnerabilityAssessmentRecurringScansProperties() + .withIsEnabled(true) + .withEmailSubscriptionAdmins(true) + .withEmails(Arrays.asList("email1@mail.com", "email2@mail.com"))) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentCreateStorageAccessKeyMin.json + */ + /** + * Sample code: Create a database's vulnerability assessment with minimal parameters, when storageAccountAccessKey + * is specified. + * + * @param manager Entry point to SqlManager. + */ + public static void + createADatabaseSVulnerabilityAssessmentWithMinimalParametersWhenStorageAccountAccessKeyIsSpecified( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseVulnerabilityAssessments() + .define(VulnerabilityAssessmentName.DEFAULT) + .withExistingDatabase("vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", "testdb") + .withStorageContainerPath("https://myStorage.blob.core.windows.net/vulnerability-assessment/") + .withStorageAccountAccessKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentsDeleteSamples.java new file mode 100644 index 0000000000000..8561514b6a407 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentsDeleteSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for DatabaseVulnerabilityAssessments Delete. */ +public final class DatabaseVulnerabilityAssessmentsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentDelete.json + */ + /** + * Sample code: Remove a database's vulnerability assessment. + * + * @param manager Entry point to SqlManager. + */ + public static void removeADatabaseSVulnerabilityAssessment( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseVulnerabilityAssessments() + .deleteWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentsGetSamples.java new file mode 100644 index 0000000000000..50855e68b719c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentsGetSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for DatabaseVulnerabilityAssessments Get. */ +public final class DatabaseVulnerabilityAssessmentsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentGet.json + */ + /** + * Sample code: Get a database's vulnerability assessment. + * + * @param manager Entry point to SqlManager. + */ + public static void getADatabaseSVulnerabilityAssessment( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseVulnerabilityAssessments() + .getWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentsListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentsListByDatabaseSamples.java new file mode 100644 index 0000000000000..4ee5e55ec9171 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabaseVulnerabilityAssessmentsListByDatabaseSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DatabaseVulnerabilityAssessments ListByDatabase. */ +public final class DatabaseVulnerabilityAssessmentsListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseVulnerabilityAssessmentListByDatabase.json + */ + /** + * Sample code: Get the database's vulnerability assessment policies. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheDatabaseSVulnerabilityAssessmentPolicies( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databaseVulnerabilityAssessments() + .listByDatabase( + "vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", "testdb", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..ff3f3ee3c7795 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesCreateOrUpdateSamples.java @@ -0,0 +1,366 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.resourcemanager.sql.generated.models.AlwaysEncryptedEnclaveType; +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.azure.resourcemanager.sql.generated.models.CreateMode; +import com.azure.resourcemanager.sql.generated.models.SecondaryType; +import com.azure.resourcemanager.sql.generated.models.Sku; +import java.time.OffsetDateTime; + +/** Samples for Databases CreateOrUpdate. */ +public final class DatabasesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/CreateDatabaseConfiguredBackupStorageRedundancy.json + */ + /** + * Sample code: Creates a database with specified backup storage redundancy. + * + * @param manager Entry point to SqlManager. + */ + public static void createsADatabaseWithSpecifiedBackupStorageRedundancy( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("testdb") + .withRegion("southeastasia") + .withExistingServer("Default-SQL-SouthEastAsia", "testsvr") + .withRequestedBackupStorageRedundancy(BackupStorageRedundancy.ZONE) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/CreateDatabaseVBSEnclave.json + */ + /** + * Sample code: Creates a database with VBS enclave type. + * + * @param manager Entry point to SqlManager. + */ + public static void createsADatabaseWithVBSEnclaveType(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("testdb") + .withRegion("southeastasia") + .withExistingServer("Default-SQL-SouthEastAsia", "testsvr") + .withPreferredEnclaveType(AlwaysEncryptedEnclaveType.VBS) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/CreateDatabaseDefaultMode.json + */ + /** + * Sample code: Creates a database with default mode. + * + * @param manager Entry point to SqlManager. + */ + public static void createsADatabaseWithDefaultMode(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("testdb") + .withRegion("southeastasia") + .withExistingServer("Default-SQL-SouthEastAsia", "testsvr") + .withSku(new Sku().withName("S0").withTier("Standard")) + .withCreateMode(CreateMode.DEFAULT) + .withCollation("SQL_Latin1_General_CP1_CI_AS") + .withMaxSizeBytes(1073741824L) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/CreateVCoreDatabaseByServiceObjective.json + */ + /** + * Sample code: Creates a VCore database by specifying service objective name. + * + * @param manager Entry point to SqlManager. + */ + public static void createsAVCoreDatabaseBySpecifyingServiceObjectiveName( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("testdb") + .withRegion("southeastasia") + .withExistingServer("Default-SQL-SouthEastAsia", "testsvr") + .withSku(new Sku().withName("BC").withFamily("Gen4").withCapacity(2)) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/CreateDatabaseMin.json + */ + /** + * Sample code: Creates a database with minimum number of parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void createsADatabaseWithMinimumNumberOfParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("testdb") + .withRegion("southeastasia") + .withExistingServer("Default-SQL-SouthEastAsia", "testsvr") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/CreateDatabaseStandbyMode.json + */ + /** + * Sample code: Creates a database as a standby secondary. + * + * @param manager Entry point to SqlManager. + */ + public static void createsADatabaseAsAStandbySecondary(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("testdb") + .withRegion("southeastasia") + .withExistingServer("Default-SQL-SouthEastAsia", "testsvr") + .withSku(new Sku().withName("S0").withTier("Standard")) + .withCreateMode(CreateMode.SECONDARY) + .withSourceDatabaseId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-NorthEurope/providers/Microsoft.Sql/servers/testsvr1/databases/testdb") + .withSecondaryType(SecondaryType.STANDBY) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/CreateDwDatabaseCrossSubscriptionRecovery.json + */ + /** + * Sample code: Creates a data warehouse database as a cross-subscription restore from a geo-backup. + * + * @param manager Entry point to SqlManager. + */ + public static void createsADataWarehouseDatabaseAsACrossSubscriptionRestoreFromAGeoBackup( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("testdw") + .withRegion("westus") + .withExistingServer("Default-SQL-WestUS", "testsvr") + .withCreateMode(CreateMode.RECOVERY) + .withSourceResourceId( + "/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-SQL-EastUS/providers/Microsoft.Sql/servers/srcsvr/recoverabledatabases/srcdw") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/CreateDatabaseMaintenanceConfiguration.json + */ + /** + * Sample code: Creates a database with preferred maintenance window. + * + * @param manager Entry point to SqlManager. + */ + public static void createsADatabaseWithPreferredMaintenanceWindow( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("testdb") + .withRegion("southeastasia") + .withExistingServer("Default-SQL-SouthEastAsia", "testsvr") + .withSku(new Sku().withName("S2").withTier("Standard")) + .withCreateMode(CreateMode.DEFAULT) + .withCollation("SQL_Latin1_General_CP1_CI_AS") + .withMaxSizeBytes(1073741824L) + .withMaintenanceConfigurationId( + "/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_SouthEastAsia_1") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/CreateDatabaseCopyMode.json + */ + /** + * Sample code: Creates a database as a copy. + * + * @param manager Entry point to SqlManager. + */ + public static void createsADatabaseAsACopy(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("dbcopy") + .withRegion("southeastasia") + .withExistingServer("Default-SQL-SouthEastAsia", "testsvr") + .withSku(new Sku().withName("S0").withTier("Standard")) + .withCreateMode(CreateMode.COPY) + .withSourceDatabaseId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/CreateDatabasePITRMode.json + */ + /** + * Sample code: Creates a database from PointInTimeRestore. + * + * @param manager Entry point to SqlManager. + */ + public static void createsADatabaseFromPointInTimeRestore( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("dbpitr") + .withRegion("southeastasia") + .withExistingServer("Default-SQL-SouthEastAsia", "testsvr") + .withCreateMode(CreateMode.POINT_IN_TIME_RESTORE) + .withSourceDatabaseId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SoutheastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb") + .withRestorePointInTime(OffsetDateTime.parse("2020-10-22T05:35:31.503Z")) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/CreateDatabaseLedger.json + */ + /** + * Sample code: Creates a database with ledger on. + * + * @param manager Entry point to SqlManager. + */ + public static void createsADatabaseWithLedgerOn(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("testdb") + .withRegion("southeastasia") + .withExistingServer("Default-SQL-SouthEastAsia", "testsvr") + .withIsLedgerOn(true) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/CreateDatabaseDefaultEnclave.json + */ + /** + * Sample code: Creates a database with Default enclave type. + * + * @param manager Entry point to SqlManager. + */ + public static void createsADatabaseWithDefaultEnclaveType( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("testdb") + .withRegion("southeastasia") + .withExistingServer("Default-SQL-SouthEastAsia", "testsvr") + .withPreferredEnclaveType(AlwaysEncryptedEnclaveType.DEFAULT) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/CreateDwDatabaseCrossSubscriptionPITR.json + */ + /** + * Sample code: Creates a data warehouse database as a cross-subscription restore from a restore point of an + * existing database. + * + * @param manager Entry point to SqlManager. + */ + public static void createsADataWarehouseDatabaseAsACrossSubscriptionRestoreFromARestorePointOfAnExistingDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("testdw") + .withRegion("southeastasia") + .withExistingServer("Default-SQL-SouthEastAsia", "testsvr") + .withCreateMode(CreateMode.POINT_IN_TIME_RESTORE) + .withRestorePointInTime(OffsetDateTime.parse("2022-01-22T05:35:31.503Z")) + .withSourceResourceId( + "/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/srcsvr/databases/srcdw") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/CreateVCoreDatabaseBySkuNameCapacity.json + */ + /** + * Sample code: Creates a VCore database by specifying sku name and capacity. + * + * @param manager Entry point to SqlManager. + */ + public static void createsAVCoreDatabaseBySpecifyingSkuNameAndCapacity( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("testdb") + .withRegion("southeastasia") + .withExistingServer("Default-SQL-SouthEastAsia", "testsvr") + .withSku(new Sku().withName("BC_Gen4").withCapacity(2)) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/CreateDwDatabaseCrossSubscriptionRestore.json + */ + /** + * Sample code: Creates a data warehouse database as a cross-subscription restore from a backup of a dropped + * database. + * + * @param manager Entry point to SqlManager. + */ + public static void createsADataWarehouseDatabaseAsACrossSubscriptionRestoreFromABackupOfADroppedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("testdw") + .withRegion("southeastasia") + .withExistingServer("Default-SQL-SouthEastAsia", "testsvr") + .withCreateMode(CreateMode.RESTORE) + .withSourceResourceId( + "/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/srcsvr/restorableDroppedDatabases/srcdw,131403269876900000") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/CreateDatabaseNamedReplica.json + */ + /** + * Sample code: Creates a database as named replica secondary. + * + * @param manager Entry point to SqlManager. + */ + public static void createsADatabaseAsNamedReplicaSecondary( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("testdb") + .withRegion("southeastasia") + .withExistingServer("Default-SQL-SouthEastAsia", "testsvr") + .withSku(new Sku().withName("HS_Gen4").withTier("Hyperscale").withCapacity(2)) + .withCreateMode(CreateMode.SECONDARY) + .withSourceDatabaseId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-NorthEurope/providers/Microsoft.Sql/servers/testsvr1/databases/primarydb") + .withSecondaryType(SecondaryType.NAMED) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/CreateDatabaseSecondaryMode.json + */ + /** + * Sample code: Creates a database as an on-line secondary. + * + * @param manager Entry point to SqlManager. + */ + public static void createsADatabaseAsAnOnLineSecondary(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .define("testdb") + .withRegion("southeastasia") + .withExistingServer("Default-SQL-SouthEastAsia", "testsvr") + .withSku(new Sku().withName("S0").withTier("Standard")) + .withCreateMode(CreateMode.SECONDARY) + .withSourceDatabaseId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-NorthEurope/providers/Microsoft.Sql/servers/testsvr1/databases/testdb") + .withSecondaryType(SecondaryType.GEO) + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesDeleteSamples.java new file mode 100644 index 0000000000000..ca4fc8860e959 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Databases Delete. */ +public final class DatabasesDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/DeleteDatabase.json + */ + /** + * Sample code: Deletes a database. + * + * @param manager Entry point to SqlManager. + */ + public static void deletesADatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databases().delete("Default-SQL-SouthEastAsia", "testsvr", "testdb", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesExportSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesExportSamples.java new file mode 100644 index 0000000000000..fc0b0b62c87f5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesExportSamples.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ExportDatabaseDefinition; +import com.azure.resourcemanager.sql.generated.models.NetworkIsolationSettings; +import com.azure.resourcemanager.sql.generated.models.StorageKeyType; + +/** Samples for Databases Export. */ +public final class DatabasesExportSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/ExportDatabase.json + */ + /** + * Sample code: Exports a database. + * + * @param manager Entry point to SqlManager. + */ + public static void exportsADatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .export( + "Default-SQL-SouthEastAsia", + "testsvr", + "testdb", + new ExportDatabaseDefinition() + .withStorageKeyType(StorageKeyType.STORAGE_ACCESS_KEY) + .withStorageKey("fakeTokenPlaceholder") + .withStorageUri("https://test.blob.core.windows.net/test.bacpac") + .withAdministratorLogin("login") + .withAdministratorLoginPassword("fakeTokenPlaceholder") + .withAuthenticationType("Sql"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/ExportDatabaseWithNetworkIsolation.json + */ + /** + * Sample code: Exports a database, using private link to communicate with SQL server and storage account. + * + * @param manager Entry point to SqlManager. + */ + public static void exportsADatabaseUsingPrivateLinkToCommunicateWithSQLServerAndStorageAccount( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .export( + "Default-SQL-SouthEastAsia", + "testsvr", + "testdb", + new ExportDatabaseDefinition() + .withStorageKeyType(StorageKeyType.STORAGE_ACCESS_KEY) + .withStorageKey("fakeTokenPlaceholder") + .withStorageUri("https://test.blob.core.windows.net/test.bacpac") + .withAdministratorLogin("login") + .withAdministratorLoginPassword("fakeTokenPlaceholder") + .withAuthenticationType("Sql") + .withNetworkIsolation( + new NetworkIsolationSettings() + .withStorageAccountResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Storage/storageAccounts/test-privatelink") + .withSqlServerResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr")), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesFailoverSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesFailoverSamples.java new file mode 100644 index 0000000000000..e195145e98d27 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesFailoverSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ReplicaType; + +/** Samples for Databases Failover. */ +public final class DatabasesFailoverSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/FailoverDatabase.json + */ + /** + * Sample code: Failover an database. + * + * @param manager Entry point to SqlManager. + */ + public static void failoverAnDatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databases().failover("group1", "testServer", "testDatabase", ReplicaType.PRIMARY, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesGetSamples.java new file mode 100644 index 0000000000000..81e1a5afc6738 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesGetSamples.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Databases Get. */ +public final class DatabasesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/GetVCoreDatabase.json + */ + /** + * Sample code: Gets a database. + * + * @param manager Entry point to SqlManager. + */ + public static void getsADatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databases().getWithResponse("Default-SQL-SouthEastAsia", "testsvr", "testdb", Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/GetVCoreDatabaseDefaultEnclave.json + */ + /** + * Sample code: Gets a database configured with Default enclave type. + * + * @param manager Entry point to SqlManager. + */ + public static void getsADatabaseConfiguredWithDefaultEnclaveType( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databases().getWithResponse("Default-SQL-SouthEastAsia", "testsvr", "testdb", Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/GetVCoreDatabaseVBSEnclave.json + */ + /** + * Sample code: Gets a database configured with VBS enclave type. + * + * @param manager Entry point to SqlManager. + */ + public static void getsADatabaseConfiguredWithVBSEnclaveType( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databases().getWithResponse("Default-SQL-SouthEastAsia", "testsvr", "testdb", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesImportMethodSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesImportMethodSamples.java new file mode 100644 index 0000000000000..99a67d46edc47 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesImportMethodSamples.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ImportExistingDatabaseDefinition; +import com.azure.resourcemanager.sql.generated.models.NetworkIsolationSettings; +import com.azure.resourcemanager.sql.generated.models.StorageKeyType; + +/** Samples for Databases ImportMethod. */ +public final class DatabasesImportMethodSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/ImportDatabase.json + */ + /** + * Sample code: Imports to an existing empty database. + * + * @param manager Entry point to SqlManager. + */ + public static void importsToAnExistingEmptyDatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .importMethod( + "Default-SQL-SouthEastAsia", + "testsvr", + "testdb", + new ImportExistingDatabaseDefinition() + .withStorageKeyType(StorageKeyType.STORAGE_ACCESS_KEY) + .withStorageKey("fakeTokenPlaceholder") + .withStorageUri("https://test.blob.core.windows.net/test.bacpac") + .withAdministratorLogin("login") + .withAdministratorLoginPassword("fakeTokenPlaceholder") + .withAuthenticationType("Sql"), + Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/ImportDatabaseWithNetworkIsolation.json + */ + /** + * Sample code: Imports to an existing empty database, using private link to communicate with SQL server and storage + * account. + * + * @param manager Entry point to SqlManager. + */ + public static void importsToAnExistingEmptyDatabaseUsingPrivateLinkToCommunicateWithSQLServerAndStorageAccount( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .importMethod( + "Default-SQL-SouthEastAsia", + "testsvr", + "testdb", + new ImportExistingDatabaseDefinition() + .withStorageKeyType(StorageKeyType.STORAGE_ACCESS_KEY) + .withStorageKey("fakeTokenPlaceholder") + .withStorageUri("https://test.blob.core.windows.net/test.bacpac") + .withAdministratorLogin("login") + .withAdministratorLoginPassword("fakeTokenPlaceholder") + .withAuthenticationType("Sql") + .withNetworkIsolation( + new NetworkIsolationSettings() + .withStorageAccountResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Storage/storageAccounts/test-privatelink") + .withSqlServerResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr")), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesListByElasticPoolSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesListByElasticPoolSamples.java new file mode 100644 index 0000000000000..ffb0da44252ed --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesListByElasticPoolSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Databases ListByElasticPool. */ +public final class DatabasesListByElasticPoolSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/ListDatabasesByElasticPool.json + */ + /** + * Sample code: Gets a list of databases in an elastic pool. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAListOfDatabasesInAnElasticPool(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databases().listByElasticPool("Default-SQL-SouthEastAsia", "testsvr", "pool1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesListByServerSamples.java new file mode 100644 index 0000000000000..069bafb133d41 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesListByServerSamples.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Databases ListByServer. */ +public final class DatabasesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/ListVCoreDatabasesEnclaveTypeByServer.json + */ + /** + * Sample code: Gets a list of databases configured with enclave type. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAListOfDatabasesConfiguredWithEnclaveType( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databases().listByServer("Default-SQL-SouthEastAsia", "testsvr", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/ListVCoreDatabasesByServer.json + */ + /** + * Sample code: Gets a list of databases. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAListOfDatabases(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databases().listByServer("Default-SQL-SouthEastAsia", "testsvr", null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesListInaccessibleByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesListInaccessibleByServerSamples.java new file mode 100644 index 0000000000000..c658f05aa5ac6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesListInaccessibleByServerSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Databases ListInaccessibleByServer. */ +public final class DatabasesListInaccessibleByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/ListVCoreInaccessibleDatabasesByServer.json + */ + /** + * Sample code: Gets a list of inaccessible databases in a logical server. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAListOfInaccessibleDatabasesInALogicalServer( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databases().listInaccessibleByServer("Default-SQL-SouthEastAsia", "testsvr", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesListMetricDefinitionsSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesListMetricDefinitionsSamples.java new file mode 100644 index 0000000000000..35a96bba25efc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesListMetricDefinitionsSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Databases ListMetricDefinitions. */ +public final class DatabasesListMetricDefinitionsSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/DatabaseMetricsDefinitionsList.json + */ + /** + * Sample code: List database usage metrics. + * + * @param manager Entry point to SqlManager. + */ + public static void listDatabaseUsageMetrics(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databases().listMetricDefinitions("sqlcrudtest-6730", "sqlcrudtest-9007", "3481", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesListMetricsSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesListMetricsSamples.java new file mode 100644 index 0000000000000..7e1704253e8b0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesListMetricsSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Databases ListMetrics. */ +public final class DatabasesListMetricsSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/DatabaseMetricsListWithFilter.json + */ + /** + * Sample code: List database usage metrics. + * + * @param manager Entry point to SqlManager. + */ + public static void listDatabaseUsageMetrics(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .listMetrics( + "sqlcrudtest-6730", + "sqlcrudtest-9007", + "3481", + "name/value eq 'cpu_percent' and timeGrain eq '00:10:00' and startTime eq '2017-06-02T18:35:00Z' and" + + " endTime eq '2017-06-02T18:55:00Z'", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesPauseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesPauseSamples.java new file mode 100644 index 0000000000000..3f64db41c4434 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesPauseSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Databases Pause. */ +public final class DatabasesPauseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/PauseDatabase.json + */ + /** + * Sample code: Pauses a database. + * + * @param manager Entry point to SqlManager. + */ + public static void pausesADatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databases().pause("Default-SQL-SouthEastAsia", "testsvr", "testdwdb", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesRenameSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesRenameSamples.java new file mode 100644 index 0000000000000..dd86647010db2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesRenameSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ResourceMoveDefinition; + +/** Samples for Databases Rename. */ +public final class DatabasesRenameSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/RenameDatabase.json + */ + /** + * Sample code: Renames a database. + * + * @param manager Entry point to SqlManager. + */ + public static void renamesADatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .databases() + .renameWithResponse( + "Default-SQL-SouthEastAsia", + "testsvr", + "testdb", + new ResourceMoveDefinition() + .withId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/newtestdb"), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesResumeSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesResumeSamples.java new file mode 100644 index 0000000000000..2be5c508e8f77 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesResumeSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Databases Resume. */ +public final class DatabasesResumeSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/ResumeDatabase.json + */ + /** + * Sample code: Resumes a database. + * + * @param manager Entry point to SqlManager. + */ + public static void resumesADatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databases().resume("Default-SQL-SouthEastAsia", "testsvr", "testdwdb", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesUpdateSamples.java new file mode 100644 index 0000000000000..59ff4ffd89924 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesUpdateSamples.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.AlwaysEncryptedEnclaveType; +import com.azure.resourcemanager.sql.generated.models.Database; +import com.azure.resourcemanager.sql.generated.models.DatabaseLicenseType; +import com.azure.resourcemanager.sql.generated.models.Sku; + +/** Samples for Databases Update. */ +public final class DatabasesUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/PatchVCoreDatabaseAssignMaintenanceConfiguration.json + */ + /** + * Sample code: Assigns maintenance window to a database. + * + * @param manager Entry point to SqlManager. + */ + public static void assignsMaintenanceWindowToADatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + Database resource = + manager + .databases() + .getWithResponse("Default-SQL-SouthEastAsia", "testsvr", "testdb", Context.NONE) + .getValue(); + resource + .update() + .withSku(new Sku().withName("BC_Gen5_4")) + .withMaintenanceConfigurationId( + "/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_SouthEastAsia_1") + .apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/PatchDatabaseVBSEnclave.json + */ + /** + * Sample code: Creates a database with VBS enclave type. + * + * @param manager Entry point to SqlManager. + */ + public static void createsADatabaseWithVBSEnclaveType(com.azure.resourcemanager.sql.generated.SqlManager manager) { + Database resource = + manager + .databases() + .getWithResponse("Default-SQL-SouthEastAsia", "testsvr", "testdb", Context.NONE) + .getValue(); + resource.update().withPreferredEnclaveType(AlwaysEncryptedEnclaveType.VBS).apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/PatchVCoreDatabaseResetMaintenanceConfiguration.json + */ + /** + * Sample code: Resets maintenance window of a database to default. + * + * @param manager Entry point to SqlManager. + */ + public static void resetsMaintenanceWindowOfADatabaseToDefault( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + Database resource = + manager + .databases() + .getWithResponse("Default-SQL-SouthEastAsia", "testsvr", "testdb", Context.NONE) + .getValue(); + resource + .update() + .withSku(new Sku().withName("BC_Gen5_4")) + .withMaintenanceConfigurationId( + "/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_Default") + .apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/PatchDatabaseDefaultEnclave.json + */ + /** + * Sample code: Updates a database with Default enclave type. + * + * @param manager Entry point to SqlManager. + */ + public static void updatesADatabaseWithDefaultEnclaveType( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + Database resource = + manager + .databases() + .getWithResponse("Default-SQL-SouthEastAsia", "testsvr", "testdb", Context.NONE) + .getValue(); + resource.update().withPreferredEnclaveType(AlwaysEncryptedEnclaveType.DEFAULT).apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/PatchVCoreDatabase.json + */ + /** + * Sample code: Updates a database. + * + * @param manager Entry point to SqlManager. + */ + public static void updatesADatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + Database resource = + manager + .databases() + .getWithResponse("Default-SQL-SouthEastAsia", "testsvr", "testdb", Context.NONE) + .getValue(); + resource + .update() + .withSku(new Sku().withName("BC_Gen4_4")) + .withMaxSizeBytes(1073741824L) + .withLicenseType(DatabaseLicenseType.LICENSE_INCLUDED) + .apply(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesUpgradeDataWarehouseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesUpgradeDataWarehouseSamples.java new file mode 100644 index 0000000000000..a3b6d508287c5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DatabasesUpgradeDataWarehouseSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Databases UpgradeDataWarehouse. */ +public final class DatabasesUpgradeDataWarehouseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/UpgradeDataWarehouse.json + */ + /** + * Sample code: Upgrades a data warehouse. + * + * @param manager Entry point to SqlManager. + */ + public static void upgradesADataWarehouse(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.databases().upgradeDataWarehouse("Default-SQL-SouthEastAsia", "testsvr", "testdwdb", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DeletedServersGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DeletedServersGetSamples.java new file mode 100644 index 0000000000000..d3f39a0cdd1fe --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DeletedServersGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DeletedServers Get. */ +public final class DeletedServersGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeletedServerGet.json + */ + /** + * Sample code: Get deleted server. + * + * @param manager Entry point to SqlManager. + */ + public static void getDeletedServer(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.deletedServers().getWithResponse("japaneast", "sqlcrudtest-d-1414", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DeletedServersListByLocationSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DeletedServersListByLocationSamples.java new file mode 100644 index 0000000000000..ca629f3144fde --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DeletedServersListByLocationSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DeletedServers ListByLocation. */ +public final class DeletedServersListByLocationSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeletedServerList.json + */ + /** + * Sample code: List deleted servers. + * + * @param manager Entry point to SqlManager. + */ + public static void listDeletedServers(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.deletedServers().listByLocation("japaneast", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DeletedServersListSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DeletedServersListSamples.java new file mode 100644 index 0000000000000..b19ce9720df23 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DeletedServersListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DeletedServers List. */ +public final class DeletedServersListSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeletedServerListBySubscription.json + */ + /** + * Sample code: List deleted servers in a subscription. + * + * @param manager Entry point to SqlManager. + */ + public static void listDeletedServersInASubscription(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.deletedServers().list(Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DeletedServersRecoverSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DeletedServersRecoverSamples.java new file mode 100644 index 0000000000000..99d86f09218ea --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DeletedServersRecoverSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DeletedServers Recover. */ +public final class DeletedServersRecoverSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeletedServerRecover.json + */ + /** + * Sample code: Recover deleted server. + * + * @param manager Entry point to SqlManager. + */ + public static void recoverDeletedServer(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.deletedServers().recover("japaneast", "sqlcrudtest-d-1414", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DistributedAvailabilityGroupsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DistributedAvailabilityGroupsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..e14ba332d03a0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DistributedAvailabilityGroupsCreateOrUpdateSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +/** Samples for DistributedAvailabilityGroups CreateOrUpdate. */ +public final class DistributedAvailabilityGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DistributedAvailabilityGroupsCreate.json + */ + /** + * Sample code: Create a distributed availability group. + * + * @param manager Entry point to SqlManager. + */ + public static void createADistributedAvailabilityGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .distributedAvailabilityGroups() + .define("dag") + .withExistingManagedInstance("testrg", "testcl") + .withTargetDatabase("testdb") + .withSourceEndpoint("TCP://SERVER:7022") + .withPrimaryAvailabilityGroupName("BoxLocalAg1") + .withSecondaryAvailabilityGroupName("testcl") + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DistributedAvailabilityGroupsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DistributedAvailabilityGroupsDeleteSamples.java new file mode 100644 index 0000000000000..5c0eef6737c3e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DistributedAvailabilityGroupsDeleteSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DistributedAvailabilityGroups Delete. */ +public final class DistributedAvailabilityGroupsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DistributedAvailabilityGroupsDelete.json + */ + /** + * Sample code: Initiate a distributed availability group drop. + * + * @param manager Entry point to SqlManager. + */ + public static void initiateADistributedAvailabilityGroupDrop( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.distributedAvailabilityGroups().delete("testrg", "testcl", "dag", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DistributedAvailabilityGroupsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DistributedAvailabilityGroupsGetSamples.java new file mode 100644 index 0000000000000..1ac09153ce0ea --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DistributedAvailabilityGroupsGetSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DistributedAvailabilityGroups Get. */ +public final class DistributedAvailabilityGroupsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DistributedAvailabilityGroupsGet.json + */ + /** + * Sample code: Gets the distributed availability group info. + * + * @param manager Entry point to SqlManager. + */ + public static void getsTheDistributedAvailabilityGroupInfo( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.distributedAvailabilityGroups().getWithResponse("testrg", "testcl", "dag", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DistributedAvailabilityGroupsListByInstanceSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DistributedAvailabilityGroupsListByInstanceSamples.java new file mode 100644 index 0000000000000..5e280226a1390 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DistributedAvailabilityGroupsListByInstanceSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for DistributedAvailabilityGroups ListByInstance. */ +public final class DistributedAvailabilityGroupsListByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DistributedAvailabilityGroupsListByInstance.json + */ + /** + * Sample code: Lists all distributed availability groups in instance. + * + * @param manager Entry point to SqlManager. + */ + public static void listsAllDistributedAvailabilityGroupsInInstance( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.distributedAvailabilityGroups().listByInstance("testrg", "testcl", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DistributedAvailabilityGroupsUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DistributedAvailabilityGroupsUpdateSamples.java new file mode 100644 index 0000000000000..51bfcfcbfe472 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/DistributedAvailabilityGroupsUpdateSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.DistributedAvailabilityGroup; +import com.azure.resourcemanager.sql.generated.models.ReplicationMode; + +/** Samples for DistributedAvailabilityGroups Update. */ +public final class DistributedAvailabilityGroupsUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DistributedAvailabilityGroupsUpdate.json + */ + /** + * Sample code: Update the distributed availability group replication mode before deleting it. + * + * @param manager Entry point to SqlManager. + */ + public static void updateTheDistributedAvailabilityGroupReplicationModeBeforeDeletingIt( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + DistributedAvailabilityGroup resource = + manager.distributedAvailabilityGroups().getWithResponse("testrg", "testcl", "dag", Context.NONE).getValue(); + resource.update().withReplicationMode(ReplicationMode.SYNC).apply(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolActivitiesListByElasticPoolSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolActivitiesListByElasticPoolSamples.java new file mode 100644 index 0000000000000..f4c30a4e3bc59 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolActivitiesListByElasticPoolSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ElasticPoolActivities ListByElasticPool. */ +public final class ElasticPoolActivitiesListByElasticPoolSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01-legacy/examples/ElasticPoolActivityList.json + */ + /** + * Sample code: List Elastic pool activity. + * + * @param manager Entry point to SqlManager. + */ + public static void listElasticPoolActivity(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.elasticPoolActivities().listByElasticPool("sqlcrudtest-4291", "sqlcrudtest-6574", "8749", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolDatabaseActivitiesListByElasticPoolSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolDatabaseActivitiesListByElasticPoolSamples.java new file mode 100644 index 0000000000000..8aa502901aa00 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolDatabaseActivitiesListByElasticPoolSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ElasticPoolDatabaseActivities ListByElasticPool. */ +public final class ElasticPoolDatabaseActivitiesListByElasticPoolSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01-legacy/examples/ElasticPoolDatabaseActivityList.json + */ + /** + * Sample code: List elastic pool database activity. + * + * @param manager Entry point to SqlManager. + */ + public static void listElasticPoolDatabaseActivity(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .elasticPoolDatabaseActivities() + .listByElasticPool("sqlcrudtest-4673", "sqlcrudtest-603", "7537", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolOperationsCancelSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolOperationsCancelSamples.java new file mode 100644 index 0000000000000..d6a105c111d28 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolOperationsCancelSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import java.util.UUID; + +/** Samples for ElasticPoolOperations Cancel. */ +public final class ElasticPoolOperationsCancelSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CancelElasticPoolOperation.json + */ + /** + * Sample code: Cancel the elastic pool management operation. + * + * @param manager Entry point to SqlManager. + */ + public static void cancelTheElasticPoolManagementOperation( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .elasticPoolOperations() + .cancelWithResponse( + "sqlcrudtest-7398", + "sqlcrudtest-6661", + "testpool", + UUID.fromString("f779414b-e748-4925-8cfe-c8598f7660ae"), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolOperationsListByElasticPoolSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolOperationsListByElasticPoolSamples.java new file mode 100644 index 0000000000000..5a66fd58017fb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolOperationsListByElasticPoolSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ElasticPoolOperations ListByElasticPool. */ +public final class ElasticPoolOperationsListByElasticPoolSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListElasticPoolOperations.json + */ + /** + * Sample code: List the elastic pool management operations. + * + * @param manager Entry point to SqlManager. + */ + public static void listTheElasticPoolManagementOperations( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .elasticPoolOperations() + .listByElasticPool("sqlcrudtestgroup", "sqlcrudtestserver", "testpool", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..c0bb80daaebbf --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolsCreateOrUpdateSamples.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.resourcemanager.sql.generated.models.ElasticPoolPerDatabaseSettings; +import com.azure.resourcemanager.sql.generated.models.Sku; + +/** Samples for ElasticPools CreateOrUpdate. */ +public final class ElasticPoolsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/ElasticPoolCreateOrUpdateMax.json + */ + /** + * Sample code: Create or update elastic pool with all parameter. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateElasticPoolWithAllParameter( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .elasticPools() + .define("sqlcrudtest-8102") + .withRegion("Japan East") + .withExistingServer("sqlcrudtest-2369", "sqlcrudtest-8069") + .withSku(new Sku().withName("GP_Gen4_2").withTier("GeneralPurpose").withCapacity(2)) + .withPerDatabaseSettings(new ElasticPoolPerDatabaseSettings().withMinCapacity(0.25D).withMaxCapacity(2.0D)) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/HyperscaleElasticPoolCreateOrUpdateSetHighAvailabilityReplicaCount.json + */ + /** + * Sample code: Create or update Hyperscale elastic pool with high availability replica count parameter. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateHyperscaleElasticPoolWithHighAvailabilityReplicaCountParameter( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .elasticPools() + .define("sqlcrudtest-8102") + .withRegion("Japan East") + .withExistingServer("sqlcrudtest-2369", "sqlcrudtest-8069") + .withSku(new Sku().withName("HS_Gen5_4")) + .withHighAvailabilityReplicaCount(2) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/ElasticPoolCreateOrUpdateSetMaintenanceConfiguration.json + */ + /** + * Sample code: Create or update elastic pool with maintenance configuration parameter. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateElasticPoolWithMaintenanceConfigurationParameter( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .elasticPools() + .define("sqlcrudtest-8102") + .withRegion("Japan East") + .withExistingServer("sqlcrudtest-2369", "sqlcrudtest-8069") + .withMaintenanceConfigurationId( + "/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_JapanEast_1") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/ElasticPoolCreateOrUpdateMin.json + */ + /** + * Sample code: Create or update elastic pool with minimum parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateElasticPoolWithMinimumParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .elasticPools() + .define("sqlcrudtest-8102") + .withRegion("Japan East") + .withExistingServer("sqlcrudtest-2369", "sqlcrudtest-8069") + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolsDeleteSamples.java new file mode 100644 index 0000000000000..581ed3a32ffe4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolsDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ElasticPools Delete. */ +public final class ElasticPoolsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/ElasticPoolDelete.json + */ + /** + * Sample code: Delete an elastic pool. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteAnElasticPool(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.elasticPools().delete("sqlcrudtest-3129", "sqlcrudtest-228", "sqlcrudtest-3851", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolsFailoverSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolsFailoverSamples.java new file mode 100644 index 0000000000000..adec50298a93a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolsFailoverSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ElasticPools Failover. */ +public final class ElasticPoolsFailoverSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/FailoverElasticPool.json + */ + /** + * Sample code: Failover an elastic pool. + * + * @param manager Entry point to SqlManager. + */ + public static void failoverAnElasticPool(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.elasticPools().failover("group1", "testServer", "testElasticPool", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolsGetSamples.java new file mode 100644 index 0000000000000..ae56788a85fbe --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolsGetSamples.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ElasticPools Get. */ +public final class ElasticPoolsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/HyperscaleElasticPoolGet.json + */ + /** + * Sample code: Get a Hyperscale elastic pool. + * + * @param manager Entry point to SqlManager. + */ + public static void getAHyperscaleElasticPool(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .elasticPools() + .getWithResponse("sqlcrudtest-2369", "sqlcrudtest-8069", "sqlcrudtest-8102", Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/ElasticPoolGet.json + */ + /** + * Sample code: Get an elastic pool. + * + * @param manager Entry point to SqlManager. + */ + public static void getAnElasticPool(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .elasticPools() + .getWithResponse("sqlcrudtest-2369", "sqlcrudtest-8069", "sqlcrudtest-8102", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolsListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolsListByServerSamples.java new file mode 100644 index 0000000000000..fd911d22f68c2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolsListByServerSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ElasticPools ListByServer. */ +public final class ElasticPoolsListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/ElasticPoolListByServer.json + */ + /** + * Sample code: Get all elastic pools in a server. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllElasticPoolsInAServer(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.elasticPools().listByServer("sqlcrudtest-2369", "sqlcrudtest-8069", null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolsListMetricDefinitionsSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolsListMetricDefinitionsSamples.java new file mode 100644 index 0000000000000..106dc48759c12 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolsListMetricDefinitionsSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ElasticPools ListMetricDefinitions. */ +public final class ElasticPoolsListMetricDefinitionsSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/ElasticPoolMetricsDefinitionsList.json + */ + /** + * Sample code: List database usage metrics. + * + * @param manager Entry point to SqlManager. + */ + public static void listDatabaseUsageMetrics(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.elasticPools().listMetricDefinitions("sqlcrudtest-6730", "sqlcrudtest-9007", "3481", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolsListMetricsSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolsListMetricsSamples.java new file mode 100644 index 0000000000000..55efe17882d43 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolsListMetricsSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ElasticPools ListMetrics. */ +public final class ElasticPoolsListMetricsSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/ElasticPoolMetricsListWithFilter.json + */ + /** + * Sample code: List database usage metrics. + * + * @param manager Entry point to SqlManager. + */ + public static void listDatabaseUsageMetrics(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .elasticPools() + .listMetrics( + "sqlcrudtest-6730", + "sqlcrudtest-9007", + "3481", + "name/value eq 'cpu_percent' and timeGrain eq '00:10:00' and startTime eq '2017-06-02T18:35:00Z' and" + + " endTime eq '2017-06-02T18:55:00Z'", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolsUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolsUpdateSamples.java new file mode 100644 index 0000000000000..580ead522a6fc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ElasticPoolsUpdateSamples.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ElasticPool; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolLicenseType; +import com.azure.resourcemanager.sql.generated.models.ElasticPoolPerDatabaseSettings; +import com.azure.resourcemanager.sql.generated.models.Sku; + +/** Samples for ElasticPools Update. */ +public final class ElasticPoolsUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/ElasticPoolUpdateMax.json + */ + /** + * Sample code: Update an elastic pool with all parameter. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAnElasticPoolWithAllParameter(com.azure.resourcemanager.sql.generated.SqlManager manager) { + ElasticPool resource = + manager + .elasticPools() + .getWithResponse("sqlcrudtest-2369", "sqlcrudtest-8069", "sqlcrudtest-8102", Context.NONE) + .getValue(); + resource + .update() + .withSku(new Sku().withName("BC_Gen4").withTier("BusinessCritical").withCapacity(2)) + .withPerDatabaseSettings(new ElasticPoolPerDatabaseSettings().withMinCapacity(0.25D).withMaxCapacity(1.0D)) + .withZoneRedundant(true) + .withLicenseType(ElasticPoolLicenseType.LICENSE_INCLUDED) + .apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/HyperscaleElasticPoolUpdateSetHighAvailabilityReplicaCount.json + */ + /** + * Sample code: Update high availability replica count of a Hyperscale elastic pool. + * + * @param manager Entry point to SqlManager. + */ + public static void updateHighAvailabilityReplicaCountOfAHyperscaleElasticPool( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ElasticPool resource = + manager + .elasticPools() + .getWithResponse("sqlcrudtest-2369", "sqlcrudtest-8069", "sqlcrudtest-8102", Context.NONE) + .getValue(); + resource.update().withHighAvailabilityReplicaCount(2).apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/ElasticPoolUpdateMin.json + */ + /** + * Sample code: Update an elastic pool with minimum parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAnElasticPoolWithMinimumParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ElasticPool resource = + manager + .elasticPools() + .getWithResponse("sqlcrudtest-2369", "sqlcrudtest-8069", "sqlcrudtest-8102", Context.NONE) + .getValue(); + resource.update().apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/ElasticPoolUpdateAssignMaintenanceConfiguration.json + */ + /** + * Sample code: Assigns maintenance configuration to an elastic pool. + * + * @param manager Entry point to SqlManager. + */ + public static void assignsMaintenanceConfigurationToAnElasticPool( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ElasticPool resource = + manager + .elasticPools() + .getWithResponse("sqlcrudtest-2369", "sqlcrudtest-8069", "sqlcrudtest-8102", Context.NONE) + .getValue(); + resource + .update() + .withMaintenanceConfigurationId( + "/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_JapanEast_1") + .apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-08-01-preview/examples/ElasticPoolUpdateResetMaintenanceConfiguration.json + */ + /** + * Sample code: Resets maintenance configuration of an elastic pool to default. + * + * @param manager Entry point to SqlManager. + */ + public static void resetsMaintenanceConfigurationOfAnElasticPoolToDefault( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ElasticPool resource = + manager + .elasticPools() + .getWithResponse("sqlcrudtest-2369", "sqlcrudtest-8069", "sqlcrudtest-8102", Context.NONE) + .getValue(); + resource + .update() + .withMaintenanceConfigurationId( + "/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_Default") + .apply(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/EncryptionProtectorsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/EncryptionProtectorsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..0a8f7fe959a40 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/EncryptionProtectorsCreateOrUpdateSamples.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.EncryptionProtector; +import com.azure.resourcemanager.sql.generated.models.EncryptionProtectorName; +import com.azure.resourcemanager.sql.generated.models.ServerKeyType; + +/** Samples for EncryptionProtectors CreateOrUpdate. */ +public final class EncryptionProtectorsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/EncryptionProtectorCreateOrUpdateKeyVault.json + */ + /** + * Sample code: Update the encryption protector to key vault. + * + * @param manager Entry point to SqlManager. + */ + public static void updateTheEncryptionProtectorToKeyVault( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + EncryptionProtector resource = + manager + .encryptionProtectors() + .getWithResponse("sqlcrudtest-7398", "sqlcrudtest-4645", EncryptionProtectorName.CURRENT, Context.NONE) + .getValue(); + resource + .update() + .withServerKeyName("someVault_someKey_01234567890123456789012345678901") + .withServerKeyType(ServerKeyType.AZURE_KEY_VAULT) + .withAutoRotationEnabled(false) + .apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/EncryptionProtectorCreateOrUpdateServiceManaged.json + */ + /** + * Sample code: Update the encryption protector to service managed. + * + * @param manager Entry point to SqlManager. + */ + public static void updateTheEncryptionProtectorToServiceManaged( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + EncryptionProtector resource = + manager + .encryptionProtectors() + .getWithResponse("sqlcrudtest-7398", "sqlcrudtest-4645", EncryptionProtectorName.CURRENT, Context.NONE) + .getValue(); + resource.update().withServerKeyName("ServiceManaged").withServerKeyType(ServerKeyType.SERVICE_MANAGED).apply(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/EncryptionProtectorsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/EncryptionProtectorsGetSamples.java new file mode 100644 index 0000000000000..3d4ad0cb22d22 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/EncryptionProtectorsGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.EncryptionProtectorName; + +/** Samples for EncryptionProtectors Get. */ +public final class EncryptionProtectorsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/EncryptionProtectorGet.json + */ + /** + * Sample code: Get the encryption protector. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheEncryptionProtector(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .encryptionProtectors() + .getWithResponse("sqlcrudtest-7398", "sqlcrudtest-4645", EncryptionProtectorName.CURRENT, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/EncryptionProtectorsListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/EncryptionProtectorsListByServerSamples.java new file mode 100644 index 0000000000000..49e2dc3c033c7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/EncryptionProtectorsListByServerSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for EncryptionProtectors ListByServer. */ +public final class EncryptionProtectorsListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/EncryptionProtectorList.json + */ + /** + * Sample code: List encryption protectors by server. + * + * @param manager Entry point to SqlManager. + */ + public static void listEncryptionProtectorsByServer(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.encryptionProtectors().listByServer("sqlcrudtest-7398", "sqlcrudtest-4645", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/EncryptionProtectorsRevalidateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/EncryptionProtectorsRevalidateSamples.java new file mode 100644 index 0000000000000..7ef6356bc9a67 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/EncryptionProtectorsRevalidateSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.EncryptionProtectorName; + +/** Samples for EncryptionProtectors Revalidate. */ +public final class EncryptionProtectorsRevalidateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/EncryptionProtectorRevalidate.json + */ + /** + * Sample code: Revalidates the encryption protector. + * + * @param manager Entry point to SqlManager. + */ + public static void revalidatesTheEncryptionProtector(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .encryptionProtectors() + .revalidate("sqlcrudtest-7398", "sqlcrudtest-4645", EncryptionProtectorName.CURRENT, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/EndpointCertificatesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/EndpointCertificatesGetSamples.java new file mode 100644 index 0000000000000..163493b8b7f1b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/EndpointCertificatesGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for EndpointCertificates Get. */ +public final class EndpointCertificatesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/EndpointCertificatesGet.json + */ + /** + * Sample code: Gets an endpoint certificate. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAnEndpointCertificate(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.endpointCertificates().getWithResponse("testrg", "testcl", "DATABASE_MIRRORING", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/EndpointCertificatesListByInstanceSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/EndpointCertificatesListByInstanceSamples.java new file mode 100644 index 0000000000000..cbd60bb21aaae --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/EndpointCertificatesListByInstanceSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for EndpointCertificates ListByInstance. */ +public final class EndpointCertificatesListByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/EndpointCertificatesListByInstance.json + */ + /** + * Sample code: Get a list of endpoint certificates. + * + * @param manager Entry point to SqlManager. + */ + public static void getAListOfEndpointCertificates(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.endpointCertificates().listByInstance("testrg", "testcl", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ExtendedDatabaseBlobAuditingPoliciesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ExtendedDatabaseBlobAuditingPoliciesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..480fe822c75a0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ExtendedDatabaseBlobAuditingPoliciesCreateOrUpdateSamples.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.resourcemanager.sql.generated.models.BlobAuditingPolicyState; +import java.util.Arrays; +import java.util.UUID; + +/** Samples for ExtendedDatabaseBlobAuditingPolicies CreateOrUpdate. */ +public final class ExtendedDatabaseBlobAuditingPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ExtendedDatabaseBlobAuditingCreateMin.json + */ + /** + * Sample code: Create or update an extended database's blob auditing policy with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateAnExtendedDatabaseSBlobAuditingPolicyWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .extendedDatabaseBlobAuditingPolicies() + .define() + .withExistingDatabase("blobauditingtest-4799", "blobauditingtest-6440", "testdb") + .withState(BlobAuditingPolicyState.ENABLED) + .withStorageEndpoint("https://mystorage.blob.core.windows.net") + .withStorageAccountAccessKey( + "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ExtendedDatabaseBlobAuditingCreateMax.json + */ + /** + * Sample code: Create or update an extended database's blob auditing policy with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateAnExtendedDatabaseSBlobAuditingPolicyWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .extendedDatabaseBlobAuditingPolicies() + .define() + .withExistingDatabase("blobauditingtest-4799", "blobauditingtest-6440", "testdb") + .withPredicateExpression("statement = 'select 1'") + .withRetentionDays(6) + .withAuditActionsAndGroups( + Arrays + .asList( + "DATABASE_LOGOUT_GROUP", + "DATABASE_ROLE_MEMBER_CHANGE_GROUP", + "UPDATE on database::TestDatabaseName by public")) + .withIsStorageSecondaryKeyInUse(false) + .withIsAzureMonitorTargetEnabled(true) + .withQueueDelayMs(4000) + .withState(BlobAuditingPolicyState.ENABLED) + .withStorageEndpoint("https://mystorage.blob.core.windows.net") + .withStorageAccountAccessKey( + "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==") + .withStorageAccountSubscriptionId(UUID.fromString("00000000-1234-0000-5678-000000000000")) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ExtendedDatabaseAzureMonitorAuditingCreateMin.json + */ + /** + * Sample code: Create or update an extended database's azure monitor auditing policy with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateAnExtendedDatabaseSAzureMonitorAuditingPolicyWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .extendedDatabaseBlobAuditingPolicies() + .define() + .withExistingDatabase("blobauditingtest-4799", "blobauditingtest-6440", "testdb") + .withIsAzureMonitorTargetEnabled(true) + .withState(BlobAuditingPolicyState.ENABLED) + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ExtendedDatabaseBlobAuditingPoliciesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ExtendedDatabaseBlobAuditingPoliciesGetSamples.java new file mode 100644 index 0000000000000..e5c73ee59a1f2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ExtendedDatabaseBlobAuditingPoliciesGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ExtendedDatabaseBlobAuditingPolicies Get. */ +public final class ExtendedDatabaseBlobAuditingPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ExtendedDatabaseBlobAuditingGet.json + */ + /** + * Sample code: Get an extended database's blob auditing policy. + * + * @param manager Entry point to SqlManager. + */ + public static void getAnExtendedDatabaseSBlobAuditingPolicy( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .extendedDatabaseBlobAuditingPolicies() + .getWithResponse("blobauditingtest-6852", "blobauditingtest-2080", "testdb", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ExtendedDatabaseBlobAuditingPoliciesListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ExtendedDatabaseBlobAuditingPoliciesListByDatabaseSamples.java new file mode 100644 index 0000000000000..476d541cdf5c1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ExtendedDatabaseBlobAuditingPoliciesListByDatabaseSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ExtendedDatabaseBlobAuditingPolicies ListByDatabase. */ +public final class ExtendedDatabaseBlobAuditingPoliciesListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DatabaseExtendedAuditingSettingsList.json + */ + /** + * Sample code: List extended auditing settings of a database. + * + * @param manager Entry point to SqlManager. + */ + public static void listExtendedAuditingSettingsOfADatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .extendedDatabaseBlobAuditingPolicies() + .listByDatabase("blobauditingtest-6852", "blobauditingtest-2080", "testdb", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ExtendedServerBlobAuditingPoliciesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ExtendedServerBlobAuditingPoliciesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..3bb8377873fd5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ExtendedServerBlobAuditingPoliciesCreateOrUpdateSamples.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.BlobAuditingPolicyState; +import com.azure.resourcemanager.sql.generated.models.ExtendedServerBlobAuditingPolicy; +import java.util.Arrays; +import java.util.UUID; + +/** Samples for ExtendedServerBlobAuditingPolicies CreateOrUpdate. */ +public final class ExtendedServerBlobAuditingPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ExtendedServerBlobAuditingCreateMin.json + */ + /** + * Sample code: Update a server's extended blob auditing policy with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAServerSExtendedBlobAuditingPolicyWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ExtendedServerBlobAuditingPolicy resource = + manager + .extendedServerBlobAuditingPolicies() + .getWithResponse("blobauditingtest-4799", "blobauditingtest-6440", Context.NONE) + .getValue(); + resource + .update() + .withState(BlobAuditingPolicyState.ENABLED) + .withStorageEndpoint("https://mystorage.blob.core.windows.net") + .withStorageAccountAccessKey( + "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==") + .apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ExtendedServerBlobAuditingCreateMax.json + */ + /** + * Sample code: Update a server's extended blob auditing policy with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAServerSExtendedBlobAuditingPolicyWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ExtendedServerBlobAuditingPolicy resource = + manager + .extendedServerBlobAuditingPolicies() + .getWithResponse("blobauditingtest-4799", "blobauditingtest-6440", Context.NONE) + .getValue(); + resource + .update() + .withPredicateExpression("object_name = 'SensitiveData'") + .withRetentionDays(6) + .withAuditActionsAndGroups( + Arrays + .asList( + "SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP", + "FAILED_DATABASE_AUTHENTICATION_GROUP", + "BATCH_COMPLETED_GROUP")) + .withIsStorageSecondaryKeyInUse(false) + .withIsAzureMonitorTargetEnabled(true) + .withQueueDelayMs(4000) + .withState(BlobAuditingPolicyState.ENABLED) + .withStorageEndpoint("https://mystorage.blob.core.windows.net") + .withStorageAccountAccessKey( + "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==") + .withStorageAccountSubscriptionId(UUID.fromString("00000000-1234-0000-5678-000000000000")) + .apply(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ExtendedServerBlobAuditingPoliciesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ExtendedServerBlobAuditingPoliciesGetSamples.java new file mode 100644 index 0000000000000..5812362cb9780 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ExtendedServerBlobAuditingPoliciesGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ExtendedServerBlobAuditingPolicies Get. */ +public final class ExtendedServerBlobAuditingPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ExtendedServerBlobAuditingGet.json + */ + /** + * Sample code: Get a server's blob extended auditing policy. + * + * @param manager Entry point to SqlManager. + */ + public static void getAServerSBlobExtendedAuditingPolicy( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .extendedServerBlobAuditingPolicies() + .getWithResponse("blobauditingtest-4799", "blobauditingtest-6440", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ExtendedServerBlobAuditingPoliciesListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ExtendedServerBlobAuditingPoliciesListByServerSamples.java new file mode 100644 index 0000000000000..e5af949d97391 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ExtendedServerBlobAuditingPoliciesListByServerSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ExtendedServerBlobAuditingPolicies ListByServer. */ +public final class ExtendedServerBlobAuditingPoliciesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerExtendedAuditingSettingsList.json + */ + /** + * Sample code: List extended auditing settings of a server. + * + * @param manager Entry point to SqlManager. + */ + public static void listExtendedAuditingSettingsOfAServer( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .extendedServerBlobAuditingPolicies() + .listByServer("blobauditingtest-4799", "blobauditingtest-6440", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FailoverGroupsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FailoverGroupsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..2db34fc2d29db --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FailoverGroupsCreateOrUpdateSamples.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.resourcemanager.sql.generated.models.FailoverGroupReadOnlyEndpoint; +import com.azure.resourcemanager.sql.generated.models.FailoverGroupReadWriteEndpoint; +import com.azure.resourcemanager.sql.generated.models.PartnerInfo; +import com.azure.resourcemanager.sql.generated.models.ReadOnlyEndpointFailoverPolicy; +import com.azure.resourcemanager.sql.generated.models.ReadWriteEndpointFailoverPolicy; +import java.util.Arrays; + +/** Samples for FailoverGroups CreateOrUpdate. */ +public final class FailoverGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FailoverGroupCreateOrUpdate.json + */ + /** + * Sample code: Create failover group. + * + * @param manager Entry point to SqlManager. + */ + public static void createFailoverGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .failoverGroups() + .define("failover-group-test-3") + .withExistingServer("Default", "failover-group-primary-server") + .withReadWriteEndpoint( + new FailoverGroupReadWriteEndpoint() + .withFailoverPolicy(ReadWriteEndpointFailoverPolicy.AUTOMATIC) + .withFailoverWithDataLossGracePeriodMinutes(480)) + .withReadOnlyEndpoint( + new FailoverGroupReadOnlyEndpoint().withFailoverPolicy(ReadOnlyEndpointFailoverPolicy.DISABLED)) + .withPartnerServers( + Arrays + .asList( + new PartnerInfo() + .withId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/failover-group-secondary-server"))) + .withDatabases( + Arrays + .asList( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/failover-group-primary-server/databases/testdb-1", + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/failover-group-primary-server/databases/testdb-2")) + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FailoverGroupsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FailoverGroupsDeleteSamples.java new file mode 100644 index 0000000000000..dbe2319f5eb95 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FailoverGroupsDeleteSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for FailoverGroups Delete. */ +public final class FailoverGroupsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FailoverGroupDelete.json + */ + /** + * Sample code: Delete failover group. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteFailoverGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .failoverGroups() + .delete("Default", "failover-group-primary-server", "failover-group-test-1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FailoverGroupsFailoverSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FailoverGroupsFailoverSamples.java new file mode 100644 index 0000000000000..2911cdb83ba62 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FailoverGroupsFailoverSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for FailoverGroups Failover. */ +public final class FailoverGroupsFailoverSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FailoverGroupFailover.json + */ + /** + * Sample code: Planned failover of a failover group. + * + * @param manager Entry point to SqlManager. + */ + public static void plannedFailoverOfAFailoverGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .failoverGroups() + .failover("Default", "failover-group-secondary-server", "failover-group-test-3", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FailoverGroupsForceFailoverAllowDataLossSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FailoverGroupsForceFailoverAllowDataLossSamples.java new file mode 100644 index 0000000000000..fdc7247ca537a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FailoverGroupsForceFailoverAllowDataLossSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for FailoverGroups ForceFailoverAllowDataLoss. */ +public final class FailoverGroupsForceFailoverAllowDataLossSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FailoverGroupForceFailoverAllowDataLoss.json + */ + /** + * Sample code: Forced failover of a failover group allowing data loss. + * + * @param manager Entry point to SqlManager. + */ + public static void forcedFailoverOfAFailoverGroupAllowingDataLoss( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .failoverGroups() + .forceFailoverAllowDataLoss( + "Default", "failover-group-secondary-server", "failover-group-test-3", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FailoverGroupsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FailoverGroupsGetSamples.java new file mode 100644 index 0000000000000..c8de0a8ef503a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FailoverGroupsGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for FailoverGroups Get. */ +public final class FailoverGroupsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FailoverGroupGet.json + */ + /** + * Sample code: Get failover group. + * + * @param manager Entry point to SqlManager. + */ + public static void getFailoverGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .failoverGroups() + .getWithResponse("Default", "failover-group-primary-server", "failover-group-test", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FailoverGroupsListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FailoverGroupsListByServerSamples.java new file mode 100644 index 0000000000000..94a74f0a32e3f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FailoverGroupsListByServerSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for FailoverGroups ListByServer. */ +public final class FailoverGroupsListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FailoverGroupList.json + */ + /** + * Sample code: List failover group. + * + * @param manager Entry point to SqlManager. + */ + public static void listFailoverGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.failoverGroups().listByServer("Default", "failover-group-primary-server", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FailoverGroupsUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FailoverGroupsUpdateSamples.java new file mode 100644 index 0000000000000..0991b66489e9f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FailoverGroupsUpdateSamples.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.FailoverGroup; +import com.azure.resourcemanager.sql.generated.models.FailoverGroupReadWriteEndpoint; +import com.azure.resourcemanager.sql.generated.models.ReadWriteEndpointFailoverPolicy; +import java.util.Arrays; + +/** Samples for FailoverGroups Update. */ +public final class FailoverGroupsUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FailoverGroupUpdate.json + */ + /** + * Sample code: Update failover group. + * + * @param manager Entry point to SqlManager. + */ + public static void updateFailoverGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + FailoverGroup resource = + manager + .failoverGroups() + .getWithResponse("Default", "failover-group-primary-server", "failover-group-test-1", Context.NONE) + .getValue(); + resource + .update() + .withReadWriteEndpoint( + new FailoverGroupReadWriteEndpoint() + .withFailoverPolicy(ReadWriteEndpointFailoverPolicy.AUTOMATIC) + .withFailoverWithDataLossGracePeriodMinutes(120)) + .withDatabases( + Arrays + .asList( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/failover-group-primary-server/databases/testdb-1")) + .apply(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FirewallRulesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FirewallRulesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..366302d981f61 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FirewallRulesCreateOrUpdateSamples.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.FirewallRule; + +/** Samples for FirewallRules CreateOrUpdate. */ +public final class FirewallRulesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FirewallRuleCreate.json + */ + /** + * Sample code: Create a firewall rule max/min. + * + * @param manager Entry point to SqlManager. + */ + public static void createAFirewallRuleMaxMin(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .firewallRules() + .define("firewallrulecrudtest-5370") + .withExistingServer("firewallrulecrudtest-12", "firewallrulecrudtest-6285") + .withStartIpAddress("0.0.0.3") + .withEndIpAddress("0.0.0.3") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FirewallRuleUpdate.json + */ + /** + * Sample code: Update a firewall rule max/min. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAFirewallRuleMaxMin(com.azure.resourcemanager.sql.generated.SqlManager manager) { + FirewallRule resource = + manager + .firewallRules() + .getWithResponse( + "firewallrulecrudtest-12", "firewallrulecrudtest-6285", "firewallrulecrudtest-3927", Context.NONE) + .getValue(); + resource.update().withStartIpAddress("0.0.0.1").withEndIpAddress("0.0.0.1").apply(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FirewallRulesDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FirewallRulesDeleteSamples.java new file mode 100644 index 0000000000000..b46239207f219 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FirewallRulesDeleteSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for FirewallRules Delete. */ +public final class FirewallRulesDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FirewallRuleDelete.json + */ + /** + * Sample code: Delete a firewall rule. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteAFirewallRule(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .firewallRules() + .deleteWithResponse( + "firewallrulecrudtest-9886", "firewallrulecrudtest-2368", "firewallrulecrudtest-7011", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FirewallRulesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FirewallRulesGetSamples.java new file mode 100644 index 0000000000000..9e6c2a79ec1df --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FirewallRulesGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for FirewallRules Get. */ +public final class FirewallRulesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FirewallRuleGet.json + */ + /** + * Sample code: Get Firewall Rule. + * + * @param manager Entry point to SqlManager. + */ + public static void getFirewallRule(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .firewallRules() + .getWithResponse( + "firewallrulecrudtest-12", "firewallrulecrudtest-6285", "firewallrulecrudtest-2304", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FirewallRulesListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FirewallRulesListByServerSamples.java new file mode 100644 index 0000000000000..3614501ace53b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FirewallRulesListByServerSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for FirewallRules ListByServer. */ +public final class FirewallRulesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FirewallRuleList.json + */ + /** + * Sample code: List Firewall Rules. + * + * @param manager Entry point to SqlManager. + */ + public static void listFirewallRules(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.firewallRules().listByServer("firewallrulecrudtest-12", "firewallrulecrudtest-6285", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FirewallRulesReplaceSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FirewallRulesReplaceSamples.java new file mode 100644 index 0000000000000..8cca0b2c71695 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/FirewallRulesReplaceSamples.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.FirewallRuleInner; +import com.azure.resourcemanager.sql.generated.models.FirewallRuleList; +import java.util.Arrays; + +/** Samples for FirewallRules Replace. */ +public final class FirewallRulesReplaceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/FirewallRuleReplace.json + */ + /** + * Sample code: Replace firewall rules. + * + * @param manager Entry point to SqlManager. + */ + public static void replaceFirewallRules(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .firewallRules() + .replaceWithResponse( + "firewallrulecrudtest-12", + "firewallrulecrudtest-6285", + new FirewallRuleList() + .withValues( + Arrays + .asList( + new FirewallRuleInner() + .withName("firewallrulecrudtest-5370 ") + .withStartIpAddress("0.0.0.0") + .withEndIpAddress("100.0.0.0"))), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/GeoBackupPoliciesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/GeoBackupPoliciesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..8017649451015 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/GeoBackupPoliciesCreateOrUpdateSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.GeoBackupPolicy; +import com.azure.resourcemanager.sql.generated.models.GeoBackupPolicyName; +import com.azure.resourcemanager.sql.generated.models.GeoBackupPolicyState; + +/** Samples for GeoBackupPolicies CreateOrUpdate. */ +public final class GeoBackupPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/GeoBackupPoliciesCreateOrUpdate.json + */ + /** + * Sample code: Update geo backup policy. + * + * @param manager Entry point to SqlManager. + */ + public static void updateGeoBackupPolicy(com.azure.resourcemanager.sql.generated.SqlManager manager) { + GeoBackupPolicy resource = + manager + .geoBackupPolicies() + .getWithResponse( + "sqlcrudtest-4799", "sqlcrudtest-5961", "testdw", GeoBackupPolicyName.DEFAULT, Context.NONE) + .getValue(); + resource.update().withState(GeoBackupPolicyState.ENABLED).apply(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/GeoBackupPoliciesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/GeoBackupPoliciesGetSamples.java new file mode 100644 index 0000000000000..0729082f6bb60 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/GeoBackupPoliciesGetSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.GeoBackupPolicyName; + +/** Samples for GeoBackupPolicies Get. */ +public final class GeoBackupPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/GeoBackupPoliciesGet.json + */ + /** + * Sample code: Get geo backup policy. + * + * @param manager Entry point to SqlManager. + */ + public static void getGeoBackupPolicy(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .geoBackupPolicies() + .getWithResponse( + "sqlcrudtest-4799", "sqlcrudtest-5961", "testdw", GeoBackupPolicyName.DEFAULT, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/GeoBackupPoliciesListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/GeoBackupPoliciesListByDatabaseSamples.java new file mode 100644 index 0000000000000..20ed3505e556d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/GeoBackupPoliciesListByDatabaseSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for GeoBackupPolicies ListByDatabase. */ +public final class GeoBackupPoliciesListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/GeoBackupPoliciesList.json + */ + /** + * Sample code: List geo backup policies. + * + * @param manager Entry point to SqlManager. + */ + public static void listGeoBackupPolicies(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.geoBackupPolicies().listByDatabase("sqlcrudtest-4799", "sqlcrudtest-5961", "testdw", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/IPv6FirewallRulesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/IPv6FirewallRulesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..90411aa8124e8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/IPv6FirewallRulesCreateOrUpdateSamples.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.IPv6FirewallRule; + +/** Samples for IPv6FirewallRules CreateOrUpdate. */ +public final class IPv6FirewallRulesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/IPv6FirewallRuleCreate.json + */ + /** + * Sample code: Create an IPv6 firewall rule max/min. + * + * @param manager Entry point to SqlManager. + */ + public static void createAnIPv6FirewallRuleMaxMin(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .iPv6FirewallRules() + .define("firewallrulecrudtest-5370") + .withExistingServer("firewallrulecrudtest-12", "firewallrulecrudtest-6285") + .withStartIPv6Address("0000:0000:0000:0000:0000:ffff:0000:0003") + .withEndIPv6Address("0000:0000:0000:0000:0000:ffff:0000:0003") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/IPv6FirewallRuleUpdate.json + */ + /** + * Sample code: Update an IPv6 firewall rule max/min. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAnIPv6FirewallRuleMaxMin(com.azure.resourcemanager.sql.generated.SqlManager manager) { + IPv6FirewallRule resource = + manager + .iPv6FirewallRules() + .getWithResponse( + "firewallrulecrudtest-12", "firewallrulecrudtest-6285", "firewallrulecrudtest-3927", Context.NONE) + .getValue(); + resource + .update() + .withStartIPv6Address("0000:0000:0000:0000:0000:ffff:0000:0001") + .withEndIPv6Address("0000:0000:0000:0000:0000:ffff:0000:0001") + .apply(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/IPv6FirewallRulesDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/IPv6FirewallRulesDeleteSamples.java new file mode 100644 index 0000000000000..ddaeefa5252bf --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/IPv6FirewallRulesDeleteSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for IPv6FirewallRules Delete. */ +public final class IPv6FirewallRulesDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/IPv6FirewallRuleDelete.json + */ + /** + * Sample code: Delete an IPv6 firewall rule. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteAnIPv6FirewallRule(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .iPv6FirewallRules() + .deleteWithResponse( + "firewallrulecrudtest-9886", "firewallrulecrudtest-2368", "firewallrulecrudtest-7011", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/IPv6FirewallRulesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/IPv6FirewallRulesGetSamples.java new file mode 100644 index 0000000000000..97c1b4b5ba845 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/IPv6FirewallRulesGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for IPv6FirewallRules Get. */ +public final class IPv6FirewallRulesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/IPv6FirewallRuleGet.json + */ + /** + * Sample code: Get IPv6 Firewall Rule. + * + * @param manager Entry point to SqlManager. + */ + public static void getIPv6FirewallRule(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .iPv6FirewallRules() + .getWithResponse( + "firewallrulecrudtest-12", "firewallrulecrudtest-6285", "firewallrulecrudtest-2304", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/IPv6FirewallRulesListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/IPv6FirewallRulesListByServerSamples.java new file mode 100644 index 0000000000000..098cbb5d7bfd7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/IPv6FirewallRulesListByServerSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for IPv6FirewallRules ListByServer. */ +public final class IPv6FirewallRulesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/IPv6FirewallRuleList.json + */ + /** + * Sample code: List IPv6 Firewall Rules. + * + * @param manager Entry point to SqlManager. + */ + public static void listIPv6FirewallRules(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.iPv6FirewallRules().listByServer("firewallrulecrudtest-12", "firewallrulecrudtest-6285", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstanceFailoverGroupsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstanceFailoverGroupsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..ee3350ca8aca4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstanceFailoverGroupsCreateOrUpdateSamples.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.resourcemanager.sql.generated.models.InstanceFailoverGroupReadOnlyEndpoint; +import com.azure.resourcemanager.sql.generated.models.InstanceFailoverGroupReadWriteEndpoint; +import com.azure.resourcemanager.sql.generated.models.ManagedInstancePairInfo; +import com.azure.resourcemanager.sql.generated.models.PartnerRegionInfo; +import com.azure.resourcemanager.sql.generated.models.ReadOnlyEndpointFailoverPolicy; +import com.azure.resourcemanager.sql.generated.models.ReadWriteEndpointFailoverPolicy; +import java.util.Arrays; + +/** Samples for InstanceFailoverGroups CreateOrUpdate. */ +public final class InstanceFailoverGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/InstanceFailoverGroupCreateOrUpdate.json + */ + /** + * Sample code: Create failover group. + * + * @param manager Entry point to SqlManager. + */ + public static void createFailoverGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .instanceFailoverGroups() + .define("failover-group-test-3") + .withExistingLocation("Default", "Japan East") + .withReadWriteEndpoint( + new InstanceFailoverGroupReadWriteEndpoint() + .withFailoverPolicy(ReadWriteEndpointFailoverPolicy.AUTOMATIC) + .withFailoverWithDataLossGracePeriodMinutes(480)) + .withReadOnlyEndpoint( + new InstanceFailoverGroupReadOnlyEndpoint().withFailoverPolicy(ReadOnlyEndpointFailoverPolicy.DISABLED)) + .withPartnerRegions(Arrays.asList(new PartnerRegionInfo().withLocation("Japan West"))) + .withManagedInstancePairs( + Arrays + .asList( + new ManagedInstancePairInfo() + .withPrimaryManagedInstanceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/failover-group-primary-mngdInstance") + .withPartnerManagedInstanceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/failover-group-secondary-mngdInstance"))) + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstanceFailoverGroupsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstanceFailoverGroupsDeleteSamples.java new file mode 100644 index 0000000000000..ced7f9cf81189 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstanceFailoverGroupsDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for InstanceFailoverGroups Delete. */ +public final class InstanceFailoverGroupsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/InstanceFailoverGroupDelete.json + */ + /** + * Sample code: Delete failover group. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteFailoverGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.instanceFailoverGroups().delete("Default", "Japan East", "failover-group-test-1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstanceFailoverGroupsFailoverSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstanceFailoverGroupsFailoverSamples.java new file mode 100644 index 0000000000000..da12d292bd1be --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstanceFailoverGroupsFailoverSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for InstanceFailoverGroups Failover. */ +public final class InstanceFailoverGroupsFailoverSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/InstanceFailoverGroupFailover.json + */ + /** + * Sample code: Planned failover of a failover group. + * + * @param manager Entry point to SqlManager. + */ + public static void plannedFailoverOfAFailoverGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.instanceFailoverGroups().failover("Default", "Japan West", "failover-group-test-3", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstanceFailoverGroupsForceFailoverAllowDataLossSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstanceFailoverGroupsForceFailoverAllowDataLossSamples.java new file mode 100644 index 0000000000000..81310247c0352 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstanceFailoverGroupsForceFailoverAllowDataLossSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for InstanceFailoverGroups ForceFailoverAllowDataLoss. */ +public final class InstanceFailoverGroupsForceFailoverAllowDataLossSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/InstanceFailoverGroupForceFailoverAllowDataLoss.json + */ + /** + * Sample code: Forced failover of a failover group allowing data loss. + * + * @param manager Entry point to SqlManager. + */ + public static void forcedFailoverOfAFailoverGroupAllowingDataLoss( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .instanceFailoverGroups() + .forceFailoverAllowDataLoss("Default", "Japan West", "failover-group-test-3", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstanceFailoverGroupsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstanceFailoverGroupsGetSamples.java new file mode 100644 index 0000000000000..1cdc47e76c34a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstanceFailoverGroupsGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for InstanceFailoverGroups Get. */ +public final class InstanceFailoverGroupsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/InstanceFailoverGroupGet.json + */ + /** + * Sample code: Get failover group. + * + * @param manager Entry point to SqlManager. + */ + public static void getFailoverGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.instanceFailoverGroups().getWithResponse("Default", "Japan East", "failover-group-test", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstanceFailoverGroupsListByLocationSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstanceFailoverGroupsListByLocationSamples.java new file mode 100644 index 0000000000000..8db3930f7f496 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstanceFailoverGroupsListByLocationSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for InstanceFailoverGroups ListByLocation. */ +public final class InstanceFailoverGroupsListByLocationSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/InstanceFailoverGroupList.json + */ + /** + * Sample code: List failover group. + * + * @param manager Entry point to SqlManager. + */ + public static void listFailoverGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.instanceFailoverGroups().listByLocation("Default", "Japan East", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstancePoolsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstancePoolsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..a694b09bab109 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstancePoolsCreateOrUpdateSamples.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.resourcemanager.sql.generated.models.InstancePoolLicenseType; +import com.azure.resourcemanager.sql.generated.models.Sku; +import java.util.HashMap; +import java.util.Map; + +/** Samples for InstancePools CreateOrUpdate. */ +public final class InstancePoolsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateInstancePoolMax.json + */ + /** + * Sample code: Create an instance pool with all properties. + * + * @param manager Entry point to SqlManager. + */ + public static void createAnInstancePoolWithAllProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .instancePools() + .define("testIP") + .withRegion("japaneast") + .withExistingResourceGroup("group1") + .withTags(mapOf("a", "b")) + .withSku(new Sku().withName("GP_Gen5").withTier("GeneralPurpose").withFamily("Gen5")) + .withSubnetId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Network/virtualNetworks/myvnet/subnets/mysubnet1") + .withVCores(8) + .withLicenseType(InstancePoolLicenseType.LICENSE_INCLUDED) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateInstancePoolMin.json + */ + /** + * Sample code: Create an instance pool with min properties. + * + * @param manager Entry point to SqlManager. + */ + public static void createAnInstancePoolWithMinProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .instancePools() + .define("testIP") + .withRegion("japaneast") + .withExistingResourceGroup("group1") + .withSku(new Sku().withName("GP_Gen5").withTier("GeneralPurpose").withFamily("Gen5")) + .withSubnetId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Network/virtualNetworks/myvnet/subnets/mysubnet1") + .withVCores(8) + .withLicenseType(InstancePoolLicenseType.LICENSE_INCLUDED) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstancePoolsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstancePoolsDeleteSamples.java new file mode 100644 index 0000000000000..1467554225ff2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstancePoolsDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for InstancePools Delete. */ +public final class InstancePoolsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeleteInstancePool.json + */ + /** + * Sample code: Delete an instance pool. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteAnInstancePool(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.instancePools().delete("group1", "testIP", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstancePoolsGetByResourceGroupSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstancePoolsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..f48091038e9a4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstancePoolsGetByResourceGroupSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for InstancePools GetByResourceGroup. */ +public final class InstancePoolsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetInstancePool.json + */ + /** + * Sample code: Get an instance pool. + * + * @param manager Entry point to SqlManager. + */ + public static void getAnInstancePool(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.instancePools().getByResourceGroupWithResponse("group1", "testIP", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstancePoolsListByResourceGroupSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstancePoolsListByResourceGroupSamples.java new file mode 100644 index 0000000000000..11a657b1fe7fd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstancePoolsListByResourceGroupSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for InstancePools ListByResourceGroup. */ +public final class InstancePoolsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListInstancePoolsByResourceGroup.json + */ + /** + * Sample code: List instance pools by resource group. + * + * @param manager Entry point to SqlManager. + */ + public static void listInstancePoolsByResourceGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.instancePools().listByResourceGroup("group1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstancePoolsListSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstancePoolsListSamples.java new file mode 100644 index 0000000000000..fbe55c728d9f5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstancePoolsListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for InstancePools List. */ +public final class InstancePoolsListSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListInstancePoolsBySubscriptionId.json + */ + /** + * Sample code: List instance pools in the subscription. + * + * @param manager Entry point to SqlManager. + */ + public static void listInstancePoolsInTheSubscription(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.instancePools().list(Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstancePoolsUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstancePoolsUpdateSamples.java new file mode 100644 index 0000000000000..05b7d4d318661 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/InstancePoolsUpdateSamples.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.InstancePool; +import java.util.HashMap; +import java.util.Map; + +/** Samples for InstancePools Update. */ +public final class InstancePoolsUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/PatchInstancePool.json + */ + /** + * Sample code: Patch an instance pool. + * + * @param manager Entry point to SqlManager. + */ + public static void patchAnInstancePool(com.azure.resourcemanager.sql.generated.SqlManager manager) { + InstancePool resource = + manager.instancePools().getByResourceGroupWithResponse("group1", "testIP", Context.NONE).getValue(); + resource.update().withTags(mapOf("x", "y")).apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobAgentsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobAgentsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..d7d7e0d90b764 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobAgentsCreateOrUpdateSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +/** Samples for JobAgents CreateOrUpdate. */ +public final class JobAgentsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateJobAgent.json + */ + /** + * Sample code: Create or update a job agent. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateAJobAgent(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobAgents() + .define("agent1") + .withRegion("southeastasia") + .withExistingServer("group1", "server1") + .withDatabaseId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/databases/db1") + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobAgentsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobAgentsDeleteSamples.java new file mode 100644 index 0000000000000..645738302f022 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobAgentsDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for JobAgents Delete. */ +public final class JobAgentsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeleteJobAgent.json + */ + /** + * Sample code: Delete a job agent. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteAJobAgent(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobAgents().delete("group1", "server1", "agent1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobAgentsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobAgentsGetSamples.java new file mode 100644 index 0000000000000..ce387d3f55944 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobAgentsGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for JobAgents Get. */ +public final class JobAgentsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJobAgent.json + */ + /** + * Sample code: Get a job agent. + * + * @param manager Entry point to SqlManager. + */ + public static void getAJobAgent(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobAgents().getWithResponse("group1", "server1", "agent1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobAgentsListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobAgentsListByServerSamples.java new file mode 100644 index 0000000000000..04bdfdd0494de --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobAgentsListByServerSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for JobAgents ListByServer. */ +public final class JobAgentsListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobAgentsByServer.json + */ + /** + * Sample code: List job agents in a server. + * + * @param manager Entry point to SqlManager. + */ + public static void listJobAgentsInAServer(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobAgents().listByServer("group1", "server1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobAgentsUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobAgentsUpdateSamples.java new file mode 100644 index 0000000000000..2a4c32a047571 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobAgentsUpdateSamples.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.JobAgent; +import java.util.HashMap; +import java.util.Map; + +/** Samples for JobAgents Update. */ +public final class JobAgentsUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/UpdateJobAgent.json + */ + /** + * Sample code: Update a job agent's tags. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAJobAgentSTags(com.azure.resourcemanager.sql.generated.SqlManager manager) { + JobAgent resource = manager.jobAgents().getWithResponse("group1", "server1", "agent1", Context.NONE).getValue(); + resource.update().withTags(mapOf("mytag1", "myvalue1")).apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobCredentialsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobCredentialsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..e6239c82de05d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobCredentialsCreateOrUpdateSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +/** Samples for JobCredentials CreateOrUpdate. */ +public final class JobCredentialsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateJobCredential.json + */ + /** + * Sample code: Create or update a credential. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateACredential(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobCredentials() + .define("cred1") + .withExistingJobAgent("group1", "server1", "agent1") + .withUsername("myuser") + .withPassword("") + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobCredentialsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobCredentialsDeleteSamples.java new file mode 100644 index 0000000000000..8f096d7447104 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobCredentialsDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for JobCredentials Delete. */ +public final class JobCredentialsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeleteJobCredential.json + */ + /** + * Sample code: Delete a credential. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteACredential(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobCredentials().deleteWithResponse("group1", "server1", "agent1", "cred1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobCredentialsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobCredentialsGetSamples.java new file mode 100644 index 0000000000000..b5290cb61fc4c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobCredentialsGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for JobCredentials Get. */ +public final class JobCredentialsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJobCredential.json + */ + /** + * Sample code: Get a credential. + * + * @param manager Entry point to SqlManager. + */ + public static void getACredential(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobCredentials().getWithResponse("group1", "server1", "agent1", "cred1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobCredentialsListByAgentSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobCredentialsListByAgentSamples.java new file mode 100644 index 0000000000000..a080178ddbb73 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobCredentialsListByAgentSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for JobCredentials ListByAgent. */ +public final class JobCredentialsListByAgentSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobCredentialsByAgent.json + */ + /** + * Sample code: List credentials in a job agent. + * + * @param manager Entry point to SqlManager. + */ + public static void listCredentialsInAJobAgent(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobCredentials().listByAgent("group1", "server1", "agent1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobExecutionsCancelSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobExecutionsCancelSamples.java new file mode 100644 index 0000000000000..be769fadd4535 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobExecutionsCancelSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import java.util.UUID; + +/** Samples for JobExecutions Cancel. */ +public final class JobExecutionsCancelSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CancelJobExecution.json + */ + /** + * Sample code: Cancel a job execution. + * + * @param manager Entry point to SqlManager. + */ + public static void cancelAJobExecution(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobExecutions() + .cancelWithResponse( + "group1", + "server1", + "agent1", + "job1", + UUID.fromString("5A86BF65-43AC-F258-2524-9E92992F97CA"), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobExecutionsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobExecutionsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..e2c57050b898f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobExecutionsCreateOrUpdateSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import java.util.UUID; + +/** Samples for JobExecutions CreateOrUpdate. */ +public final class JobExecutionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateJobExecution.json + */ + /** + * Sample code: Create job execution. + * + * @param manager Entry point to SqlManager. + */ + public static void createJobExecution(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobExecutions() + .createOrUpdate( + "group1", + "server1", + "agent1", + "job1", + UUID.fromString("5A86BF65-43AC-F258-2524-9E92992F97CA"), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobExecutionsCreateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobExecutionsCreateSamples.java new file mode 100644 index 0000000000000..109a54272556c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobExecutionsCreateSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for JobExecutions Create. */ +public final class JobExecutionsCreateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateJobExecution.json + */ + /** + * Sample code: Start a job execution. + * + * @param manager Entry point to SqlManager. + */ + public static void startAJobExecution(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobExecutions().create("group1", "server1", "agent1", "job1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobExecutionsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobExecutionsGetSamples.java new file mode 100644 index 0000000000000..3704d059bd24e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobExecutionsGetSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import java.util.UUID; + +/** Samples for JobExecutions Get. */ +public final class JobExecutionsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJobExecution.json + */ + /** + * Sample code: Get a job execution. + * + * @param manager Entry point to SqlManager. + */ + public static void getAJobExecution(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobExecutions() + .getWithResponse( + "group1", + "server1", + "agent1", + "job1", + UUID.fromString("5A86BF65-43AC-F258-2524-9E92992F97CA"), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobExecutionsListByAgentSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobExecutionsListByAgentSamples.java new file mode 100644 index 0000000000000..9facde6e8a3ac --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobExecutionsListByAgentSamples.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import java.time.OffsetDateTime; + +/** Samples for JobExecutions ListByAgent. */ +public final class JobExecutionsListByAgentSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobExecutionsByAgent.json + */ + /** + * Sample code: List all job executions in a job agent. + * + * @param manager Entry point to SqlManager. + */ + public static void listAllJobExecutionsInAJobAgent(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobExecutions() + .listByAgent("group1", "server1", "agent1", null, null, null, null, null, null, null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobExecutionsByAgentWithFilter.json + */ + /** + * Sample code: List all job executions in a job agent with filtering. + * + * @param manager Entry point to SqlManager. + */ + public static void listAllJobExecutionsInAJobAgentWithFiltering( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobExecutions() + .listByAgent( + "group1", + "server1", + "agent1", + OffsetDateTime.parse("2017-03-21T19:00:00Z"), + OffsetDateTime.parse("2017-03-21T19:05:00Z"), + OffsetDateTime.parse("2017-03-21T19:20:00Z"), + OffsetDateTime.parse("2017-03-21T19:25:00Z"), + false, + null, + null, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobExecutionsListByJobSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobExecutionsListByJobSamples.java new file mode 100644 index 0000000000000..6f22cc761a2eb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobExecutionsListByJobSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for JobExecutions ListByJob. */ +public final class JobExecutionsListByJobSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobExecutionsByJob.json + */ + /** + * Sample code: List a job's executions. + * + * @param manager Entry point to SqlManager. + */ + public static void listAJobSExecutions(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobExecutions() + .listByJob("group1", "server1", "agent1", "job1", null, null, null, null, null, null, null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobStepExecutionsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobStepExecutionsGetSamples.java new file mode 100644 index 0000000000000..118c0c3336414 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobStepExecutionsGetSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import java.util.UUID; + +/** Samples for JobStepExecutions Get. */ +public final class JobStepExecutionsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJobExecutionStep.json + */ + /** + * Sample code: Get a job step execution. + * + * @param manager Entry point to SqlManager. + */ + public static void getAJobStepExecution(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobStepExecutions() + .getWithResponse( + "group1", + "server1", + "agent1", + "job1", + UUID.fromString("5A86BF65-43AC-F258-2524-9E92992F97CA"), + "step1", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobStepExecutionsListByJobExecutionSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobStepExecutionsListByJobExecutionSamples.java new file mode 100644 index 0000000000000..c5f09e7cf8fc8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobStepExecutionsListByJobExecutionSamples.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import java.util.UUID; + +/** Samples for JobStepExecutions ListByJobExecution. */ +public final class JobStepExecutionsListByJobExecutionSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobExecutionSteps.json + */ + /** + * Sample code: List job step executions. + * + * @param manager Entry point to SqlManager. + */ + public static void listJobStepExecutions(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobStepExecutions() + .listByJobExecution( + "group1", + "server1", + "agent1", + "job1", + UUID.fromString("5A86BF65-43AC-F258-2524-9E92992F97CA"), + null, + null, + null, + null, + null, + null, + null, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobStepsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobStepsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..4b64bf11ba5ca --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobStepsCreateOrUpdateSamples.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.resourcemanager.sql.generated.models.JobStepAction; +import com.azure.resourcemanager.sql.generated.models.JobStepActionSource; +import com.azure.resourcemanager.sql.generated.models.JobStepActionType; +import com.azure.resourcemanager.sql.generated.models.JobStepExecutionOptions; +import com.azure.resourcemanager.sql.generated.models.JobStepOutput; +import com.azure.resourcemanager.sql.generated.models.JobStepOutputType; +import java.util.UUID; + +/** Samples for JobSteps CreateOrUpdate. */ +public final class JobStepsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateJobStepMin.json + */ + /** + * Sample code: Create or update a job step with minimal properties specified. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateAJobStepWithMinimalPropertiesSpecified( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobSteps() + .define("step1") + .withExistingJob("group1", "server1", "agent1", "job1") + .withTargetGroup( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/targetGroups/targetGroup0") + .withCredential( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/cred0") + .withAction(new JobStepAction().withValue("select 1")) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateJobStepMax.json + */ + /** + * Sample code: Create or update a job step with all properties specified. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateAJobStepWithAllPropertiesSpecified( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobSteps() + .define("step1") + .withExistingJob("group1", "server1", "agent1", "job1") + .withStepId(1) + .withTargetGroup( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/targetGroups/targetGroup1") + .withCredential( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/servers/server1/jobAgents/agent1/credentials/cred1") + .withAction( + new JobStepAction() + .withType(JobStepActionType.TSQL) + .withSource(JobStepActionSource.INLINE) + .withValue("select 2")) + .withOutput( + new JobStepOutput() + .withType(JobStepOutputType.SQL_DATABASE) + .withSubscriptionId(UUID.fromString("3501b905-a848-4b5d-96e8-b253f62d735a")) + .withResourceGroupName("group3") + .withServerName("server3") + .withDatabaseName("database3") + .withSchemaName("myschema1234") + .withTableName("mytable5678") + .withCredential("fakeTokenPlaceholder")) + .withExecutionOptions( + new JobStepExecutionOptions() + .withTimeoutSeconds(1234) + .withRetryAttempts(42) + .withInitialRetryIntervalSeconds(11) + .withMaximumRetryIntervalSeconds(222) + .withRetryIntervalBackoffMultiplier(3.0F)) + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobStepsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobStepsDeleteSamples.java new file mode 100644 index 0000000000000..3af13e8fc00e5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobStepsDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for JobSteps Delete. */ +public final class JobStepsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeleteJobStep.json + */ + /** + * Sample code: Delete a job step. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteAJobStep(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobSteps().deleteWithResponse("group1", "server1", "agent1", "job1", "step1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobStepsGetByVersionSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobStepsGetByVersionSamples.java new file mode 100644 index 0000000000000..58a8b7c7c98a3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobStepsGetByVersionSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for JobSteps GetByVersion. */ +public final class JobStepsGetByVersionSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJobStepByVersion.json + */ + /** + * Sample code: Get the specified version of a job step. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheSpecifiedVersionOfAJobStep(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobSteps().getByVersionWithResponse("group1", "server1", "agent1", "job1", 1, "step1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobStepsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobStepsGetSamples.java new file mode 100644 index 0000000000000..8b2ed8d6b1f03 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobStepsGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for JobSteps Get. */ +public final class JobStepsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJobStepByJob.json + */ + /** + * Sample code: Get the latest version of a job step. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheLatestVersionOfAJobStep(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobSteps().getWithResponse("group1", "server1", "agent1", "job1", "step1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobStepsListByJobSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobStepsListByJobSamples.java new file mode 100644 index 0000000000000..a6b9c6960969d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobStepsListByJobSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for JobSteps ListByJob. */ +public final class JobStepsListByJobSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobStepsByJob.json + */ + /** + * Sample code: List job steps for the latest version of a job. + * + * @param manager Entry point to SqlManager. + */ + public static void listJobStepsForTheLatestVersionOfAJob( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobSteps().listByJob("group1", "server1", "agent1", "job1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobStepsListByVersionSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobStepsListByVersionSamples.java new file mode 100644 index 0000000000000..60ecdd7e49775 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobStepsListByVersionSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for JobSteps ListByVersion. */ +public final class JobStepsListByVersionSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobStepsByVersion.json + */ + /** + * Sample code: List job steps for the specified version of a job. + * + * @param manager Entry point to SqlManager. + */ + public static void listJobStepsForTheSpecifiedVersionOfAJob( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobSteps().listByVersion("group1", "server1", "agent1", "job1", 1, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobTargetExecutionsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobTargetExecutionsGetSamples.java new file mode 100644 index 0000000000000..5d7b8ed7f9b37 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobTargetExecutionsGetSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import java.util.UUID; + +/** Samples for JobTargetExecutions Get. */ +public final class JobTargetExecutionsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJobExecutionTarget.json + */ + /** + * Sample code: Get a job step target execution. + * + * @param manager Entry point to SqlManager. + */ + public static void getAJobStepTargetExecution(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobTargetExecutions() + .getWithResponse( + "group1", + "server1", + "agent1", + "job1", + UUID.fromString("5A86BF65-43AC-F258-2524-9E92992F97CA"), + "step1", + UUID.fromString("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobTargetExecutionsListByJobExecutionSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobTargetExecutionsListByJobExecutionSamples.java new file mode 100644 index 0000000000000..cb3ebebe64223 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobTargetExecutionsListByJobExecutionSamples.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import java.util.UUID; + +/** Samples for JobTargetExecutions ListByJobExecution. */ +public final class JobTargetExecutionsListByJobExecutionSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobExecutionTargetsByExecution.json + */ + /** + * Sample code: List job step target executions. + * + * @param manager Entry point to SqlManager. + */ + public static void listJobStepTargetExecutions(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobTargetExecutions() + .listByJobExecution( + "group1", + "server1", + "agent1", + "job1", + UUID.fromString("5A86BF65-43AC-F258-2524-9E92992F97CA"), + null, + null, + null, + null, + null, + null, + null, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobTargetExecutionsListByStepSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobTargetExecutionsListByStepSamples.java new file mode 100644 index 0000000000000..f00c6b0914718 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobTargetExecutionsListByStepSamples.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import java.util.UUID; + +/** Samples for JobTargetExecutions ListByStep. */ +public final class JobTargetExecutionsListByStepSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobExecutionTargetsByStep.json + */ + /** + * Sample code: List job step target executions. + * + * @param manager Entry point to SqlManager. + */ + public static void listJobStepTargetExecutions(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobTargetExecutions() + .listByStep( + "group1", + "server1", + "agent1", + "job1", + UUID.fromString("5A86BF65-43AC-F258-2524-9E92992F97CA"), + "step1", + null, + null, + null, + null, + null, + null, + null, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobTargetGroupsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobTargetGroupsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..10330b3d099e4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobTargetGroupsCreateOrUpdateSamples.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.resourcemanager.sql.generated.models.JobTarget; +import com.azure.resourcemanager.sql.generated.models.JobTargetGroupMembershipType; +import com.azure.resourcemanager.sql.generated.models.JobTargetType; +import java.util.Arrays; + +/** Samples for JobTargetGroups CreateOrUpdate. */ +public final class JobTargetGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateJobTargetGroupMin.json + */ + /** + * Sample code: Create or update a target group with minimal properties. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateATargetGroupWithMinimalProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobTargetGroups() + .define("targetGroup1") + .withExistingJobAgent("group1", "server1", "agent1") + .withMembers(Arrays.asList()) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateJobTargetGroupMax.json + */ + /** + * Sample code: Create or update a target group with all properties. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateATargetGroupWithAllProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobTargetGroups() + .define("targetGroup1") + .withExistingJobAgent("group1", "server1", "agent1") + .withMembers( + Arrays + .asList( + new JobTarget() + .withMembershipType(JobTargetGroupMembershipType.EXCLUDE) + .withType(JobTargetType.SQL_DATABASE) + .withServerName("server1") + .withDatabaseName("database1"), + new JobTarget() + .withMembershipType(JobTargetGroupMembershipType.INCLUDE) + .withType(JobTargetType.SQL_SERVER) + .withServerName("server1") + .withRefreshCredential("fakeTokenPlaceholder"), + new JobTarget() + .withMembershipType(JobTargetGroupMembershipType.INCLUDE) + .withType(JobTargetType.SQL_ELASTIC_POOL) + .withServerName("server2") + .withElasticPoolName("pool1") + .withRefreshCredential("fakeTokenPlaceholder"), + new JobTarget() + .withMembershipType(JobTargetGroupMembershipType.INCLUDE) + .withType(JobTargetType.SQL_SHARD_MAP) + .withServerName("server3") + .withShardMapName("shardMap1") + .withRefreshCredential("fakeTokenPlaceholder"))) + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobTargetGroupsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobTargetGroupsDeleteSamples.java new file mode 100644 index 0000000000000..7ec741d9669d2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobTargetGroupsDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for JobTargetGroups Delete. */ +public final class JobTargetGroupsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeleteJobTargetGroup.json + */ + /** + * Sample code: Delete a target group. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteATargetGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobTargetGroups().deleteWithResponse("group1", "server1", "agent1", "targetGroup1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobTargetGroupsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobTargetGroupsGetSamples.java new file mode 100644 index 0000000000000..a1444623012b1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobTargetGroupsGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for JobTargetGroups Get. */ +public final class JobTargetGroupsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJobTargetGroup.json + */ + /** + * Sample code: Get a target group. + * + * @param manager Entry point to SqlManager. + */ + public static void getATargetGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobTargetGroups().getWithResponse("group1", "server1", "agent1", "targetGroup1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobTargetGroupsListByAgentSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobTargetGroupsListByAgentSamples.java new file mode 100644 index 0000000000000..e124ccfb615dc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobTargetGroupsListByAgentSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for JobTargetGroups ListByAgent. */ +public final class JobTargetGroupsListByAgentSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobTargetGroups.json + */ + /** + * Sample code: Get all target groups in an agent. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllTargetGroupsInAnAgent(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobTargetGroups().listByAgent("group1", "server1", "agent1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobVersionsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobVersionsGetSamples.java new file mode 100644 index 0000000000000..11b638b1ce6ec --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobVersionsGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for JobVersions Get. */ +public final class JobVersionsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJobVersion.json + */ + /** + * Sample code: Get a version of a job. + * + * @param manager Entry point to SqlManager. + */ + public static void getAVersionOfAJob(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobVersions().getWithResponse("group1", "server1", "agent1", "job1", 1, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobVersionsListByJobSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobVersionsListByJobSamples.java new file mode 100644 index 0000000000000..5ebb07ccbe1e7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobVersionsListByJobSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for JobVersions ListByJob. */ +public final class JobVersionsListByJobSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobVersions.json + */ + /** + * Sample code: Get all versions of a job. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllVersionsOfAJob(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobVersions().listByJob("group1", "server1", "agent1", "job1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..234b2d0a25337 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobsCreateOrUpdateSamples.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.resourcemanager.sql.generated.models.JobSchedule; +import com.azure.resourcemanager.sql.generated.models.JobScheduleType; +import java.time.OffsetDateTime; + +/** Samples for Jobs CreateOrUpdate. */ +public final class JobsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateJobMin.json + */ + /** + * Sample code: Create a job with default properties. + * + * @param manager Entry point to SqlManager. + */ + public static void createAJobWithDefaultProperties(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobs().define("job1").withExistingJobAgent("group1", "server1", "agent1").create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateJobMax.json + */ + /** + * Sample code: Create a job with all properties specified. + * + * @param manager Entry point to SqlManager. + */ + public static void createAJobWithAllPropertiesSpecified( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .jobs() + .define("job1") + .withExistingJobAgent("group1", "server1", "agent1") + .withDescription("my favourite job") + .withSchedule( + new JobSchedule() + .withStartTime(OffsetDateTime.parse("2015-09-24T18:30:01Z")) + .withEndTime(OffsetDateTime.parse("2015-09-24T23:59:59Z")) + .withType(JobScheduleType.RECURRING) + .withEnabled(true) + .withInterval("PT5M")) + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobsDeleteSamples.java new file mode 100644 index 0000000000000..cb7a43be56337 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobsDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Jobs Delete. */ +public final class JobsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeleteJob.json + */ + /** + * Sample code: Delete a job. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteAJob(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobs().deleteWithResponse("group1", "server1", "agent1", "job1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobsGetSamples.java new file mode 100644 index 0000000000000..ee2f2bac96559 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobsGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Jobs Get. */ +public final class JobsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetJob.json + */ + /** + * Sample code: Get a job. + * + * @param manager Entry point to SqlManager. + */ + public static void getAJob(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobs().getWithResponse("group1", "server1", "agent1", "job1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobsListByAgentSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobsListByAgentSamples.java new file mode 100644 index 0000000000000..9b56eb974a9f3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/JobsListByAgentSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Jobs ListByAgent. */ +public final class JobsListByAgentSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListJobsByAgent.json + */ + /** + * Sample code: List jobs in a job agent. + * + * @param manager Entry point to SqlManager. + */ + public static void listJobsInAJobAgent(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.jobs().listByAgent("group1", "server1", "agent1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LedgerDigestUploadsOperationCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LedgerDigestUploadsOperationCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..5a7add9bce1cb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LedgerDigestUploadsOperationCreateOrUpdateSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.resourcemanager.sql.generated.models.LedgerDigestUploadsName; + +/** Samples for LedgerDigestUploadsOperation CreateOrUpdate. */ +public final class LedgerDigestUploadsOperationCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/LedgerDigestUploadsEnable.json + */ + /** + * Sample code: Enables ledger digest upload configuration for a database. + * + * @param manager Entry point to SqlManager. + */ + public static void enablesLedgerDigestUploadConfigurationForADatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .ledgerDigestUploadsOperations() + .define(LedgerDigestUploadsName.CURRENT) + .withExistingDatabase("ledgertestrg", "ledgertestserver", "testdb") + .withDigestStorageEndpoint("https://MyAccount.blob.core.windows.net") + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LedgerDigestUploadsOperationDisableSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LedgerDigestUploadsOperationDisableSamples.java new file mode 100644 index 0000000000000..ebb67c040067d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LedgerDigestUploadsOperationDisableSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.LedgerDigestUploadsName; + +/** Samples for LedgerDigestUploadsOperation Disable. */ +public final class LedgerDigestUploadsOperationDisableSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/LedgerDigestUploadsDisable.json + */ + /** + * Sample code: Disables uploading ledger digests for a database. + * + * @param manager Entry point to SqlManager. + */ + public static void disablesUploadingLedgerDigestsForADatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .ledgerDigestUploadsOperations() + .disable("ledgertestrg", "ledgertestserver", "testdb", LedgerDigestUploadsName.CURRENT, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LedgerDigestUploadsOperationGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LedgerDigestUploadsOperationGetSamples.java new file mode 100644 index 0000000000000..dd40c14a36b19 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LedgerDigestUploadsOperationGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.LedgerDigestUploadsName; + +/** Samples for LedgerDigestUploadsOperation Get. */ +public final class LedgerDigestUploadsOperationGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/LedgerDigestUploadsGet.json + */ + /** + * Sample code: Gets the current ledger digest upload configuration for a database. + * + * @param manager Entry point to SqlManager. + */ + public static void getsTheCurrentLedgerDigestUploadConfigurationForADatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .ledgerDigestUploadsOperations() + .getWithResponse( + "ledgertestrg", "ledgertestserver", "testdb", LedgerDigestUploadsName.CURRENT, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LedgerDigestUploadsOperationListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LedgerDigestUploadsOperationListByDatabaseSamples.java new file mode 100644 index 0000000000000..4d766f0fcc25a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LedgerDigestUploadsOperationListByDatabaseSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for LedgerDigestUploadsOperation ListByDatabase. */ +public final class LedgerDigestUploadsOperationListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/LedgerDigestUploadsList.json + */ + /** + * Sample code: Gets list of ledger digest upload settings on a database. + * + * @param manager Entry point to SqlManager. + */ + public static void getsListOfLedgerDigestUploadSettingsOnADatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .ledgerDigestUploadsOperations() + .listByDatabase("ledgertestrg", "ledgertestserver", "testdb", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsCopyByResourceGroupSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsCopyByResourceGroupSamples.java new file mode 100644 index 0000000000000..2131e436e1952 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsCopyByResourceGroupSamples.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.azure.resourcemanager.sql.generated.models.CopyLongTermRetentionBackupParameters; + +/** Samples for LongTermRetentionBackups CopyByResourceGroup. */ +public final class LongTermRetentionBackupsCopyByResourceGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedLongTermRetentionBackupCopy.json + */ + /** + * Sample code: Copy the long term retention backup. + * + * @param manager Entry point to SqlManager. + */ + public static void copyTheLongTermRetentionBackup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionBackups() + .copyByResourceGroup( + "testResourceGroup", + "japaneast", + "testserver", + "testDatabase", + "55555555-6666-7777-8888-999999999999;131637960820000000", + new CopyLongTermRetentionBackupParameters() + .withTargetServerResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/resourceGroups/resourceGroup/servers/testserver2") + .withTargetDatabaseName("testDatabase2") + .withTargetBackupStorageRedundancy(BackupStorageRedundancy.GEO), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsCopySamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsCopySamples.java new file mode 100644 index 0000000000000..6e851be634c41 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsCopySamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.azure.resourcemanager.sql.generated.models.CopyLongTermRetentionBackupParameters; + +/** Samples for LongTermRetentionBackups Copy. */ +public final class LongTermRetentionBackupsCopySamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/LongTermRetentionBackupCopy.json + */ + /** + * Sample code: Copy the long term retention backup. + * + * @param manager Entry point to SqlManager. + */ + public static void copyTheLongTermRetentionBackup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionBackups() + .copy( + "japaneast", + "testserver", + "testDatabase", + "55555555-6666-7777-8888-999999999999;131637960820000000", + new CopyLongTermRetentionBackupParameters() + .withTargetServerResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Sql/resourceGroups/resourceGroup/servers/testserver2") + .withTargetDatabaseName("testDatabase2") + .withTargetBackupStorageRedundancy(BackupStorageRedundancy.GEO), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsDeleteByResourceGroupSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsDeleteByResourceGroupSamples.java new file mode 100644 index 0000000000000..5dbc367f74398 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsDeleteByResourceGroupSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionBackups DeleteByResourceGroup. */ +public final class LongTermRetentionBackupsDeleteByResourceGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedLongTermRetentionBackupDelete.json + */ + /** + * Sample code: Delete the long term retention backup. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteTheLongTermRetentionBackup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionBackups() + .deleteByResourceGroup( + "testResourceGroup", + "japaneast", + "testserver", + "testDatabase", + "55555555-6666-7777-8888-999999999999;131637960820000000", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsDeleteSamples.java new file mode 100644 index 0000000000000..b54d874487596 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsDeleteSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionBackups Delete. */ +public final class LongTermRetentionBackupsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/LongTermRetentionBackupDelete.json + */ + /** + * Sample code: Delete the long term retention backup. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteTheLongTermRetentionBackup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionBackups() + .delete( + "japaneast", + "testserver", + "testDatabase", + "55555555-6666-7777-8888-999999999999;131637960820000000", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsGetByResourceGroupSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..c863da62b3aa6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsGetByResourceGroupSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionBackups GetByResourceGroup. */ +public final class LongTermRetentionBackupsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedLongTermRetentionBackupGet.json + */ + /** + * Sample code: Get the long term retention backup. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheLongTermRetentionBackup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionBackups() + .getByResourceGroupWithResponse( + "testResourceGroup", + "japaneast", + "testserver", + "testDatabase", + "55555555-6666-7777-8888-999999999999;131637960820000000", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsGetSamples.java new file mode 100644 index 0000000000000..0d065fa1432a5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsGetSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionBackups Get. */ +public final class LongTermRetentionBackupsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/LongTermRetentionBackupGet.json + */ + /** + * Sample code: Get the long term retention backup. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheLongTermRetentionBackup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionBackups() + .getWithResponse( + "japaneast", + "testserver", + "testDatabase", + "55555555-6666-7777-8888-999999999999;131637960820000000", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsListByDatabaseSamples.java new file mode 100644 index 0000000000000..76f509b6ee860 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsListByDatabaseSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionBackups ListByDatabase. */ +public final class LongTermRetentionBackupsListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/LongTermRetentionBackupListByDatabase.json + */ + /** + * Sample code: Get all long term retention backups under the database. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllLongTermRetentionBackupsUnderTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionBackups() + .listByDatabase("japaneast", "testserver", "testDatabase", null, null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsListByLocationSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsListByLocationSamples.java new file mode 100644 index 0000000000000..c4fa779fc306b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsListByLocationSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionBackups ListByLocation. */ +public final class LongTermRetentionBackupsListByLocationSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/LongTermRetentionBackupListByLocation.json + */ + /** + * Sample code: Get all long term retention backups under the location. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllLongTermRetentionBackupsUnderTheLocation( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.longTermRetentionBackups().listByLocation("japaneast", null, null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsListByResourceGroupDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsListByResourceGroupDatabaseSamples.java new file mode 100644 index 0000000000000..c649774f5ce25 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsListByResourceGroupDatabaseSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionBackups ListByResourceGroupDatabase. */ +public final class LongTermRetentionBackupsListByResourceGroupDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedLongTermRetentionBackupListByDatabase.json + */ + /** + * Sample code: Get all long term retention backups under the database. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllLongTermRetentionBackupsUnderTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionBackups() + .listByResourceGroupDatabase( + "testResourceGroup", "japaneast", "testserver", "testDatabase", null, null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsListByResourceGroupLocationSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsListByResourceGroupLocationSamples.java new file mode 100644 index 0000000000000..b3f37fdc63302 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsListByResourceGroupLocationSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionBackups ListByResourceGroupLocation. */ +public final class LongTermRetentionBackupsListByResourceGroupLocationSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedLongTermRetentionBackupListByLocation.json + */ + /** + * Sample code: Get all long term retention backups under the location. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllLongTermRetentionBackupsUnderTheLocation( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionBackups() + .listByResourceGroupLocation("testResourceGroup", "japaneast", null, null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsListByResourceGroupServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsListByResourceGroupServerSamples.java new file mode 100644 index 0000000000000..d66c5e3e08930 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsListByResourceGroupServerSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionBackups ListByResourceGroupServer. */ +public final class LongTermRetentionBackupsListByResourceGroupServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedLongTermRetentionBackupListByServer.json + */ + /** + * Sample code: Get all long term retention backups under the server. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllLongTermRetentionBackupsUnderTheServer( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionBackups() + .listByResourceGroupServer("testResourceGroup", "japaneast", "testserver", null, null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsListByServerSamples.java new file mode 100644 index 0000000000000..901d87266ddf3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsListByServerSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionBackups ListByServer. */ +public final class LongTermRetentionBackupsListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/LongTermRetentionBackupListByServer.json + */ + /** + * Sample code: Get all long term retention backups under the server. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllLongTermRetentionBackupsUnderTheServer( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.longTermRetentionBackups().listByServer("japaneast", "testserver", null, null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsUpdateByResourceGroupSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsUpdateByResourceGroupSamples.java new file mode 100644 index 0000000000000..49bce2e1a5f3c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsUpdateByResourceGroupSamples.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.azure.resourcemanager.sql.generated.models.UpdateLongTermRetentionBackupParameters; + +/** Samples for LongTermRetentionBackups UpdateByResourceGroup. */ +public final class LongTermRetentionBackupsUpdateByResourceGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedLongTermRetentionBackupUpdate.json + */ + /** + * Sample code: Update the long term retention backup. + * + * @param manager Entry point to SqlManager. + */ + public static void updateTheLongTermRetentionBackup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionBackups() + .updateByResourceGroup( + "testResourceGroup", + "japaneast", + "testserver", + "testDatabase", + "55555555-6666-7777-8888-999999999999;131637960820000000", + new UpdateLongTermRetentionBackupParameters() + .withRequestedBackupStorageRedundancy(BackupStorageRedundancy.GEO), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsUpdateSamples.java new file mode 100644 index 0000000000000..d38bc66bf1b55 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionBackupsUpdateSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.azure.resourcemanager.sql.generated.models.UpdateLongTermRetentionBackupParameters; + +/** Samples for LongTermRetentionBackups Update. */ +public final class LongTermRetentionBackupsUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/LongTermRetentionBackupUpdate.json + */ + /** + * Sample code: Update the long term retention backup. + * + * @param manager Entry point to SqlManager. + */ + public static void updateTheLongTermRetentionBackup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionBackups() + .update( + "japaneast", + "testserver", + "testDatabase", + "55555555-6666-7777-8888-999999999999;131637960820000000", + new UpdateLongTermRetentionBackupParameters() + .withRequestedBackupStorageRedundancy(BackupStorageRedundancy.GEO), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupSamples.java new file mode 100644 index 0000000000000..93ea21946d1ab --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionManagedInstanceBackups DeleteByResourceGroup. */ +public final class LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedManagedInstanceLongTermRetentionBackupDelete.json + */ + /** + * Sample code: Delete the long term retention backup. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteTheLongTermRetentionBackup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionManagedInstanceBackups() + .deleteByResourceGroup( + "testResourceGroup", + "japaneast", + "testInstance", + "testDatabase", + "55555555-6666-7777-8888-999999999999;131637960820000000", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsDeleteSamples.java new file mode 100644 index 0000000000000..0b4f3d8b04723 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsDeleteSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionManagedInstanceBackups Delete. */ +public final class LongTermRetentionManagedInstanceBackupsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceLongTermRetentionBackupDelete.json + */ + /** + * Sample code: Delete the long term retention backup. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteTheLongTermRetentionBackup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionManagedInstanceBackups() + .delete( + "japaneast", + "testInstance", + "testDatabase", + "55555555-6666-7777-8888-999999999999;131637960820000000", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsGetByResourceGroupSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..6be91f1901b06 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsGetByResourceGroupSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionManagedInstanceBackups GetByResourceGroup. */ +public final class LongTermRetentionManagedInstanceBackupsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedManagedInstanceLongTermRetentionBackupGet.json + */ + /** + * Sample code: Get the long term retention backup. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheLongTermRetentionBackup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionManagedInstanceBackups() + .getByResourceGroupWithResponse( + "testResourceGroup", + "japaneast", + "testInstance", + "testDatabase", + "55555555-6666-7777-8888-999999999999;131637960820000000", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsGetSamples.java new file mode 100644 index 0000000000000..2d4cefe718a61 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsGetSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionManagedInstanceBackups Get. */ +public final class LongTermRetentionManagedInstanceBackupsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceLongTermRetentionBackupGet.json + */ + /** + * Sample code: Get the long term retention backup of a managed database. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheLongTermRetentionBackupOfAManagedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionManagedInstanceBackups() + .getWithResponse( + "japaneast", + "testInstance", + "testDatabase", + "55555555-6666-7777-8888-999999999999;131637960820000000", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsListByDatabaseSamples.java new file mode 100644 index 0000000000000..65dc2aa472c61 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsListByDatabaseSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionManagedInstanceBackups ListByDatabase. */ +public final class LongTermRetentionManagedInstanceBackupsListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceLongTermRetentionBackupListByDatabase.json + */ + /** + * Sample code: Get all long term retention backups under the database. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllLongTermRetentionBackupsUnderTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionManagedInstanceBackups() + .listByDatabase("japaneast", "testInstance", "testDatabase", null, null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsListByInstanceSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsListByInstanceSamples.java new file mode 100644 index 0000000000000..c008aa4cf48cd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsListByInstanceSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionManagedInstanceBackups ListByInstance. */ +public final class LongTermRetentionManagedInstanceBackupsListByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceLongTermRetentionBackupListByInstance.json + */ + /** + * Sample code: Get all long term retention backups under the managed instance. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllLongTermRetentionBackupsUnderTheManagedInstance( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionManagedInstanceBackups() + .listByInstance("japaneast", "testInstance", null, null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsListByLocationSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsListByLocationSamples.java new file mode 100644 index 0000000000000..e48b8523da6d2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsListByLocationSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionManagedInstanceBackups ListByLocation. */ +public final class LongTermRetentionManagedInstanceBackupsListByLocationSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceLongTermRetentionBackupListByLocation.json + */ + /** + * Sample code: Get all long term retention backups under the location. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllLongTermRetentionBackupsUnderTheLocation( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.longTermRetentionManagedInstanceBackups().listByLocation("japaneast", null, null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsListByResourceGroupDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsListByResourceGroupDatabaseSamples.java new file mode 100644 index 0000000000000..e17c976a2d04d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsListByResourceGroupDatabaseSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionManagedInstanceBackups ListByResourceGroupDatabase. */ +public final class LongTermRetentionManagedInstanceBackupsListByResourceGroupDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedManagedInstanceLongTermRetentionBackupListByDatabase.json + */ + /** + * Sample code: Get all long term retention backups under the database. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllLongTermRetentionBackupsUnderTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionManagedInstanceBackups() + .listByResourceGroupDatabase( + "testResourceGroup", "japaneast", "testInstance", "testDatabase", null, null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsListByResourceGroupInstanceSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsListByResourceGroupInstanceSamples.java new file mode 100644 index 0000000000000..5458e6c7ec231 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsListByResourceGroupInstanceSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionManagedInstanceBackups ListByResourceGroupInstance. */ +public final class LongTermRetentionManagedInstanceBackupsListByResourceGroupInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedManagedInstanceLongTermRetentionBackupListByInstance.json + */ + /** + * Sample code: Get all long term retention backups under the managed instance. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllLongTermRetentionBackupsUnderTheManagedInstance( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionManagedInstanceBackups() + .listByResourceGroupInstance("testResourceGroup", "japaneast", "testInstance", null, null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsListByResourceGroupLocationSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsListByResourceGroupLocationSamples.java new file mode 100644 index 0000000000000..a6b60a42f8086 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionManagedInstanceBackupsListByResourceGroupLocationSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionManagedInstanceBackups ListByResourceGroupLocation. */ +public final class LongTermRetentionManagedInstanceBackupsListByResourceGroupLocationSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ResourceGroupBasedManagedInstanceLongTermRetentionBackupListByLocation.json + */ + /** + * Sample code: Get all long term retention backups under the location. + * + * @param manager Entry point to SqlManager. + */ + public static void getAllLongTermRetentionBackupsUnderTheLocation( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionManagedInstanceBackups() + .listByResourceGroupLocation("testResourceGroup", "japaneast", null, null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionPoliciesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionPoliciesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..8fb136518d191 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionPoliciesCreateOrUpdateSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.resourcemanager.sql.generated.models.LongTermRetentionPolicyName; + +/** Samples for LongTermRetentionPolicies CreateOrUpdate. */ +public final class LongTermRetentionPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/LongTermRetentionPolicyCreateOrUpdate.json + */ + /** + * Sample code: Create or update the long term retention policy for the database. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateTheLongTermRetentionPolicyForTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionPolicies() + .define(LongTermRetentionPolicyName.DEFAULT) + .withExistingDatabase("resourceGroup", "testserver", "testDatabase") + .withWeeklyRetention("P1M") + .withMonthlyRetention("P1Y") + .withYearlyRetention("P5Y") + .withWeekOfYear(5) + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionPoliciesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionPoliciesGetSamples.java new file mode 100644 index 0000000000000..279bfd451fe1d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionPoliciesGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.LongTermRetentionPolicyName; + +/** Samples for LongTermRetentionPolicies Get. */ +public final class LongTermRetentionPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/LongTermRetentionPolicyGet.json + */ + /** + * Sample code: Get the long term retention policy for the database. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheLongTermRetentionPolicyForTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .longTermRetentionPolicies() + .getWithResponse( + "resourceGroup", "testserver", "testDatabase", LongTermRetentionPolicyName.DEFAULT, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionPoliciesListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionPoliciesListByDatabaseSamples.java new file mode 100644 index 0000000000000..75c3fe63827e1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/LongTermRetentionPoliciesListByDatabaseSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for LongTermRetentionPolicies ListByDatabase. */ +public final class LongTermRetentionPoliciesListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/LongTermRetentionPolicyListByDatabase.json + */ + /** + * Sample code: Get the long term retention policy for the database. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheLongTermRetentionPolicyForTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.longTermRetentionPolicies().listByDatabase("resourceGroup", "testserver", "testDatabase", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/MaintenanceWindowOptionsOperationGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/MaintenanceWindowOptionsOperationGetSamples.java new file mode 100644 index 0000000000000..a503eb6efeda6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/MaintenanceWindowOptionsOperationGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for MaintenanceWindowOptionsOperation Get. */ +public final class MaintenanceWindowOptionsOperationGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetMaintenanceWindowOptions.json + */ + /** + * Sample code: Gets a list of available maintenance windows for a selected database. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAListOfAvailableMaintenanceWindowsForASelectedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .maintenanceWindowOptionsOperations() + .getWithResponse("Default-SQL-SouthEastAsia", "testsvr", "testdb", "current", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/MaintenanceWindowsOperationCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/MaintenanceWindowsOperationCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..4953925f961cd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/MaintenanceWindowsOperationCreateOrUpdateSamples.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.MaintenanceWindowsInner; +import com.azure.resourcemanager.sql.generated.models.DayOfWeek; +import com.azure.resourcemanager.sql.generated.models.MaintenanceWindowTimeRange; +import java.util.Arrays; + +/** Samples for MaintenanceWindowsOperation CreateOrUpdate. */ +public final class MaintenanceWindowsOperationCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateMaintenanceWindows.json + */ + /** + * Sample code: Sets maintenance window settings for a selected database. + * + * @param manager Entry point to SqlManager. + */ + public static void setsMaintenanceWindowSettingsForASelectedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .maintenanceWindowsOperations() + .createOrUpdateWithResponse( + "Default-SQL-SouthEastAsia", + "testsvr", + "testdwdb", + "current", + new MaintenanceWindowsInner() + .withTimeRanges( + Arrays + .asList( + new MaintenanceWindowTimeRange() + .withDayOfWeek(DayOfWeek.SATURDAY) + .withStartTime("00:00:00") + .withDuration("PT60M"))), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/MaintenanceWindowsOperationGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/MaintenanceWindowsOperationGetSamples.java new file mode 100644 index 0000000000000..cf2d0b8ec062b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/MaintenanceWindowsOperationGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for MaintenanceWindowsOperation Get. */ +public final class MaintenanceWindowsOperationGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetMaintenanceWindows.json + */ + /** + * Sample code: Gets maintenance window settings for a selected database. + * + * @param manager Entry point to SqlManager. + */ + public static void getsMaintenanceWindowSettingsForASelectedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .maintenanceWindowsOperations() + .getWithResponse("Default-SQL-SouthEastAsia", "testsvr", "testdb", "current", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedBackupShortTermRetentionPoliciesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedBackupShortTermRetentionPoliciesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..6c1b4e6e2f9b6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedBackupShortTermRetentionPoliciesCreateOrUpdateSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.resourcemanager.sql.generated.models.ManagedShortTermRetentionPolicyName; + +/** Samples for ManagedBackupShortTermRetentionPolicies CreateOrUpdate. */ +public final class ManagedBackupShortTermRetentionPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/UpdateManagedShortTermRetentionPolicy.json + */ + /** + * Sample code: Update the short term retention policy for the database. + * + * @param manager Entry point to SqlManager. + */ + public static void updateTheShortTermRetentionPolicyForTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedBackupShortTermRetentionPolicies() + .define(ManagedShortTermRetentionPolicyName.DEFAULT) + .withExistingDatabase("resourceGroup", "testsvr", "testdb") + .withRetentionDays(14) + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedBackupShortTermRetentionPoliciesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedBackupShortTermRetentionPoliciesGetSamples.java new file mode 100644 index 0000000000000..7f07c9fecee5e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedBackupShortTermRetentionPoliciesGetSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ManagedShortTermRetentionPolicyName; + +/** Samples for ManagedBackupShortTermRetentionPolicies Get. */ +public final class ManagedBackupShortTermRetentionPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetManagedShortTermRetentionPolicy.json + */ + /** + * Sample code: Get the short term retention policy for the database. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheShortTermRetentionPolicyForTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedBackupShortTermRetentionPolicies() + .getWithResponse( + "Default-SQL-SouthEastAsia", + "testsvr", + "testdb", + ManagedShortTermRetentionPolicyName.DEFAULT, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedBackupShortTermRetentionPoliciesListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedBackupShortTermRetentionPoliciesListByDatabaseSamples.java new file mode 100644 index 0000000000000..c5f5eab9fb1d5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedBackupShortTermRetentionPoliciesListByDatabaseSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedBackupShortTermRetentionPolicies ListByDatabase. */ +public final class ManagedBackupShortTermRetentionPoliciesListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetListManagedShortTermRetentionPolicy.json + */ + /** + * Sample code: Get the short term retention policy list for the database. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheShortTermRetentionPolicyListForTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedBackupShortTermRetentionPolicies() + .listByDatabase("Default-SQL-SouthEastAsia", "testsvr", "testdb", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedBackupShortTermRetentionPoliciesUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedBackupShortTermRetentionPoliciesUpdateSamples.java new file mode 100644 index 0000000000000..a8acaf9db9740 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedBackupShortTermRetentionPoliciesUpdateSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ManagedBackupShortTermRetentionPolicy; +import com.azure.resourcemanager.sql.generated.models.ManagedShortTermRetentionPolicyName; + +/** Samples for ManagedBackupShortTermRetentionPolicies Update. */ +public final class ManagedBackupShortTermRetentionPoliciesUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/UpdateManagedShortTermRetentionPolicy.json + */ + /** + * Sample code: Update the short term retention policy for the database. + * + * @param manager Entry point to SqlManager. + */ + public static void updateTheShortTermRetentionPolicyForTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedBackupShortTermRetentionPolicy resource = + manager + .managedBackupShortTermRetentionPolicies() + .getWithResponse( + "resourceGroup", "testsvr", "testdb", ManagedShortTermRetentionPolicyName.DEFAULT, Context.NONE) + .getValue(); + resource.update().withRetentionDays(14).apply(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseAdvancedThreatProtectionSettingsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseAdvancedThreatProtectionSettingsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..43048152a7df2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseAdvancedThreatProtectionSettingsCreateOrUpdateSamples.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.AdvancedThreatProtectionName; +import com.azure.resourcemanager.sql.generated.models.AdvancedThreatProtectionState; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseAdvancedThreatProtection; + +/** Samples for ManagedDatabaseAdvancedThreatProtectionSettings CreateOrUpdate. */ +public final class ManagedDatabaseAdvancedThreatProtectionSettingsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ManagedDatabaseAdvancedThreatProtectionSettingsCreateMax.json + */ + /** + * Sample code: Update a managed database's Advanced Threat Protection settings with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAManagedDatabaseSAdvancedThreatProtectionSettingsWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedDatabaseAdvancedThreatProtection resource = + manager + .managedDatabaseAdvancedThreatProtectionSettings() + .getWithResponse( + "threatprotection-4799", + "threatprotection-6440", + "testdb", + AdvancedThreatProtectionName.DEFAULT, + Context.NONE) + .getValue(); + resource.update().withState(AdvancedThreatProtectionState.ENABLED).apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ManagedDatabaseAdvancedThreatProtectionSettingsCreateMin.json + */ + /** + * Sample code: Update a managed database's Advanced Threat Protection settings with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAManagedDatabaseSAdvancedThreatProtectionSettingsWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedDatabaseAdvancedThreatProtection resource = + manager + .managedDatabaseAdvancedThreatProtectionSettings() + .getWithResponse( + "threatprotection-4799", + "threatprotection-6440", + "testdb", + AdvancedThreatProtectionName.DEFAULT, + Context.NONE) + .getValue(); + resource.update().withState(AdvancedThreatProtectionState.DISABLED).apply(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseAdvancedThreatProtectionSettingsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseAdvancedThreatProtectionSettingsGetSamples.java new file mode 100644 index 0000000000000..38e0fc5a7f216 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseAdvancedThreatProtectionSettingsGetSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.AdvancedThreatProtectionName; + +/** Samples for ManagedDatabaseAdvancedThreatProtectionSettings Get. */ +public final class ManagedDatabaseAdvancedThreatProtectionSettingsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ManagedDatabaseAdvancedThreatProtectionSettingsGet.json + */ + /** + * Sample code: Get a managed database's Advanced Threat Protection settings. + * + * @param manager Entry point to SqlManager. + */ + public static void getAManagedDatabaseSAdvancedThreatProtectionSettings( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseAdvancedThreatProtectionSettings() + .getWithResponse( + "threatprotection-6852", + "threatprotection-2080", + "testdb", + AdvancedThreatProtectionName.DEFAULT, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseAdvancedThreatProtectionSettingsListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseAdvancedThreatProtectionSettingsListByDatabaseSamples.java new file mode 100644 index 0000000000000..e451ea21aaeba --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseAdvancedThreatProtectionSettingsListByDatabaseSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseAdvancedThreatProtectionSettings ListByDatabase. */ +public final class ManagedDatabaseAdvancedThreatProtectionSettingsListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ManagedDatabaseAdvancedThreatProtectionSettingsListByDatabase.json + */ + /** + * Sample code: Get a list of the managed database's Advanced Threat Protection settings. + * + * @param manager Entry point to SqlManager. + */ + public static void getAListOfTheManagedDatabaseSAdvancedThreatProtectionSettings( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseAdvancedThreatProtectionSettings() + .listByDatabase("threatprotection-6852", "threatprotection-2080", "testdb", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseColumnsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseColumnsGetSamples.java new file mode 100644 index 0000000000000..d41e191e36309 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseColumnsGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseColumns Get. */ +public final class ManagedDatabaseColumnsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseColumnGet.json + */ + /** + * Sample code: Get managed database column. + * + * @param manager Entry point to SqlManager. + */ + public static void getManagedDatabaseColumn(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseColumns() + .getWithResponse("myRG", "myManagedInstanceName", "myDatabase", "dbo", "table1", "column1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseColumnsListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseColumnsListByDatabaseSamples.java new file mode 100644 index 0000000000000..7abc252ed96e6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseColumnsListByDatabaseSamples.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import java.util.Arrays; + +/** Samples for ManagedDatabaseColumns ListByDatabase. */ +public final class ManagedDatabaseColumnsListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedColumnsListByDatabaseMin.json + */ + /** + * Sample code: List managed database columns. + * + * @param manager Entry point to SqlManager. + */ + public static void listManagedDatabaseColumns(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseColumns() + .listByDatabase("myRG", "serverName", "myDatabase", null, null, null, null, null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedColumnsListByDatabaseMax.json + */ + /** + * Sample code: Filter managed database columns. + * + * @param manager Entry point to SqlManager. + */ + public static void filterManagedDatabaseColumns(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseColumns() + .listByDatabase( + "myRG", + "serverName", + "myDatabase", + Arrays.asList("dbo"), + Arrays.asList("customer", "address"), + Arrays.asList("username"), + Arrays.asList("schema asc", "table", "column desc"), + null, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseColumnsListByTableSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseColumnsListByTableSamples.java new file mode 100644 index 0000000000000..c075cd8dfb1b2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseColumnsListByTableSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseColumns ListByTable. */ +public final class ManagedDatabaseColumnsListByTableSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseColumnListByTable.json + */ + /** + * Sample code: List managed database columns. + * + * @param manager Entry point to SqlManager. + */ + public static void listManagedDatabaseColumns(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseColumns() + .listByTable("myRG", "myManagedInstanceName", "myDatabase", "dbo", "table1", null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseMoveOperationsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseMoveOperationsGetSamples.java new file mode 100644 index 0000000000000..5cd85714fa05e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseMoveOperationsGetSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import java.util.UUID; + +/** Samples for ManagedDatabaseMoveOperations Get. */ +public final class ManagedDatabaseMoveOperationsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/ManagedDatabaseMoveOperationResultGet.json + */ + /** + * Sample code: Gets a managed database move operation. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAManagedDatabaseMoveOperation(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseMoveOperations() + .getWithResponse( + "rg1", "westeurope", UUID.fromString("15961324-d809-46ed-86b9-d786953140e2"), Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseMoveOperationsListByLocationSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseMoveOperationsListByLocationSamples.java new file mode 100644 index 0000000000000..eb0df9c7c4a59 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseMoveOperationsListByLocationSamples.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseMoveOperations ListByLocation. */ +public final class ManagedDatabaseMoveOperationsListByLocationSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/ManagedDatabaseMoveOperationResultList.json + */ + /** + * Sample code: Gets all managed database move operations for specified subscription, resource group and location. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAllManagedDatabaseMoveOperationsForSpecifiedSubscriptionResourceGroupAndLocation( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedDatabaseMoveOperations().listByLocation("rg1", "westeurope", null, null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/ManagedDatabaseMoveOperationResultListLastOperations.json + */ + /** + * Sample code: Gets the latest managed database move operations for each database under specified subscription, + * resource group and location. + * + * @param manager Entry point to SqlManager. + */ + public static void + getsTheLatestManagedDatabaseMoveOperationsForEachDatabaseUnderSpecifiedSubscriptionResourceGroupAndLocation( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedDatabaseMoveOperations().listByLocation("rg1", "westeurope", null, null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/ManagedDatabaseMoveOperationResultListMax.json + */ + /** + * Sample code: Gets the latest managed database move operations for each database under specified subscription, + * resource group and location, filtered by operation type. + * + * @param manager Entry point to SqlManager. + */ + public static void + getsTheLatestManagedDatabaseMoveOperationsForEachDatabaseUnderSpecifiedSubscriptionResourceGroupAndLocationFilteredByOperationType( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseMoveOperations() + .listByLocation( + "rg1", "westeurope", null, "Properties/Operation eq 'StartManagedInstanceDatabaseMove'", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseQueriesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseQueriesGetSamples.java new file mode 100644 index 0000000000000..dd0d37447df5f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseQueriesGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseQueries Get. */ +public final class ManagedDatabaseQueriesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceQueryGet.json + */ + /** + * Sample code: Obtain query properties. + * + * @param manager Entry point to SqlManager. + */ + public static void obtainQueryProperties(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseQueries() + .getWithResponse("sqlcrudtest-7398", "sqlcrudtest-4645", "database_1", "42", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseQueriesListByQuerySamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseQueriesListByQuerySamples.java new file mode 100644 index 0000000000000..ae3991d41905b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseQueriesListByQuerySamples.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.QueryTimeGrainType; + +/** Samples for ManagedDatabaseQueries ListByQuery. */ +public final class ManagedDatabaseQueriesListByQuerySamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceQueryStatisticsListMax.json + */ + /** + * Sample code: Obtain query execution statistics. Example with all request parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void obtainQueryExecutionStatisticsExampleWithAllRequestParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseQueries() + .listByQuery( + "sqlcrudtest-7398", + "sqlcrudtest-4645", + "database_1", + "42", + "03/01/2020 16:23:09", + "03/11/2020 14:00:00", + QueryTimeGrainType.P1D, + Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceQueryStatisticsList.json + */ + /** + * Sample code: Obtain query execution statistics. + * + * @param manager Entry point to SqlManager. + */ + public static void obtainQueryExecutionStatistics(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseQueries() + .listByQuery("sqlcrudtest-7398", "sqlcrudtest-4645", "database_1", "42", null, null, null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceQueryStatisticsListMin.json + */ + /** + * Sample code: Obtain query execution statistics. Minimal example with only mandatory request parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void obtainQueryExecutionStatisticsMinimalExampleWithOnlyMandatoryRequestParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseQueries() + .listByQuery( + "sqlcrudtest-7398", + "sqlcrudtest-4645", + "database_1", + "42", + null, + null, + QueryTimeGrainType.PT1H, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseRecommendedSensitivityLabelsUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseRecommendedSensitivityLabelsUpdateSamples.java new file mode 100644 index 0000000000000..711f4cc0d7bd0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseRecommendedSensitivityLabelsUpdateSamples.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.RecommendedSensitivityLabelUpdate; +import com.azure.resourcemanager.sql.generated.models.RecommendedSensitivityLabelUpdateKind; +import com.azure.resourcemanager.sql.generated.models.RecommendedSensitivityLabelUpdateList; +import java.util.Arrays; + +/** Samples for ManagedDatabaseRecommendedSensitivityLabels Update. */ +public final class ManagedDatabaseRecommendedSensitivityLabelsUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSensitivityLabelsRecommendedUpdate.json + */ + /** + * Sample code: Update recommended sensitivity labels of a given database using an operations batch. + * + * @param manager Entry point to SqlManager. + */ + public static void updateRecommendedSensitivityLabelsOfAGivenDatabaseUsingAnOperationsBatch( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseRecommendedSensitivityLabels() + .updateWithResponse( + "myRG", + "myManagedInstanceName", + "myDatabase", + new RecommendedSensitivityLabelUpdateList() + .withOperations( + Arrays + .asList( + new RecommendedSensitivityLabelUpdate() + .withOp(RecommendedSensitivityLabelUpdateKind.ENABLE) + .withSchema("dbo") + .withTable("table1") + .withColumn("column1"), + new RecommendedSensitivityLabelUpdate() + .withOp(RecommendedSensitivityLabelUpdateKind.DISABLE) + .withSchema("dbo") + .withTable("table2") + .withColumn("column2"), + new RecommendedSensitivityLabelUpdate() + .withOp(RecommendedSensitivityLabelUpdateKind.DISABLE) + .withSchema("dbo") + .withTable("Table1") + .withColumn("Column3"))), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseRestoreDetailsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseRestoreDetailsGetSamples.java new file mode 100644 index 0000000000000..697772e5cf2e4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseRestoreDetailsGetSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.RestoreDetailsName; + +/** Samples for ManagedDatabaseRestoreDetails Get. */ +public final class ManagedDatabaseRestoreDetailsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ManagedDatabaseRestoreDetails.json + */ + /** + * Sample code: Managed database restore details. + * + * @param manager Entry point to SqlManager. + */ + public static void managedDatabaseRestoreDetails(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseRestoreDetails() + .getWithResponse( + "Default-SQL-SouthEastAsia", "managedInstance", "testdb", RestoreDetailsName.DEFAULT, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSchemasGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSchemasGetSamples.java new file mode 100644 index 0000000000000..8aceeed59cb7c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSchemasGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseSchemas Get. */ +public final class ManagedDatabaseSchemasGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSchemaGet.json + */ + /** + * Sample code: Get managed database schema. + * + * @param manager Entry point to SqlManager. + */ + public static void getManagedDatabaseSchema(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseSchemas() + .getWithResponse("myRG", "myManagedInstanceName", "myDatabase", "dbo", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSchemasListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSchemasListByDatabaseSamples.java new file mode 100644 index 0000000000000..20a9b7bc0b142 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSchemasListByDatabaseSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseSchemas ListByDatabase. */ +public final class ManagedDatabaseSchemasListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSchemaListByDatabase.json + */ + /** + * Sample code: List managed database schemas. + * + * @param manager Entry point to SqlManager. + */ + public static void listManagedDatabaseSchemas(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseSchemas() + .listByDatabase("myRG", "myManagedInstanceName", "myDatabase", null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSecurityAlertPoliciesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSecurityAlertPoliciesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..357d70b18d9d6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSecurityAlertPoliciesCreateOrUpdateSamples.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseSecurityAlertPolicy; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyName; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyState; +import java.util.Arrays; + +/** Samples for ManagedDatabaseSecurityAlertPolicies CreateOrUpdate. */ +public final class ManagedDatabaseSecurityAlertPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSecurityAlertCreateMax.json + */ + /** + * Sample code: Update a database's threat detection policy with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateADatabaseSThreatDetectionPolicyWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedDatabaseSecurityAlertPolicy resource = + manager + .managedDatabaseSecurityAlertPolicies() + .getWithResponse( + "securityalert-4799", "securityalert-6440", "testdb", SecurityAlertPolicyName.DEFAULT, Context.NONE) + .getValue(); + resource + .update() + .withState(SecurityAlertPolicyState.ENABLED) + .withDisabledAlerts(Arrays.asList("Sql_Injection", "Usage_Anomaly")) + .withEmailAddresses(Arrays.asList("test@contoso.com", "user@contoso.com")) + .withEmailAccountAdmins(true) + .withStorageEndpoint("https://mystorage.blob.core.windows.net") + .withStorageAccountAccessKey( + "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==") + .withRetentionDays(6) + .apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSecurityAlertCreateMin.json + */ + /** + * Sample code: Update a database's threat detection policy with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateADatabaseSThreatDetectionPolicyWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedDatabaseSecurityAlertPolicy resource = + manager + .managedDatabaseSecurityAlertPolicies() + .getWithResponse( + "securityalert-4799", "securityalert-6440", "testdb", SecurityAlertPolicyName.DEFAULT, Context.NONE) + .getValue(); + resource.update().withState(SecurityAlertPolicyState.ENABLED).apply(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSecurityAlertPoliciesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSecurityAlertPoliciesGetSamples.java new file mode 100644 index 0000000000000..5cf96563a6208 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSecurityAlertPoliciesGetSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyName; + +/** Samples for ManagedDatabaseSecurityAlertPolicies Get. */ +public final class ManagedDatabaseSecurityAlertPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSecurityAlertGet.json + */ + /** + * Sample code: Get a database's threat detection policy. + * + * @param manager Entry point to SqlManager. + */ + public static void getADatabaseSThreatDetectionPolicy(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseSecurityAlertPolicies() + .getWithResponse( + "securityalert-6852", "securityalert-2080", "testdb", SecurityAlertPolicyName.DEFAULT, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSecurityAlertPoliciesListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSecurityAlertPoliciesListByDatabaseSamples.java new file mode 100644 index 0000000000000..6aa48ac0c012c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSecurityAlertPoliciesListByDatabaseSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseSecurityAlertPolicies ListByDatabase. */ +public final class ManagedDatabaseSecurityAlertPoliciesListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSecurityAlertListByDatabase.json + */ + /** + * Sample code: Get a list of the database's threat detection policies. + * + * @param manager Entry point to SqlManager. + */ + public static void getAListOfTheDatabaseSThreatDetectionPolicies( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseSecurityAlertPolicies() + .listByDatabase("securityalert-6852", "securityalert-2080", "testdb", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSecurityEventsListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSecurityEventsListByDatabaseSamples.java new file mode 100644 index 0000000000000..37aeaa004a72b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSecurityEventsListByDatabaseSamples.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseSecurityEvents ListByDatabase. */ +public final class ManagedDatabaseSecurityEventsListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSecurityEventsGetMin.json + */ + /** + * Sample code: Get the managed database's security events with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheManagedDatabaseSSecurityEventsWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseSecurityEvents() + .listByDatabase("testrg", "testcl", "database1", null, null, null, null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSecurityEventsGetMax.json + */ + /** + * Sample code: Get the managed database's security events with maximal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheManagedDatabaseSSecurityEventsWithMaximalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseSecurityEvents() + .listByDatabase( + "testrg", + "testcl", + "database1", + "ShowServerRecords eq true", + 0, + 1, + "eyJCbG9iTmFtZURhdGVUaW1lIjoiXC9EYXRlKDE1MTIyODg4MTIwMTArMDIwMClcLyIsIkJsb2JOYW1lUm9sbG92ZXJJbmRleCI6IjAiLCJFbmREYXRlIjoiXC9EYXRlKDE1MTI0NjYyMDA1MjkpXC8iLCJJc1NraXBUb2tlblNldCI6ZmFsc2UsIklzVjJCbG9iVGltZUZvcm1hdCI6dHJ1ZSwiU2hvd1NlcnZlclJlY29yZHMiOmZhbHNlLCJTa2lwVmFsdWUiOjAsIlRha2VWYWx1ZSI6MTB9", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSensitivityLabelsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSensitivityLabelsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..dc4a11d87826e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSensitivityLabelsCreateOrUpdateSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelRank; + +/** Samples for ManagedDatabaseSensitivityLabels CreateOrUpdate. */ +public final class ManagedDatabaseSensitivityLabelsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseColumnSensitivityLabelCreate.json + */ + /** + * Sample code: Updates or creates a sensitivity label of a given column with all parameters in a managed database. + * + * @param manager Entry point to SqlManager. + */ + public static void updatesOrCreatesASensitivityLabelOfAGivenColumnWithAllParametersInAManagedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseSensitivityLabels() + .define() + .withExistingColumn("myRG", "myManagedInstanceName", "myDatabase", "dbo", "myTable", "myColumn") + .withLabelName("PII") + .withLabelId("bf91e08c-f4f0-478a-b016-25164b2a65ff") + .withInformationType("PhoneNumber") + .withInformationTypeId("d22fa6e9-5ee4-3bde-4c2b-a409604c4646") + .withRank(SensitivityLabelRank.HIGH) + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSensitivityLabelsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSensitivityLabelsDeleteSamples.java new file mode 100644 index 0000000000000..b5d3d2c685d8b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSensitivityLabelsDeleteSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseSensitivityLabels Delete. */ +public final class ManagedDatabaseSensitivityLabelsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseColumnSensitivityLabelDelete.json + */ + /** + * Sample code: Deletes the sensitivity label of a given column in a managed database. + * + * @param manager Entry point to SqlManager. + */ + public static void deletesTheSensitivityLabelOfAGivenColumnInAManagedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseSensitivityLabels() + .deleteWithResponse( + "myRG", "myManagedInstanceName", "myDatabase", "dbo", "myTable", "myColumn", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSensitivityLabelsDisableRecommendationSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSensitivityLabelsDisableRecommendationSamples.java new file mode 100644 index 0000000000000..374325c91f631 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSensitivityLabelsDisableRecommendationSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseSensitivityLabels DisableRecommendation. */ +public final class ManagedDatabaseSensitivityLabelsDisableRecommendationSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseRecommendedColumnSensitivityLabelDisable.json + */ + /** + * Sample code: Disables the sensitivity recommendations on a given column. + * + * @param manager Entry point to SqlManager. + */ + public static void disablesTheSensitivityRecommendationsOnAGivenColumn( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseSensitivityLabels() + .disableRecommendationWithResponse( + "myRG", "myManagedInstanceName", "myDatabase", "dbo", "myTable", "myColumn", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSensitivityLabelsEnableRecommendationSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSensitivityLabelsEnableRecommendationSamples.java new file mode 100644 index 0000000000000..b322ce526e5a4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSensitivityLabelsEnableRecommendationSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseSensitivityLabels EnableRecommendation. */ +public final class ManagedDatabaseSensitivityLabelsEnableRecommendationSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseRecommendedColumnSensitivityLabelEnable.json + */ + /** + * Sample code: Enables the sensitivity recommendations on a given column. + * + * @param manager Entry point to SqlManager. + */ + public static void enablesTheSensitivityRecommendationsOnAGivenColumn( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseSensitivityLabels() + .enableRecommendationWithResponse( + "myRG", "myManagedInstanceName", "myDatabase", "dbo", "myTable", "myColumn", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSensitivityLabelsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSensitivityLabelsGetSamples.java new file mode 100644 index 0000000000000..353c048778a12 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSensitivityLabelsGetSamples.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelSource; + +/** Samples for ManagedDatabaseSensitivityLabels Get. */ +public final class ManagedDatabaseSensitivityLabelsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseColumnSensitivityLabelGet.json + */ + /** + * Sample code: Gets the sensitivity label of a given column in a managed database. + * + * @param manager Entry point to SqlManager. + */ + public static void getsTheSensitivityLabelOfAGivenColumnInAManagedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseSensitivityLabels() + .getWithResponse( + "myRG", + "myManagedInstanceName", + "myDatabase", + "dbo", + "myTable", + "myColumn", + SensitivityLabelSource.CURRENT, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSensitivityLabelsListCurrentByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSensitivityLabelsListCurrentByDatabaseSamples.java new file mode 100644 index 0000000000000..f5bd3f95330a4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSensitivityLabelsListCurrentByDatabaseSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseSensitivityLabels ListCurrentByDatabase. */ +public final class ManagedDatabaseSensitivityLabelsListCurrentByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSensitivityLabelsListByDatabaseCurrent.json + */ + /** + * Sample code: Gets the current sensitivity labels of a given database in a managed database. + * + * @param manager Entry point to SqlManager. + */ + public static void getsTheCurrentSensitivityLabelsOfAGivenDatabaseInAManagedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseSensitivityLabels() + .listCurrentByDatabase("myRG", "myManagedInstanceName", "myDatabase", null, null, null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSensitivityLabelsListRecommendedByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSensitivityLabelsListRecommendedByDatabaseSamples.java new file mode 100644 index 0000000000000..3d1e8088ca579 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSensitivityLabelsListRecommendedByDatabaseSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseSensitivityLabels ListRecommendedByDatabase. */ +public final class ManagedDatabaseSensitivityLabelsListRecommendedByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSensitivityLabelsListByDatabaseRecommended.json + */ + /** + * Sample code: Gets the recommended sensitivity labels of a given database in a managed database. + * + * @param manager Entry point to SqlManager. + */ + public static void getsTheRecommendedSensitivityLabelsOfAGivenDatabaseInAManagedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseSensitivityLabels() + .listRecommendedByDatabase("myRG", "myManagedInstanceName", "myDatabase", null, null, null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSensitivityLabelsUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSensitivityLabelsUpdateSamples.java new file mode 100644 index 0000000000000..33d1623426bbd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseSensitivityLabelsUpdateSamples.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.SensitivityLabelInner; +import com.azure.resourcemanager.sql.generated.fluent.models.SensitivityLabelUpdateInner; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelUpdateKind; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelUpdateList; +import java.util.Arrays; + +/** Samples for ManagedDatabaseSensitivityLabels Update. */ +public final class ManagedDatabaseSensitivityLabelsUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseSensitivityLabelsCurrentUpdate.json + */ + /** + * Sample code: Update sensitivity labels of a given database using an operations batch. + * + * @param manager Entry point to SqlManager. + */ + public static void updateSensitivityLabelsOfAGivenDatabaseUsingAnOperationsBatch( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseSensitivityLabels() + .updateWithResponse( + "myRG", + "myManagedInstanceName", + "myDatabase", + new SensitivityLabelUpdateList() + .withOperations( + Arrays + .asList( + new SensitivityLabelUpdateInner() + .withOp(SensitivityLabelUpdateKind.SET) + .withSchema("dbo") + .withTable("table1") + .withColumn("column1") + .withSensitivityLabel( + new SensitivityLabelInner() + .withLabelName("Highly Confidential") + .withLabelId("3A477B16-9423-432B-AA97-6069B481CEC3") + .withInformationType("Financial") + .withInformationTypeId("1D3652D6-422C-4115-82F1-65DAEBC665C8")), + new SensitivityLabelUpdateInner() + .withOp(SensitivityLabelUpdateKind.SET) + .withSchema("dbo") + .withTable("table2") + .withColumn("column2") + .withSensitivityLabel( + new SensitivityLabelInner() + .withLabelName("PII") + .withLabelId("bf91e08c-f4f0-478a-b016-25164b2a65ff") + .withInformationType("PhoneNumber") + .withInformationTypeId("d22fa6e9-5ee4-3bde-4c2b-a409604c4646")), + new SensitivityLabelUpdateInner() + .withOp(SensitivityLabelUpdateKind.REMOVE) + .withSchema("dbo") + .withTable("Table1") + .withColumn("Column3"))), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseTablesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseTablesGetSamples.java new file mode 100644 index 0000000000000..b7d0917cd0c00 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseTablesGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseTables Get. */ +public final class ManagedDatabaseTablesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseTableGet.json + */ + /** + * Sample code: Get managed database table. + * + * @param manager Entry point to SqlManager. + */ + public static void getManagedDatabaseTable(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseTables() + .getWithResponse("myRG", "myManagedInstanceName", "myDatabase", "dbo", "table1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseTablesListBySchemaSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseTablesListBySchemaSamples.java new file mode 100644 index 0000000000000..c0030bf6c10b8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseTablesListBySchemaSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseTables ListBySchema. */ +public final class ManagedDatabaseTablesListBySchemaSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseTableListBySchema.json + */ + /** + * Sample code: List managed database tables. + * + * @param manager Entry point to SqlManager. + */ + public static void listManagedDatabaseTables(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseTables() + .listBySchema("myRG", "myManagedInstanceName", "myDatabase", "dbo", null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseTransparentDataEncryptionCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseTransparentDataEncryptionCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..570d6686aa361 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseTransparentDataEncryptionCreateOrUpdateSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ManagedTransparentDataEncryption; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionName; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionState; + +/** Samples for ManagedDatabaseTransparentDataEncryption CreateOrUpdate. */ +public final class ManagedDatabaseTransparentDataEncryptionCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedTransparentDataEncryptionUpdate.json + */ + /** + * Sample code: Update a database's Transparent Data Encryption state with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateADatabaseSTransparentDataEncryptionStateWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedTransparentDataEncryption resource = + manager + .managedDatabaseTransparentDataEncryptions() + .getWithResponse( + "securitytde-42-rg", + "securitytde-42", + "testdb", + TransparentDataEncryptionName.CURRENT, + Context.NONE) + .getValue(); + resource.update().withState(TransparentDataEncryptionState.ENABLED).apply(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseTransparentDataEncryptionGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseTransparentDataEncryptionGetSamples.java new file mode 100644 index 0000000000000..408f4251806e9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseTransparentDataEncryptionGetSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionName; + +/** Samples for ManagedDatabaseTransparentDataEncryption Get. */ +public final class ManagedDatabaseTransparentDataEncryptionGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedTransparentDataEncryptionGet.json + */ + /** + * Sample code: Get a database's transparent data encryption. + * + * @param manager Entry point to SqlManager. + */ + public static void getADatabaseSTransparentDataEncryption( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseTransparentDataEncryptions() + .getWithResponse( + "security-tde-resourcegroup", + "securitytde", + "testdb", + TransparentDataEncryptionName.CURRENT, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseTransparentDataEncryptionListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseTransparentDataEncryptionListByDatabaseSamples.java new file mode 100644 index 0000000000000..b14d7ec25c6ad --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseTransparentDataEncryptionListByDatabaseSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseTransparentDataEncryption ListByDatabase. */ +public final class ManagedDatabaseTransparentDataEncryptionListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedTransparentDataEncryptionList.json + */ + /** + * Sample code: Get a list of the database's transparent data encryptions. + * + * @param manager Entry point to SqlManager. + */ + public static void getAListOfTheDatabaseSTransparentDataEncryptions( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseTransparentDataEncryptions() + .listByDatabase("security-tde-resourcegroup", "securitytde", "testdb", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..53b3f68c8c20c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesCreateOrUpdateSamples.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentRuleBaselineInner; +import com.azure.resourcemanager.sql.generated.models.DatabaseVulnerabilityAssessmentRuleBaselineItem; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentPolicyBaselineName; +import java.util.Arrays; + +/** Samples for ManagedDatabaseVulnerabilityAssessmentRuleBaselines CreateOrUpdate. */ +public final class ManagedDatabaseVulnerabilityAssessmentRuleBaselinesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentRuleBaselineCreate.json + */ + /** + * Sample code: Creates or updates a database's vulnerability assessment rule baseline. + * + * @param manager Entry point to SqlManager. + */ + public static void createsOrUpdatesADatabaseSVulnerabilityAssessmentRuleBaseline( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseVulnerabilityAssessmentRuleBaselines() + .createOrUpdateWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + "VA1001", + VulnerabilityAssessmentPolicyBaselineName.DEFAULT, + new DatabaseVulnerabilityAssessmentRuleBaselineInner() + .withBaselineResults( + Arrays + .asList( + new DatabaseVulnerabilityAssessmentRuleBaselineItem() + .withResult(Arrays.asList("userA", "SELECT")), + new DatabaseVulnerabilityAssessmentRuleBaselineItem() + .withResult(Arrays.asList("userB", "SELECT")), + new DatabaseVulnerabilityAssessmentRuleBaselineItem() + .withResult(Arrays.asList("userC", "SELECT", "tableId_4")))), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesDeleteSamples.java new file mode 100644 index 0000000000000..d7e32b4433aba --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesDeleteSamples.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentPolicyBaselineName; + +/** Samples for ManagedDatabaseVulnerabilityAssessmentRuleBaselines Delete. */ +public final class ManagedDatabaseVulnerabilityAssessmentRuleBaselinesDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentRuleBaselineDelete.json + */ + /** + * Sample code: Removes a database's vulnerability assessment rule baseline. + * + * @param manager Entry point to SqlManager. + */ + public static void removesADatabaseSVulnerabilityAssessmentRuleBaseline( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseVulnerabilityAssessmentRuleBaselines() + .deleteWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + "VA1001", + VulnerabilityAssessmentPolicyBaselineName.DEFAULT, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesGetSamples.java new file mode 100644 index 0000000000000..c362d027c544f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentRuleBaselinesGetSamples.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentPolicyBaselineName; + +/** Samples for ManagedDatabaseVulnerabilityAssessmentRuleBaselines Get. */ +public final class ManagedDatabaseVulnerabilityAssessmentRuleBaselinesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentRuleBaselineGet.json + */ + /** + * Sample code: Gets a database's vulnerability assessment rule baseline. + * + * @param manager Entry point to SqlManager. + */ + public static void getsADatabaseSVulnerabilityAssessmentRuleBaseline( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseVulnerabilityAssessmentRuleBaselines() + .getWithResponse( + "vulnerabilityaseessmenttest-4711", + "vulnerabilityaseessmenttest-6411", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + "VA1001", + VulnerabilityAssessmentPolicyBaselineName.MASTER, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentScansExportSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentScansExportSamples.java new file mode 100644 index 0000000000000..370da63998f8e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentScansExportSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for ManagedDatabaseVulnerabilityAssessmentScans Export. */ +public final class ManagedDatabaseVulnerabilityAssessmentScansExportSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentScanExport.json + */ + /** + * Sample code: Export a database's vulnerability assessment scan results. + * + * @param manager Entry point to SqlManager. + */ + public static void exportADatabaseSVulnerabilityAssessmentScanResults( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseVulnerabilityAssessmentScans() + .exportWithResponse( + "vulnerabilityassessmenttest-4799", + "vulnerabilityassessmenttest-6440", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + "scan001", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentScansGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentScansGetSamples.java new file mode 100644 index 0000000000000..33f02a72b3e5d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentScansGetSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for ManagedDatabaseVulnerabilityAssessmentScans Get. */ +public final class ManagedDatabaseVulnerabilityAssessmentScansGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentScanRecordsGet.json + */ + /** + * Sample code: Gets a database vulnerability assessment scan record by scan ID. + * + * @param manager Entry point to SqlManager. + */ + public static void getsADatabaseVulnerabilityAssessmentScanRecordByScanID( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseVulnerabilityAssessmentScans() + .getWithResponse( + "vulnerabilityassessmenttest-4711", + "vulnerabilityassessmenttest-6411", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + "scan001", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentScansInitiateScanSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentScansInitiateScanSamples.java new file mode 100644 index 0000000000000..f09cdbea97f00 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentScansInitiateScanSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for ManagedDatabaseVulnerabilityAssessmentScans InitiateScan. */ +public final class ManagedDatabaseVulnerabilityAssessmentScansInitiateScanSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentScansExecute.json + */ + /** + * Sample code: Executes a database's vulnerability assessment scan. + * + * @param manager Entry point to SqlManager. + */ + public static void executesADatabaseSVulnerabilityAssessmentScan( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseVulnerabilityAssessmentScans() + .initiateScan( + "vulnerabilityassessmenttest-4711", + "vulnerabilityassessmenttest-6411", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + "scan01", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentScansListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentScansListByDatabaseSamples.java new file mode 100644 index 0000000000000..cf9ab41bad0dd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentScansListByDatabaseSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for ManagedDatabaseVulnerabilityAssessmentScans ListByDatabase. */ +public final class ManagedDatabaseVulnerabilityAssessmentScansListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentScanRecordsListByDatabase.json + */ + /** + * Sample code: Gets the list of a database vulnerability assessment scan records. + * + * @param manager Entry point to SqlManager. + */ + public static void getsTheListOfADatabaseVulnerabilityAssessmentScanRecords( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseVulnerabilityAssessmentScans() + .listByDatabase( + "vulnerabilityassessmenttest-4711", + "vulnerabilityassessmenttest-6411", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..99bbc4df76c03 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentsCreateOrUpdateSamples.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.DatabaseVulnerabilityAssessmentInner; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentRecurringScansProperties; +import java.util.Arrays; + +/** Samples for ManagedDatabaseVulnerabilityAssessments CreateOrUpdate. */ +public final class ManagedDatabaseVulnerabilityAssessmentsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentCreateMax.json + */ + /** + * Sample code: Create a database's vulnerability assessment with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void createADatabaseSVulnerabilityAssessmentWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseVulnerabilityAssessments() + .createOrUpdateWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + new DatabaseVulnerabilityAssessmentInner() + .withStorageContainerPath("https://myStorage.blob.core.windows.net/vulnerability-assessment/") + .withStorageContainerSasKey("fakeTokenPlaceholder") + .withRecurringScans( + new VulnerabilityAssessmentRecurringScansProperties() + .withIsEnabled(true) + .withEmailSubscriptionAdmins(true) + .withEmails(Arrays.asList("email1@mail.com", "email2@mail.com"))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentCreateMin.json + */ + /** + * Sample code: Create a database's vulnerability assessment with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void createADatabaseSVulnerabilityAssessmentWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseVulnerabilityAssessments() + .createOrUpdateWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + new DatabaseVulnerabilityAssessmentInner() + .withStorageContainerPath("https://myStorage.blob.core.windows.net/vulnerability-assessment/") + .withStorageContainerSasKey("fakeTokenPlaceholder"), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentsDeleteSamples.java new file mode 100644 index 0000000000000..06a0ceb833aa2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentsDeleteSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for ManagedDatabaseVulnerabilityAssessments Delete. */ +public final class ManagedDatabaseVulnerabilityAssessmentsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentDelete.json + */ + /** + * Sample code: Remove a database's vulnerability assessment. + * + * @param manager Entry point to SqlManager. + */ + public static void removeADatabaseSVulnerabilityAssessment( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseVulnerabilityAssessments() + .deleteWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentsGetSamples.java new file mode 100644 index 0000000000000..2d969186c24b2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentsGetSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for ManagedDatabaseVulnerabilityAssessments Get. */ +public final class ManagedDatabaseVulnerabilityAssessmentsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentGet.json + */ + /** + * Sample code: Get a database's vulnerability assessment. + * + * @param manager Entry point to SqlManager. + */ + public static void getADatabaseSVulnerabilityAssessment( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseVulnerabilityAssessments() + .getWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + "testdb", + VulnerabilityAssessmentName.DEFAULT, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentsListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentsListByDatabaseSamples.java new file mode 100644 index 0000000000000..ec35c6cfda2c0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabaseVulnerabilityAssessmentsListByDatabaseSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedDatabaseVulnerabilityAssessments ListByDatabase. */ +public final class ManagedDatabaseVulnerabilityAssessmentsListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedDatabaseVulnerabilityAssessmentListByDatabase.json + */ + /** + * Sample code: Get a database's vulnerability assessments list. + * + * @param manager Entry point to SqlManager. + */ + public static void getADatabaseSVulnerabilityAssessmentsList( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabaseVulnerabilityAssessments() + .listByDatabase( + "vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", "testdb", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesCancelMoveSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesCancelMoveSamples.java new file mode 100644 index 0000000000000..d71b489015761 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesCancelMoveSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseMoveDefinition; + +/** Samples for ManagedDatabases CancelMove. */ +public final class ManagedDatabasesCancelMoveSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ManagedDatabaseCancelMove.json + */ + /** + * Sample code: Cancels a managed database move. + * + * @param manager Entry point to SqlManager. + */ + public static void cancelsAManagedDatabaseMove(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabases() + .cancelMove( + "group1", + "testInstanceSrc", + "testDatabase", + new ManagedDatabaseMoveDefinition() + .withDestinationManagedDatabaseId( + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/managedInstances/testInstanceTgt/databases/testDatabase"), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesCompleteMoveSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesCompleteMoveSamples.java new file mode 100644 index 0000000000000..853ce2fd97b8d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesCompleteMoveSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseMoveDefinition; + +/** Samples for ManagedDatabases CompleteMove. */ +public final class ManagedDatabasesCompleteMoveSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ManagedDatabaseCompleteMove.json + */ + /** + * Sample code: Completes a managed database move. + * + * @param manager Entry point to SqlManager. + */ + public static void completesAManagedDatabaseMove(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabases() + .completeMove( + "group1", + "testInstanceSrc", + "testDatabase", + new ManagedDatabaseMoveDefinition() + .withDestinationManagedDatabaseId( + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/managedInstances/testInstanceTgt/databases/testDatabase"), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesCompleteRestoreSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesCompleteRestoreSamples.java new file mode 100644 index 0000000000000..280e4de15d871 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesCompleteRestoreSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.CompleteDatabaseRestoreDefinition; + +/** Samples for ManagedDatabases CompleteRestore. */ +public final class ManagedDatabasesCompleteRestoreSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ManagedDatabaseCompleteExternalRestore.json + */ + /** + * Sample code: Completes a managed database external backup restore. + * + * @param manager Entry point to SqlManager. + */ + public static void completesAManagedDatabaseExternalBackupRestore( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabases() + .completeRestore( + "myRG", + "myManagedInstanceName", + "myDatabase", + new CompleteDatabaseRestoreDefinition().withLastBackupName("testdb1_log4"), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..44786db29872c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesCreateOrUpdateSamples.java @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseCreateMode; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ManagedDatabases CreateOrUpdate. */ +public final class ManagedDatabasesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ManagedDatabaseCreateRestoreExternalBackupManagedIdentity.json + */ + /** + * Sample code: Creates a new managed database by restoring from an external backup using managed identity. + * + * @param manager Entry point to SqlManager. + */ + public static void createsANewManagedDatabaseByRestoringFromAnExternalBackupUsingManagedIdentity( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabases() + .define("managedDatabase") + .withRegion("southeastasia") + .withExistingManagedInstance("Default-SQL-SouthEastAsia", "managedInstance") + .withCollation("SQL_Latin1_General_CP1_CI_AS") + .withCreateMode(ManagedDatabaseCreateMode.RESTORE_EXTERNAL_BACKUP) + .withStorageContainerUri("https://myaccountname.blob.core.windows.net/backups") + .withStorageContainerIdentity("ManagedIdentity") + .withAutoCompleteRestore(true) + .withLastBackupName("last_backup_name") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ManagedDatabaseCreateRecovery.json + */ + /** + * Sample code: Creates a new managed database from restoring a geo-replicated backup. + * + * @param manager Entry point to SqlManager. + */ + public static void createsANewManagedDatabaseFromRestoringAGeoReplicatedBackup( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabases() + .define("testdb_recovered") + .withRegion("southeastasia") + .withExistingManagedInstance("Default-SQL-SouthEastAsia", "server1") + .withCreateMode(ManagedDatabaseCreateMode.RECOVERY) + .withRecoverableDatabaseId( + "/subscriptions/11111111-2222-3333-4444-555555555555/resourceGroups/Default-SQL-WestEurope/providers/Microsoft.Sql/managedInstances/testsvr/recoverableDatabases/testdb") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ManagedDatabaseCreateRestoreExternalBackup.json + */ + /** + * Sample code: Creates a new managed database by restoring from an external backup. + * + * @param manager Entry point to SqlManager. + */ + public static void createsANewManagedDatabaseByRestoringFromAnExternalBackup( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabases() + .define("managedDatabase") + .withRegion("southeastasia") + .withExistingManagedInstance("Default-SQL-SouthEastAsia", "managedInstance") + .withCollation("SQL_Latin1_General_CP1_CI_AS") + .withCreateMode(ManagedDatabaseCreateMode.RESTORE_EXTERNAL_BACKUP) + .withStorageContainerUri("https://myaccountname.blob.core.windows.net/backups") + .withStorageContainerSasToken("sv=2015-12-11&sr=c&sp=rl&sig=1234") + .withAutoCompleteRestore(true) + .withLastBackupName("last_backup_name") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ManagedDatabaseCreateMax.json + */ + /** + * Sample code: Creates a new managed database with maximal properties. + * + * @param manager Entry point to SqlManager. + */ + public static void createsANewManagedDatabaseWithMaximalProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabases() + .define("managedDatabase") + .withRegion("southeastasia") + .withExistingManagedInstance("Default-SQL-SouthEastAsia", "managedInstance") + .withTags(mapOf("tagKey1", "TagValue1")) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ManagedDatabaseCreateMin.json + */ + /** + * Sample code: Creates a new managed database with minimal properties. + * + * @param manager Entry point to SqlManager. + */ + public static void createsANewManagedDatabaseWithMinimalProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabases() + .define("managedDatabase") + .withRegion("southeastasia") + .withExistingManagedInstance("Default-SQL-SouthEastAsia", "managedInstance") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ManagedDatabaseCreatePointInTimeRestore.json + */ + /** + * Sample code: Creates a new managed database using point in time restore. + * + * @param manager Entry point to SqlManager. + */ + public static void createsANewManagedDatabaseUsingPointInTimeRestore( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabases() + .define("managedDatabase") + .withRegion("southeastasia") + .withExistingManagedInstance("Default-SQL-SouthEastAsia", "managedInstance") + .withRestorePointInTime(OffsetDateTime.parse("2017-07-14T05:35:31.503Z")) + .withCreateMode(ManagedDatabaseCreateMode.POINT_IN_TIME_RESTORE) + .withSourceDatabaseId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/managedInstances/testsvr/databases/testdb") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ManagedDatabaseCreateRestoreLtrBackup.json + */ + /** + * Sample code: Creates a new managed database from restoring a long term retention backup. + * + * @param manager Entry point to SqlManager. + */ + public static void createsANewManagedDatabaseFromRestoringALongTermRetentionBackup( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabases() + .define("managedDatabase") + .withRegion("southeastasia") + .withExistingManagedInstance("Default-SQL-SouthEastAsia", "managedInstance") + .withCollation("SQL_Latin1_General_CP1_CI_AS") + .withCreateMode(ManagedDatabaseCreateMode.RESTORE_EXTERNAL_BACKUP) + .withStorageContainerUri("https://myaccountname.blob.core.windows.net/backups") + .withStorageContainerSasToken("sv=2015-12-11&sr=c&sp=rl&sig=1234") + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesDeleteSamples.java new file mode 100644 index 0000000000000..1c88c7d23ade2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedDatabases Delete. */ +public final class ManagedDatabasesDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ManagedDatabaseDelete.json + */ + /** + * Sample code: Delete managed database. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteManagedDatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedDatabases().delete("Default-SQL-SouthEastAsia", "managedInstance", "testdb", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesGetSamples.java new file mode 100644 index 0000000000000..9b65fc30d4c01 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedDatabases Get. */ +public final class ManagedDatabasesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ManagedDatabaseGet.json + */ + /** + * Sample code: Gets a managed database. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAManagedDatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedDatabases().getWithResponse("Test1", "managedInstance", "managedDatabase", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesListByInstanceSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesListByInstanceSamples.java new file mode 100644 index 0000000000000..4acf5dbf7f5b0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesListByInstanceSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedDatabases ListByInstance. */ +public final class ManagedDatabasesListByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ManagedDatabaseListByManagedInstance.json + */ + /** + * Sample code: List databases by managed instances. + * + * @param manager Entry point to SqlManager. + */ + public static void listDatabasesByManagedInstances(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedDatabases().listByInstance("Test1", "managedInstance", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesListInaccessibleByInstanceSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesListInaccessibleByInstanceSamples.java new file mode 100644 index 0000000000000..88e95085e587a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesListInaccessibleByInstanceSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedDatabases ListInaccessibleByInstance. */ +public final class ManagedDatabasesListInaccessibleByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/InaccessibleManagedDatabaseListByManagedInstance.json + */ + /** + * Sample code: List inaccessible managed databases by managed instances. + * + * @param manager Entry point to SqlManager. + */ + public static void listInaccessibleManagedDatabasesByManagedInstances( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedDatabases().listInaccessibleByInstance("testrg", "testcl", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesStartMoveSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesStartMoveSamples.java new file mode 100644 index 0000000000000..bd6330c6e944d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesStartMoveSamples.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabaseStartMoveDefinition; +import com.azure.resourcemanager.sql.generated.models.MoveOperationMode; + +/** Samples for ManagedDatabases StartMove. */ +public final class ManagedDatabasesStartMoveSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ManagedDatabaseStartMoveMax.json + */ + /** + * Sample code: Starts a managed database move with all optional parameters specified. + * + * @param manager Entry point to SqlManager. + */ + public static void startsAManagedDatabaseMoveWithAllOptionalParametersSpecified( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabases() + .startMove( + "group1", + "testInstanceSrc", + "testDatabase", + new ManagedDatabaseStartMoveDefinition() + .withDestinationManagedDatabaseId( + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/managedInstances/testInstanceTgt/databases/testDatabase") + .withOperationMode(MoveOperationMode.COPY), + Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ManagedDatabaseStartMoveMin.json + */ + /** + * Sample code: Starts a managed database move with no optional parameters specified. + * + * @param manager Entry point to SqlManager. + */ + public static void startsAManagedDatabaseMoveWithNoOptionalParametersSpecified( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedDatabases() + .startMove( + "group1", + "testInstanceSrc", + "testDatabase", + new ManagedDatabaseStartMoveDefinition() + .withDestinationManagedDatabaseId( + "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/group1/providers/Microsoft.Sql/managedInstances/testInstanceTgt/databases/testDatabase"), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesUpdateSamples.java new file mode 100644 index 0000000000000..43a4eced846dc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedDatabasesUpdateSamples.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ManagedDatabase; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ManagedDatabases Update. */ +public final class ManagedDatabasesUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ManagedDatabaseUpdateMax.json + */ + /** + * Sample code: Updates a managed database with maximal properties. + * + * @param manager Entry point to SqlManager. + */ + public static void updatesAManagedDatabaseWithMaximalProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedDatabase resource = + manager + .managedDatabases() + .getWithResponse("Default-SQL-SouthEastAsia", "managedInstance", "testdb", Context.NONE) + .getValue(); + resource.update().withTags(mapOf("tagKey1", "TagValue1")).apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ManagedDatabaseUpdateMin.json + */ + /** + * Sample code: Updates a managed database with minimal properties. + * + * @param manager Entry point to SqlManager. + */ + public static void updatesAManagedDatabaseWithMinimalProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedDatabase resource = + manager + .managedDatabases() + .getWithResponse("Default-SQL-SouthEastAsia", "managedInstance", "testdb", Context.NONE) + .getValue(); + resource.update().withTags(mapOf("tagKey1", "TagValue1")).apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAdministratorsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAdministratorsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..d38765af3a200 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAdministratorsCreateOrUpdateSamples.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.AdministratorName; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceAdministrator; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceAdministratorType; +import java.util.UUID; + +/** Samples for ManagedInstanceAdministrators CreateOrUpdate. */ +public final class ManagedInstanceAdministratorsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceAdministratorCreate.json + */ + /** + * Sample code: Create administrator of managed instance. + * + * @param manager Entry point to SqlManager. + */ + public static void createAdministratorOfManagedInstance( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceAdministrators() + .define(AdministratorName.ACTIVE_DIRECTORY) + .withExistingManagedInstance("Default-SQL-SouthEastAsia", "managedInstance") + .withAdministratorType(ManagedInstanceAdministratorType.ACTIVE_DIRECTORY) + .withLogin("bob@contoso.com") + .withSid(UUID.fromString("44444444-3333-2222-1111-000000000000")) + .withTenantId(UUID.fromString("55555555-4444-3333-2222-111111111111")) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceAdministratorUpdate.json + */ + /** + * Sample code: Update administrator of managed instance. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAdministratorOfManagedInstance( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedInstanceAdministrator resource = + manager + .managedInstanceAdministrators() + .getWithResponse( + "Default-SQL-SouthEastAsia", "managedInstance", AdministratorName.ACTIVE_DIRECTORY, Context.NONE) + .getValue(); + resource + .update() + .withAdministratorType(ManagedInstanceAdministratorType.ACTIVE_DIRECTORY) + .withLogin("bob@contoso.com") + .withSid(UUID.fromString("44444444-3333-2222-1111-000000000000")) + .withTenantId(UUID.fromString("55555555-4444-3333-2222-111111111111")) + .apply(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAdministratorsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAdministratorsDeleteSamples.java new file mode 100644 index 0000000000000..b04289a2bc302 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAdministratorsDeleteSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.AdministratorName; + +/** Samples for ManagedInstanceAdministrators Delete. */ +public final class ManagedInstanceAdministratorsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceAdministratorDelete.json + */ + /** + * Sample code: Delete administrator of managed instance. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteAdministratorOfManagedInstance( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceAdministrators() + .delete("Default-SQL-SouthEastAsia", "managedInstance", AdministratorName.ACTIVE_DIRECTORY, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAdministratorsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAdministratorsGetSamples.java new file mode 100644 index 0000000000000..c962d7dbcda86 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAdministratorsGetSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.AdministratorName; + +/** Samples for ManagedInstanceAdministrators Get. */ +public final class ManagedInstanceAdministratorsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceAdministratorGet.json + */ + /** + * Sample code: Get administrator of managed instance. + * + * @param manager Entry point to SqlManager. + */ + public static void getAdministratorOfManagedInstance(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceAdministrators() + .getWithResponse( + "Default-SQL-SouthEastAsia", "managedInstance", AdministratorName.ACTIVE_DIRECTORY, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAdministratorsListByInstanceSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAdministratorsListByInstanceSamples.java new file mode 100644 index 0000000000000..456cfcbed938b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAdministratorsListByInstanceSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedInstanceAdministrators ListByInstance. */ +public final class ManagedInstanceAdministratorsListByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceAdministratorListByInstance.json + */ + /** + * Sample code: List administrators of managed instance. + * + * @param manager Entry point to SqlManager. + */ + public static void listAdministratorsOfManagedInstance(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceAdministrators() + .listByInstance("Default-SQL-SouthEastAsia", "managedInstance", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAdvancedThreatProtectionSettingsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAdvancedThreatProtectionSettingsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..d3547912b7b97 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAdvancedThreatProtectionSettingsCreateOrUpdateSamples.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.AdvancedThreatProtectionName; +import com.azure.resourcemanager.sql.generated.models.AdvancedThreatProtectionState; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceAdvancedThreatProtection; + +/** Samples for ManagedInstanceAdvancedThreatProtectionSettings CreateOrUpdate. */ +public final class ManagedInstanceAdvancedThreatProtectionSettingsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ManagedInstanceAdvancedThreatProtectionSettingsCreateMin.json + */ + /** + * Sample code: Update a managed instance's Advanced Threat Protection settings with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAManagedInstanceSAdvancedThreatProtectionSettingsWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedInstanceAdvancedThreatProtection resource = + manager + .managedInstanceAdvancedThreatProtectionSettings() + .getWithResponse( + "threatprotection-4799", + "threatprotection-6440", + AdvancedThreatProtectionName.DEFAULT, + Context.NONE) + .getValue(); + resource.update().withState(AdvancedThreatProtectionState.DISABLED).apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ManagedInstanceAdvancedThreatProtectionSettingsCreateMax.json + */ + /** + * Sample code: Update a managed instance's Advanced Threat Protection settings with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAManagedInstanceSAdvancedThreatProtectionSettingsWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedInstanceAdvancedThreatProtection resource = + manager + .managedInstanceAdvancedThreatProtectionSettings() + .getWithResponse( + "threatprotection-4799", + "threatprotection-6440", + AdvancedThreatProtectionName.DEFAULT, + Context.NONE) + .getValue(); + resource.update().withState(AdvancedThreatProtectionState.ENABLED).apply(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAdvancedThreatProtectionSettingsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAdvancedThreatProtectionSettingsGetSamples.java new file mode 100644 index 0000000000000..318f7acd516e4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAdvancedThreatProtectionSettingsGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.AdvancedThreatProtectionName; + +/** Samples for ManagedInstanceAdvancedThreatProtectionSettings Get. */ +public final class ManagedInstanceAdvancedThreatProtectionSettingsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ManagedInstanceAdvancedThreatProtectionSettingsGet.json + */ + /** + * Sample code: Get a managed instance's Advanced Threat Protection settings. + * + * @param manager Entry point to SqlManager. + */ + public static void getAManagedInstanceSAdvancedThreatProtectionSettings( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceAdvancedThreatProtectionSettings() + .getWithResponse( + "threatprotection-4799", "threatprotection-6440", AdvancedThreatProtectionName.DEFAULT, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAdvancedThreatProtectionSettingsListByInstanceSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAdvancedThreatProtectionSettingsListByInstanceSamples.java new file mode 100644 index 0000000000000..7b351a60be2dd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAdvancedThreatProtectionSettingsListByInstanceSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedInstanceAdvancedThreatProtectionSettings ListByInstance. */ +public final class ManagedInstanceAdvancedThreatProtectionSettingsListByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ManagedInstanceAdvancedThreatProtectionSettingsListByInstance.json + */ + /** + * Sample code: List the managed instance's Advanced Threat Protection settings. + * + * @param manager Entry point to SqlManager. + */ + public static void listTheManagedInstanceSAdvancedThreatProtectionSettings( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceAdvancedThreatProtectionSettings() + .listByInstance("threatprotection-4799", "threatprotection-6440", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..62e1159c835a7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.resourcemanager.sql.generated.models.AuthenticationName; + +/** Samples for ManagedInstanceAzureADOnlyAuthentications CreateOrUpdate. */ +public final class ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceAzureADOnlyAuthCreateOrUpdate.json + */ + /** + * Sample code: Creates or updates Azure Active Directory only authentication object. + * + * @param manager Entry point to SqlManager. + */ + public static void createsOrUpdatesAzureActiveDirectoryOnlyAuthenticationObject( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceAzureADOnlyAuthentications() + .define(AuthenticationName.DEFAULT) + .withExistingManagedInstance("Default-SQL-SouthEastAsia", "managedInstance") + .withAzureADOnlyAuthentication(false) + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAzureADOnlyAuthenticationsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAzureADOnlyAuthenticationsDeleteSamples.java new file mode 100644 index 0000000000000..cd1c44ca52d2c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAzureADOnlyAuthenticationsDeleteSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.AuthenticationName; + +/** Samples for ManagedInstanceAzureADOnlyAuthentications Delete. */ +public final class ManagedInstanceAzureADOnlyAuthenticationsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceAzureADOnlyAuthDelete.json + */ + /** + * Sample code: Deletes Azure Active Directory only authentication object. + * + * @param manager Entry point to SqlManager. + */ + public static void deletesAzureActiveDirectoryOnlyAuthenticationObject( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceAzureADOnlyAuthentications() + .delete("Default-SQL-SouthEastAsia", "managedInstance", AuthenticationName.DEFAULT, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAzureADOnlyAuthenticationsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAzureADOnlyAuthenticationsGetSamples.java new file mode 100644 index 0000000000000..45120ee7bb600 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAzureADOnlyAuthenticationsGetSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.AuthenticationName; + +/** Samples for ManagedInstanceAzureADOnlyAuthentications Get. */ +public final class ManagedInstanceAzureADOnlyAuthenticationsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceAzureADOnlyAuthGet.json + */ + /** + * Sample code: Gets a Azure Active Directory only authentication property. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAAzureActiveDirectoryOnlyAuthenticationProperty( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceAzureADOnlyAuthentications() + .getWithResponse("Default-SQL-SouthEastAsia", "managedInstance", AuthenticationName.DEFAULT, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAzureADOnlyAuthenticationsListByInstanceSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAzureADOnlyAuthenticationsListByInstanceSamples.java new file mode 100644 index 0000000000000..c7bca916266c9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceAzureADOnlyAuthenticationsListByInstanceSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedInstanceAzureADOnlyAuthentications ListByInstance. */ +public final class ManagedInstanceAzureADOnlyAuthenticationsListByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceAzureADOnlyAuthListByInstance.json + */ + /** + * Sample code: Gets a list of Azure Active Directory only authentication object. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAListOfAzureActiveDirectoryOnlyAuthenticationObject( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceAzureADOnlyAuthentications() + .listByInstance("Default-SQL-SouthEastAsia", "managedInstance", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceDtcsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceDtcsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..560ca8fcdecb5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceDtcsCreateOrUpdateSamples.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.DtcName; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceDtc; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceDtcSecuritySettings; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceDtcTransactionManagerCommunicationSettings; +import java.util.Arrays; + +/** Samples for ManagedInstanceDtcs CreateOrUpdate. */ +public final class ManagedInstanceDtcsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/ManagedInstanceDtcUpdateEnableDtc.json + */ + /** + * Sample code: Updates managed instance DTC settings by enabling DTC. + * + * @param manager Entry point to SqlManager. + */ + public static void updatesManagedInstanceDTCSettingsByEnablingDTC( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedInstanceDtc resource = + manager + .managedInstanceDtcs() + .getWithResponse("testrg", "testinstance", DtcName.CURRENT, Context.NONE) + .getValue(); + resource.update().withDtcEnabled(true).apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/ManagedInstanceDtcUpdateMax.json + */ + /** + * Sample code: Updates managed instance DTC settings with all optional parameters specified. + * + * @param manager Entry point to SqlManager. + */ + public static void updatesManagedInstanceDTCSettingsWithAllOptionalParametersSpecified( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedInstanceDtc resource = + manager + .managedInstanceDtcs() + .getWithResponse("testrg", "testinstance", DtcName.CURRENT, Context.NONE) + .getValue(); + resource + .update() + .withDtcEnabled(true) + .withSecuritySettings( + new ManagedInstanceDtcSecuritySettings() + .withTransactionManagerCommunicationSettings( + new ManagedInstanceDtcTransactionManagerCommunicationSettings() + .withAllowInboundEnabled(false) + .withAllowOutboundEnabled(true) + .withAuthentication("NoAuth")) + .withXaTransactionsEnabled(false) + .withSnaLu6Point2TransactionsEnabled(false) + .withXaTransactionsDefaultTimeout(1000) + .withXaTransactionsMaximumTimeout(3000)) + .withExternalDnsSuffixSearchList(Arrays.asList("dns.example1.com", "dns.example2.com")) + .apply(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceDtcsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceDtcsGetSamples.java new file mode 100644 index 0000000000000..be7c3899d1e7c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceDtcsGetSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.DtcName; + +/** Samples for ManagedInstanceDtcs Get. */ +public final class ManagedInstanceDtcsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/ManagedInstanceDtcGet.json + */ + /** + * Sample code: Gets managed instance DTC settings. + * + * @param manager Entry point to SqlManager. + */ + public static void getsManagedInstanceDTCSettings(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstanceDtcs().getWithResponse("testrg", "testinstance", DtcName.CURRENT, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceDtcsListByManagedInstanceSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceDtcsListByManagedInstanceSamples.java new file mode 100644 index 0000000000000..b3e39c96150d2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceDtcsListByManagedInstanceSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedInstanceDtcs ListByManagedInstance. */ +public final class ManagedInstanceDtcsListByManagedInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/ManagedInstanceDtcList.json + */ + /** + * Sample code: Gets a list of managed instance DTC settings. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAListOfManagedInstanceDTCSettings( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstanceDtcs().listByManagedInstance("testrg", "testinstance", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceEncryptionProtectorsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceEncryptionProtectorsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..e91c9042ad461 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceEncryptionProtectorsCreateOrUpdateSamples.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.EncryptionProtectorName; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceEncryptionProtector; +import com.azure.resourcemanager.sql.generated.models.ServerKeyType; + +/** Samples for ManagedInstanceEncryptionProtectors CreateOrUpdate. */ +public final class ManagedInstanceEncryptionProtectorsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceEncryptionProtectorCreateOrUpdateKeyVault.json + */ + /** + * Sample code: Update the encryption protector to key vault. + * + * @param manager Entry point to SqlManager. + */ + public static void updateTheEncryptionProtectorToKeyVault( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedInstanceEncryptionProtector resource = + manager + .managedInstanceEncryptionProtectors() + .getWithResponse("sqlcrudtest-7398", "sqlcrudtest-4645", EncryptionProtectorName.CURRENT, Context.NONE) + .getValue(); + resource + .update() + .withServerKeyName("someVault_someKey_01234567890123456789012345678901") + .withServerKeyType(ServerKeyType.AZURE_KEY_VAULT) + .withAutoRotationEnabled(false) + .apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceEncryptionProtectorCreateOrUpdateServiceManaged.json + */ + /** + * Sample code: Update the encryption protector to service managed. + * + * @param manager Entry point to SqlManager. + */ + public static void updateTheEncryptionProtectorToServiceManaged( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedInstanceEncryptionProtector resource = + manager + .managedInstanceEncryptionProtectors() + .getWithResponse("sqlcrudtest-7398", "sqlcrudtest-4645", EncryptionProtectorName.CURRENT, Context.NONE) + .getValue(); + resource.update().withServerKeyName("ServiceManaged").withServerKeyType(ServerKeyType.SERVICE_MANAGED).apply(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceEncryptionProtectorsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceEncryptionProtectorsGetSamples.java new file mode 100644 index 0000000000000..2d481684307d8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceEncryptionProtectorsGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.EncryptionProtectorName; + +/** Samples for ManagedInstanceEncryptionProtectors Get. */ +public final class ManagedInstanceEncryptionProtectorsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceEncryptionProtectorGet.json + */ + /** + * Sample code: Get the encryption protector. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheEncryptionProtector(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceEncryptionProtectors() + .getWithResponse("sqlcrudtest-7398", "sqlcrudtest-4645", EncryptionProtectorName.CURRENT, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceEncryptionProtectorsListByInstanceSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceEncryptionProtectorsListByInstanceSamples.java new file mode 100644 index 0000000000000..d241a9f4f2799 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceEncryptionProtectorsListByInstanceSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedInstanceEncryptionProtectors ListByInstance. */ +public final class ManagedInstanceEncryptionProtectorsListByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceEncryptionProtectorList.json + */ + /** + * Sample code: List encryption protectors by managed instance. + * + * @param manager Entry point to SqlManager. + */ + public static void listEncryptionProtectorsByManagedInstance( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceEncryptionProtectors() + .listByInstance("sqlcrudtest-7398", "sqlcrudtest-4645", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceEncryptionProtectorsRevalidateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceEncryptionProtectorsRevalidateSamples.java new file mode 100644 index 0000000000000..1bf1b74800b12 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceEncryptionProtectorsRevalidateSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.EncryptionProtectorName; + +/** Samples for ManagedInstanceEncryptionProtectors Revalidate. */ +public final class ManagedInstanceEncryptionProtectorsRevalidateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceEncryptionProtectorRevalidate.json + */ + /** + * Sample code: Revalidates the encryption protector. + * + * @param manager Entry point to SqlManager. + */ + public static void revalidatesTheEncryptionProtector(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceEncryptionProtectors() + .revalidate("sqlcrudtest-7398", "sqlcrudtest-4645", EncryptionProtectorName.CURRENT, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceKeysCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceKeysCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..97f4c03484607 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceKeysCreateOrUpdateSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.resourcemanager.sql.generated.models.ServerKeyType; + +/** Samples for ManagedInstanceKeys CreateOrUpdate. */ +public final class ManagedInstanceKeysCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceKeyCreateOrUpdate.json + */ + /** + * Sample code: Creates or updates a managed instance key. + * + * @param manager Entry point to SqlManager. + */ + public static void createsOrUpdatesAManagedInstanceKey(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceKeys() + .define("someVault_someKey_01234567890123456789012345678901") + .withExistingManagedInstance("sqlcrudtest-7398", "sqlcrudtest-4645") + .withServerKeyType(ServerKeyType.AZURE_KEY_VAULT) + .withUri("https://someVault.vault.azure.net/keys/someKey/01234567890123456789012345678901") + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceKeysDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceKeysDeleteSamples.java new file mode 100644 index 0000000000000..c67250c3248db --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceKeysDeleteSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedInstanceKeys Delete. */ +public final class ManagedInstanceKeysDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceKeyDelete.json + */ + /** + * Sample code: Delete the managed instance key. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteTheManagedInstanceKey(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceKeys() + .delete( + "sqlcrudtest-7398", + "sqlcrudtest-4645", + "someVault_someKey_01234567890123456789012345678901", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceKeysGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceKeysGetSamples.java new file mode 100644 index 0000000000000..ff952d7cd160f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceKeysGetSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedInstanceKeys Get. */ +public final class ManagedInstanceKeysGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceKeyGet.json + */ + /** + * Sample code: Get the managed instance key. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheManagedInstanceKey(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceKeys() + .getWithResponse( + "sqlcrudtest-7398", + "sqlcrudtest-4645", + "someVault_someKey_01234567890123456789012345678901", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceKeysListByInstanceSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceKeysListByInstanceSamples.java new file mode 100644 index 0000000000000..66cedae3291f8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceKeysListByInstanceSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedInstanceKeys ListByInstance. */ +public final class ManagedInstanceKeysListByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceKeyList.json + */ + /** + * Sample code: List the keys for a managed instance. + * + * @param manager Entry point to SqlManager. + */ + public static void listTheKeysForAManagedInstance(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstanceKeys().listByInstance("sqlcrudtest-7398", "sqlcrudtest-4645", null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceLongTermRetentionPoliciesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceLongTermRetentionPoliciesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..484599cfb9707 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceLongTermRetentionPoliciesCreateOrUpdateSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceLongTermRetentionPolicyName; + +/** Samples for ManagedInstanceLongTermRetentionPolicies CreateOrUpdate. */ +public final class ManagedInstanceLongTermRetentionPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceLongTermRetentionPolicyCreateOrUpdate.json + */ + /** + * Sample code: Create or update the LTR policy for the managed database. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateTheLTRPolicyForTheManagedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceLongTermRetentionPolicies() + .define(ManagedInstanceLongTermRetentionPolicyName.DEFAULT) + .withExistingDatabase("testResourceGroup", "testInstance", "testDatabase") + .withWeeklyRetention("P1M") + .withMonthlyRetention("P1Y") + .withYearlyRetention("P5Y") + .withWeekOfYear(5) + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceLongTermRetentionPoliciesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceLongTermRetentionPoliciesGetSamples.java new file mode 100644 index 0000000000000..8a83125b7cf03 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceLongTermRetentionPoliciesGetSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceLongTermRetentionPolicyName; + +/** Samples for ManagedInstanceLongTermRetentionPolicies Get. */ +public final class ManagedInstanceLongTermRetentionPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceLongTermRetentionPolicyGet.json + */ + /** + * Sample code: Get the long term retention policy for the managed database. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheLongTermRetentionPolicyForTheManagedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceLongTermRetentionPolicies() + .getWithResponse( + "testResourceGroup", + "testInstance", + "testDatabase", + ManagedInstanceLongTermRetentionPolicyName.DEFAULT, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceLongTermRetentionPoliciesListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceLongTermRetentionPoliciesListByDatabaseSamples.java new file mode 100644 index 0000000000000..ee4b960b85e0a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceLongTermRetentionPoliciesListByDatabaseSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedInstanceLongTermRetentionPolicies ListByDatabase. */ +public final class ManagedInstanceLongTermRetentionPoliciesListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceLongTermRetentionPolicyListByDatabase.json + */ + /** + * Sample code: Get the long term retention policies for the managed database. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheLongTermRetentionPoliciesForTheManagedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceLongTermRetentionPolicies() + .listByDatabase("testResourceGroup", "testInstance", "testDatabase", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceOperationsCancelSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceOperationsCancelSamples.java new file mode 100644 index 0000000000000..db53d0d647752 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceOperationsCancelSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import java.util.UUID; + +/** Samples for ManagedInstanceOperations Cancel. */ +public final class ManagedInstanceOperationsCancelSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CancelManagedInstanceOperation.json + */ + /** + * Sample code: Cancel the managed instance management operation. + * + * @param manager Entry point to SqlManager. + */ + public static void cancelTheManagedInstanceManagementOperation( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceOperations() + .cancelWithResponse( + "sqlcrudtest-7398", + "sqlcrudtest-4645", + UUID.fromString("11111111-1111-1111-1111-111111111111"), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceOperationsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceOperationsGetSamples.java new file mode 100644 index 0000000000000..b7a0a156c7e95 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceOperationsGetSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import java.util.UUID; + +/** Samples for ManagedInstanceOperations Get. */ +public final class ManagedInstanceOperationsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetManagedInstanceOperation.json + */ + /** + * Sample code: Gets the managed instance management operation. + * + * @param manager Entry point to SqlManager. + */ + public static void getsTheManagedInstanceManagementOperation( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceOperations() + .getWithResponse( + "sqlcrudtest-7398", + "sqlcrudtest-4645", + UUID.fromString("00000000-1111-2222-3333-444444444444"), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceOperationsListByManagedInstanceSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceOperationsListByManagedInstanceSamples.java new file mode 100644 index 0000000000000..890fc6e47a16f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceOperationsListByManagedInstanceSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedInstanceOperations ListByManagedInstance. */ +public final class ManagedInstanceOperationsListByManagedInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListManagedInstanceOperations.json + */ + /** + * Sample code: List the managed instance management operations. + * + * @param manager Entry point to SqlManager. + */ + public static void listTheManagedInstanceManagementOperations( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstanceOperations().listByManagedInstance("sqlcrudtest-7398", "sqlcrudtest-4645", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancePrivateEndpointConnectionsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancePrivateEndpointConnectionsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..8c4c3270a745f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancePrivateEndpointConnectionsCreateOrUpdateSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.resourcemanager.sql.generated.models.ManagedInstancePrivateLinkServiceConnectionStateProperty; + +/** Samples for ManagedInstancePrivateEndpointConnections CreateOrUpdate. */ +public final class ManagedInstancePrivateEndpointConnectionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstancePrivateEndpointConnectionUpdate.json + */ + /** + * Sample code: Approve or reject a private endpoint connection with a given name. + * + * @param manager Entry point to SqlManager. + */ + public static void approveOrRejectAPrivateEndpointConnectionWithAGivenName( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstancePrivateEndpointConnections() + .define("private-endpoint-connection-name") + .withExistingManagedInstance("Default", "test-cl") + .withPrivateLinkServiceConnectionState( + new ManagedInstancePrivateLinkServiceConnectionStateProperty() + .withStatus("Approved") + .withDescription("Approved by johndoe@contoso.com")) + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancePrivateEndpointConnectionsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancePrivateEndpointConnectionsDeleteSamples.java new file mode 100644 index 0000000000000..25c5f62d8355e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancePrivateEndpointConnectionsDeleteSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedInstancePrivateEndpointConnections Delete. */ +public final class ManagedInstancePrivateEndpointConnectionsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstancePrivateEndpointConnectionDelete.json + */ + /** + * Sample code: Deletes a private endpoint connection with a given name. + * + * @param manager Entry point to SqlManager. + */ + public static void deletesAPrivateEndpointConnectionWithAGivenName( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstancePrivateEndpointConnections() + .delete("Default", "test-cl", "private-endpoint-connection-name", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancePrivateEndpointConnectionsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancePrivateEndpointConnectionsGetSamples.java new file mode 100644 index 0000000000000..0cd80e0811e06 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancePrivateEndpointConnectionsGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedInstancePrivateEndpointConnections Get. */ +public final class ManagedInstancePrivateEndpointConnectionsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstancePrivateEndpointConnectionGet.json + */ + /** + * Sample code: Gets private endpoint connection. + * + * @param manager Entry point to SqlManager. + */ + public static void getsPrivateEndpointConnection(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstancePrivateEndpointConnections() + .getWithResponse("Default", "test-cl", "private-endpoint-connection-name", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancePrivateEndpointConnectionsListByManagedInstanceSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancePrivateEndpointConnectionsListByManagedInstanceSamples.java new file mode 100644 index 0000000000000..1b172a6fb44e7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancePrivateEndpointConnectionsListByManagedInstanceSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedInstancePrivateEndpointConnections ListByManagedInstance. */ +public final class ManagedInstancePrivateEndpointConnectionsListByManagedInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstancePrivateEndpointConnectionList.json + */ + /** + * Sample code: Gets list of private endpoint connections on a server. + * + * @param manager Entry point to SqlManager. + */ + public static void getsListOfPrivateEndpointConnectionsOnAServer( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstancePrivateEndpointConnections().listByManagedInstance("Default", "test-cl", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancePrivateLinkResourcesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancePrivateLinkResourcesGetSamples.java new file mode 100644 index 0000000000000..17268ecf82ee9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancePrivateLinkResourcesGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedInstancePrivateLinkResources Get. */ +public final class ManagedInstancePrivateLinkResourcesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstancePrivateLinkResourcesGet.json + */ + /** + * Sample code: Gets a private link resource for SQL. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAPrivateLinkResourceForSQL(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstancePrivateLinkResources().getWithResponse("Default", "test-cl", "plr", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancePrivateLinkResourcesListByManagedInstanceSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancePrivateLinkResourcesListByManagedInstanceSamples.java new file mode 100644 index 0000000000000..25f0019485bb6 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancePrivateLinkResourcesListByManagedInstanceSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedInstancePrivateLinkResources ListByManagedInstance. */ +public final class ManagedInstancePrivateLinkResourcesListByManagedInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstancePrivateLinkResourcesList.json + */ + /** + * Sample code: Gets private link resources for SQL. + * + * @param manager Entry point to SqlManager. + */ + public static void getsPrivateLinkResourcesForSQL(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstancePrivateLinkResources().listByManagedInstance("Default", "test-cl", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceTdeCertificatesCreateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceTdeCertificatesCreateSamples.java new file mode 100644 index 0000000000000..a899a9849ba59 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceTdeCertificatesCreateSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.TdeCertificate; + +/** Samples for ManagedInstanceTdeCertificates Create. */ +public final class ManagedInstanceTdeCertificatesCreateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceTdeCertificate.json + */ + /** + * Sample code: Upload a TDE certificate. + * + * @param manager Entry point to SqlManager. + */ + public static void uploadATDECertificate(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceTdeCertificates() + .create("testtdecert", "testtdecert", new TdeCertificate().withPrivateBlob("MIIXXXXXXXX"), Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceVulnerabilityAssessmentsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceVulnerabilityAssessmentsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..23fdce85127af --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceVulnerabilityAssessmentsCreateOrUpdateSamples.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentRecurringScansProperties; +import java.util.Arrays; + +/** Samples for ManagedInstanceVulnerabilityAssessments CreateOrUpdate. */ +public final class ManagedInstanceVulnerabilityAssessmentsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceVulnerabilityAssessmentCreateStorageAccessKeyMin.json + */ + /** + * Sample code: Create a managed instance's vulnerability assessment with minimal parameters, when + * storageAccountAccessKey is specified. + * + * @param manager Entry point to SqlManager. + */ + public static void + createAManagedInstanceSVulnerabilityAssessmentWithMinimalParametersWhenStorageAccountAccessKeyIsSpecified( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceVulnerabilityAssessments() + .define(VulnerabilityAssessmentName.DEFAULT) + .withExistingManagedInstance("vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440") + .withStorageContainerPath("https://myStorage.blob.core.windows.net/vulnerability-assessment/") + .withStorageAccountAccessKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceVulnerabilityAssessmentCreateContainerSasKeyMin.json + */ + /** + * Sample code: Create a managed instance's vulnerability assessment with minimal parameters, when + * storageContainerSasKey is specified. + * + * @param manager Entry point to SqlManager. + */ + public static void + createAManagedInstanceSVulnerabilityAssessmentWithMinimalParametersWhenStorageContainerSasKeyIsSpecified( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceVulnerabilityAssessments() + .define(VulnerabilityAssessmentName.DEFAULT) + .withExistingManagedInstance("vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440") + .withStorageContainerPath("https://myStorage.blob.core.windows.net/vulnerability-assessment/") + .withStorageContainerSasKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceVulnerabilityAssessmentCreateMax.json + */ + /** + * Sample code: Create a managed instance's vulnerability assessment with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void createAManagedInstanceSVulnerabilityAssessmentWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceVulnerabilityAssessments() + .define(VulnerabilityAssessmentName.DEFAULT) + .withExistingManagedInstance("vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440") + .withStorageContainerPath("https://myStorage.blob.core.windows.net/vulnerability-assessment/") + .withStorageContainerSasKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + .withStorageAccountAccessKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + .withRecurringScans( + new VulnerabilityAssessmentRecurringScansProperties() + .withIsEnabled(true) + .withEmailSubscriptionAdmins(true) + .withEmails(Arrays.asList("email1@mail.com", "email2@mail.com"))) + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceVulnerabilityAssessmentsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceVulnerabilityAssessmentsDeleteSamples.java new file mode 100644 index 0000000000000..42a5a52e2cbe2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceVulnerabilityAssessmentsDeleteSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for ManagedInstanceVulnerabilityAssessments Delete. */ +public final class ManagedInstanceVulnerabilityAssessmentsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceVulnerabilityAssessmentDelete.json + */ + /** + * Sample code: Remove a managed instance's vulnerability assessment. + * + * @param manager Entry point to SqlManager. + */ + public static void removeAManagedInstanceSVulnerabilityAssessment( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceVulnerabilityAssessments() + .deleteWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + VulnerabilityAssessmentName.DEFAULT, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceVulnerabilityAssessmentsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceVulnerabilityAssessmentsGetSamples.java new file mode 100644 index 0000000000000..5f45a8ce3974a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceVulnerabilityAssessmentsGetSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for ManagedInstanceVulnerabilityAssessments Get. */ +public final class ManagedInstanceVulnerabilityAssessmentsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceVulnerabilityAssessmentGet.json + */ + /** + * Sample code: Get a managed instance's vulnerability assessment. + * + * @param manager Entry point to SqlManager. + */ + public static void getAManagedInstanceSVulnerabilityAssessment( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceVulnerabilityAssessments() + .getWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + VulnerabilityAssessmentName.DEFAULT, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceVulnerabilityAssessmentsListByInstanceSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceVulnerabilityAssessmentsListByInstanceSamples.java new file mode 100644 index 0000000000000..4380e0bc06e21 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstanceVulnerabilityAssessmentsListByInstanceSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedInstanceVulnerabilityAssessments ListByInstance. */ +public final class ManagedInstanceVulnerabilityAssessmentsListByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceVulnerabilityAssessmentListByInstance.json + */ + /** + * Sample code: Get a managed instance's vulnerability assessment policies. + * + * @param manager Entry point to SqlManager. + */ + public static void getAManagedInstanceSVulnerabilityAssessmentPolicies( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstanceVulnerabilityAssessments() + .listByInstance("vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..be675dfe618c3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesCreateOrUpdateSamples.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.resourcemanager.sql.generated.models.BackupStorageRedundancy; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceExternalAdministrator; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceLicenseType; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceProxyOverride; +import com.azure.resourcemanager.sql.generated.models.PrincipalType; +import com.azure.resourcemanager.sql.generated.models.ServicePrincipal; +import com.azure.resourcemanager.sql.generated.models.ServicePrincipalType; +import com.azure.resourcemanager.sql.generated.models.Sku; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +/** Samples for ManagedInstances CreateOrUpdate. */ +public final class ManagedInstancesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceCreateMin.json + */ + /** + * Sample code: Create managed instance with minimal properties. + * + * @param manager Entry point to SqlManager. + */ + public static void createManagedInstanceWithMinimalProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstances() + .define("testinstance") + .withRegion("Japan East") + .withExistingResourceGroup("testrg") + .withSku(new Sku().withName("GP_Gen4").withTier("GeneralPurpose")) + .withAdministratorLogin("dummylogin") + .withAdministratorLoginPassword("PLACEHOLDER") + .withSubnetId( + "/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1") + .withLicenseType(ManagedInstanceLicenseType.LICENSE_INCLUDED) + .withVCores(8) + .withStorageSizeInGB(1024) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceCreateMax.json + */ + /** + * Sample code: Create managed instance with all properties. + * + * @param manager Entry point to SqlManager. + */ + public static void createManagedInstanceWithAllProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstances() + .define("testinstance") + .withRegion("Japan East") + .withExistingResourceGroup("testrg") + .withTags(mapOf("tagKey1", "TagValue1")) + .withSku(new Sku().withName("GP_Gen5").withTier("GeneralPurpose")) + .withAdministratorLogin("dummylogin") + .withAdministratorLoginPassword("PLACEHOLDER") + .withSubnetId( + "/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1") + .withLicenseType(ManagedInstanceLicenseType.LICENSE_INCLUDED) + .withVCores(8) + .withStorageSizeInGB(1024) + .withCollation("SQL_Latin1_General_CP1_CI_AS") + .withDnsZonePartner( + "/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/testrg/providers/Microsoft.Sql/managedInstances/testinstance") + .withPublicDataEndpointEnabled(false) + .withProxyOverride(ManagedInstanceProxyOverride.REDIRECT) + .withTimezoneId("UTC") + .withInstancePoolId( + "/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/testrg/providers/Microsoft.Sql/instancePools/pool1") + .withMaintenanceConfigurationId( + "/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_JapanEast_MI_1") + .withMinimalTlsVersion("1.2") + .withRequestedBackupStorageRedundancy(BackupStorageRedundancy.GEO) + .withAdministrators( + new ManagedInstanceExternalAdministrator() + .withPrincipalType(PrincipalType.USER) + .withLogin("bob@contoso.com") + .withSid(UUID.fromString("00000011-1111-2222-2222-123456789111")) + .withTenantId(UUID.fromString("00000011-1111-2222-2222-123456789111")) + .withAzureADOnlyAuthentication(true)) + .withServicePrincipal(new ServicePrincipal().withType(ServicePrincipalType.SYSTEM_ASSIGNED)) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesDeleteSamples.java new file mode 100644 index 0000000000000..19a4295db2e9a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedInstances Delete. */ +public final class ManagedInstancesDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceDelete.json + */ + /** + * Sample code: Delete managed instance. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteManagedInstance(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstances().delete("testrg", "testinstance", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesFailoverSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesFailoverSamples.java new file mode 100644 index 0000000000000..eccdd87c75b97 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesFailoverSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ReplicaType; + +/** Samples for ManagedInstances Failover. */ +public final class ManagedInstancesFailoverSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/FailoverManagedInstance.json + */ + /** + * Sample code: Failover a managed instance. + * + * @param manager Entry point to SqlManager. + */ + public static void failoverAManagedInstance(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstances().failover("group1", "instanceName", ReplicaType.PRIMARY, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesGetByResourceGroupSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..9b878c6658b9e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesGetByResourceGroupSamples.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedInstances GetByResourceGroup. */ +public final class ManagedInstancesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceGetWithExpandEqualsAdministrators.json + */ + /** + * Sample code: Get managed instance with $expand=administrators/activedirectory. + * + * @param manager Entry point to SqlManager. + */ + public static void getManagedInstanceWithExpandAdministratorsActivedirectory( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstances().getByResourceGroupWithResponse("testrg", "testinstance", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceGet.json + */ + /** + * Sample code: Get managed instance. + * + * @param manager Entry point to SqlManager. + */ + public static void getManagedInstance(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstances().getByResourceGroupWithResponse("testrg", "testinstance", null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesListByInstancePoolSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesListByInstancePoolSamples.java new file mode 100644 index 0000000000000..cf3ddbfdda081 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesListByInstancePoolSamples.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedInstances ListByInstancePool. */ +public final class ManagedInstancesListByInstancePoolSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceListByInstancePool.json + */ + /** + * Sample code: List managed instances by instance pool. + * + * @param manager Entry point to SqlManager. + */ + public static void listManagedInstancesByInstancePool(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstances().listByInstancePool("Test1", "pool1", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceListByInstancePoolWithExpandEqualsAdministrators.json + */ + /** + * Sample code: List managed instances by instance pool with $expand=administrators/activedirectory. + * + * @param manager Entry point to SqlManager. + */ + public static void listManagedInstancesByInstancePoolWithExpandAdministratorsActivedirectory( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstances().listByInstancePool("Test1", "pool1", null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesListByManagedInstanceSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesListByManagedInstanceSamples.java new file mode 100644 index 0000000000000..4da4252bf739c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesListByManagedInstanceSamples.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.MetricType; +import com.azure.resourcemanager.sql.generated.models.QueryTimeGrainType; + +/** Samples for ManagedInstances ListByManagedInstance. */ +public final class ManagedInstancesListByManagedInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceTopQueriesList.json + */ + /** + * Sample code: Obtain list of instance's top resource consuming queries. + * + * @param manager Entry point to SqlManager. + */ + public static void obtainListOfInstanceSTopResourceConsumingQueries( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstances() + .listByManagedInstance( + "sqlcrudtest-7398", + "sqlcrudtest-4645", + null, + null, + null, + null, + QueryTimeGrainType.PT1H, + null, + MetricType.DURATION, + Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceTopQueriesListMax.json + */ + /** + * Sample code: Obtain list of instance's top resource consuming queries. Full-blown request and response. + * + * @param manager Entry point to SqlManager. + */ + public static void obtainListOfInstanceSTopResourceConsumingQueriesFullBlownRequestAndResponse( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstances() + .listByManagedInstance( + "sqlcrudtest-7398", + "sqlcrudtest-4645", + null, + "db1,db2", + "2020-03-10T12:00:00Z", + "2020-03-12T12:00:00Z", + QueryTimeGrainType.P1D, + null, + MetricType.CPU, + Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceTopQueriesListMin.json + */ + /** + * Sample code: Obtain list of instance's top resource consuming queries. Minimal request and response. + * + * @param manager Entry point to SqlManager. + */ + public static void obtainListOfInstanceSTopResourceConsumingQueriesMinimalRequestAndResponse( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedInstances() + .listByManagedInstance( + "sqlcrudtest-7398", "sqlcrudtest-4645", null, null, null, null, null, null, null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesListByResourceGroupSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesListByResourceGroupSamples.java new file mode 100644 index 0000000000000..969926cce3770 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesListByResourceGroupSamples.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedInstances ListByResourceGroup. */ +public final class ManagedInstancesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceListByResourceGroupWithExpandEqualsAdministrators.json + */ + /** + * Sample code: List managed instances by resource group with $expand=administrators/activedirectory. + * + * @param manager Entry point to SqlManager. + */ + public static void listManagedInstancesByResourceGroupWithExpandAdministratorsActivedirectory( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstances().listByResourceGroup("Test1", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceListByResourceGroup.json + */ + /** + * Sample code: List managed instances by resource group. + * + * @param manager Entry point to SqlManager. + */ + public static void listManagedInstancesByResourceGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstances().listByResourceGroup("Test1", null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesListSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesListSamples.java new file mode 100644 index 0000000000000..be86294aa621f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesListSamples.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedInstances List. */ +public final class ManagedInstancesListSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceList.json + */ + /** + * Sample code: List managed instances. + * + * @param manager Entry point to SqlManager. + */ + public static void listManagedInstances(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstances().list(null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceListWithExpandEqualsAdministrators.json + */ + /** + * Sample code: List managed instances with $expand=administrators/activedirectory. + * + * @param manager Entry point to SqlManager. + */ + public static void listManagedInstancesWithExpandAdministratorsActivedirectory( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedInstances().list(null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesUpdateSamples.java new file mode 100644 index 0000000000000..feee899386f7e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedInstancesUpdateSamples.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ManagedInstance; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceLicenseType; +import com.azure.resourcemanager.sql.generated.models.ManagedInstanceProxyOverride; +import com.azure.resourcemanager.sql.generated.models.Sku; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ManagedInstances Update. */ +public final class ManagedInstancesUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceUpdateMin.json + */ + /** + * Sample code: Update managed instance with minimal properties. + * + * @param manager Entry point to SqlManager. + */ + public static void updateManagedInstanceWithMinimalProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedInstance resource = + manager + .managedInstances() + .getByResourceGroupWithResponse("testrg", "testinstance", null, Context.NONE) + .getValue(); + resource.update().withTags(mapOf("tagKey1", "TagValue1")).apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceUpdateMax.json + */ + /** + * Sample code: Update managed instance with all properties. + * + * @param manager Entry point to SqlManager. + */ + public static void updateManagedInstanceWithAllProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedInstance resource = + manager + .managedInstances() + .getByResourceGroupWithResponse("testrg", "testinstance", null, Context.NONE) + .getValue(); + resource + .update() + .withTags(mapOf("tagKey1", "TagValue1")) + .withSku(new Sku().withName("GP_Gen4").withTier("GeneralPurpose").withCapacity(8)) + .withAdministratorLoginPassword("PLACEHOLDER") + .withLicenseType(ManagedInstanceLicenseType.BASE_PRICE) + .withVCores(8) + .withStorageSizeInGB(448) + .withPublicDataEndpointEnabled(false) + .withProxyOverride(ManagedInstanceProxyOverride.REDIRECT) + .withMaintenanceConfigurationId( + "/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_JapanEast_MI_1") + .withMinimalTlsVersion("1.2") + .apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ManagedInstanceRemoveMaintenanceConfiguration.json + */ + /** + * Sample code: Remove maintenance policy from managed instance (select default maintenance policy). + * + * @param manager Entry point to SqlManager. + */ + public static void removeMaintenancePolicyFromManagedInstanceSelectDefaultMaintenancePolicy( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedInstance resource = + manager + .managedInstances() + .getByResourceGroupWithResponse("testrg", "testinstance", null, Context.NONE) + .getValue(); + resource + .update() + .withMaintenanceConfigurationId( + "/subscriptions/20d7082a-0fc7-4468-82bd-542694d5042b/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_Default") + .apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..56495917bb553 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCreateOrUpdateSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedBackupShortTermRetentionPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ManagedShortTermRetentionPolicyName; + +/** Samples for ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies CreateOrUpdate. */ +public final class ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/UpdateManagedShortTermRetentionPolicyRestorableDropped.json + */ + /** + * Sample code: Update the short term retention policy for the restorable dropped database. + * + * @param manager Entry point to SqlManager. + */ + public static void updateTheShortTermRetentionPolicyForTheRestorableDroppedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedRestorableDroppedDatabaseBackupShortTermRetentionPolicies() + .createOrUpdate( + "resourceGroup", + "testsvr", + "testdb,131403269876900000", + ManagedShortTermRetentionPolicyName.DEFAULT, + new ManagedBackupShortTermRetentionPolicyInner().withRetentionDays(14), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesGetSamples.java new file mode 100644 index 0000000000000..038c372bad842 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesGetSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ManagedShortTermRetentionPolicyName; + +/** Samples for ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies Get. */ +public final class ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetManagedShortTermRetentionPolicyRestorableDropped.json + */ + /** + * Sample code: Get the short term retention policy for the database. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheShortTermRetentionPolicyForTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedRestorableDroppedDatabaseBackupShortTermRetentionPolicies() + .getWithResponse( + "Default-SQL-SouthEastAsia", + "testsvr", + "testdb,131403269876900000", + ManagedShortTermRetentionPolicyName.DEFAULT, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesListByRestorableDroppedDatabaseS.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesListByRestorableDroppedDatabaseS.java new file mode 100644 index 0000000000000..292facf452157 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesListByRestorableDroppedDatabaseS.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies ListByRestorableDroppedDatabase. */ +public final class ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesListByRestorableDroppedDatabaseS { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetListManagedShortTermRetentionPolicyRestorableDropped.json + */ + /** + * Sample code: Get the short term retention policy list for the database. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheShortTermRetentionPolicyListForTheDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedRestorableDroppedDatabaseBackupShortTermRetentionPolicies() + .listByRestorableDroppedDatabase( + "Default-SQL-SouthEastAsia", "testsvr", "testdb,131403269876900000", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesUpdateSamples.java new file mode 100644 index 0000000000000..0aca8dd7cdc8f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesUpdateSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ManagedBackupShortTermRetentionPolicyInner; +import com.azure.resourcemanager.sql.generated.models.ManagedShortTermRetentionPolicyName; + +/** Samples for ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies Update. */ +public final class ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/UpdateManagedShortTermRetentionPolicyRestorableDropped.json + */ + /** + * Sample code: Update the short term retention policy for the restorable dropped database. + * + * @param manager Entry point to SqlManager. + */ + public static void updateTheShortTermRetentionPolicyForTheRestorableDroppedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedRestorableDroppedDatabaseBackupShortTermRetentionPolicies() + .update( + "resourceGroup", + "testsvr", + "testdb,131403269876900000", + ManagedShortTermRetentionPolicyName.DEFAULT, + new ManagedBackupShortTermRetentionPolicyInner().withRetentionDays(14), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedServerDnsAliasesAcquireSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedServerDnsAliasesAcquireSamples.java new file mode 100644 index 0000000000000..174a959d1dde9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedServerDnsAliasesAcquireSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ManagedServerDnsAliasAcquisition; + +/** Samples for ManagedServerDnsAliases Acquire. */ +public final class ManagedServerDnsAliasesAcquireSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ManagedServerDnsAliasAcquire.json + */ + /** + * Sample code: Acquire managed server DNS alias. + * + * @param manager Entry point to SqlManager. + */ + public static void acquireManagedServerDNSAlias(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedServerDnsAliases() + .acquire( + "Default", + "new-mi", + "dns-alias-mi", + new ManagedServerDnsAliasAcquisition() + .withOldManagedServerDnsAliasResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/old-mi/dnsAliases/alias1"), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedServerDnsAliasesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedServerDnsAliasesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..25fcbf7f15b33 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedServerDnsAliasesCreateOrUpdateSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +/** Samples for ManagedServerDnsAliases CreateOrUpdate. */ +public final class ManagedServerDnsAliasesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ManagedServerDnsAliasCreateOrUpdate.json + */ + /** + * Sample code: Create managed server DNS alias. + * + * @param manager Entry point to SqlManager. + */ + public static void createManagedServerDNSAlias(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedServerDnsAliases() + .define("dns-alias-mi") + .withExistingManagedInstance("Default", "dns-mi") + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedServerDnsAliasesDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedServerDnsAliasesDeleteSamples.java new file mode 100644 index 0000000000000..6b6c924f78ae7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedServerDnsAliasesDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedServerDnsAliases Delete. */ +public final class ManagedServerDnsAliasesDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ManagedServerDnsAliasDelete.json + */ + /** + * Sample code: Delete managed server DNS alias. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteManagedServerDNSAlias(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedServerDnsAliases().delete("Default", "dns-mi", "dns-alias-mi", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedServerDnsAliasesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedServerDnsAliasesGetSamples.java new file mode 100644 index 0000000000000..4dac17fd64eca --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedServerDnsAliasesGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedServerDnsAliases Get. */ +public final class ManagedServerDnsAliasesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ManagedServerDnsAliasGet.json + */ + /** + * Sample code: Get managed server DNS alias. + * + * @param manager Entry point to SqlManager. + */ + public static void getManagedServerDNSAlias(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedServerDnsAliases().getWithResponse("Default", "dns-mi", "dns-alias-mi", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedServerDnsAliasesListByManagedInstanceSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedServerDnsAliasesListByManagedInstanceSamples.java new file mode 100644 index 0000000000000..afd934ecf416d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedServerDnsAliasesListByManagedInstanceSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedServerDnsAliases ListByManagedInstance. */ +public final class ManagedServerDnsAliasesListByManagedInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ManagedServerDnsAliasList.json + */ + /** + * Sample code: List managed server DNS aliases. + * + * @param manager Entry point to SqlManager. + */ + public static void listManagedServerDNSAliases(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.managedServerDnsAliases().listByManagedInstance("Default", "dns-mi", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedServerSecurityAlertPoliciesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedServerSecurityAlertPoliciesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..61559b8458d1e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedServerSecurityAlertPoliciesCreateOrUpdateSamples.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ManagedServerSecurityAlertPolicy; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyName; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertsPolicyState; +import java.util.Arrays; + +/** Samples for ManagedServerSecurityAlertPolicies CreateOrUpdate. */ +public final class ManagedServerSecurityAlertPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedServerSecurityAlertCreateMin.json + */ + /** + * Sample code: Update a managed server's threat detection policy with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAManagedServerSThreatDetectionPolicyWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedServerSecurityAlertPolicy resource = + manager + .managedServerSecurityAlertPolicies() + .getWithResponse( + "securityalert-4799", "securityalert-6440", SecurityAlertPolicyName.DEFAULT, Context.NONE) + .getValue(); + resource.update().withState(SecurityAlertsPolicyState.ENABLED).apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedServerSecurityAlertCreateMax.json + */ + /** + * Sample code: Update a managed server's threat detection policy with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAManagedServerSThreatDetectionPolicyWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ManagedServerSecurityAlertPolicy resource = + manager + .managedServerSecurityAlertPolicies() + .getWithResponse( + "securityalert-4799", "securityalert-6440", SecurityAlertPolicyName.DEFAULT, Context.NONE) + .getValue(); + resource + .update() + .withState(SecurityAlertsPolicyState.ENABLED) + .withDisabledAlerts(Arrays.asList("Access_Anomaly", "Usage_Anomaly")) + .withEmailAddresses(Arrays.asList("testSecurityAlert@microsoft.com")) + .withEmailAccountAdmins(true) + .withStorageEndpoint("https://mystorage.blob.core.windows.net") + .withStorageAccountAccessKey( + "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==") + .withRetentionDays(5) + .apply(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedServerSecurityAlertPoliciesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedServerSecurityAlertPoliciesGetSamples.java new file mode 100644 index 0000000000000..7509b858edfcf --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedServerSecurityAlertPoliciesGetSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyName; + +/** Samples for ManagedServerSecurityAlertPolicies Get. */ +public final class ManagedServerSecurityAlertPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedServerSecurityAlertGet.json + */ + /** + * Sample code: Get a managed server's threat detection policy. + * + * @param manager Entry point to SqlManager. + */ + public static void getAManagedServerSThreatDetectionPolicy( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedServerSecurityAlertPolicies() + .getWithResponse("securityalert-4799", "securityalert-6440", SecurityAlertPolicyName.DEFAULT, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedServerSecurityAlertPoliciesListByInstanceSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedServerSecurityAlertPoliciesListByInstanceSamples.java new file mode 100644 index 0000000000000..4274d236cfa94 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ManagedServerSecurityAlertPoliciesListByInstanceSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ManagedServerSecurityAlertPolicies ListByInstance. */ +public final class ManagedServerSecurityAlertPoliciesListByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedServerSecurityAlertListByInstance.json + */ + /** + * Sample code: Get the managed server's threat detection policies. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheManagedServerSThreatDetectionPolicies( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .managedServerSecurityAlertPolicies() + .listByInstance("securityalert-4799", "securityalert-6440", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/OutboundFirewallRulesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/OutboundFirewallRulesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..85c0f99d6b7b0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/OutboundFirewallRulesCreateOrUpdateSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +/** Samples for OutboundFirewallRules CreateOrUpdate. */ +public final class OutboundFirewallRulesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/OutboundFirewallRuleCreate.json + */ + /** + * Sample code: Approve or reject a outbound firewall rule with a given name. + * + * @param manager Entry point to SqlManager. + */ + public static void approveOrRejectAOutboundFirewallRuleWithAGivenName( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .outboundFirewallRules() + .define("server.database.windows.net") + .withExistingServer("sqlcrudtest-7398", "sqlcrudtest-4645") + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/OutboundFirewallRulesDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/OutboundFirewallRulesDeleteSamples.java new file mode 100644 index 0000000000000..36b79f4a2b416 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/OutboundFirewallRulesDeleteSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for OutboundFirewallRules Delete. */ +public final class OutboundFirewallRulesDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/OutboundFirewallRuleDelete.json + */ + /** + * Sample code: Deletes a outbound firewall rule with a given name. + * + * @param manager Entry point to SqlManager. + */ + public static void deletesAOutboundFirewallRuleWithAGivenName( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .outboundFirewallRules() + .delete("sqlcrudtest-7398", "sqlcrudtest-6661", "server.database.windows.net", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/OutboundFirewallRulesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/OutboundFirewallRulesGetSamples.java new file mode 100644 index 0000000000000..e756d2a8698df --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/OutboundFirewallRulesGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for OutboundFirewallRules Get. */ +public final class OutboundFirewallRulesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/OutboundFirewallRuleGet.json + */ + /** + * Sample code: Gets outbound firewall rule. + * + * @param manager Entry point to SqlManager. + */ + public static void getsOutboundFirewallRule(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .outboundFirewallRules() + .getWithResponse("sqlcrudtest-7398", "sqlcrudtest-4645", "server.database.windows.net", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/OutboundFirewallRulesListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/OutboundFirewallRulesListByServerSamples.java new file mode 100644 index 0000000000000..bd420e31dff5f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/OutboundFirewallRulesListByServerSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for OutboundFirewallRules ListByServer. */ +public final class OutboundFirewallRulesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/OutboundFirewallRuleList.json + */ + /** + * Sample code: Gets list of outbound firewall rules on a server. + * + * @param manager Entry point to SqlManager. + */ + public static void getsListOfOutboundFirewallRulesOnAServer( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.outboundFirewallRules().listByServer("sqlcrudtest-7398", "sqlcrudtest-4645", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/PrivateEndpointConnectionsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/PrivateEndpointConnectionsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..6b17996d60c2b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/PrivateEndpointConnectionsCreateOrUpdateSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.resourcemanager.sql.generated.models.PrivateLinkServiceConnectionStateProperty; +import com.azure.resourcemanager.sql.generated.models.PrivateLinkServiceConnectionStateStatus; + +/** Samples for PrivateEndpointConnections CreateOrUpdate. */ +public final class PrivateEndpointConnectionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/PrivateEndpointConnectionUpdate.json + */ + /** + * Sample code: Approve or reject a private endpoint connection with a given name. + * + * @param manager Entry point to SqlManager. + */ + public static void approveOrRejectAPrivateEndpointConnectionWithAGivenName( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .privateEndpointConnections() + .define("private-endpoint-connection-name") + .withExistingServer("Default", "test-svr") + .withPrivateLinkServiceConnectionState( + new PrivateLinkServiceConnectionStateProperty() + .withStatus(PrivateLinkServiceConnectionStateStatus.APPROVED) + .withDescription("Approved by johndoe@contoso.com")) + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/PrivateEndpointConnectionsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/PrivateEndpointConnectionsDeleteSamples.java new file mode 100644 index 0000000000000..5ec9e3475ded8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/PrivateEndpointConnectionsDeleteSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections Delete. */ +public final class PrivateEndpointConnectionsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/PrivateEndpointConnectionDelete.json + */ + /** + * Sample code: Deletes a private endpoint connection with a given name. + * + * @param manager Entry point to SqlManager. + */ + public static void deletesAPrivateEndpointConnectionWithAGivenName( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .privateEndpointConnections() + .delete("Default", "test-svr", "private-endpoint-connection-name", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/PrivateEndpointConnectionsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/PrivateEndpointConnectionsGetSamples.java new file mode 100644 index 0000000000000..5737297acde46 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/PrivateEndpointConnectionsGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections Get. */ +public final class PrivateEndpointConnectionsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/PrivateEndpointConnectionGet.json + */ + /** + * Sample code: Gets private endpoint connection. + * + * @param manager Entry point to SqlManager. + */ + public static void getsPrivateEndpointConnection(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .privateEndpointConnections() + .getWithResponse("Default", "test-svr", "private-endpoint-connection-name", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/PrivateEndpointConnectionsListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/PrivateEndpointConnectionsListByServerSamples.java new file mode 100644 index 0000000000000..a6daf1882eca3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/PrivateEndpointConnectionsListByServerSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections ListByServer. */ +public final class PrivateEndpointConnectionsListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/PrivateEndpointConnectionList.json + */ + /** + * Sample code: Gets list of private endpoint connections on a server. + * + * @param manager Entry point to SqlManager. + */ + public static void getsListOfPrivateEndpointConnectionsOnAServer( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.privateEndpointConnections().listByServer("Default", "test-svr", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/PrivateLinkResourcesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/PrivateLinkResourcesGetSamples.java new file mode 100644 index 0000000000000..91ade0bb18084 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/PrivateLinkResourcesGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateLinkResources Get. */ +public final class PrivateLinkResourcesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/PrivateLinkResourcesGet.json + */ + /** + * Sample code: Gets a private link resource for SQL. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAPrivateLinkResourceForSQL(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.privateLinkResources().getWithResponse("Default", "test-svr", "plr", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/PrivateLinkResourcesListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/PrivateLinkResourcesListByServerSamples.java new file mode 100644 index 0000000000000..27355a546cc81 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/PrivateLinkResourcesListByServerSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for PrivateLinkResources ListByServer. */ +public final class PrivateLinkResourcesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/PrivateLinkResourcesList.json + */ + /** + * Sample code: Gets private link resources for SQL. + * + * @param manager Entry point to SqlManager. + */ + public static void getsPrivateLinkResourcesForSQL(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.privateLinkResources().listByServer("Default", "test-svr", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RecommendedSensitivityLabelsUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RecommendedSensitivityLabelsUpdateSamples.java new file mode 100644 index 0000000000000..087c1e021b0a7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RecommendedSensitivityLabelsUpdateSamples.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.RecommendedSensitivityLabelUpdate; +import com.azure.resourcemanager.sql.generated.models.RecommendedSensitivityLabelUpdateKind; +import com.azure.resourcemanager.sql.generated.models.RecommendedSensitivityLabelUpdateList; +import java.util.Arrays; + +/** Samples for RecommendedSensitivityLabels Update. */ +public final class RecommendedSensitivityLabelsUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SensitivityLabelsRecommendedUpdate.json + */ + /** + * Sample code: Update recommended sensitivity labels of a given database using an operations batch. + * + * @param manager Entry point to SqlManager. + */ + public static void updateRecommendedSensitivityLabelsOfAGivenDatabaseUsingAnOperationsBatch( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .recommendedSensitivityLabels() + .updateWithResponse( + "myRG", + "myServer", + "myDatabase", + new RecommendedSensitivityLabelUpdateList() + .withOperations( + Arrays + .asList( + new RecommendedSensitivityLabelUpdate() + .withOp(RecommendedSensitivityLabelUpdateKind.ENABLE) + .withSchema("dbo") + .withTable("table1") + .withColumn("column1"), + new RecommendedSensitivityLabelUpdate() + .withOp(RecommendedSensitivityLabelUpdateKind.ENABLE) + .withSchema("dbo") + .withTable("table2") + .withColumn("column2"), + new RecommendedSensitivityLabelUpdate() + .withOp(RecommendedSensitivityLabelUpdateKind.DISABLE) + .withSchema("dbo") + .withTable("table1") + .withColumn("column3"))), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RecoverableDatabasesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RecoverableDatabasesGetSamples.java new file mode 100644 index 0000000000000..574e8eecc124d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RecoverableDatabasesGetSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for RecoverableDatabases Get. */ +public final class RecoverableDatabasesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01-legacy/examples/RecoverableDatabaseGet.json + */ + /** + * Sample code: Get a recoverable database. + * + * @param manager Entry point to SqlManager. + */ + public static void getARecoverableDatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .recoverableDatabases() + .getWithResponse( + "recoverabledatabasetest-6852", + "recoverabledatabasetest-2080", + "recoverabledatabasetest-9187", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RecoverableDatabasesListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RecoverableDatabasesListByServerSamples.java new file mode 100644 index 0000000000000..fa88d41c7ffef --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RecoverableDatabasesListByServerSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for RecoverableDatabases ListByServer. */ +public final class RecoverableDatabasesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01-legacy/examples/RecoverableDatabaseList.json + */ + /** + * Sample code: Get list of restorable dropped databases. + * + * @param manager Entry point to SqlManager. + */ + public static void getListOfRestorableDroppedDatabases(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .recoverableDatabases() + .listByServer("recoverabledatabasetest-1234", "recoverabledatabasetest-7177", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RecoverableManagedDatabasesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RecoverableManagedDatabasesGetSamples.java new file mode 100644 index 0000000000000..1fd50cabd28b3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RecoverableManagedDatabasesGetSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for RecoverableManagedDatabases Get. */ +public final class RecoverableManagedDatabasesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetRecoverableManagedDatabase.json + */ + /** + * Sample code: Gets a recoverable databases by managed instances. + * + * @param manager Entry point to SqlManager. + */ + public static void getsARecoverableDatabasesByManagedInstances( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.recoverableManagedDatabases().getWithResponse("Test1", "managedInstance", "testdb", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RecoverableManagedDatabasesListByInstanceSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RecoverableManagedDatabasesListByInstanceSamples.java new file mode 100644 index 0000000000000..f4d9dafcd5779 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RecoverableManagedDatabasesListByInstanceSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for RecoverableManagedDatabases ListByInstance. */ +public final class RecoverableManagedDatabasesListByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListRecoverableManagedDatabasesByServer.json + */ + /** + * Sample code: List recoverable databases by managed instances. + * + * @param manager Entry point to SqlManager. + */ + public static void listRecoverableDatabasesByManagedInstances( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.recoverableManagedDatabases().listByInstance("Test1", "managedInstance", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ReplicationLinksDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ReplicationLinksDeleteSamples.java new file mode 100644 index 0000000000000..895a5cb8d94c9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ReplicationLinksDeleteSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ReplicationLinks Delete. */ +public final class ReplicationLinksDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ReplicationLinkDelete.json + */ + /** + * Sample code: Delete replication link on server. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteReplicationLinkOnServer(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .replicationLinks() + .delete("Default", "sourcesvr", "gamma-db", "4891ca10-ebd0-47d7-9182-c722651780fb", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ReplicationLinksFailoverAllowDataLossSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ReplicationLinksFailoverAllowDataLossSamples.java new file mode 100644 index 0000000000000..6398c75103846 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ReplicationLinksFailoverAllowDataLossSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ReplicationLinks FailoverAllowDataLoss. */ +public final class ReplicationLinksFailoverAllowDataLossSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ReplicationLinkFailoverAllowDataLoss.json + */ + /** + * Sample code: Forced failover of a replication link. + * + * @param manager Entry point to SqlManager. + */ + public static void forcedFailoverOfAReplicationLink(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .replicationLinks() + .failoverAllowDataLoss( + "Default", "sourcesvr", "gamma-db", "4891ca10-ebd0-47d7-9182-c722651780fb", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ReplicationLinksFailoverSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ReplicationLinksFailoverSamples.java new file mode 100644 index 0000000000000..3884435f32102 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ReplicationLinksFailoverSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ReplicationLinks Failover. */ +public final class ReplicationLinksFailoverSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ReplicationLinkFailover.json + */ + /** + * Sample code: Planned failover of a replication link. + * + * @param manager Entry point to SqlManager. + */ + public static void plannedFailoverOfAReplicationLink(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .replicationLinks() + .failover("Default", "sourcesvr", "gamma-db", "4891ca10-ebd0-47d7-9182-c722651780fb", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ReplicationLinksGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ReplicationLinksGetSamples.java new file mode 100644 index 0000000000000..9fc8b946858ec --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ReplicationLinksGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ReplicationLinks Get. */ +public final class ReplicationLinksGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ReplicationLinkGet.json + */ + /** + * Sample code: Gets the replication link. + * + * @param manager Entry point to SqlManager. + */ + public static void getsTheReplicationLink(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .replicationLinks() + .getWithResponse("Default", "sourcesvr", "gamma-db", "4891ca10-ebd0-47d7-9182-c722651780fb", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ReplicationLinksListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ReplicationLinksListByDatabaseSamples.java new file mode 100644 index 0000000000000..8590aab0e9b36 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ReplicationLinksListByDatabaseSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ReplicationLinks ListByDatabase. */ +public final class ReplicationLinksListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ReplicationLinkListByDatabase.json + */ + /** + * Sample code: List replication links on server on database. + * + * @param manager Entry point to SqlManager. + */ + public static void listReplicationLinksOnServerOnDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.replicationLinks().listByDatabase("Default", "sourcesvr", "tetha-db", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ReplicationLinksListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ReplicationLinksListByServerSamples.java new file mode 100644 index 0000000000000..70ac3a2020eee --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ReplicationLinksListByServerSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ReplicationLinks ListByServer. */ +public final class ReplicationLinksListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ReplicationLinkListByServer.json + */ + /** + * Sample code: List replication links on server. + * + * @param manager Entry point to SqlManager. + */ + public static void listReplicationLinksOnServer(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.replicationLinks().listByServer("Default", "sourcesvr", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RestorableDroppedDatabasesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RestorableDroppedDatabasesGetSamples.java new file mode 100644 index 0000000000000..08bdb5ab00387 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RestorableDroppedDatabasesGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for RestorableDroppedDatabases Get. */ +public final class RestorableDroppedDatabasesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/GetRestorableDroppedDatabase.json + */ + /** + * Sample code: Gets a restorable dropped database. + * + * @param manager Entry point to SqlManager. + */ + public static void getsARestorableDroppedDatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .restorableDroppedDatabases() + .getWithResponse("Default-SQL-SouthEastAsia", "testsvr", "testdb,131403269876900000", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RestorableDroppedDatabasesListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RestorableDroppedDatabasesListByServerSamples.java new file mode 100644 index 0000000000000..fbfb497e5c47f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RestorableDroppedDatabasesListByServerSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for RestorableDroppedDatabases ListByServer. */ +public final class RestorableDroppedDatabasesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ListRestorableDroppedDatabasesByServer.json + */ + /** + * Sample code: Gets a list of restorable dropped databases. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAListOfRestorableDroppedDatabases( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.restorableDroppedDatabases().listByServer("Default-SQL-SouthEastAsia", "testsvr", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RestorableDroppedManagedDatabasesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RestorableDroppedManagedDatabasesGetSamples.java new file mode 100644 index 0000000000000..15626ae356aef --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RestorableDroppedManagedDatabasesGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for RestorableDroppedManagedDatabases Get. */ +public final class RestorableDroppedManagedDatabasesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/GetRestorableDroppedManagedDatabase.json + */ + /** + * Sample code: Gets a restorable dropped managed database. + * + * @param manager Entry point to SqlManager. + */ + public static void getsARestorableDroppedManagedDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .restorableDroppedManagedDatabases() + .getWithResponse("Test1", "managedInstance", "testdb,131403269876900000", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RestorableDroppedManagedDatabasesListByInstanceSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RestorableDroppedManagedDatabasesListByInstanceSamples.java new file mode 100644 index 0000000000000..8507a5aa5d866 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RestorableDroppedManagedDatabasesListByInstanceSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for RestorableDroppedManagedDatabases ListByInstance. */ +public final class RestorableDroppedManagedDatabasesListByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/RestorableDroppedManagedDatabaseListByManagedInstance.json + */ + /** + * Sample code: List restorable dropped databases by managed instances. + * + * @param manager Entry point to SqlManager. + */ + public static void listRestorableDroppedDatabasesByManagedInstances( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.restorableDroppedManagedDatabases().listByInstance("Test1", "managedInstance", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RestorePointsCreateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RestorePointsCreateSamples.java new file mode 100644 index 0000000000000..9cc1d5e5ff0b3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RestorePointsCreateSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.CreateDatabaseRestorePointDefinition; + +/** Samples for RestorePoints Create. */ +public final class RestorePointsCreateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseRestorePointsPost.json + */ + /** + * Sample code: Creates datawarehouse database restore point. + * + * @param manager Entry point to SqlManager. + */ + public static void createsDatawarehouseDatabaseRestorePoint( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .restorePoints() + .create( + "Default-SQL-SouthEastAsia", + "testserver", + "testDatabase", + new CreateDatabaseRestorePointDefinition().withRestorePointLabel("mylabel"), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RestorePointsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RestorePointsDeleteSamples.java new file mode 100644 index 0000000000000..e005d3e56d107 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RestorePointsDeleteSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for RestorePoints Delete. */ +public final class RestorePointsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseRestorePointsDelete.json + */ + /** + * Sample code: Deletes a restore point. + * + * @param manager Entry point to SqlManager. + */ + public static void deletesARestorePoint(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .restorePoints() + .deleteWithResponse( + "Default-SQL-SouthEastAsia", "testserver", "testDatabase", "131546477590000000", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RestorePointsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RestorePointsGetSamples.java new file mode 100644 index 0000000000000..c2e3980936732 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RestorePointsGetSamples.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for RestorePoints Get. */ +public final class RestorePointsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseRestorePointsGet.json + */ + /** + * Sample code: Gets a database restore point. + * + * @param manager Entry point to SqlManager. + */ + public static void getsADatabaseRestorePoint(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .restorePoints() + .getWithResponse( + "Default-SQL-SouthEastAsia", "testserver", "testDatabase", "131546477590000000", Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DataWarehouseRestorePointsGet.json + */ + /** + * Sample code: Gets a datawarehouse database restore point. + * + * @param manager Entry point to SqlManager. + */ + public static void getsADatawarehouseDatabaseRestorePoint( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .restorePoints() + .getWithResponse( + "Default-SQL-SouthEastAsia", "testserver", "testDatabase", "131546477590000000", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RestorePointsListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RestorePointsListByDatabaseSamples.java new file mode 100644 index 0000000000000..7af51718ef889 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/RestorePointsListByDatabaseSamples.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for RestorePoints ListByDatabase. */ +public final class RestorePointsListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DatabaseRestorePointsListByDatabase.json + */ + /** + * Sample code: List database restore points. + * + * @param manager Entry point to SqlManager. + */ + public static void listDatabaseRestorePoints(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.restorePoints().listByDatabase("sqlcrudtest-6730", "sqlcrudtest-9007", "3481", Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DataWarehouseRestorePointsListByDatabase.json + */ + /** + * Sample code: List datawarehouse database restore points. + * + * @param manager Entry point to SqlManager. + */ + public static void listDatawarehouseDatabaseRestorePoints( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.restorePoints().listByDatabase("Default-SQL-SouthEastAsia", "testserver", "testDatabase", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SensitivityLabelsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SensitivityLabelsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..1c7968a9624d7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SensitivityLabelsCreateOrUpdateSamples.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.SensitivityLabelInner; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelRank; + +/** Samples for SensitivityLabels CreateOrUpdate. */ +public final class SensitivityLabelsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ColumnSensitivityLabelCreateMax.json + */ + /** + * Sample code: Updates the sensitivity label of a given column with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updatesTheSensitivityLabelOfAGivenColumnWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sensitivityLabels() + .createOrUpdateWithResponse( + "myRG", + "myServer", + "myDatabase", + "dbo", + "myTable", + "myColumn", + new SensitivityLabelInner() + .withLabelName("PII") + .withLabelId("bf91e08c-f4f0-478a-b016-25164b2a65ff") + .withInformationType("PhoneNumber") + .withInformationTypeId("d22fa6e9-5ee4-3bde-4c2b-a409604c4646") + .withRank(SensitivityLabelRank.LOW), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SensitivityLabelsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SensitivityLabelsDeleteSamples.java new file mode 100644 index 0000000000000..0166f539fa128 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SensitivityLabelsDeleteSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SensitivityLabels Delete. */ +public final class SensitivityLabelsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ColumnSensitivityLabelDelete.json + */ + /** + * Sample code: Deletes the sensitivity label of a given column. + * + * @param manager Entry point to SqlManager. + */ + public static void deletesTheSensitivityLabelOfAGivenColumn( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sensitivityLabels() + .deleteWithResponse("myRG", "myServer", "myDatabase", "dbo", "myTable", "myColumn", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SensitivityLabelsDisableRecommendationSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SensitivityLabelsDisableRecommendationSamples.java new file mode 100644 index 0000000000000..d5159dbe53f99 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SensitivityLabelsDisableRecommendationSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SensitivityLabels DisableRecommendation. */ +public final class SensitivityLabelsDisableRecommendationSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/RecommendedColumnSensitivityLabelDisable.json + */ + /** + * Sample code: Disables sensitivity recommendations on a given column. + * + * @param manager Entry point to SqlManager. + */ + public static void disablesSensitivityRecommendationsOnAGivenColumn( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sensitivityLabels() + .disableRecommendationWithResponse( + "myRG", "myServer", "myDatabase", "dbo", "myTable", "myColumn", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SensitivityLabelsEnableRecommendationSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SensitivityLabelsEnableRecommendationSamples.java new file mode 100644 index 0000000000000..8b12969eb7075 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SensitivityLabelsEnableRecommendationSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SensitivityLabels EnableRecommendation. */ +public final class SensitivityLabelsEnableRecommendationSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/RecommendedColumnSensitivityLabelEnable.json + */ + /** + * Sample code: Enables sensitivity recommendations on a given column. + * + * @param manager Entry point to SqlManager. + */ + public static void enablesSensitivityRecommendationsOnAGivenColumn( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sensitivityLabels() + .enableRecommendationWithResponse( + "myRG", "myServer", "myDatabase", "dbo", "myTable", "myColumn", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SensitivityLabelsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SensitivityLabelsGetSamples.java new file mode 100644 index 0000000000000..b01ef44938993 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SensitivityLabelsGetSamples.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelSource; + +/** Samples for SensitivityLabels Get. */ +public final class SensitivityLabelsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ColumnSensitivityLabelGet.json + */ + /** + * Sample code: Gets the sensitivity label of a given column. + * + * @param manager Entry point to SqlManager. + */ + public static void getsTheSensitivityLabelOfAGivenColumn( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sensitivityLabels() + .getWithResponse( + "myRG", + "myServer", + "myDatabase", + "dbo", + "myTable", + "myColumn", + SensitivityLabelSource.CURRENT, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SensitivityLabelsListCurrentByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SensitivityLabelsListCurrentByDatabaseSamples.java new file mode 100644 index 0000000000000..06b8c95026873 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SensitivityLabelsListCurrentByDatabaseSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SensitivityLabels ListCurrentByDatabase. */ +public final class SensitivityLabelsListCurrentByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SensitivityLabelsListByDatabaseWithSourceCurrent.json + */ + /** + * Sample code: Gets the current sensitivity labels of a given database. + * + * @param manager Entry point to SqlManager. + */ + public static void getsTheCurrentSensitivityLabelsOfAGivenDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sensitivityLabels() + .listCurrentByDatabase("myRG", "myServer", "myDatabase", null, null, null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SensitivityLabelsListRecommendedByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SensitivityLabelsListRecommendedByDatabaseSamples.java new file mode 100644 index 0000000000000..d80a3bb9e0290 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SensitivityLabelsListRecommendedByDatabaseSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SensitivityLabels ListRecommendedByDatabase. */ +public final class SensitivityLabelsListRecommendedByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SensitivityLabelsListByDatabaseWithSourceRecommended.json + */ + /** + * Sample code: Gets the recommended sensitivity labels of a given database. + * + * @param manager Entry point to SqlManager. + */ + public static void getsTheRecommendedSensitivityLabelsOfAGivenDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sensitivityLabels() + .listRecommendedByDatabase("myRG", "myServer", "myDatabase", null, null, null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SensitivityLabelsUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SensitivityLabelsUpdateSamples.java new file mode 100644 index 0000000000000..bd71affa9ec29 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SensitivityLabelsUpdateSamples.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.SensitivityLabelInner; +import com.azure.resourcemanager.sql.generated.fluent.models.SensitivityLabelUpdateInner; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelRank; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelUpdateKind; +import com.azure.resourcemanager.sql.generated.models.SensitivityLabelUpdateList; +import java.util.Arrays; + +/** Samples for SensitivityLabels Update. */ +public final class SensitivityLabelsUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SensitivityLabelsCurrentUpdate.json + */ + /** + * Sample code: Update sensitivity labels of a given database using an operations batch. + * + * @param manager Entry point to SqlManager. + */ + public static void updateSensitivityLabelsOfAGivenDatabaseUsingAnOperationsBatch( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sensitivityLabels() + .updateWithResponse( + "myRG", + "myServer", + "myDatabase", + new SensitivityLabelUpdateList() + .withOperations( + Arrays + .asList( + new SensitivityLabelUpdateInner() + .withOp(SensitivityLabelUpdateKind.SET) + .withSchema("dbo") + .withTable("table1") + .withColumn("column1") + .withSensitivityLabel( + new SensitivityLabelInner() + .withLabelName("Highly Confidential") + .withLabelId("3A477B16-9423-432B-AA97-6069B481CEC3") + .withInformationType("Financial") + .withInformationTypeId("1D3652D6-422C-4115-82F1-65DAEBC665C8") + .withRank(SensitivityLabelRank.LOW)), + new SensitivityLabelUpdateInner() + .withOp(SensitivityLabelUpdateKind.SET) + .withSchema("dbo") + .withTable("table2") + .withColumn("column2") + .withSensitivityLabel( + new SensitivityLabelInner() + .withLabelName("PII") + .withLabelId("bf91e08c-f4f0-478a-b016-25164b2a65ff") + .withInformationType("PhoneNumber") + .withInformationTypeId("d22fa6e9-5ee4-3bde-4c2b-a409604c4646") + .withRank(SensitivityLabelRank.CRITICAL)), + new SensitivityLabelUpdateInner() + .withOp(SensitivityLabelUpdateKind.REMOVE) + .withSchema("dbo") + .withTable("Table1") + .withColumn("Column3"))), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAdvancedThreatProtectionSettingsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAdvancedThreatProtectionSettingsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..d0433d6dab0b9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAdvancedThreatProtectionSettingsCreateOrUpdateSamples.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.AdvancedThreatProtectionName; +import com.azure.resourcemanager.sql.generated.models.AdvancedThreatProtectionState; +import com.azure.resourcemanager.sql.generated.models.ServerAdvancedThreatProtection; + +/** Samples for ServerAdvancedThreatProtectionSettings CreateOrUpdate. */ +public final class ServerAdvancedThreatProtectionSettingsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerAdvancedThreatProtectionSettingsCreateMin.json + */ + /** + * Sample code: Update a server's Advanced Threat Protection settings with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAServerSAdvancedThreatProtectionSettingsWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ServerAdvancedThreatProtection resource = + manager + .serverAdvancedThreatProtectionSettings() + .getWithResponse( + "threatprotection-4799", + "threatprotection-6440", + AdvancedThreatProtectionName.DEFAULT, + Context.NONE) + .getValue(); + resource.update().withState(AdvancedThreatProtectionState.DISABLED).apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerAdvancedThreatProtectionSettingsCreateMax.json + */ + /** + * Sample code: Update a server's Advanced Threat Protection settings with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAServerSAdvancedThreatProtectionSettingsWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ServerAdvancedThreatProtection resource = + manager + .serverAdvancedThreatProtectionSettings() + .getWithResponse( + "threatprotection-4799", + "threatprotection-6440", + AdvancedThreatProtectionName.DEFAULT, + Context.NONE) + .getValue(); + resource.update().withState(AdvancedThreatProtectionState.ENABLED).apply(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAdvancedThreatProtectionSettingsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAdvancedThreatProtectionSettingsGetSamples.java new file mode 100644 index 0000000000000..58cb6d0bf6a5b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAdvancedThreatProtectionSettingsGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.AdvancedThreatProtectionName; + +/** Samples for ServerAdvancedThreatProtectionSettings Get. */ +public final class ServerAdvancedThreatProtectionSettingsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerAdvancedThreatProtectionSettingsGet.json + */ + /** + * Sample code: Get a server's Advanced Threat Protection settings. + * + * @param manager Entry point to SqlManager. + */ + public static void getAServerSAdvancedThreatProtectionSettings( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverAdvancedThreatProtectionSettings() + .getWithResponse( + "threatprotection-4799", "threatprotection-6440", AdvancedThreatProtectionName.DEFAULT, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAdvancedThreatProtectionSettingsListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAdvancedThreatProtectionSettingsListByServerSamples.java new file mode 100644 index 0000000000000..5a449453d1846 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAdvancedThreatProtectionSettingsListByServerSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerAdvancedThreatProtectionSettings ListByServer. */ +public final class ServerAdvancedThreatProtectionSettingsListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerAdvancedThreatProtectionSettingsListByServer.json + */ + /** + * Sample code: List the server's Advanced Threat Protection settings. + * + * @param manager Entry point to SqlManager. + */ + public static void listTheServerSAdvancedThreatProtectionSettings( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverAdvancedThreatProtectionSettings() + .listByServer("threatprotection-4799", "threatprotection-6440", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAdvisorsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAdvisorsGetSamples.java new file mode 100644 index 0000000000000..b49b51d054033 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAdvisorsGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerAdvisors Get. */ +public final class ServerAdvisorsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerAdvisorGet.json + */ + /** + * Sample code: Get server advisor. + * + * @param manager Entry point to SqlManager. + */ + public static void getServerAdvisor(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverAdvisors().getWithResponse("workloadinsight-demos", "misosisvr", "CreateIndex", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAdvisorsListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAdvisorsListByServerSamples.java new file mode 100644 index 0000000000000..f650396d80077 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAdvisorsListByServerSamples.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerAdvisors ListByServer. */ +public final class ServerAdvisorsListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerAdvisorList.json + */ + /** + * Sample code: List of server advisors. + * + * @param manager Entry point to SqlManager. + */ + public static void listOfServerAdvisors(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverAdvisors().listByServerWithResponse("workloadinsight-demos", "misosisvr", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerRecommendedActionListExpand.json + */ + /** + * Sample code: List of server recommended actions for all advisors. + * + * @param manager Entry point to SqlManager. + */ + public static void listOfServerRecommendedActionsForAllAdvisors( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverAdvisors() + .listByServerWithResponse("workloadinsight-demos", "misosisvr", "recommendedActions", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAdvisorsUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAdvisorsUpdateSamples.java new file mode 100644 index 0000000000000..8be8609ff97cc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAdvisorsUpdateSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.AdvisorInner; +import com.azure.resourcemanager.sql.generated.models.AutoExecuteStatus; + +/** Samples for ServerAdvisors Update. */ +public final class ServerAdvisorsUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerAdvisorUpdate.json + */ + /** + * Sample code: Update server advisor. + * + * @param manager Entry point to SqlManager. + */ + public static void updateServerAdvisor(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverAdvisors() + .updateWithResponse( + "workloadinsight-demos", + "misosisvr", + "CreateIndex", + new AdvisorInner().withAutoExecuteStatus(AutoExecuteStatus.DISABLED), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAutomaticTuningGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAutomaticTuningGetSamples.java new file mode 100644 index 0000000000000..d5e04910834f3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAutomaticTuningGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerAutomaticTuning Get. */ +public final class ServerAutomaticTuningGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerAutomaticTuningGet.json + */ + /** + * Sample code: Get a server's automatic tuning settings. + * + * @param manager Entry point to SqlManager. + */ + public static void getAServerSAutomaticTuningSettings(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverAutomaticTunings().getWithResponse("default-sql-onebox", "testsvr11", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAutomaticTuningUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAutomaticTuningUpdateSamples.java new file mode 100644 index 0000000000000..bdea78e47d811 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAutomaticTuningUpdateSamples.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.ServerAutomaticTuningInner; +import com.azure.resourcemanager.sql.generated.models.AutomaticTuningOptionModeDesired; +import com.azure.resourcemanager.sql.generated.models.AutomaticTuningServerMode; +import com.azure.resourcemanager.sql.generated.models.AutomaticTuningServerOptions; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ServerAutomaticTuning Update. */ +public final class ServerAutomaticTuningUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerAutomaticTuningUpdateMax.json + */ + /** + * Sample code: Updates server automatic tuning settings with all properties. + * + * @param manager Entry point to SqlManager. + */ + public static void updatesServerAutomaticTuningSettingsWithAllProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverAutomaticTunings() + .updateWithResponse( + "default-sql-onebox", + "testsvr11", + new ServerAutomaticTuningInner() + .withDesiredState(AutomaticTuningServerMode.AUTO) + .withOptions( + mapOf( + "createIndex", + new AutomaticTuningServerOptions().withDesiredState(AutomaticTuningOptionModeDesired.OFF), + "dropIndex", + new AutomaticTuningServerOptions().withDesiredState(AutomaticTuningOptionModeDesired.ON), + "forceLastGoodPlan", + new AutomaticTuningServerOptions() + .withDesiredState(AutomaticTuningOptionModeDesired.DEFAULT))), + Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerAutomaticTuningUpdateMin.json + */ + /** + * Sample code: Updates server automatic tuning settings with minimal properties. + * + * @param manager Entry point to SqlManager. + */ + public static void updatesServerAutomaticTuningSettingsWithMinimalProperties( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverAutomaticTunings() + .updateWithResponse( + "default-sql-onebox", + "testsvr11", + new ServerAutomaticTuningInner().withDesiredState(AutomaticTuningServerMode.AUTO), + Context.NONE); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAzureADAdministratorsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAzureADAdministratorsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..438b8489ec8e9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAzureADAdministratorsCreateOrUpdateSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.resourcemanager.sql.generated.models.AdministratorName; +import com.azure.resourcemanager.sql.generated.models.AdministratorType; +import java.util.UUID; + +/** Samples for ServerAzureADAdministrators CreateOrUpdate. */ +public final class ServerAzureADAdministratorsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/AdministratorCreateOrUpdate.json + */ + /** + * Sample code: Creates or updates an existing Azure Active Directory administrator. + * + * @param manager Entry point to SqlManager. + */ + public static void createsOrUpdatesAnExistingAzureActiveDirectoryAdministrator( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverAzureADAdministrators() + .define(AdministratorName.ACTIVE_DIRECTORY) + .withExistingServer("sqlcrudtest-4799", "sqlcrudtest-6440") + .withAdministratorType(AdministratorType.ACTIVE_DIRECTORY) + .withLogin("bob@contoso.com") + .withSid(UUID.fromString("c6b82b90-a647-49cb-8a62-0d2d3cb7ac7c")) + .withTenantId(UUID.fromString("c6b82b90-a647-49cb-8a62-0d2d3cb7ac7c")) + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAzureADAdministratorsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAzureADAdministratorsDeleteSamples.java new file mode 100644 index 0000000000000..eecaea09b4902 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAzureADAdministratorsDeleteSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.AdministratorName; + +/** Samples for ServerAzureADAdministrators Delete. */ +public final class ServerAzureADAdministratorsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/AdministratorDelete.json + */ + /** + * Sample code: Delete Azure Active Directory administrator. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteAzureActiveDirectoryAdministrator( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverAzureADAdministrators() + .delete("sqlcrudtest-4799", "sqlcrudtest-6440", AdministratorName.ACTIVE_DIRECTORY, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAzureADAdministratorsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAzureADAdministratorsGetSamples.java new file mode 100644 index 0000000000000..4e964a86711d5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAzureADAdministratorsGetSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.AdministratorName; + +/** Samples for ServerAzureADAdministrators Get. */ +public final class ServerAzureADAdministratorsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/AdministratorGet.json + */ + /** + * Sample code: Gets a Azure Active Directory administrator. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAAzureActiveDirectoryAdministrator( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverAzureADAdministrators() + .getWithResponse("sqlcrudtest-4799", "sqlcrudtest-6440", AdministratorName.ACTIVE_DIRECTORY, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAzureADAdministratorsListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAzureADAdministratorsListByServerSamples.java new file mode 100644 index 0000000000000..e90d8436ca89a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAzureADAdministratorsListByServerSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerAzureADAdministrators ListByServer. */ +public final class ServerAzureADAdministratorsListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/AdministratorList.json + */ + /** + * Sample code: Gets a list of Azure Active Directory administrator. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAListOfAzureActiveDirectoryAdministrator( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverAzureADAdministrators().listByServer("sqlcrudtest-4799", "sqlcrudtest-6440", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAzureADOnlyAuthenticationsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAzureADOnlyAuthenticationsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..cc582250a4728 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAzureADOnlyAuthenticationsCreateOrUpdateSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.resourcemanager.sql.generated.models.AuthenticationName; + +/** Samples for ServerAzureADOnlyAuthentications CreateOrUpdate. */ +public final class ServerAzureADOnlyAuthenticationsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/AzureADOnlyAuthCreateOrUpdate.json + */ + /** + * Sample code: Creates or updates Azure Active Directory only authentication object. + * + * @param manager Entry point to SqlManager. + */ + public static void createsOrUpdatesAzureActiveDirectoryOnlyAuthenticationObject( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverAzureADOnlyAuthentications() + .define(AuthenticationName.DEFAULT) + .withExistingServer("sqlcrudtest-4799", "sqlcrudtest-6440") + .withAzureADOnlyAuthentication(false) + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAzureADOnlyAuthenticationsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAzureADOnlyAuthenticationsDeleteSamples.java new file mode 100644 index 0000000000000..7fe836bc424ca --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAzureADOnlyAuthenticationsDeleteSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.AuthenticationName; + +/** Samples for ServerAzureADOnlyAuthentications Delete. */ +public final class ServerAzureADOnlyAuthenticationsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/AzureADOnlyAuthDelete.json + */ + /** + * Sample code: Deletes Azure Active Directory only authentication object. + * + * @param manager Entry point to SqlManager. + */ + public static void deletesAzureActiveDirectoryOnlyAuthenticationObject( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverAzureADOnlyAuthentications() + .delete("sqlcrudtest-4799", "sqlcrudtest-6440", AuthenticationName.DEFAULT, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAzureADOnlyAuthenticationsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAzureADOnlyAuthenticationsGetSamples.java new file mode 100644 index 0000000000000..5ad7b7488550c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAzureADOnlyAuthenticationsGetSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.AuthenticationName; + +/** Samples for ServerAzureADOnlyAuthentications Get. */ +public final class ServerAzureADOnlyAuthenticationsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/AzureADOnlyAuthGet.json + */ + /** + * Sample code: Gets a Azure Active Directory only authentication property. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAAzureActiveDirectoryOnlyAuthenticationProperty( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverAzureADOnlyAuthentications() + .getWithResponse("sqlcrudtest-4799", "sqlcrudtest-6440", AuthenticationName.DEFAULT, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAzureADOnlyAuthenticationsListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAzureADOnlyAuthenticationsListByServerSamples.java new file mode 100644 index 0000000000000..f53afa79eec0d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerAzureADOnlyAuthenticationsListByServerSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerAzureADOnlyAuthentications ListByServer. */ +public final class ServerAzureADOnlyAuthenticationsListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/AzureADOnlyAuthList.json + */ + /** + * Sample code: Gets a list of Azure Active Directory only authentication object. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAListOfAzureActiveDirectoryOnlyAuthenticationObject( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverAzureADOnlyAuthentications().listByServer("sqlcrudtest-4799", "sqlcrudtest-6440", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerBlobAuditingPoliciesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerBlobAuditingPoliciesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..8cf152f01bec8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerBlobAuditingPoliciesCreateOrUpdateSamples.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.BlobAuditingPolicyState; +import com.azure.resourcemanager.sql.generated.models.ServerBlobAuditingPolicy; +import java.util.Arrays; +import java.util.UUID; + +/** Samples for ServerBlobAuditingPolicies CreateOrUpdate. */ +public final class ServerBlobAuditingPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerBlobAuditingCreateMin.json + */ + /** + * Sample code: Update a server's blob auditing policy with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAServerSBlobAuditingPolicyWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ServerBlobAuditingPolicy resource = + manager + .serverBlobAuditingPolicies() + .getWithResponse("blobauditingtest-4799", "blobauditingtest-6440", Context.NONE) + .getValue(); + resource + .update() + .withState(BlobAuditingPolicyState.ENABLED) + .withStorageEndpoint("https://mystorage.blob.core.windows.net") + .withStorageAccountAccessKey( + "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==") + .apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerBlobAuditingCreateMax.json + */ + /** + * Sample code: Update a server's blob auditing policy with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAServerSBlobAuditingPolicyWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ServerBlobAuditingPolicy resource = + manager + .serverBlobAuditingPolicies() + .getWithResponse("blobauditingtest-4799", "blobauditingtest-6440", Context.NONE) + .getValue(); + resource + .update() + .withRetentionDays(6) + .withAuditActionsAndGroups( + Arrays + .asList( + "SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP", + "FAILED_DATABASE_AUTHENTICATION_GROUP", + "BATCH_COMPLETED_GROUP")) + .withIsStorageSecondaryKeyInUse(false) + .withIsAzureMonitorTargetEnabled(true) + .withQueueDelayMs(4000) + .withState(BlobAuditingPolicyState.ENABLED) + .withStorageEndpoint("https://mystorage.blob.core.windows.net") + .withStorageAccountAccessKey( + "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==") + .withStorageAccountSubscriptionId(UUID.fromString("00000000-1234-0000-5678-000000000000")) + .apply(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerBlobAuditingPoliciesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerBlobAuditingPoliciesGetSamples.java new file mode 100644 index 0000000000000..c886e2db926ae --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerBlobAuditingPoliciesGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerBlobAuditingPolicies Get. */ +public final class ServerBlobAuditingPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerBlobAuditingGet.json + */ + /** + * Sample code: Get a server's blob auditing policy. + * + * @param manager Entry point to SqlManager. + */ + public static void getAServerSBlobAuditingPolicy(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverBlobAuditingPolicies() + .getWithResponse("blobauditingtest-4799", "blobauditingtest-6440", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerBlobAuditingPoliciesListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerBlobAuditingPoliciesListByServerSamples.java new file mode 100644 index 0000000000000..af91d2a167fdc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerBlobAuditingPoliciesListByServerSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerBlobAuditingPolicies ListByServer. */ +public final class ServerBlobAuditingPoliciesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerAuditingSettingsList.json + */ + /** + * Sample code: List auditing settings of a server. + * + * @param manager Entry point to SqlManager. + */ + public static void listAuditingSettingsOfAServer(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverBlobAuditingPolicies() + .listByServer("blobauditingtest-4799", "blobauditingtest-6440", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerCommunicationLinksCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerCommunicationLinksCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..b2d0db4a13dcd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerCommunicationLinksCreateOrUpdateSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +/** Samples for ServerCommunicationLinks CreateOrUpdate. */ +public final class ServerCommunicationLinksCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/ServerCommunicationLinkCreateOrUpdate.json + */ + /** + * Sample code: Create a server communication link. + * + * @param manager Entry point to SqlManager. + */ + public static void createAServerCommunicationLink(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverCommunicationLinks() + .define("link1") + .withExistingServer("sqlcrudtest-7398", "sqlcrudtest-4645") + .withPartnerServer("sqldcrudtest-test") + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerCommunicationLinksDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerCommunicationLinksDeleteSamples.java new file mode 100644 index 0000000000000..f0b60343bd5ae --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerCommunicationLinksDeleteSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerCommunicationLinks Delete. */ +public final class ServerCommunicationLinksDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/ServerCommunicationLinkDelete.json + */ + /** + * Sample code: Delete a server communication link. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteAServerCommunicationLink(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverCommunicationLinks() + .deleteWithResponse("sqlcrudtest-7398", "sqlcrudtest-4645", "link1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerCommunicationLinksGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerCommunicationLinksGetSamples.java new file mode 100644 index 0000000000000..39222d1599efe --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerCommunicationLinksGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerCommunicationLinks Get. */ +public final class ServerCommunicationLinksGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/ServerCommunicationLinkGet.json + */ + /** + * Sample code: Get a server communication link. + * + * @param manager Entry point to SqlManager. + */ + public static void getAServerCommunicationLink(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverCommunicationLinks() + .getWithResponse("sqlcrudtest-7398", "sqlcrudtest-4645", "link1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerCommunicationLinksListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerCommunicationLinksListByServerSamples.java new file mode 100644 index 0000000000000..f7126302e397e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerCommunicationLinksListByServerSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerCommunicationLinks ListByServer. */ +public final class ServerCommunicationLinksListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/ServerCommunicationLinkList.json + */ + /** + * Sample code: List server communication links. + * + * @param manager Entry point to SqlManager. + */ + public static void listServerCommunicationLinks(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverCommunicationLinks().listByServer("sqlcrudtest-7398", "sqlcrudtest-4645", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerConnectionPoliciesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerConnectionPoliciesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..9afac1c560c9f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerConnectionPoliciesCreateOrUpdateSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ConnectionPolicyName; +import com.azure.resourcemanager.sql.generated.models.ServerConnectionPolicy; +import com.azure.resourcemanager.sql.generated.models.ServerConnectionType; + +/** Samples for ServerConnectionPolicies CreateOrUpdate. */ +public final class ServerConnectionPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ServerConnectionPoliciesUpdate.json + */ + /** + * Sample code: Updates a server connection policy. + * + * @param manager Entry point to SqlManager. + */ + public static void updatesAServerConnectionPolicy(com.azure.resourcemanager.sql.generated.SqlManager manager) { + ServerConnectionPolicy resource = + manager + .serverConnectionPolicies() + .getWithResponse("testrg", "testserver", ConnectionPolicyName.DEFAULT, Context.NONE) + .getValue(); + resource.update().withConnectionType(ServerConnectionType.REDIRECT).apply(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerConnectionPoliciesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerConnectionPoliciesGetSamples.java new file mode 100644 index 0000000000000..53f1d05156848 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerConnectionPoliciesGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ConnectionPolicyName; + +/** Samples for ServerConnectionPolicies Get. */ +public final class ServerConnectionPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ServerConnectionPoliciesGet.json + */ + /** + * Sample code: Gets a server connection policy. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAServerConnectionPolicy(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverConnectionPolicies() + .getWithResponse("rgtest-12", "servertest-6285", ConnectionPolicyName.DEFAULT, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerConnectionPoliciesListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerConnectionPoliciesListByServerSamples.java new file mode 100644 index 0000000000000..9da46bfaf0c11 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerConnectionPoliciesListByServerSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerConnectionPolicies ListByServer. */ +public final class ServerConnectionPoliciesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-05-01-preview/examples/ServerConnectionPoliciesList.json + */ + /** + * Sample code: Lists a servers connection policies. + * + * @param manager Entry point to SqlManager. + */ + public static void listsAServersConnectionPolicies(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverConnectionPolicies().listByServer("rgtest-12", "servertest-6285", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerDevOpsAuditSettingsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerDevOpsAuditSettingsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..08b8a50592b9f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerDevOpsAuditSettingsCreateOrUpdateSamples.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.BlobAuditingPolicyState; +import com.azure.resourcemanager.sql.generated.models.DevOpsAuditingSettingsName; +import com.azure.resourcemanager.sql.generated.models.ServerDevOpsAuditingSettings; +import java.util.UUID; + +/** Samples for ServerDevOpsAuditSettings CreateOrUpdate. */ +public final class ServerDevOpsAuditSettingsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ServerDevOpsAuditCreateMin.json + */ + /** + * Sample code: Update a server's DevOps audit settings with minimal input. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAServerSDevOpsAuditSettingsWithMinimalInput( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ServerDevOpsAuditingSettings resource = + manager + .serverDevOpsAuditSettings() + .getWithResponse( + "devAuditTestRG", "devOpsAuditTestSvr", DevOpsAuditingSettingsName.DEFAULT, Context.NONE) + .getValue(); + resource + .update() + .withState(BlobAuditingPolicyState.ENABLED) + .withStorageEndpoint("https://mystorage.blob.core.windows.net") + .withStorageAccountAccessKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + .apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ServerDevOpsAuditCreateMax.json + */ + /** + * Sample code: Update a server's DevOps audit settings with all params. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAServerSDevOpsAuditSettingsWithAllParams( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ServerDevOpsAuditingSettings resource = + manager + .serverDevOpsAuditSettings() + .getWithResponse( + "devAuditTestRG", "devOpsAuditTestSvr", DevOpsAuditingSettingsName.DEFAULT, Context.NONE) + .getValue(); + resource + .update() + .withIsAzureMonitorTargetEnabled(true) + .withState(BlobAuditingPolicyState.ENABLED) + .withStorageEndpoint("https://mystorage.blob.core.windows.net") + .withStorageAccountAccessKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + .withStorageAccountSubscriptionId(UUID.fromString("00000000-1234-0000-5678-000000000000")) + .apply(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerDevOpsAuditSettingsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerDevOpsAuditSettingsGetSamples.java new file mode 100644 index 0000000000000..1ad4fc0bad1fa --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerDevOpsAuditSettingsGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.DevOpsAuditingSettingsName; + +/** Samples for ServerDevOpsAuditSettings Get. */ +public final class ServerDevOpsAuditSettingsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ServerDevOpsAuditGet.json + */ + /** + * Sample code: Get a server's DevOps audit settings. + * + * @param manager Entry point to SqlManager. + */ + public static void getAServerSDevOpsAuditSettings(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverDevOpsAuditSettings() + .getWithResponse("devAuditTestRG", "devOpsAuditTestSvr", DevOpsAuditingSettingsName.DEFAULT, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerDevOpsAuditSettingsListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerDevOpsAuditSettingsListByServerSamples.java new file mode 100644 index 0000000000000..ef6d15fcaf9ef --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerDevOpsAuditSettingsListByServerSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerDevOpsAuditSettings ListByServer. */ +public final class ServerDevOpsAuditSettingsListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/ServerDevOpsAuditList.json + */ + /** + * Sample code: List DevOps audit settings of a server. + * + * @param manager Entry point to SqlManager. + */ + public static void listDevOpsAuditSettingsOfAServer(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverDevOpsAuditSettings().listByServer("devAuditTestRG", "devOpsAuditTestSvr", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerDnsAliasesAcquireSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerDnsAliasesAcquireSamples.java new file mode 100644 index 0000000000000..7a90a3ec7e490 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerDnsAliasesAcquireSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ServerDnsAliasAcquisition; + +/** Samples for ServerDnsAliases Acquire. */ +public final class ServerDnsAliasesAcquireSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerDnsAliasAcquire.json + */ + /** + * Sample code: Acquire server DNS alias. + * + * @param manager Entry point to SqlManager. + */ + public static void acquireServerDNSAlias(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverDnsAliases() + .acquire( + "Default", + "dns-alias-new-server", + "dns-alias-name-1", + new ServerDnsAliasAcquisition() + .withOldServerDnsAliasId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/servers/dns-alias-old-server/dnsAliases/dns-alias-name-1"), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerDnsAliasesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerDnsAliasesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..209cc36c5a9ab --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerDnsAliasesCreateOrUpdateSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerDnsAliases CreateOrUpdate. */ +public final class ServerDnsAliasesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerDnsAliasCreateOrUpdate.json + */ + /** + * Sample code: Create server DNS alias. + * + * @param manager Entry point to SqlManager. + */ + public static void createServerDNSAlias(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverDnsAliases().createOrUpdate("Default", "dns-alias-server", "dns-alias-name-1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerDnsAliasesDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerDnsAliasesDeleteSamples.java new file mode 100644 index 0000000000000..c194c81d1725b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerDnsAliasesDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerDnsAliases Delete. */ +public final class ServerDnsAliasesDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerDnsAliasDelete.json + */ + /** + * Sample code: Delete server DNS alias. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteServerDNSAlias(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverDnsAliases().delete("Default", "dns-alias-server", "dns-alias-name-1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerDnsAliasesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerDnsAliasesGetSamples.java new file mode 100644 index 0000000000000..ac8096a9e78e0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerDnsAliasesGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerDnsAliases Get. */ +public final class ServerDnsAliasesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerDnsAliasGet.json + */ + /** + * Sample code: Get server DNS alias. + * + * @param manager Entry point to SqlManager. + */ + public static void getServerDNSAlias(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverDnsAliases().getWithResponse("Default", "dns-alias-server", "dns-alias-name-1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerDnsAliasesListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerDnsAliasesListByServerSamples.java new file mode 100644 index 0000000000000..fcf03c308c6e7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerDnsAliasesListByServerSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerDnsAliases ListByServer. */ +public final class ServerDnsAliasesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerDnsAliasList.json + */ + /** + * Sample code: List server DNS aliases. + * + * @param manager Entry point to SqlManager. + */ + public static void listServerDNSAliases(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverDnsAliases().listByServer("Default", "dns-alias-server", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerKeysCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerKeysCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..20d72e7b3ed41 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerKeysCreateOrUpdateSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.resourcemanager.sql.generated.models.ServerKeyType; + +/** Samples for ServerKeys CreateOrUpdate. */ +public final class ServerKeysCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerKeyCreateOrUpdate.json + */ + /** + * Sample code: Creates or updates a server key. + * + * @param manager Entry point to SqlManager. + */ + public static void createsOrUpdatesAServerKey(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverKeys() + .define("someVault_someKey_01234567890123456789012345678901") + .withExistingServer("sqlcrudtest-7398", "sqlcrudtest-4645") + .withServerKeyType(ServerKeyType.AZURE_KEY_VAULT) + .withUri("https://someVault.vault.azure.net/keys/someKey/01234567890123456789012345678901") + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerKeysDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerKeysDeleteSamples.java new file mode 100644 index 0000000000000..435b6cc3b469a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerKeysDeleteSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerKeys Delete. */ +public final class ServerKeysDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerKeyDelete.json + */ + /** + * Sample code: Delete the server key. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteTheServerKey(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverKeys() + .delete( + "sqlcrudtest-7398", + "sqlcrudtest-4645", + "someVault_someKey_01234567890123456789012345678901", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerKeysGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerKeysGetSamples.java new file mode 100644 index 0000000000000..c204784ac8601 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerKeysGetSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerKeys Get. */ +public final class ServerKeysGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerKeyGet.json + */ + /** + * Sample code: Get the server key. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheServerKey(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverKeys() + .getWithResponse( + "sqlcrudtest-7398", + "sqlcrudtest-4645", + "someVault_someKey_01234567890123456789012345678901", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerKeysListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerKeysListByServerSamples.java new file mode 100644 index 0000000000000..d1c09f1e931db --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerKeysListByServerSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerKeys ListByServer. */ +public final class ServerKeysListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerKeyList.json + */ + /** + * Sample code: List the server keys by server. + * + * @param manager Entry point to SqlManager. + */ + public static void listTheServerKeysByServer(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverKeys().listByServer("sqlcrudtest-7398", "sqlcrudtest-4645", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerOperationsListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerOperationsListByServerSamples.java new file mode 100644 index 0000000000000..e1fb16be20e17 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerOperationsListByServerSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerOperations ListByServer. */ +public final class ServerOperationsListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ListServerOperations.json + */ + /** + * Sample code: List the server management operations. + * + * @param manager Entry point to SqlManager. + */ + public static void listTheServerManagementOperations(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverOperations().listByServer("sqlcrudtest-7398", "sqlcrudtest-4645", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerSecurityAlertPoliciesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerSecurityAlertPoliciesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..5b77b516c5457 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerSecurityAlertPoliciesCreateOrUpdateSamples.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyName; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertsPolicyState; +import com.azure.resourcemanager.sql.generated.models.ServerSecurityAlertPolicy; +import java.util.Arrays; + +/** Samples for ServerSecurityAlertPolicies CreateOrUpdate. */ +public final class ServerSecurityAlertPoliciesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerSecurityAlertsCreateMin.json + */ + /** + * Sample code: Update a server's threat detection policy with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAServerSThreatDetectionPolicyWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ServerSecurityAlertPolicy resource = + manager + .serverSecurityAlertPolicies() + .getWithResponse( + "securityalert-4799", "securityalert-6440", SecurityAlertPolicyName.DEFAULT, Context.NONE) + .getValue(); + resource.update().withState(SecurityAlertsPolicyState.ENABLED).apply(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerSecurityAlertsCreateMax.json + */ + /** + * Sample code: Update a server's threat detection policy with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAServerSThreatDetectionPolicyWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + ServerSecurityAlertPolicy resource = + manager + .serverSecurityAlertPolicies() + .getWithResponse( + "securityalert-4799", "securityalert-6440", SecurityAlertPolicyName.DEFAULT, Context.NONE) + .getValue(); + resource + .update() + .withState(SecurityAlertsPolicyState.ENABLED) + .withDisabledAlerts(Arrays.asList("Access_Anomaly", "Usage_Anomaly")) + .withEmailAddresses(Arrays.asList("testSecurityAlert@microsoft.com")) + .withEmailAccountAdmins(true) + .withStorageEndpoint("https://mystorage.blob.core.windows.net") + .withStorageAccountAccessKey( + "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==") + .withRetentionDays(5) + .apply(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerSecurityAlertPoliciesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerSecurityAlertPoliciesGetSamples.java new file mode 100644 index 0000000000000..849d45ef4505d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerSecurityAlertPoliciesGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.SecurityAlertPolicyName; + +/** Samples for ServerSecurityAlertPolicies Get. */ +public final class ServerSecurityAlertPoliciesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerSecurityAlertsGet.json + */ + /** + * Sample code: Get a server's threat detection policy. + * + * @param manager Entry point to SqlManager. + */ + public static void getAServerSThreatDetectionPolicy(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverSecurityAlertPolicies() + .getWithResponse("securityalert-4799", "securityalert-6440", SecurityAlertPolicyName.DEFAULT, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerSecurityAlertPoliciesListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerSecurityAlertPoliciesListByServerSamples.java new file mode 100644 index 0000000000000..1273abef09d7a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerSecurityAlertPoliciesListByServerSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerSecurityAlertPolicies ListByServer. */ +public final class ServerSecurityAlertPoliciesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerSecurityAlertsListByServer.json + */ + /** + * Sample code: List the server's threat detection policies. + * + * @param manager Entry point to SqlManager. + */ + public static void listTheServerSThreatDetectionPolicies( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverSecurityAlertPolicies().listByServer("securityalert-4799", "securityalert-6440", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustCertificatesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustCertificatesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..ef754c849dffb --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustCertificatesCreateOrUpdateSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +/** Samples for ServerTrustCertificates CreateOrUpdate. */ +public final class ServerTrustCertificatesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerTrustCertificatesCreate.json + */ + /** + * Sample code: Create server trust certificate. + * + * @param manager Entry point to SqlManager. + */ + public static void createServerTrustCertificate(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverTrustCertificates() + .define("customerCertificateName") + .withExistingManagedInstance("testrg", "testcl") + .withPublicBlob("308203AE30820296A0030201020210") + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustCertificatesDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustCertificatesDeleteSamples.java new file mode 100644 index 0000000000000..793f57fa90bb0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustCertificatesDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerTrustCertificates Delete. */ +public final class ServerTrustCertificatesDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerTrustCertificatesDelete.json + */ + /** + * Sample code: Delete server trust certificate. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteServerTrustCertificate(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverTrustCertificates().delete("testrg", "testcl", "customerCertificateName", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustCertificatesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustCertificatesGetSamples.java new file mode 100644 index 0000000000000..e2996ea325886 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustCertificatesGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerTrustCertificates Get. */ +public final class ServerTrustCertificatesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerTrustCertificatesGet.json + */ + /** + * Sample code: Gets server trust certificate. + * + * @param manager Entry point to SqlManager. + */ + public static void getsServerTrustCertificate(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverTrustCertificates().getWithResponse("testrg", "testcl", "customerCertificateName", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustCertificatesListByInstanceSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustCertificatesListByInstanceSamples.java new file mode 100644 index 0000000000000..b0466b1f1f54e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustCertificatesListByInstanceSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerTrustCertificates ListByInstance. */ +public final class ServerTrustCertificatesListByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/ServerTrustCertificatesListByInstance.json + */ + /** + * Sample code: Gets a list of server trust certificates on a given server. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAListOfServerTrustCertificatesOnAGivenServer( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverTrustCertificates().listByInstance("testrg", "testcl", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustGroupsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustGroupsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..26ad5cea261ec --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustGroupsCreateOrUpdateSamples.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.resourcemanager.sql.generated.models.ServerInfo; +import com.azure.resourcemanager.sql.generated.models.ServerTrustGroupPropertiesTrustScopesItem; +import java.util.Arrays; + +/** Samples for ServerTrustGroups CreateOrUpdate. */ +public final class ServerTrustGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerTrustGroupCreate.json + */ + /** + * Sample code: Create server trust group. + * + * @param manager Entry point to SqlManager. + */ + public static void createServerTrustGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverTrustGroups() + .define("server-trust-group-test") + .withExistingLocation("Default", "Japan East") + .withGroupMembers( + Arrays + .asList( + new ServerInfo() + .withServerId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/managedInstance-1"), + new ServerInfo() + .withServerId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Sql/managedInstances/managedInstance-2"))) + .withTrustScopes( + Arrays + .asList( + ServerTrustGroupPropertiesTrustScopesItem.GLOBAL_TRANSACTIONS, + ServerTrustGroupPropertiesTrustScopesItem.SERVICE_BROKER)) + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustGroupsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustGroupsDeleteSamples.java new file mode 100644 index 0000000000000..ed415cda20be2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustGroupsDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerTrustGroups Delete. */ +public final class ServerTrustGroupsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerTrustGroupDelete.json + */ + /** + * Sample code: Drop server trust group. + * + * @param manager Entry point to SqlManager. + */ + public static void dropServerTrustGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverTrustGroups().delete("Default", "Japan East", "server-trust-group-test", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustGroupsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustGroupsGetSamples.java new file mode 100644 index 0000000000000..1539b68ad4e77 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustGroupsGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerTrustGroups Get. */ +public final class ServerTrustGroupsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerTrustGroupGet.json + */ + /** + * Sample code: Get server trust group. + * + * @param manager Entry point to SqlManager. + */ + public static void getServerTrustGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverTrustGroups().getWithResponse("Default", "Japan East", "server-trust-group-test", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustGroupsListByInstanceSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustGroupsListByInstanceSamples.java new file mode 100644 index 0000000000000..f1d33ee0f0b86 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustGroupsListByInstanceSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerTrustGroups ListByInstance. */ +public final class ServerTrustGroupsListByInstanceSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerTrustGroupListByManagedInstance.json + */ + /** + * Sample code: List server trust groups by managed instance. + * + * @param manager Entry point to SqlManager. + */ + public static void listServerTrustGroupsByManagedInstance( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverTrustGroups().listByInstance("Default-SQL-SouthEastAsia", "managedInstance-1", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustGroupsListByLocationSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustGroupsListByLocationSamples.java new file mode 100644 index 0000000000000..3e2d3f7ee5885 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerTrustGroupsListByLocationSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerTrustGroups ListByLocation. */ +public final class ServerTrustGroupsListByLocationSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerTrustGroupList.json + */ + /** + * Sample code: List server trust groups. + * + * @param manager Entry point to SqlManager. + */ + public static void listServerTrustGroups(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverTrustGroups().listByLocation("Default", "Japan East", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerUsagesListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerUsagesListByServerSamples.java new file mode 100644 index 0000000000000..ba3b9c0505adc --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerUsagesListByServerSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerUsages ListByServer. */ +public final class ServerUsagesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01-legacy/examples/ServerUsageMetricsList.json + */ + /** + * Sample code: List servers usages. + * + * @param manager Entry point to SqlManager. + */ + public static void listServersUsages(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serverUsages().listByServer("sqlcrudtest-6730", "sqlcrudtest-9007", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerVulnerabilityAssessmentsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerVulnerabilityAssessmentsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..8d1bfe2a0c26d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerVulnerabilityAssessmentsCreateOrUpdateSamples.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentRecurringScansProperties; +import java.util.Arrays; + +/** Samples for ServerVulnerabilityAssessments CreateOrUpdate. */ +public final class ServerVulnerabilityAssessmentsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerVulnerabilityAssessmentCreateMax.json + */ + /** + * Sample code: Create a server's vulnerability assessment with all parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void createAServerSVulnerabilityAssessmentWithAllParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverVulnerabilityAssessments() + .define(VulnerabilityAssessmentName.DEFAULT) + .withExistingServer("vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440") + .withStorageContainerPath("https://myStorage.blob.core.windows.net/vulnerability-assessment/") + .withStorageContainerSasKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + .withStorageAccountAccessKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + .withRecurringScans( + new VulnerabilityAssessmentRecurringScansProperties() + .withIsEnabled(true) + .withEmailSubscriptionAdmins(true) + .withEmails(Arrays.asList("email1@mail.com", "email2@mail.com"))) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerVulnerabilityAssessmentCreateStorageAccessKeyMin.json + */ + /** + * Sample code: Create a server's vulnerability assessment with minimal parameters, when storageAccountAccessKey is + * specified. + * + * @param manager Entry point to SqlManager. + */ + public static void createAServerSVulnerabilityAssessmentWithMinimalParametersWhenStorageAccountAccessKeyIsSpecified( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverVulnerabilityAssessments() + .define(VulnerabilityAssessmentName.DEFAULT) + .withExistingServer("vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440") + .withStorageContainerPath("https://myStorage.blob.core.windows.net/vulnerability-assessment/") + .withStorageAccountAccessKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerVulnerabilityAssessmentCreateContainerSasKeyMin.json + */ + /** + * Sample code: Create a server's vulnerability assessment with minimal parameters, when storageContainerSasKey is + * specified. + * + * @param manager Entry point to SqlManager. + */ + public static void createAServerSVulnerabilityAssessmentWithMinimalParametersWhenStorageContainerSasKeyIsSpecified( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverVulnerabilityAssessments() + .define(VulnerabilityAssessmentName.DEFAULT) + .withExistingServer("vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440") + .withStorageContainerPath("https://myStorage.blob.core.windows.net/vulnerability-assessment/") + .withStorageContainerSasKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerVulnerabilityAssessmentsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerVulnerabilityAssessmentsDeleteSamples.java new file mode 100644 index 0000000000000..87daa61510e7c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerVulnerabilityAssessmentsDeleteSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for ServerVulnerabilityAssessments Delete. */ +public final class ServerVulnerabilityAssessmentsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerVulnerabilityAssessmentDelete.json + */ + /** + * Sample code: Remove a server's vulnerability assessment. + * + * @param manager Entry point to SqlManager. + */ + public static void removeAServerSVulnerabilityAssessment( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverVulnerabilityAssessments() + .deleteWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + VulnerabilityAssessmentName.DEFAULT, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerVulnerabilityAssessmentsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerVulnerabilityAssessmentsGetSamples.java new file mode 100644 index 0000000000000..611f0bde01b07 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerVulnerabilityAssessmentsGetSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for ServerVulnerabilityAssessments Get. */ +public final class ServerVulnerabilityAssessmentsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerVulnerabilityAssessmentGet.json + */ + /** + * Sample code: Get a server's vulnerability assessment. + * + * @param manager Entry point to SqlManager. + */ + public static void getAServerSVulnerabilityAssessment(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverVulnerabilityAssessments() + .getWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + VulnerabilityAssessmentName.DEFAULT, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerVulnerabilityAssessmentsListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerVulnerabilityAssessmentsListByServerSamples.java new file mode 100644 index 0000000000000..745018ad4d304 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServerVulnerabilityAssessmentsListByServerSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServerVulnerabilityAssessments ListByServer. */ +public final class ServerVulnerabilityAssessmentsListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ServerVulnerabilityAssessmentListByServer.json + */ + /** + * Sample code: Get a server's vulnerability assessment policies. + * + * @param manager Entry point to SqlManager. + */ + public static void getAServerSVulnerabilityAssessmentPolicies( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serverVulnerabilityAssessments() + .listByServer("vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServersCheckNameAvailabilitySamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServersCheckNameAvailabilitySamples.java new file mode 100644 index 0000000000000..5b1fddb51db35 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServersCheckNameAvailabilitySamples.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.CheckNameAvailabilityRequest; + +/** Samples for Servers CheckNameAvailability. */ +public final class ServersCheckNameAvailabilitySamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/CheckNameAvailabilityServerAvailable.json + */ + /** + * Sample code: Check for a server name that is available. + * + * @param manager Entry point to SqlManager. + */ + public static void checkForAServerNameThatIsAvailable(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .servers() + .checkNameAvailabilityWithResponse(new CheckNameAvailabilityRequest().withName("server1"), Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/CheckNameAvailabilityServerAlreadyExists.json + */ + /** + * Sample code: Check for a server name that already exists. + * + * @param manager Entry point to SqlManager. + */ + public static void checkForAServerNameThatAlreadyExists( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .servers() + .checkNameAvailabilityWithResponse(new CheckNameAvailabilityRequest().withName("server1"), Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/CheckNameAvailabilityServerInvalid.json + */ + /** + * Sample code: Check for a server name that is invalid. + * + * @param manager Entry point to SqlManager. + */ + public static void checkForAServerNameThatIsInvalid(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .servers() + .checkNameAvailabilityWithResponse(new CheckNameAvailabilityRequest().withName("SERVER1"), Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServersCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServersCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..62852eeb1e206 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServersCreateOrUpdateSamples.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.resourcemanager.sql.generated.models.PrincipalType; +import com.azure.resourcemanager.sql.generated.models.ServerExternalAdministrator; +import com.azure.resourcemanager.sql.generated.models.ServerNetworkAccessFlag; +import java.util.UUID; + +/** Samples for Servers CreateOrUpdate. */ +public final class ServersCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ServerCreate.json + */ + /** + * Sample code: Create server. + * + * @param manager Entry point to SqlManager. + */ + public static void createServer(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .servers() + .define("sqlcrudtest-4645") + .withRegion("Japan East") + .withExistingResourceGroup("sqlcrudtest-7398") + .withAdministratorLogin("dummylogin") + .withAdministratorLoginPassword("PLACEHOLDER") + .withPublicNetworkAccess(ServerNetworkAccessFlag.ENABLED) + .withAdministrators( + new ServerExternalAdministrator() + .withPrincipalType(PrincipalType.USER) + .withLogin("bob@contoso.com") + .withSid(UUID.fromString("00000011-1111-2222-2222-123456789111")) + .withTenantId(UUID.fromString("00000011-1111-2222-2222-123456789111")) + .withAzureADOnlyAuthentication(true)) + .withRestrictOutboundNetworkAccess(ServerNetworkAccessFlag.ENABLED) + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServersDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServersDeleteSamples.java new file mode 100644 index 0000000000000..7f93fec99f7b9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServersDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Servers Delete. */ +public final class ServersDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ServerDelete.json + */ + /** + * Sample code: Delete server. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteServer(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.servers().delete("sqlcrudtest-7398", "sqlcrudtest-6661", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServersGetByResourceGroupSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServersGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..b5aa04e430279 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServersGetByResourceGroupSamples.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Servers GetByResourceGroup. */ +public final class ServersGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ServerGetWithExpandEqualsAdministrators.json + */ + /** + * Sample code: Get server with $expand=administrators. + * + * @param manager Entry point to SqlManager. + */ + public static void getServerWithExpandAdministrators(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.servers().getByResourceGroupWithResponse("sqlcrudtest-7398", "sqlcrudtest-4645", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ServerGet.json + */ + /** + * Sample code: Get server. + * + * @param manager Entry point to SqlManager. + */ + public static void getServer(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.servers().getByResourceGroupWithResponse("sqlcrudtest-7398", "sqlcrudtest-4645", null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServersImportDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServersImportDatabaseSamples.java new file mode 100644 index 0000000000000..c9ef19e7647ca --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServersImportDatabaseSamples.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.ImportNewDatabaseDefinition; +import com.azure.resourcemanager.sql.generated.models.NetworkIsolationSettings; +import com.azure.resourcemanager.sql.generated.models.StorageKeyType; + +/** Samples for Servers ImportDatabase. */ +public final class ServersImportDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ImportNewDatabaseWithNetworkIsolation.json + */ + /** + * Sample code: Imports to a new database, using private link for the SQL server and storage account. + * + * @param manager Entry point to SqlManager. + */ + public static void importsToANewDatabaseUsingPrivateLinkForTheSQLServerAndStorageAccount( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .servers() + .importDatabase( + "Default-SQL-SouthEastAsia", + "testsvr", + new ImportNewDatabaseDefinition() + .withDatabaseName("testdb") + .withStorageKeyType(StorageKeyType.STORAGE_ACCESS_KEY) + .withStorageKey("fakeTokenPlaceholder") + .withStorageUri("https://test.blob.core.windows.net/test.bacpac") + .withAdministratorLogin("login") + .withAdministratorLoginPassword("fakeTokenPlaceholder") + .withAuthenticationType("Sql") + .withNetworkIsolation( + new NetworkIsolationSettings() + .withStorageAccountResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Storage/storageAccounts/test-privatelink") + .withSqlServerResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr")), + Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ImportNewDatabase.json + */ + /** + * Sample code: Imports to a new database. + * + * @param manager Entry point to SqlManager. + */ + public static void importsToANewDatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .servers() + .importDatabase( + "Default-SQL-SouthEastAsia", + "testsvr", + new ImportNewDatabaseDefinition() + .withDatabaseName("testdb") + .withStorageKeyType(StorageKeyType.STORAGE_ACCESS_KEY) + .withStorageKey("fakeTokenPlaceholder") + .withStorageUri("https://test.blob.core.windows.net/test.bacpac") + .withAdministratorLogin("login") + .withAdministratorLoginPassword("fakeTokenPlaceholder") + .withAuthenticationType("Sql"), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServersListByResourceGroupSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServersListByResourceGroupSamples.java new file mode 100644 index 0000000000000..55157947d6cd3 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServersListByResourceGroupSamples.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Servers ListByResourceGroup. */ +public final class ServersListByResourceGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ServerListByResourceGroup.json + */ + /** + * Sample code: List servers by resource group. + * + * @param manager Entry point to SqlManager. + */ + public static void listServersByResourceGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.servers().listByResourceGroup("sqlcrudtest-7398", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ServerListByResourceGroupWithExpandEqualsAdministrators.json + */ + /** + * Sample code: List servers by resource group with $expand=administrators. + * + * @param manager Entry point to SqlManager. + */ + public static void listServersByResourceGroupWithExpandAdministrators( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.servers().listByResourceGroup("sqlcrudtest-7398", null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServersListSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServersListSamples.java new file mode 100644 index 0000000000000..b6f6a33eab9b9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServersListSamples.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Servers List. */ +public final class ServersListSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ServerList.json + */ + /** + * Sample code: List servers. + * + * @param manager Entry point to SqlManager. + */ + public static void listServers(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.servers().list(null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ServerListWithExpandEqualsAdministrators.json + */ + /** + * Sample code: List servers with expand equals administrators. + * + * @param manager Entry point to SqlManager. + */ + public static void listServersWithExpandEqualsAdministrators( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.servers().list(null, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServersUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServersUpdateSamples.java new file mode 100644 index 0000000000000..c80a23f7b180d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServersUpdateSamples.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.Server; +import com.azure.resourcemanager.sql.generated.models.ServerNetworkAccessFlag; + +/** Samples for Servers Update. */ +public final class ServersUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ServerUpdate.json + */ + /** + * Sample code: Update a server. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAServer(com.azure.resourcemanager.sql.generated.SqlManager manager) { + Server resource = + manager + .servers() + .getByResourceGroupWithResponse("sqlcrudtest-7398", "sqlcrudtest-4645", null, Context.NONE) + .getValue(); + resource + .update() + .withAdministratorLoginPassword("placeholder") + .withPublicNetworkAccess(ServerNetworkAccessFlag.DISABLED) + .withRestrictOutboundNetworkAccess(ServerNetworkAccessFlag.ENABLED) + .apply(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServiceObjectivesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServiceObjectivesGetSamples.java new file mode 100644 index 0000000000000..c4fe563b31f5c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServiceObjectivesGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServiceObjectives Get. */ +public final class ServiceObjectivesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/ServiceObjectiveGet.json + */ + /** + * Sample code: Get a service objective. + * + * @param manager Entry point to SqlManager. + */ + public static void getAServiceObjective(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .serviceObjectives() + .getWithResponse("group1", "sqlcrudtest", "29dd7459-4a7c-4e56-be22-f0adda49440d", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServiceObjectivesListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServiceObjectivesListByServerSamples.java new file mode 100644 index 0000000000000..c54ae1456bb94 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/ServiceObjectivesListByServerSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for ServiceObjectives ListByServer. */ +public final class ServiceObjectivesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/stable/2014-04-01/examples/ServiceObjectiveList.json + */ + /** + * Sample code: List service objectives. + * + * @param manager Entry point to SqlManager. + */ + public static void listServiceObjectives(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.serviceObjectives().listByServer("group1", "sqlcrudtest", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlAgentCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlAgentCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..d707b2d6c1e20 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlAgentCreateOrUpdateSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.fluent.models.SqlAgentConfigurationInner; +import com.azure.resourcemanager.sql.generated.models.SqlAgentConfigurationPropertiesState; + +/** Samples for SqlAgent CreateOrUpdate. */ +public final class SqlAgentCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SqlAgentConfigurationPut.json + */ + /** + * Sample code: Puts new sql agent configuration to instance. + * + * @param manager Entry point to SqlManager. + */ + public static void putsNewSqlAgentConfigurationToInstance( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sqlAgents() + .createOrUpdateWithResponse( + "sqlcrudtest-7398", + "sqlcrudtest-4645", + new SqlAgentConfigurationInner().withState(SqlAgentConfigurationPropertiesState.ENABLED), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlAgentGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlAgentGetSamples.java new file mode 100644 index 0000000000000..3c36f952a1faf --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlAgentGetSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlAgent Get. */ +public final class SqlAgentGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SqlAgentConfigurationGet.json + */ + /** + * Sample code: Gets current instance sql agent configuration. + * + * @param manager Entry point to SqlManager. + */ + public static void getsCurrentInstanceSqlAgentConfiguration( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.sqlAgents().getWithResponse("sqlcrudtest-7398", "sqlcrudtest-4645", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentBaselineGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentBaselineGetSamples.java new file mode 100644 index 0000000000000..11335ec757f29 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentBaselineGetSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.BaselineName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for SqlVulnerabilityAssessmentBaseline Get. */ +public final class SqlVulnerabilityAssessmentBaselineGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/SqlVulnerabilityAssessmentBaselineGet.json + */ + /** + * Sample code: Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAListOfDatabaseSSqlVulnerabilityAssessmentRuleBaselines( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sqlVulnerabilityAssessmentBaselines() + .getWithResponse( + "vulnerabilityaseessmenttest-4711", + "vulnerabilityaseessmenttest-6411", + VulnerabilityAssessmentName.DEFAULT, + BaselineName.DEFAULT, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentBaselineListBySqlVulnerabilityAssessmentSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentBaselineListBySqlVulnerabilityAssessmentSamples.java new file mode 100644 index 0000000000000..70d743fc844d4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentBaselineListBySqlVulnerabilityAssessmentSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for SqlVulnerabilityAssessmentBaseline ListBySqlVulnerabilityAssessment. */ +public final class SqlVulnerabilityAssessmentBaselineListBySqlVulnerabilityAssessmentSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/SqlVulnerabilityAssessmentBaselineListBySqlVulnerabilityAssessment.json + */ + /** + * Sample code: Gets a list of database's sql vulnerability assessment rule baselines. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAListOfDatabaseSSqlVulnerabilityAssessmentRuleBaselines( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sqlVulnerabilityAssessmentBaselines() + .listBySqlVulnerabilityAssessment( + "vulnerabilityaseessmenttest-4711", + "vulnerabilityaseessmenttest-6411", + VulnerabilityAssessmentName.DEFAULT, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentBaselinesOperationCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentBaselinesOperationCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..b6c5f554a746e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentBaselinesOperationCreateOrUpdateSamples.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.BaselineName; +import com.azure.resourcemanager.sql.generated.models.DatabaseSqlVulnerabilityAssessmentRuleBaselineListInput; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for SqlVulnerabilityAssessmentBaselinesOperation CreateOrUpdate. */ +public final class SqlVulnerabilityAssessmentBaselinesOperationCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/SqlVulnerabilityAssessmentBaselineAddLatest.json + */ + /** + * Sample code: Add a database's vulnerability assessment rule baseline from the latest scan result. + * + * @param manager Entry point to SqlManager. + */ + public static void addADatabaseSVulnerabilityAssessmentRuleBaselineFromTheLatestScanResult( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sqlVulnerabilityAssessmentBaselinesOperations() + .createOrUpdateWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + VulnerabilityAssessmentName.DEFAULT, + BaselineName.DEFAULT, + new DatabaseSqlVulnerabilityAssessmentRuleBaselineListInput().withLatestScan(true).withResults(mapOf()), + Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/SqlVulnerabilityAssessmentBaselineAdd.json + */ + /** + * Sample code: Add a database's vulnerability assessment rule baseline list. + * + * @param manager Entry point to SqlManager. + */ + public static void addADatabaseSVulnerabilityAssessmentRuleBaselineList( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sqlVulnerabilityAssessmentBaselinesOperations() + .createOrUpdateWithResponse( + "vulnerabilityaseessmenttest-4711", + "vulnerabilityaseessmenttest-6411", + VulnerabilityAssessmentName.DEFAULT, + BaselineName.DEFAULT, + new DatabaseSqlVulnerabilityAssessmentRuleBaselineListInput() + .withLatestScan(false) + .withResults( + mapOf( + "VA2063", + Arrays.asList(Arrays.asList("AllowAll", "0.0.0.0", "255.255.255.255")), + "VA2065", + Arrays.asList(Arrays.asList("AllowAll", "0.0.0.0", "255.255.255.255")))), + Context.NONE); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentExecuteScanExecuteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentExecuteScanExecuteSamples.java new file mode 100644 index 0000000000000..a23366a1eb0da --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentExecuteScanExecuteSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for SqlVulnerabilityAssessmentExecuteScan Execute. */ +public final class SqlVulnerabilityAssessmentExecuteScanExecuteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/SqlVulnerabilityAssessmentScansExecute.json + */ + /** + * Sample code: Executes a database's vulnerability assessment scan. + * + * @param manager Entry point to SqlManager. + */ + public static void executesADatabaseSVulnerabilityAssessmentScan( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sqlVulnerabilityAssessmentExecuteScans() + .execute( + "vulnerabilityassessmenttest-4711", + "vulnerabilityassessmenttest-6411", + VulnerabilityAssessmentName.DEFAULT, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentRuleBaselineCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentRuleBaselineCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..b49c31865094f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentRuleBaselineCreateOrUpdateSamples.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.BaselineName; +import com.azure.resourcemanager.sql.generated.models.DatabaseSqlVulnerabilityAssessmentRuleBaselineInput; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; +import java.util.Arrays; + +/** Samples for SqlVulnerabilityAssessmentRuleBaseline CreateOrUpdate. */ +public final class SqlVulnerabilityAssessmentRuleBaselineCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/SqlVulnerabilityAssessmentRuleBaselineCreate.json + */ + /** + * Sample code: Creates or updates a database's vulnerability assessment rule baseline. + * + * @param manager Entry point to SqlManager. + */ + public static void createsOrUpdatesADatabaseSVulnerabilityAssessmentRuleBaseline( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sqlVulnerabilityAssessmentRuleBaselines() + .createOrUpdateWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + VulnerabilityAssessmentName.DEFAULT, + BaselineName.DEFAULT, + "VA1001", + new DatabaseSqlVulnerabilityAssessmentRuleBaselineInput() + .withLatestScan(false) + .withResults( + Arrays + .asList( + Arrays.asList("userA", "SELECT"), + Arrays.asList("userB", "SELECT"), + Arrays.asList("userC", "SELECT"))), + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentRuleBaselineGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentRuleBaselineGetSamples.java new file mode 100644 index 0000000000000..0261402317e0f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentRuleBaselineGetSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.BaselineName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for SqlVulnerabilityAssessmentRuleBaseline Get. */ +public final class SqlVulnerabilityAssessmentRuleBaselineGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/SqlVulnerabilityAssessmentRuleBaselineGet.json + */ + /** + * Sample code: Gets a system database's sql vulnerability assessment rule baseline. + * + * @param manager Entry point to SqlManager. + */ + public static void getsASystemDatabaseSSqlVulnerabilityAssessmentRuleBaseline( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sqlVulnerabilityAssessmentRuleBaselines() + .getWithResponse( + "vulnerabilityaseessmenttest-4711", + "vulnerabilityaseessmenttest-6411", + VulnerabilityAssessmentName.DEFAULT, + BaselineName.DEFAULT, + "VA1001", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentRuleBaselineListByBaselineSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentRuleBaselineListByBaselineSamples.java new file mode 100644 index 0000000000000..de04193ba86a4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentRuleBaselineListByBaselineSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.BaselineName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for SqlVulnerabilityAssessmentRuleBaseline ListByBaseline. */ +public final class SqlVulnerabilityAssessmentRuleBaselineListByBaselineSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/SqlVulnerabilityAssessmentRuleBaselineListByBaseline.json + */ + /** + * Sample code: Gets a system database's sql vulnerability assessment rule baseline. + * + * @param manager Entry point to SqlManager. + */ + public static void getsASystemDatabaseSSqlVulnerabilityAssessmentRuleBaseline( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sqlVulnerabilityAssessmentRuleBaselines() + .listByBaseline( + "vulnerabilityaseessmenttest-4711", + "vulnerabilityaseessmenttest-6411", + VulnerabilityAssessmentName.DEFAULT, + BaselineName.DEFAULT, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentRuleBaselinesOperationDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentRuleBaselinesOperationDeleteSamples.java new file mode 100644 index 0000000000000..af841113b6815 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentRuleBaselinesOperationDeleteSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.BaselineName; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for SqlVulnerabilityAssessmentRuleBaselinesOperation Delete. */ +public final class SqlVulnerabilityAssessmentRuleBaselinesOperationDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/SqlVulnerabilityAssessmentRuleBaselineDelete.json + */ + /** + * Sample code: Removes a database's vulnerability assessment rule baseline. + * + * @param manager Entry point to SqlManager. + */ + public static void removesADatabaseSVulnerabilityAssessmentRuleBaseline( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sqlVulnerabilityAssessmentRuleBaselinesOperations() + .deleteWithResponse( + "vulnerabilityaseessmenttest-4711", + "vulnerabilityaseessmenttest-6411", + VulnerabilityAssessmentName.DEFAULT, + BaselineName.DEFAULT, + "VA1001", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentScanResultOperationGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentScanResultOperationGetSamples.java new file mode 100644 index 0000000000000..3acf8f7f32944 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentScanResultOperationGetSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentName; + +/** Samples for SqlVulnerabilityAssessmentScanResultOperation Get. */ +public final class SqlVulnerabilityAssessmentScanResultOperationGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/SqlVulnerabilityAssessmentScansResults.json + */ + /** + * Sample code: Get a system database SQL Vulnerability Assessment scan result for scan id and scan result id. + * + * @param manager Entry point to SqlManager. + */ + public static void getASystemDatabaseSQLVulnerabilityAssessmentScanResultForScanIdAndScanResultId( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sqlVulnerabilityAssessmentScanResultOperations() + .getWithResponse( + "vulnerabilityassessmenttest-4711", + "vulnerabilityassessmenttest-6411", + SqlVulnerabilityAssessmentName.DEFAULT, + "scanId1", + "VA1234", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentScanResultOperationListByScanSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentScanResultOperationListByScanSamples.java new file mode 100644 index 0000000000000..c09122fc69931 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentScanResultOperationListByScanSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentName; + +/** Samples for SqlVulnerabilityAssessmentScanResultOperation ListByScan. */ +public final class SqlVulnerabilityAssessmentScanResultOperationListByScanSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/SqlVulnerabilityAssessmentListScansResults.json + */ + /** + * Sample code: List system database SQL Vulnerability Assessment scan results for scan id. + * + * @param manager Entry point to SqlManager. + */ + public static void listSystemDatabaseSQLVulnerabilityAssessmentScanResultsForScanId( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sqlVulnerabilityAssessmentScanResultOperations() + .listByScan( + "vulnerabilityassessmenttest-4711", + "testsvr", + SqlVulnerabilityAssessmentName.DEFAULT, + "scanId1", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentScansGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentScansGetSamples.java new file mode 100644 index 0000000000000..9143d4d0a4be8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentScansGetSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for SqlVulnerabilityAssessmentScans Get. */ +public final class SqlVulnerabilityAssessmentScansGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/SqlVulnerabilityAssessmentScan.json + */ + /** + * Sample code: Gets the a database vulnerability assessment scan records. + * + * @param manager Entry point to SqlManager. + */ + public static void getsTheADatabaseVulnerabilityAssessmentScanRecords( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sqlVulnerabilityAssessmentScans() + .getWithResponse( + "vulnerabilityassessmenttest-4711", + "vulnerabilityassessmenttest-6411", + VulnerabilityAssessmentName.DEFAULT, + "scan001", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentScansListBySqlVulnerabilityAssessmentsSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentScansListBySqlVulnerabilityAssessmentsSamples.java new file mode 100644 index 0000000000000..5155ce00734c1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentScansListBySqlVulnerabilityAssessmentsSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for SqlVulnerabilityAssessmentScans ListBySqlVulnerabilityAssessments. */ +public final class SqlVulnerabilityAssessmentScansListBySqlVulnerabilityAssessmentsSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/SqlVulnerabilityAssessmentScanRecordsListByDatabase.json + */ + /** + * Sample code: Gets the list of a database vulnerability assessment scan records. + * + * @param manager Entry point to SqlManager. + */ + public static void getsTheListOfADatabaseVulnerabilityAssessmentScanRecords( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sqlVulnerabilityAssessmentScans() + .listBySqlVulnerabilityAssessments( + "vulnerabilityassessmenttest-4711", + "vulnerabilityassessmenttest-6411", + VulnerabilityAssessmentName.DEFAULT, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentsDeleteSamples.java new file mode 100644 index 0000000000000..06f32498e4cc9 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentsDeleteSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for SqlVulnerabilityAssessments Delete. */ +public final class SqlVulnerabilityAssessmentsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/SqlVulnerabilityAssessmentDelete.json + */ + /** + * Sample code: Remove SQL Vulnerability Assessment. + * + * @param manager Entry point to SqlManager. + */ + public static void removeSQLVulnerabilityAssessment(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sqlVulnerabilityAssessments() + .deleteWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + VulnerabilityAssessmentName.DEFAULT, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentsSettingsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentsSettingsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..edefd4cf4cef8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentsSettingsCreateOrUpdateSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentState; +import com.azure.resourcemanager.sql.generated.models.VulnerabilityAssessmentName; + +/** Samples for SqlVulnerabilityAssessmentsSettings CreateOrUpdate. */ +public final class SqlVulnerabilityAssessmentsSettingsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/SqlVulnerabilityAssessmentCreate.json + */ + /** + * Sample code: Create a SQL Vulnerability Assessment policy. + * + * @param manager Entry point to SqlManager. + */ + public static void createASQLVulnerabilityAssessmentPolicy( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sqlVulnerabilityAssessmentsSettings() + .define(VulnerabilityAssessmentName.DEFAULT) + .withExistingServer("vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440") + .withState(SqlVulnerabilityAssessmentState.ENABLED) + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentsSettingsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentsSettingsGetSamples.java new file mode 100644 index 0000000000000..ed61d3cf523b4 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentsSettingsGetSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.SqlVulnerabilityAssessmentNameAutoGenerated; + +/** Samples for SqlVulnerabilityAssessmentsSettings Get. */ +public final class SqlVulnerabilityAssessmentsSettingsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/SqlVulnerabilityAssessmentGet.json + */ + /** + * Sample code: Get SQL Vulnerability Assessment policy. + * + * @param manager Entry point to SqlManager. + */ + public static void getSQLVulnerabilityAssessmentPolicy(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sqlVulnerabilityAssessmentsSettings() + .getWithResponse( + "vulnerabilityaseessmenttest-4799", + "vulnerabilityaseessmenttest-6440", + SqlVulnerabilityAssessmentNameAutoGenerated.DEFAULT, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentsSettingsListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentsSettingsListByServerSamples.java new file mode 100644 index 0000000000000..2120600a0e39b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SqlVulnerabilityAssessmentsSettingsListByServerSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SqlVulnerabilityAssessmentsSettings ListByServer. */ +public final class SqlVulnerabilityAssessmentsSettingsListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-02-01-preview/examples/SqlVulnerabilityAssessmentListByServer.json + */ + /** + * Sample code: Get SQL Vulnerability Assessment policies. + * + * @param manager Entry point to SqlManager. + */ + public static void getSQLVulnerabilityAssessmentPolicies( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .sqlVulnerabilityAssessmentsSettings() + .listByServer("vulnerabilityaseessmenttest-4799", "vulnerabilityaseessmenttest-6440", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SubscriptionUsagesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SubscriptionUsagesGetSamples.java new file mode 100644 index 0000000000000..25aeb0b90e883 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SubscriptionUsagesGetSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SubscriptionUsages Get. */ +public final class SubscriptionUsagesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SubscriptionUsageGet.json + */ + /** + * Sample code: Get specific subscription usage in the given location. + * + * @param manager Entry point to SqlManager. + */ + public static void getSpecificSubscriptionUsageInTheGivenLocation( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.subscriptionUsages().getWithResponse("WestUS", "ServerQuota", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SubscriptionUsagesListByLocationSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SubscriptionUsagesListByLocationSamples.java new file mode 100644 index 0000000000000..90dda93dde3e2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SubscriptionUsagesListByLocationSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SubscriptionUsages ListByLocation. */ +public final class SubscriptionUsagesListByLocationSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SubscriptionUsageListByLocation.json + */ + /** + * Sample code: List subscription usages in the given location. + * + * @param manager Entry point to SqlManager. + */ + public static void listSubscriptionUsagesInTheGivenLocation( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.subscriptionUsages().listByLocation("WestUS", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SynapseLinkWorkspacesListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SynapseLinkWorkspacesListByDatabaseSamples.java new file mode 100644 index 0000000000000..e7fcc2e20f3e8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SynapseLinkWorkspacesListByDatabaseSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SynapseLinkWorkspaces ListByDatabase. */ +public final class SynapseLinkWorkspacesListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/SynapseLinkWorkspaceListByDatabase.json + */ + /** + * Sample code: List all synapselink workspaces for the given database. + * + * @param manager Entry point to SqlManager. + */ + public static void listAllSynapselinkWorkspacesForTheGivenDatabase( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .synapseLinkWorkspaces() + .listByDatabase("Default-SQL-SouthEastAsia", "testsvr", "dbSynapse", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncAgentsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncAgentsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..1c952b8d4676c --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncAgentsCreateOrUpdateSamples.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.SyncAgent; + +/** Samples for SyncAgents CreateOrUpdate. */ +public final class SyncAgentsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncAgentCreate.json + */ + /** + * Sample code: Create a new sync agent. + * + * @param manager Entry point to SqlManager. + */ + public static void createANewSyncAgent(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncAgents() + .define("syncagentcrud-3187") + .withExistingServer("syncagentcrud-65440", "syncagentcrud-8475") + .withSyncDatabaseId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-Onebox/providers/Microsoft.Sql/servers/syncagentcrud-8475/databases/sync") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncAgentUpdate.json + */ + /** + * Sample code: Update a sync agent. + * + * @param manager Entry point to SqlManager. + */ + public static void updateASyncAgent(com.azure.resourcemanager.sql.generated.SqlManager manager) { + SyncAgent resource = + manager + .syncAgents() + .getWithResponse("syncagentcrud-65440", "syncagentcrud-8475", "syncagentcrud-3187", Context.NONE) + .getValue(); + resource + .update() + .withSyncDatabaseId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-Onebox/providers/Microsoft.Sql/servers/syncagentcrud-8475/databases/sync") + .apply(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncAgentsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncAgentsDeleteSamples.java new file mode 100644 index 0000000000000..1f480cbd49dff --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncAgentsDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SyncAgents Delete. */ +public final class SyncAgentsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncAgentDelete.json + */ + /** + * Sample code: Delete a sync agent. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteASyncAgent(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.syncAgents().delete("syncagentcrud-65440", "syncagentcrud-8475", "syncagentcrud-3187", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncAgentsGenerateKeySamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncAgentsGenerateKeySamples.java new file mode 100644 index 0000000000000..3adfb44d8cac0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncAgentsGenerateKeySamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SyncAgents GenerateKey. */ +public final class SyncAgentsGenerateKeySamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncAgentGenerateKey.json + */ + /** + * Sample code: Generate a sync agent key. + * + * @param manager Entry point to SqlManager. + */ + public static void generateASyncAgentKey(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncAgents() + .generateKeyWithResponse("syncagentcrud-65440", "syncagentcrud-8475", "syncagentcrud-3187", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncAgentsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncAgentsGetSamples.java new file mode 100644 index 0000000000000..466b52e9a483b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncAgentsGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SyncAgents Get. */ +public final class SyncAgentsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncAgentGet.json + */ + /** + * Sample code: Get a sync agent. + * + * @param manager Entry point to SqlManager. + */ + public static void getASyncAgent(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncAgents() + .getWithResponse("syncagentcrud-65440", "syncagentcrud-8475", "syncagentcrud-3187", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncAgentsListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncAgentsListByServerSamples.java new file mode 100644 index 0000000000000..5374f43c962ea --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncAgentsListByServerSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SyncAgents ListByServer. */ +public final class SyncAgentsListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncAgentListByServer.json + */ + /** + * Sample code: Get sync agents under a server. + * + * @param manager Entry point to SqlManager. + */ + public static void getSyncAgentsUnderAServer(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.syncAgents().listByServer("syncagentcrud-65440", "syncagentcrud-8475", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncAgentsListLinkedDatabasesSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncAgentsListLinkedDatabasesSamples.java new file mode 100644 index 0000000000000..9e0f897a7461f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncAgentsListLinkedDatabasesSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SyncAgents ListLinkedDatabases. */ +public final class SyncAgentsListLinkedDatabasesSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncAgentGetLinkedDatabases.json + */ + /** + * Sample code: Get sync agent linked databases. + * + * @param manager Entry point to SqlManager. + */ + public static void getSyncAgentLinkedDatabases(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncAgents() + .listLinkedDatabases("syncagentcrud-65440", "syncagentcrud-8475", "syncagentcrud-3187", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsCancelSyncSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsCancelSyncSamples.java new file mode 100644 index 0000000000000..1d352dd846c76 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsCancelSyncSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SyncGroups CancelSync. */ +public final class SyncGroupsCancelSyncSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupCancelSync.json + */ + /** + * Sample code: Cancel a sync group synchronization. + * + * @param manager Entry point to SqlManager. + */ + public static void cancelASyncGroupSynchronization(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncGroups() + .cancelSyncWithResponse( + "syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", "syncgroupcrud-3187", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..e9117ef471a48 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsCreateOrUpdateSamples.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.resourcemanager.sql.generated.models.SyncConflictResolutionPolicy; + +/** Samples for SyncGroups CreateOrUpdate. */ +public final class SyncGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupUpdate.json + */ + /** + * Sample code: Update a sync group. + * + * @param manager Entry point to SqlManager. + */ + public static void updateASyncGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncGroups() + .define("syncgroupcrud-3187") + .withExistingDatabase("syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328") + .withInterval(-1) + .withConflictResolutionPolicy(SyncConflictResolutionPolicy.HUB_WIN) + .withSyncDatabaseId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/syncgroupcrud-3521/providers/Microsoft.Sql/servers/syncgroupcrud-8475/databases/syncgroupcrud-4328") + .withHubDatabaseUsername("hubUser") + .withUsePrivateLinkConnection(true) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupCreate.json + */ + /** + * Sample code: Create a sync group. + * + * @param manager Entry point to SqlManager. + */ + public static void createASyncGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncGroups() + .define("syncgroupcrud-3187") + .withExistingDatabase("syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328") + .withInterval(-1) + .withConflictResolutionPolicy(SyncConflictResolutionPolicy.HUB_WIN) + .withSyncDatabaseId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/syncgroupcrud-3521/providers/Microsoft.Sql/servers/syncgroupcrud-8475/databases/syncgroupcrud-4328") + .withHubDatabaseUsername("hubUser") + .withUsePrivateLinkConnection(true) + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsDeleteSamples.java new file mode 100644 index 0000000000000..b1344b7ab383b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsDeleteSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SyncGroups Delete. */ +public final class SyncGroupsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupDelete.json + */ + /** + * Sample code: Delete a sync group. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteASyncGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncGroups() + .delete( + "syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", "syncgroupcrud-3187", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsGetSamples.java new file mode 100644 index 0000000000000..0fac25ebef687 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SyncGroups Get. */ +public final class SyncGroupsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupGet.json + */ + /** + * Sample code: Get a sync group. + * + * @param manager Entry point to SqlManager. + */ + public static void getASyncGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncGroups() + .getWithResponse( + "syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", "syncgroupcrud-3187", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsListByDatabaseSamples.java new file mode 100644 index 0000000000000..8b4792423297d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsListByDatabaseSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SyncGroups ListByDatabase. */ +public final class SyncGroupsListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupListByDatabase.json + */ + /** + * Sample code: List sync groups under a given database. + * + * @param manager Entry point to SqlManager. + */ + public static void listSyncGroupsUnderAGivenDatabase(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncGroups() + .listByDatabase("syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsListHubSchemasSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsListHubSchemasSamples.java new file mode 100644 index 0000000000000..e5a891610720b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsListHubSchemasSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SyncGroups ListHubSchemas. */ +public final class SyncGroupsListHubSchemasSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupGetHubSchema.json + */ + /** + * Sample code: Get a hub database schema. + * + * @param manager Entry point to SqlManager. + */ + public static void getAHubDatabaseSchema(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncGroups() + .listHubSchemas( + "syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", "syncgroupcrud-3187", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsListLogsSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsListLogsSamples.java new file mode 100644 index 0000000000000..281dd6af9966f --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsListLogsSamples.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.SyncGroupsType; + +/** Samples for SyncGroups ListLogs. */ +public final class SyncGroupsListLogsSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupGetLog.json + */ + /** + * Sample code: Get sync group logs. + * + * @param manager Entry point to SqlManager. + */ + public static void getSyncGroupLogs(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncGroups() + .listLogs( + "syncgroupcrud-65440", + "syncgroupcrud-8475", + "syncgroupcrud-4328", + "syncgroupcrud-3187", + "2017-01-01T00:00:00", + "2017-12-31T00:00:00", + SyncGroupsType.ALL, + null, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsListSyncDatabaseIdsSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsListSyncDatabaseIdsSamples.java new file mode 100644 index 0000000000000..36563f73c7d8d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsListSyncDatabaseIdsSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SyncGroups ListSyncDatabaseIds. */ +public final class SyncGroupsListSyncDatabaseIdsSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupGetSyncDatabaseId.json + */ + /** + * Sample code: Get a sync database ID. + * + * @param manager Entry point to SqlManager. + */ + public static void getASyncDatabaseID(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.syncGroups().listSyncDatabaseIds("westus", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsRefreshHubSchemaSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsRefreshHubSchemaSamples.java new file mode 100644 index 0000000000000..0bb94646cc05d --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsRefreshHubSchemaSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SyncGroups RefreshHubSchema. */ +public final class SyncGroupsRefreshHubSchemaSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupRefreshHubSchema.json + */ + /** + * Sample code: Refresh a hub database schema. + * + * @param manager Entry point to SqlManager. + */ + public static void refreshAHubDatabaseSchema(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncGroups() + .refreshHubSchema( + "syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", "syncgroupcrud-3187", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsTriggerSyncSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsTriggerSyncSamples.java new file mode 100644 index 0000000000000..d37622fb7ab55 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsTriggerSyncSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SyncGroups TriggerSync. */ +public final class SyncGroupsTriggerSyncSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupTriggerSync.json + */ + /** + * Sample code: Trigger a sync group synchronization. + * + * @param manager Entry point to SqlManager. + */ + public static void triggerASyncGroupSynchronization(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncGroups() + .triggerSyncWithResponse( + "syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", "syncgroupcrud-3187", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsUpdateSamples.java new file mode 100644 index 0000000000000..877029bdaba26 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncGroupsUpdateSamples.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.SyncConflictResolutionPolicy; +import com.azure.resourcemanager.sql.generated.models.SyncGroup; + +/** Samples for SyncGroups Update. */ +public final class SyncGroupsUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncGroupPatch.json + */ + /** + * Sample code: Update a sync group. + * + * @param manager Entry point to SqlManager. + */ + public static void updateASyncGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + SyncGroup resource = + manager + .syncGroups() + .getWithResponse( + "syncgroupcrud-65440", + "syncgroupcrud-8475", + "syncgroupcrud-4328", + "syncgroupcrud-3187", + Context.NONE) + .getValue(); + resource + .update() + .withInterval(-1) + .withConflictResolutionPolicy(SyncConflictResolutionPolicy.HUB_WIN) + .withSyncDatabaseId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/syncgroupcrud-3521/providers/Microsoft.Sql/servers/syncgroupcrud-8475/databases/syncgroupcrud-4328") + .withHubDatabaseUsername("hubUser") + .withHubDatabasePassword("hubPassword") + .withUsePrivateLinkConnection(true) + .apply(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncMembersCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncMembersCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..4344a99690c4e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncMembersCreateOrUpdateSamples.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.resourcemanager.sql.generated.models.SyncDirection; +import com.azure.resourcemanager.sql.generated.models.SyncMemberDbType; + +/** Samples for SyncMembers CreateOrUpdate. */ +public final class SyncMembersCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncMemberCreate.json + */ + /** + * Sample code: Create a new sync member. + * + * @param manager Entry point to SqlManager. + */ + public static void createANewSyncMember(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncMembers() + .define("syncmembercrud-4879") + .withExistingSyncGroup( + "syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", "syncgroupcrud-3187") + .withDatabaseType(SyncMemberDbType.AZURE_SQL_DATABASE) + .withSyncMemberAzureDatabaseResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/syncgroupcrud-65440/providers/Microsoft.Sql/servers/syncgroupcrud-8475/databases/syncgroupcrud-4328") + .withUsePrivateLinkConnection(true) + .withServerName("syncgroupcrud-3379.database.windows.net") + .withDatabaseName("syncgroupcrud-7421") + .withUsername("myUser") + .withSyncDirection(SyncDirection.BIDIRECTIONAL) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncMemberUpdate.json + */ + /** + * Sample code: Update a sync member. + * + * @param manager Entry point to SqlManager. + */ + public static void updateASyncMember(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncMembers() + .define("syncmembercrud-4879") + .withExistingSyncGroup( + "syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", "syncgroupcrud-3187") + .withDatabaseType(SyncMemberDbType.AZURE_SQL_DATABASE) + .withSyncMemberAzureDatabaseResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/syncgroupcrud-65440/providers/Microsoft.Sql/servers/syncgroupcrud-8475/databases/syncgroupcrud-4328") + .withUsePrivateLinkConnection(true) + .withServerName("syncgroupcrud-3379.database.windows.net") + .withDatabaseName("syncgroupcrud-7421") + .withUsername("myUser") + .withSyncDirection(SyncDirection.BIDIRECTIONAL) + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncMembersDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncMembersDeleteSamples.java new file mode 100644 index 0000000000000..3603e9373b77e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncMembersDeleteSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SyncMembers Delete. */ +public final class SyncMembersDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncMemberDelete.json + */ + /** + * Sample code: Delete a sync member. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteASyncMember(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncMembers() + .delete( + "syncgroupcrud-65440", + "syncgroupcrud-8475", + "syncgroupcrud-4328", + "syncgroupcrud-3187", + "syncgroupcrud-4879", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncMembersGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncMembersGetSamples.java new file mode 100644 index 0000000000000..01ae4cac83319 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncMembersGetSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SyncMembers Get. */ +public final class SyncMembersGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncMemberGet.json + */ + /** + * Sample code: Get a sync member. + * + * @param manager Entry point to SqlManager. + */ + public static void getASyncMember(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncMembers() + .getWithResponse( + "syncgroupcrud-65440", + "syncgroupcrud-8475", + "syncgroupcrud-4328", + "syncgroupcrud-3187", + "syncmembercrud-4879", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncMembersListBySyncGroupSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncMembersListBySyncGroupSamples.java new file mode 100644 index 0000000000000..e7b7728936d3a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncMembersListBySyncGroupSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SyncMembers ListBySyncGroup. */ +public final class SyncMembersListBySyncGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncMemberListBySyncGroup.json + */ + /** + * Sample code: List sync members under a sync group. + * + * @param manager Entry point to SqlManager. + */ + public static void listSyncMembersUnderASyncGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncMembers() + .listBySyncGroup( + "syncgroupcrud-65440", "syncgroupcrud-8475", "syncgroupcrud-4328", "syncgroupcrud-3187", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncMembersListMemberSchemasSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncMembersListMemberSchemasSamples.java new file mode 100644 index 0000000000000..052568854482b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncMembersListMemberSchemasSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SyncMembers ListMemberSchemas. */ +public final class SyncMembersListMemberSchemasSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncMemberGetSchema.json + */ + /** + * Sample code: Get a sync member schema. + * + * @param manager Entry point to SqlManager. + */ + public static void getASyncMemberSchema(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncMembers() + .listMemberSchemas( + "syncgroupcrud-65440", + "syncgroupcrud-8475", + "syncgroupcrud-4328", + "syncgroupcrud-3187", + "syncgroupcrud-4879", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncMembersRefreshMemberSchemaSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncMembersRefreshMemberSchemaSamples.java new file mode 100644 index 0000000000000..c77c3dae16014 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncMembersRefreshMemberSchemaSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for SyncMembers RefreshMemberSchema. */ +public final class SyncMembersRefreshMemberSchemaSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncMemberRefreshSchema.json + */ + /** + * Sample code: Refresh a sync member database schema. + * + * @param manager Entry point to SqlManager. + */ + public static void refreshASyncMemberDatabaseSchema(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .syncMembers() + .refreshMemberSchema( + "syncgroupcrud-65440", + "syncgroupcrud-8475", + "syncgroupcrud-4328", + "syncgroupcrud-3187", + "syncgroupcrud-4879", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncMembersUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncMembersUpdateSamples.java new file mode 100644 index 0000000000000..3d99f7116e19e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/SyncMembersUpdateSamples.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.SyncDirection; +import com.azure.resourcemanager.sql.generated.models.SyncMember; +import com.azure.resourcemanager.sql.generated.models.SyncMemberDbType; + +/** Samples for SyncMembers Update. */ +public final class SyncMembersUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SyncMemberPatch.json + */ + /** + * Sample code: Update an existing sync member. + * + * @param manager Entry point to SqlManager. + */ + public static void updateAnExistingSyncMember(com.azure.resourcemanager.sql.generated.SqlManager manager) { + SyncMember resource = + manager + .syncMembers() + .getWithResponse( + "syncgroupcrud-65440", + "syncgroupcrud-8475", + "syncgroupcrud-4328", + "syncgroupcrud-3187", + "syncmembercrud-4879", + Context.NONE) + .getValue(); + resource + .update() + .withDatabaseType(SyncMemberDbType.AZURE_SQL_DATABASE) + .withSyncMemberAzureDatabaseResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/syncgroupcrud-65440/providers/Microsoft.Sql/servers/syncgroupcrud-8475/databases/syncgroupcrud-4328") + .withUsePrivateLinkConnection(true) + .withServerName("syncgroupcrud-3379.database.windows.net") + .withDatabaseName("syncgroupcrud-7421") + .withUsername("myUser") + .withSyncDirection(SyncDirection.BIDIRECTIONAL) + .apply(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/TdeCertificatesCreateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/TdeCertificatesCreateSamples.java new file mode 100644 index 0000000000000..6b0b2ded2acae --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/TdeCertificatesCreateSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.TdeCertificate; + +/** Samples for TdeCertificates Create. */ +public final class TdeCertificatesCreateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/SqlTdeCertificateCreate.json + */ + /** + * Sample code: Upload a TDE certificate. + * + * @param manager Entry point to SqlManager. + */ + public static void uploadATDECertificate(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .tdeCertificates() + .create("testtdecert", "testtdecert", new TdeCertificate().withPrivateBlob("MIIXXXXXXXX"), Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/TimeZonesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/TimeZonesGetSamples.java new file mode 100644 index 0000000000000..806cc89ab8f66 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/TimeZonesGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for TimeZones Get. */ +public final class TimeZonesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceTimeZoneGet.json + */ + /** + * Sample code: Get managed instance time zone. + * + * @param manager Entry point to SqlManager. + */ + public static void getManagedInstanceTimeZone(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.timeZones().getWithResponse("canadaeast", "Haiti Standard Time", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/TimeZonesListByLocationSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/TimeZonesListByLocationSamples.java new file mode 100644 index 0000000000000..a44e68b6d32df --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/TimeZonesListByLocationSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for TimeZones ListByLocation. */ +public final class TimeZonesListByLocationSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/ManagedInstanceTimeZoneListByLocation.json + */ + /** + * Sample code: List managed instance time zones by location. + * + * @param manager Entry point to SqlManager. + */ + public static void listManagedInstanceTimeZonesByLocation( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.timeZones().listByLocation("canadaeast", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/TransparentDataEncryptionsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/TransparentDataEncryptionsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..ca8ec683705c7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/TransparentDataEncryptionsCreateOrUpdateSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.LogicalDatabaseTransparentDataEncryption; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionName; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionState; + +/** Samples for TransparentDataEncryptions CreateOrUpdate. */ +public final class TransparentDataEncryptionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/TransparentDataEncryptionUpdate.json + */ + /** + * Sample code: Update a database's Transparent Data Encryption state with minimal parameters. + * + * @param manager Entry point to SqlManager. + */ + public static void updateADatabaseSTransparentDataEncryptionStateWithMinimalParameters( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + LogicalDatabaseTransparentDataEncryption resource = + manager + .transparentDataEncryptions() + .getWithResponse( + "securitytde-42-rg", + "securitytde-42", + "testdb", + TransparentDataEncryptionName.CURRENT, + Context.NONE) + .getValue(); + resource.update().withState(TransparentDataEncryptionState.ENABLED).apply(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/TransparentDataEncryptionsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/TransparentDataEncryptionsGetSamples.java new file mode 100644 index 0000000000000..c5841c31a4cf0 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/TransparentDataEncryptionsGetSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.TransparentDataEncryptionName; + +/** Samples for TransparentDataEncryptions Get. */ +public final class TransparentDataEncryptionsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/TransparentDataEncryptionGet.json + */ + /** + * Sample code: Get a database's transparent data encryption. + * + * @param manager Entry point to SqlManager. + */ + public static void getADatabaseSTransparentDataEncryption( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .transparentDataEncryptions() + .getWithResponse( + "security-tde-resourcegroup", + "securitytde", + "testdb", + TransparentDataEncryptionName.CURRENT, + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/TransparentDataEncryptionsListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/TransparentDataEncryptionsListByDatabaseSamples.java new file mode 100644 index 0000000000000..247c3099d6cb1 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/TransparentDataEncryptionsListByDatabaseSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for TransparentDataEncryptions ListByDatabase. */ +public final class TransparentDataEncryptionsListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/TransparentDataEncryptionList.json + */ + /** + * Sample code: Get a list of the database's transparent data encryption. + * + * @param manager Entry point to SqlManager. + */ + public static void getAListOfTheDatabaseSTransparentDataEncryption( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .transparentDataEncryptions() + .listByDatabase("security-tde-resourcegroup", "securitytde", "testdb", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/UsagesListByInstancePoolSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/UsagesListByInstancePoolSamples.java new file mode 100644 index 0000000000000..7ae872ad84e36 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/UsagesListByInstancePoolSamples.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for Usages ListByInstancePool. */ +public final class UsagesListByInstancePoolSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ListInstancePoolUsage.json + */ + /** + * Sample code: List instance pool usages. + * + * @param manager Entry point to SqlManager. + */ + public static void listInstancePoolUsages(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.usages().listByInstancePool("group1", "testIP", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2021-02-01-preview/examples/ListInstancePoolUsageExpanded.json + */ + /** + * Sample code: List instance pool usages expanded with children. + * + * @param manager Entry point to SqlManager. + */ + public static void listInstancePoolUsagesExpandedWithChildren( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.usages().listByInstancePool("group1", "testIP", true, Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualClustersDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualClustersDeleteSamples.java new file mode 100644 index 0000000000000..66e07a1ef5c0a --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualClustersDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualClusters Delete. */ +public final class VirtualClustersDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/VirtualClusterDelete.json + */ + /** + * Sample code: Delete virtual cluster. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteVirtualCluster(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.virtualClusters().delete("testrg", "vc-subnet1-f769ed71-b3ad-491a-a9d5-26eeceaa6be2", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualClustersGetByResourceGroupSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualClustersGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..14da1d3ec23b7 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualClustersGetByResourceGroupSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualClusters GetByResourceGroup. */ +public final class VirtualClustersGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/VirtualClusterGet.json + */ + /** + * Sample code: Gets a virtual cluster. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAVirtualCluster(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .virtualClusters() + .getByResourceGroupWithResponse("testrg", "vc-f769ed71-b3ad-491a-a9d5-26eeceaa6be2", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualClustersListByResourceGroupSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualClustersListByResourceGroupSamples.java new file mode 100644 index 0000000000000..7722222c64204 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualClustersListByResourceGroupSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualClusters ListByResourceGroup. */ +public final class VirtualClustersListByResourceGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/VirtualClusterListByResourceGroup.json + */ + /** + * Sample code: List virtual clusters by resource group. + * + * @param manager Entry point to SqlManager. + */ + public static void listVirtualClustersByResourceGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.virtualClusters().listByResourceGroup("testrg", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualClustersListSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualClustersListSamples.java new file mode 100644 index 0000000000000..3d1e4f256b594 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualClustersListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualClusters List. */ +public final class VirtualClustersListSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/VirtualClusterList.json + */ + /** + * Sample code: List virtualClusters. + * + * @param manager Entry point to SqlManager. + */ + public static void listVirtualClusters(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.virtualClusters().list(Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualClustersUpdateDnsServersSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualClustersUpdateDnsServersSamples.java new file mode 100644 index 0000000000000..a1fc753591a16 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualClustersUpdateDnsServersSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualClusters UpdateDnsServers. */ +public final class VirtualClustersUpdateDnsServersSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/UpdateVirtualClusterDnsServers.json + */ + /** + * Sample code: Performs update of dns servers on managed instance. + * + * @param manager Entry point to SqlManager. + */ + public static void performsUpdateOfDnsServersOnManagedInstance( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .virtualClusters() + .updateDnsServers("sqlcrudtest-7398", "VirtualCluster2b9a846b-2e37-43ef-a8e9-f2c6d645c1d7", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualClustersUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualClustersUpdateSamples.java new file mode 100644 index 0000000000000..01154792b6fd5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualClustersUpdateSamples.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.sql.generated.models.VirtualClusterUpdate; +import java.util.HashMap; +import java.util.Map; + +/** Samples for VirtualClusters Update. */ +public final class VirtualClustersUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2022-05-01-preview/examples/VirtualClusterUpdate.json + */ + /** + * Sample code: Update virtual cluster with tags. + * + * @param manager Entry point to SqlManager. + */ + public static void updateVirtualClusterWithTags(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .virtualClusters() + .update( + "testrg", + "vc-subnet1-f769ed71-b3ad-491a-a9d5-26eeceaa6be2", + new VirtualClusterUpdate().withTags(mapOf("tkey", "tvalue1")), + Context.NONE); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualNetworkRulesCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualNetworkRulesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..e5666b9eca8f2 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualNetworkRulesCreateOrUpdateSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +/** Samples for VirtualNetworkRules CreateOrUpdate. */ +public final class VirtualNetworkRulesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/VirtualNetworkRulesCreateOrUpdate.json + */ + /** + * Sample code: Create or update a virtual network rule. + * + * @param manager Entry point to SqlManager. + */ + public static void createOrUpdateAVirtualNetworkRule(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .virtualNetworkRules() + .define("vnet-firewall-rule") + .withExistingServer("Default", "vnet-test-svr") + .withVirtualNetworkSubnetId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default/providers/Microsoft.Network/virtualNetworks/testvnet/subnets/testsubnet") + .withIgnoreMissingVnetServiceEndpoint(false) + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualNetworkRulesDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualNetworkRulesDeleteSamples.java new file mode 100644 index 0000000000000..9ff4a18ca15aa --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualNetworkRulesDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualNetworkRules Delete. */ +public final class VirtualNetworkRulesDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/VirtualNetworkRulesDelete.json + */ + /** + * Sample code: Delete a virtual network rule. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteAVirtualNetworkRule(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.virtualNetworkRules().delete("Default", "vnet-test-svr", "vnet-firewall-rule", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualNetworkRulesGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualNetworkRulesGetSamples.java new file mode 100644 index 0000000000000..82ae44a9c6abd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualNetworkRulesGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualNetworkRules Get. */ +public final class VirtualNetworkRulesGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/VirtualNetworkRulesGet.json + */ + /** + * Sample code: Gets a virtual network rule. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAVirtualNetworkRule(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.virtualNetworkRules().getWithResponse("Default", "vnet-test-svr", "vnet-firewall-rule", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualNetworkRulesListByServerSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualNetworkRulesListByServerSamples.java new file mode 100644 index 0000000000000..7db256b0e5308 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/VirtualNetworkRulesListByServerSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for VirtualNetworkRules ListByServer. */ +public final class VirtualNetworkRulesListByServerSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/VirtualNetworkRulesList.json + */ + /** + * Sample code: List virtual network rules. + * + * @param manager Entry point to SqlManager. + */ + public static void listVirtualNetworkRules(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.virtualNetworkRules().listByServer("Default", "vnet-test-svr", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/WorkloadClassifiersCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/WorkloadClassifiersCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..59b1f0a0e48cd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/WorkloadClassifiersCreateOrUpdateSamples.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +/** Samples for WorkloadClassifiers CreateOrUpdate. */ +public final class WorkloadClassifiersCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateWorkloadClassifierMin.json + */ + /** + * Sample code: Create a workload group with the required properties specified. + * + * @param manager Entry point to SqlManager. + */ + public static void createAWorkloadGroupWithTheRequiredPropertiesSpecified( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .workloadClassifiers() + .define("wlm_workloadclassifier") + .withExistingWorkloadGroup("Default-SQL-SouthEastAsia", "testsvr", "testdb", "wlm_workloadgroup") + .withMemberName("dbo") + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateWorkloadClassifierMax.json + */ + /** + * Sample code: Create a workload group with all properties specified. + * + * @param manager Entry point to SqlManager. + */ + public static void createAWorkloadGroupWithAllPropertiesSpecified( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .workloadClassifiers() + .define("wlm_workloadclassifier") + .withExistingWorkloadGroup("Default-SQL-SouthEastAsia", "testsvr", "testdb", "wlm_workloadgroup") + .withMemberName("dbo") + .withLabel("test_label") + .withContext("test_context") + .withStartTime("12:00") + .withEndTime("14:00") + .withImportance("high") + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/WorkloadClassifiersDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/WorkloadClassifiersDeleteSamples.java new file mode 100644 index 0000000000000..ab730b18eeec5 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/WorkloadClassifiersDeleteSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for WorkloadClassifiers Delete. */ +public final class WorkloadClassifiersDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeleteWorkloadClassifier.json + */ + /** + * Sample code: Delete a workload classifier. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteAWorkloadClassifier(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .workloadClassifiers() + .delete( + "Default-SQL-SouthEastAsia", + "testsvr", + "testdb", + "wlm_workloadgroup", + "wlm_workloadclassifier", + Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/WorkloadClassifiersGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/WorkloadClassifiersGetSamples.java new file mode 100644 index 0000000000000..dd2f2e9282e4b --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/WorkloadClassifiersGetSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for WorkloadClassifiers Get. */ +public final class WorkloadClassifiersGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetWorkloadClassifier.json + */ + /** + * Sample code: Gets a workload classifier for a data warehouse. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAWorkloadClassifierForADataWarehouse( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .workloadClassifiers() + .getWithResponse( + "Default-SQL-SouthEastAsia", "testsvr", "testdb", "wlm_workloadgroup", "wlm_classifier", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/WorkloadClassifiersListByWorkloadGroupSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/WorkloadClassifiersListByWorkloadGroupSamples.java new file mode 100644 index 0000000000000..e163996a36386 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/WorkloadClassifiersListByWorkloadGroupSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for WorkloadClassifiers ListByWorkloadGroup. */ +public final class WorkloadClassifiersListByWorkloadGroupSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetWorkloadClassifierList.json + */ + /** + * Sample code: Get the list of workload classifiers for a workload group. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheListOfWorkloadClassifiersForAWorkloadGroup( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .workloadClassifiers() + .listByWorkloadGroup("Default-SQL-SouthEastAsia", "testsvr", "testdb", "wlm_workloadgroup", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/WorkloadGroupsCreateOrUpdateSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/WorkloadGroupsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..f9d4f58f84136 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/WorkloadGroupsCreateOrUpdateSamples.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +/** Samples for WorkloadGroups CreateOrUpdate. */ +public final class WorkloadGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateWorkloadGroupMin.json + */ + /** + * Sample code: Create a workload group with the required properties specified. + * + * @param manager Entry point to SqlManager. + */ + public static void createAWorkloadGroupWithTheRequiredPropertiesSpecified( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .workloadGroups() + .define("smallrc") + .withExistingDatabase("Default-SQL-SouthEastAsia", "testsvr", "testdb") + .withMinResourcePercent(0) + .withMaxResourcePercent(100) + .withMinResourcePercentPerRequest(3.0) + .create(); + } + + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/CreateOrUpdateWorkloadGroupMax.json + */ + /** + * Sample code: Create a workload group with all properties specified. + * + * @param manager Entry point to SqlManager. + */ + public static void createAWorkloadGroupWithAllPropertiesSpecified( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .workloadGroups() + .define("smallrc") + .withExistingDatabase("Default-SQL-SouthEastAsia", "testsvr", "testdb") + .withMinResourcePercent(0) + .withMaxResourcePercent(100) + .withMinResourcePercentPerRequest(3.0) + .withMaxResourcePercentPerRequest(3.0D) + .withImportance("normal") + .withQueryExecutionTimeout(0) + .create(); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/WorkloadGroupsDeleteSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/WorkloadGroupsDeleteSamples.java new file mode 100644 index 0000000000000..d317221fbc0c8 --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/WorkloadGroupsDeleteSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for WorkloadGroups Delete. */ +public final class WorkloadGroupsDeleteSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/DeleteWorkloadGroup.json + */ + /** + * Sample code: Delete a workload group. + * + * @param manager Entry point to SqlManager. + */ + public static void deleteAWorkloadGroup(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .workloadGroups() + .delete("Default-SQL-SouthEastAsia", "testsvr", "testdb", "wlm_workloadgroup", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/WorkloadGroupsGetSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/WorkloadGroupsGetSamples.java new file mode 100644 index 0000000000000..4b1bee2bfb4dd --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/WorkloadGroupsGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for WorkloadGroups Get. */ +public final class WorkloadGroupsGetSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetWorkloadGroup.json + */ + /** + * Sample code: Gets a workload group for a data warehouse. + * + * @param manager Entry point to SqlManager. + */ + public static void getsAWorkloadGroupForADataWarehouse(com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager + .workloadGroups() + .getWithResponse("Default-SQL-SouthEastAsia", "testsvr", "testdb", "smallrc", Context.NONE); + } +} diff --git a/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/WorkloadGroupsListByDatabaseSamples.java b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/WorkloadGroupsListByDatabaseSamples.java new file mode 100644 index 0000000000000..668ce1b55a43e --- /dev/null +++ b/sdk/sql/azure-resourcemanager-sql-generated/src/samples/java/com/azure/resourcemanager/sql/generated/generated/WorkloadGroupsListByDatabaseSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.sql.generated.generated; + +import com.azure.core.util.Context; + +/** Samples for WorkloadGroups ListByDatabase. */ +public final class WorkloadGroupsListByDatabaseSamples { + /* + * x-ms-original-file: specification/sql/resource-manager/Microsoft.Sql/preview/2020-11-01-preview/examples/GetWorkloadGroupList.json + */ + /** + * Sample code: Get the list of workload groups for a data warehouse. + * + * @param manager Entry point to SqlManager. + */ + public static void getTheListOfWorkloadGroupsForADataWarehouse( + com.azure.resourcemanager.sql.generated.SqlManager manager) { + manager.workloadGroups().listByDatabase("Default-SQL-SouthEastAsia", "testsvr", "testdb", Context.NONE); + } +} diff --git a/sdk/sql/ci.yml b/sdk/sql/ci.yml new file mode 100644 index 0000000000000..6ad706390c745 --- /dev/null +++ b/sdk/sql/ci.yml @@ -0,0 +1,47 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/sql/ci.yml + - sdk/sql/azure-resourcemanager-sql-generated/ + exclude: + - sdk/sql/pom.xml + - sdk/sql/azure-resourcemanager-sql-generated/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/sql/ci.yml + - sdk/sql/azure-resourcemanager-sql-generated/ + exclude: + - sdk/sql/pom.xml + - sdk/sql/azure-resourcemanager-sql-generated/pom.xml + +parameters: + - name: release_azureresourcemanagersqlgenerated + displayName: azure-resourcemanager-sql-generated + type: boolean + default: false + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: sql + EnableBatchRelease: true + Artifacts: + - name: azure-resourcemanager-sql-generated + groupId: com.azure.resourcemanager + safeName: azureresourcemanagersqlgenerated + releaseInBatch: ${{ parameters.release_azureresourcemanagersqlgenerated }} diff --git a/sdk/sql/pom.xml b/sdk/sql/pom.xml new file mode 100644 index 0000000000000..727ec78410803 --- /dev/null +++ b/sdk/sql/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-sql-service + pom + 1.0.0 + + + azure-resourcemanager-sql-generated + +